Skip to content

fix(spec-specs, tests): reject legacy chain ids over 64 bits - #3828

Merged
fselmo merged 4 commits into
ethereum:forks/bogotafrom
fselmo:legacy-chain-id-overflow
Oct 14, 2026
Merged

fselmo merged 4 commits into
ethereum:forks/bogotafrom
fselmo:legacy-chain-id-overflow

Conversation

@fselmo

@fselmo fselmo commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Description

Since #3000, chain_id() narrows the chain ID derived from a legacy v to U64, so a v of 2**65 + 35 or more raised OverflowError and crashed block processing instead of rejecting the transaction. In all 21 forks that have chain_id() (Spurious Dragon through Bogota), a chain ID that doesn't fit in 64 bits now raises InvalidSignatureError("bad v"), which is what mainnet's recover_sender raises for the same input.

test_legacy_chain_id_over_64_bits covers the boundary: the largest chain ID that fits in 64 bits (INVALID_CHAINID), the smallest that doesn't, and this chain's ID plus 2**64 (both INVALID_SIGNATURE_VRS).

Related Issues or PRs

Fixes the crash introduced in #3000 (9d117a0). A review comment there caught the lower bound, where a v below 35 underflowed with the same OverflowError, and #3000 added the v < 35 check for it; this adds the upper one.

Checklist

  • Ran fast static checks to avoid CI fails, see Code Standards & Verifying Changes: just static
  • PR title has the form <type>(<area>): <description>, where <type> and <area> come from an appropriate C-<type>, respectively A-<area>, label. The title should match the target squash commit message.

Cute Animal Picture

Screenshot 2026-10-14 at 12 39 07

fselmo and others added 2 commits October 14, 2026 12:35
chain_id() narrowed the chain ID derived from a legacy v to U64, so a v of 2**65 + 35 or more raised OverflowError and crashed block processing instead of rejecting the transaction. It now raises InvalidSignatureError("bad v") for a chain ID that does not fit in 64 bits, as mainnet's recover_sender does for the same input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds legacy transactions whose v encodes the largest chain ID that fits in 64 bits (INVALID_CHAINID), the smallest that does not, and this chain's ID plus 2**64 (both INVALID_SIGNATURE_VRS), from Spurious Dragon on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.99%. Comparing base (6610d7e) to head (eaed1ca).

Additional details and impacted files
@@              Coverage Diff              @@
##           forks/bogota    #3828   +/-   ##
=============================================
  Coverage         94.99%   94.99%           
=============================================
  Files               673      673           
  Lines             40849    40888   +39     
  Branches           3756     3769   +13     
=============================================
+ Hits              38803    38842   +39     
  Misses             1429     1429           
  Partials            617      617           
Flag Coverage Δ
unittests 94.99% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

fselmo and others added 2 commits October 14, 2026 12:49
Both clients read a legacy v as a 64-bit integer and reject a larger one while decoding the payload, so map those decode errors to INVALID_SIGNATURE_VRS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@marioevz marioevz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

@fselmo
fselmo merged commit 067505d into ethereum:forks/bogota Oct 14, 2026
28 checks passed
@fselmo fselmo mentioned this pull request Oct 15, 2026
6 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants