Update EIP-8024 decoding to new spec#10710
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates Nethermind’s legacy (non-EOF) EIP-8024 immediate decoding for DUPN/SWAPN/EXCHANGE to match the latest spec changes, and refactors the associated NUnit test suite to use shared TestCaseSource generators.
Changes:
- Update
DUPN/SWAPNimmediate decoding todepth = (imm + 145) mod 256and keep the disallowed immediate window0x5B..0x7F. - Update
EXCHANGEimmediate decoding tok = imm ^ 0x8Fand narrow the disallowed window to0x52..0x7F(making0x50/0x51valid). - Refactor EIP-8024 tests into a smaller set of parameterized tests with shared bytecode builders and generators.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.Stack.cs |
Adjusts EIP-8024 immediate decoding formulas and updates the invalid-immediate range for EXCHANGE. |
src/Nethermind/Nethermind.Evm.Test/Eip8024Tests.cs |
Reworks tests into TestCaseSource-based suites and updates vectors/immediates to the new decoding rules. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
EVM Opcode Benchmark DiffAggregated runs: base=1, pr=1 No significant regressions or improvements detected. |
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
benaadams
approved these changes
Mar 4, 2026
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.
Summary
n = (x + 145) % 256(was branchedx+17/x-20)k = x ^ 143(was branchedx/x-48), invalid range narrowed from 80-127 to 82-127 (immediates 0x50, 0x51 now valid, encoding new pairs (14,16) and (14,15))TestCaseSourcewithbyte[]bytecode parameters, covering same 33 unique scenariosChanges
EvmInstructions.Stack.cs: UpdatedTryDecodeSingleandTryDecodePairdecoding formulas and disallowed range checkEip8024Tests.cs: Refactored withTestCaseSourcegenerators, extracted helpers, removed duplicate testTest plan
dotnet test --filter Eip8024)🤖 Generated with Claude Code