EIP-3860: Change the failure to OOG#6249
Merged
eth-bot merged 2 commits intoethereum:masterfrom Jan 9, 2023
Merged
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).
Collaborator
|
A critical exception has occurred: |
yperbasis
previously approved these changes
Jan 2, 2023
jochem-brouwer
previously approved these changes
Jan 2, 2023
axic
reviewed
Jan 2, 2023
EIPS/eip-3860.md
Outdated
| ### 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). |
Member
There was a problem hiding this comment.
It also pushes the burden of length check to the caller side for factory contracts.
This was referenced Jan 3, 2023
Member
Author
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. |
jflo
previously approved these changes
Jan 5, 2023
Member
Author
|
Let's give it 24 hours before merging. |
ralexstokes
reviewed
Jan 5, 2023
yperbasis
added a commit
to erigontech/erigon
that referenced
this pull request
Jan 6, 2023
9 tasks
f970028
Co-authored-by: Alex Stokes <[email protected]>
eth-bot
approved these changes
Jan 9, 2023
This was referenced Jan 11, 2023
Closed
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.
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.