-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EIP-3860: Change the failure to OOG #6249
Conversation
Change the failure in case of exceeding the initcode size limit for CREATE instructions to be OOG (same as the other check and many others).
A critical exception has occurred: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
EIPS/eip-3860.md
Outdated
@@ -94,7 +94,7 @@ The initcode cost for create transaction data (0.0625 gas per byte) is negligibl | |||
|
|||
### How to report initcode limit violation? | |||
|
|||
We specified that initcode size limit violation for `CREATE`/`CREATE2` results in `0` on stack. Most checks in these instructions are specified this way, except for 3 checks not specific to creation instructions (stack underflow, out of gas, static call violation). In these three cases the entire execution is exceptionally aborted. However, we decided to be consistent with the majority of the possible error conditions in order to keep the specification and implementations simple. | |||
We specified that initcode size limit violation for `CREATE`/`CREATE2` results in exceptional abort of the execution. This place it in the group of early out-of-gas checks, including: stack underflow, memory expansion, static call violation, initcode hashing cost, and initcode cost introduced by this EIP. They precede the later "light" checks: call depth and balance. The choice gives consistency to the order of checks and lowers implementation complexity (out-of-gas checks can be performed in any order). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also pushes the burden of length check to the caller side for factory contracts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any examples in the wild?
diff --git a/lib/evmone/instructions_calls.cpp b/lib/evmone/instructions_calls.cpp
index e9a6ba910..830c38129 100644
--- a/lib/evmone/instructions_calls.cpp
+++ b/lib/evmone/instructions_calls.cpp
@@ -138,7 +138,7 @@ evmc_status_code create_impl(StackTop stack, ExecutionState& state) noexcept
const auto init_code_size = static_cast<size_t>(init_code_size_u256);
if (state.rev >= EVMC_SHANGHAI && init_code_size > 0xC000)
- return EVMC_SUCCESS; // "Light" failure.
+ return EVMC_OUT_OF_GAS;
const auto init_code_words = num_words(init_code_size);
if constexpr (Op == OP_CREATE2) After some refactoring the difference between two implementation variants in evmone is not very big. |
Let's give it 24 hours before merging. |
f970028
Co-authored-by: Alex Stokes <[email protected]>
Change the failure in case of exceeding the initcode size limit for CREATE instructions to be OOG (same as the other check and many others).
See https://ethereum-magicians.org/t/eip-3860-limit-and-meter-initcode/7018/15.