Implement EIP-7954: "Increase Maximum Contract Size" - #1575
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1575 +/- ##
=======================================
Coverage 97.71% 97.72%
=======================================
Files 171 171
Lines 15607 15629 +22
Branches 3610 3613 +3
=======================================
+ Hits 15251 15273 +22
Misses 269 269
Partials 87 87
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR updates evmone’s protocol limits for the Amsterdam fork to implement EIP-7954, increasing the maximum deployed contract code size and the corresponding initcode size limit (per EIP-3860’s “2× code size” rule).
Changes:
- Introduce Amsterdam-specific constants for max deployed code size (0x10000) and max initcode size (0x20000).
- Update CREATE/initcode size validation in both the EVM (CREATE opcode path) and transaction validation logic for Amsterdam.
- Update the test host’s created-code size enforcement and add unit tests for the new deployed code-size boundary.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/unittests/state_transition_create_test.cpp | Adds Amsterdam EIP-7954 boundary tests for create transactions (max code size / above max). |
| test/state/state.cpp | Raises transaction-level initcode size limit for Amsterdam during validation. |
| test/state/host.cpp | Raises created-code size enforcement limit for Amsterdam in the test host implementation. |
| lib/evmone/instructions_calls.cpp | Raises CREATE/CREATE2 initcode size limit in the interpreter for Amsterdam. |
| lib/evmone/constants.hpp | Adds Amsterdam max code/initcode size constants. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Amsterdam raises the deployed contract code limit from 0x6000 (EIP-170) to 0x10000, and the init code limit from 0xC000 to 0x20000 (EIP-3860 keeps the initcode limit at twice the code limit).
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (2)
lib/evmone/instructions_calls.cpp:222
- The CREATE/CREATE2 path for the raised initcode limit remains untested. The existing
evm_eip3860_initcode_test.cppcovers both opcodes only at Paris/Shanghai and the 0xC000 boundary, while the new state-transition tests exercise contract output size rather than the CREATE operand size. Please extend those opcode tests with Amsterdam cases at 0x20000 and 0x20001, and retain a pre-Amsterdam boundary case.
const size_t max_init_code_size =
state.rev >= EVMC_AMSTERDAM ? MAX_INITCODE_SIZE_AMSTERDAM : MAX_INITCODE_SIZE;
if (state.rev >= EVMC_SHANGHAI && init_code_size > max_init_code_size)
test/state/state.cpp:530
- The Amsterdam transaction-initcode boundary is not exercised by the added tests: both new create transactions use the short
ret(...)program, so this branch could still reject 0x20000-byte initcode or accept 0x20001 bytes unnoticed. Please add transaction-validation cases for Amsterdam at and above the new limit, ideally also pinning Osaka to the old 0xC000 limit.
const size_t max_initcode_size =
rev >= EVMC_AMSTERDAM ? MAX_INITCODE_SIZE_AMSTERDAM : MAX_INITCODE_SIZE;
if (rev >= EVMC_SHANGHAI && !tx.to.has_value() && tx.data.size() > max_initcode_size)
Amsterdam raises the deployed contract code limit from 0x6000 (EIP-170) to 0x10000, and the init code limit from 0xC000 to 0x20000 (EIP-3860 keeps the init code limit at twice the code limit).
Amsterdam raises the deployed contract code limit from 0x6000 (EIP-170) to 0x10000, and the init code limit from 0xC000 to 0x20000 (EIP-3860 keeps the init code limit at twice the code limit).