Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Feat/#454 implement ErrorOutOfGasCreate error state #481

Merged
merged 17 commits into from
Aug 30, 2023

Conversation

KimiWu123
Copy link
Contributor

@KimiWu123 KimiWu123 commented Aug 4, 2023

closed #454 and #459


EIP-3860 includes

  • limit the max size of init code to 49152
  • add extra gas required for init code, 2 * len(ceil(init_code/32))

This PR includes

  1. move CREATE/2 oog from error_oog_dynamic_memory_expansion.py to error_oog_create.py
  2. support EIP-3860
    • create.py add extra gas cost for init code.
    • begin_tx.py add extra gas cost for init code
    • error_oog_create.py handles errors of oog and max size of init code (see Rules 1 and 3).
    • error_gas_uint_overflow.py handles extra gas required for init code

@KimiWu123 KimiWu123 force-pushed the feat/#454-Implement-ErrorOutOfGasCREATE2-error-state branch from 644909f to af8d6e0 Compare August 4, 2023 02:40
@KimiWu123 KimiWu123 self-assigned this Aug 7, 2023
@KimiWu123 KimiWu123 marked this pull request as ready for review August 7, 2023 02:48
Copy link
Collaborator

@ChihChengLiang ChihChengLiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after the feedback is addressed.

specs/error_state/ErrorOutOfGasDynamicMemoryExpansion.md Outdated Show resolved Hide resolved
specs/opcode/F0CREATE_F5CREATE2.md Outdated Show resolved Hide resolved
specs/opcode/F0CREATE_F5CREATE2.md Outdated Show resolved Hide resolved
specs/error_state/ErrorOutOfGasCreate.md Outdated Show resolved Hide resolved
Comment on lines +28 to +29
offset_word = instruction.stack_lookup(RW.Read, 1)
size_word = instruction.stack_lookup(RW.Read, 2)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note:
No change is required here. But we discussed where we should use stack_pop or stack_lookup here.

stack_pop modifies the stack, and stack_lookup has no side-effects.

We think it's okay to use either one since Stack will reset after the error state.

Copy link
Contributor

@rrtoledo rrtoledo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

@KimiWu123 KimiWu123 merged commit c4a2d72 into master Aug 30, 2023
1 check passed
@KimiWu123 KimiWu123 deleted the feat/#454-Implement-ErrorOutOfGasCREATE2-error-state branch September 6, 2023 06:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Shanghai] EIP-3860 Limit and meter initcode Implement ErrorOutOfGasCREATE2 error state
3 participants