Repository navigation
evm: Read the account also for a 0-byte EXTCODECOPY - #1753
Conversation
Merging this PR will degrade performance by 16.67%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | test_extcodecopy_warm[fork_Osaka-blockchain_test-copy_size_0-benchmark-gas-value_1M] |
7.2 ms | 8.6 ms | -16.67% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing evm/extcodecopy-zero-size (a89c91f) with master (39425f3)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1753 +/- ##
=======================================
Coverage 98.06% 98.07%
=======================================
Files 183 183
Lines 16940 16944 +4
Branches 3873 3876 +3
=======================================
+ Hits 16613 16617 +4
Misses 245 245
Partials 82 82
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
EXTCODECOPY skipped Host::copy_code() when copying 0 bytes, unlike execution-specs which reads the account regardless of the size. Call it always. For a 0-byte copy pass a null buffer, as for empty LOG data, because the memory offset may then be out of bounds; the hosts accept it.
a4db3c3 to
a89c91f
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The implementation matches the specified behavior and safely avoids dereferencing invalid memory for zero-length copies.
0 open findings
What changed in this PR
Ensures zero-byte EXTCODECOPY still reads the target account while safely handling out-of-bounds memory offsets.
Changes:
- Always invokes
Host::copy_code(), using a null buffer for zero-byte copies. - Updates EIP-2929 account-access expectations.
| File | Description |
|---|---|
lib/evmone/instructions.hpp |
Corrects zero-byte EXTCODECOPY behavior. |
test/unittests/evm_eip2929_test.cpp |
Verifies the additional account reads. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
EXTCODECOPY skipped Host::copy_code() when copying 0 bytes, unlike
execution-specs which reads the account regardless of the size. Call it
always. For a 0-byte copy pass a null buffer, as for empty LOG data,
because the memory offset may then be out of bounds; the hosts accept
it.