feat(tests): add max-code-size jumpdest test for immediate bytes - #2998
Merged
danceratopz merged 1 commit intoJun 18, 2026
Merged
Conversation
Add `test_max_code_size_jumpdest_in_immediate`, which places a `0x5B` as the last byte of a `MAX_CODE_SIZE` contract, right after an immediate-carrying opcode, and jumps to it: - `PUSH1`: The `0x5B` is push data, always skipped, so the jump is rejected. - `DUPN`/`SWAPN`/`EXCHANGE`: Per EIP-8024 the `0x5B` is an invalid immediate, kept at an instruction boundary, so it stays a valid `JUMPDEST` and the jump is accepted. Exercises the immediate-skipping branches of jumpdest analysis well past the old 24 KiB code and 48 KiB initcode limits.
4 tasks
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## forks/amsterdam #2998 +/- ##
================================================
Coverage 93.20% 93.20%
================================================
Files 620 620
Lines 38759 38759
Branches 3341 3341
================================================
Hits 36127 36127
Misses 1773 1773
Partials 859 859
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:
|
LouisTsai-Csie
approved these changes
Jun 18, 2026
LouisTsai-Csie
left a comment
Contributor
There was a problem hiding this comment.
Thanks! This is what i want.
28 tasks
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
Follow-up to #2993, from a review idea by @LouisTsai-Csie: extend the max-code-size jumpdest coverage to a
0x5Bthat lands in an instruction's immediate bytes: #2993 (review)test_max_code_size_jumpdest_in_immediateputs a0x5Bas the last byte of aMAX_CODE_SIZEcontract, right after an immediate-carrying opcode, and jumps to it:PUSH1: the0x5Bis push data, always skipped, so it is not aJUMPDESTand the jump is rejected.DUPN/SWAPN/EXCHANGE: per EIP-8024 the0x5Bis an invalid immediate that is not skipped, so it stays a validJUMPDESTand the jump is accepted.HTML explainer of test cases with visualization
The additional benefit is marginal. EIP-8024 already tests this immediate classification (on small contracts), and #2993 already proves the jumpdest scan survives to 64 KiB. The only thing this uniquely catches is a client whose immediate-skipping logic is size-bounded independently of the main jumpdest pass: it would pass both existing suites yet break on an EIP-8024 immediate near the new max. Obscure and unlikely, since real clients run one linear pass over the whole code.
Cost is negligible (sub-second t8n per case), so I'm not precious about it: happy to merge or close as people see fit.
🔗 Related Issues or PRs
glamsterdam-devnet@v6.0.0#2915 (glamsterdam-devnet@v6.0.0)✅ Checklist
just statictype(scope):.mkdocs servelocally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.Cute Animal Picture