Conversation
AssemblyItem::dup()/swap() create the stack manipulation items from a depth argument, and AbstractAssembly::appendDup()/appendSwap() expose them uniformly to code generators. All call sites that constructed DUP1-16/SWAP1-16 from a computed depth are converted. No functional change. Co-authored-by: Francisco Giordano <fg@frang.io>
rodiazet
force-pushed
the
eip-8024
branch
3 times, most recently
from
July 16, 2026 08:42
e44ed59 to
16ceb83
Compare
blishko
reviewed
Jul 16, 2026
Comment on lines
+755
to
+756
| Opcodes marked with ``F``, ``H``, ``B``, ``C``, ``I``, ``L``, ``P``, ``N`` and ``O`` are present since | ||
| Frontier, Homestead, Byzantium, Constantinople, Istanbul, London, Paris, Cancun or Osaka respectively. | ||
| Frontier, Homestead, Byzantium, Constantinople, Istanbul, London, Paris, Cancun, Osaka or Amsterdam respectively. |
Contributor
There was a problem hiding this comment.
Why add Amsterdam here if you are not adding the one-letter mark?
| uint8_t encodeDupSwapNImmediate(size_t _depth) | ||
| { | ||
| solAssert(_depth >= 17 && _depth <= 235); | ||
| return static_cast<uint8_t>(_depth + 111); |
Contributor
There was a problem hiding this comment.
Isn't this overflowing uint8_t? What am I missing here?
Contributor
Author
There was a problem hiding this comment.
It should because according to spec we have to get % 256. Maybe explicit modulo would be more readable here.
def encode_single(n: int) -> int:
assert 17 <= n <= 235
return (n + 111) % 256Introduce the DUPN and SWAPN instructions with the devnet-3 immediate encoding, available in legacy bytecode starting from the "amsterdam" EVM version. The AssemblyItem::dup()/swap() factories now emit them for depths above 16, extending the reachable stack depth to 235 in legacy codegen, inline assembly and the Yul code transforms. Includes assembler, disassembler, optimizer and gas metering support as well as assembly JSON import/export. Co-authored-by: Francisco Giordano <fg@frang.io>
Add assembler, disassembler, semantic and code transform tests for DUPN and SWAPN. Tests whose expectations depend on the stack being limited to 16 reachable slots are restricted to EVM versions before "amsterdam" via the new maxEVMVersionCheck() helper or the EVMVersion setting, with counterparts exceeding the new limit of 235 where applicable. Co-authored-by: Francisco Giordano <fg@frang.io>
All space-separated constraints in the `EVMVersion` setting have to be satisfied for the test to run. This allows expressing version ranges, e.g. `>homestead <=osaka` for tests whose expectations only hold before "amsterdam" but which cannot run on the oldest versions either.
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
EIP-8024
AI Disclosure
Claude Fable 5 (model ID claude-fable-5) was used to make automatic changes.