Repository navigation
fix(spec-specs, tests): reject legacy chain ids over 64 bits - #3828
Merged
Merged
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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>
2 tasks done
6 tasks done
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Since #3000,
chain_id()narrows the chain ID derived from a legacyvtoU64, so avof2**65 + 35or more raisedOverflowErrorand crashed block processing instead of rejecting the transaction. In all 21 forks that havechain_id()(Spurious Dragon through Bogota), a chain ID that doesn't fit in 64 bits now raisesInvalidSignatureError("bad v"), which is what mainnet'srecover_senderraises for the same input.test_legacy_chain_id_over_64_bitscovers the boundary: the largest chain ID that fits in 64 bits (INVALID_CHAINID), the smallest that doesn't, and this chain's ID plus2**64(bothINVALID_SIGNATURE_VRS).Related Issues or PRs
Fixes the crash introduced in #3000 (9d117a0). A review comment there caught the lower bound, where a
vbelow 35 underflowed with the sameOverflowError, and #3000 added thev < 35check for it; this adds the upper one.Checklist
just static<type>(<area>): <description>, where<type>and<area>come from an appropriateC-<type>, respectivelyA-<area>, label. The title should match the target squash commit message.Cute Animal Picture