Skip to content

fix(tests): EIP-7620 - make CREATE/CREATE2 restrictions specific #1475

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/osaka/eip7692_eof_v1/eip7620_eof_create/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
slot_call_or_create = next(_slot)
slot_counter = next(_slot)
slot_data_load = next(_slot)
slot_all_subcall_gas_gone = next(_slot)

slot_last_slot = next(_slot)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
from ethereum_test_tools.vm.opcode import Opcodes
from ethereum_test_tools.vm.opcode import Opcodes as Op
from ethereum_test_types.eof.v1 import Container
from ethereum_test_types.helpers import compute_create_address

from .. import EOF_FORK_NAME
from .helpers import (
slot_all_subcall_gas_gone,
slot_code_worked,
slot_create_address,
smallest_initcode_subcontainer,
Expand Down Expand Up @@ -52,28 +54,38 @@ def test_cross_version_creates_fail(
):
"""Verifies that CREATE and CREATE2 cannot create EOF contracts."""
env = Environment()
salt_param = [0] if legacy_create_opcode == Op.CREATE2 else []

sender = pre.fund_eoa()

tx_gas_limit = 10_000_000

contract_address = pre.deploy_contract(
code=Op.CALLDATACOPY(0, 0, Op.CALLDATASIZE)
+ Op.SSTORE(slot_create_address, legacy_create_opcode(0, 0, Op.CALLDATASIZE, *salt_param))
+ Op.SSTORE(slot_create_address, legacy_create_opcode(size=Op.CALLDATASIZE))
# Aproximates whether code until here consumed the 63/64th gas given to subcall
+ Op.SSTORE(slot_all_subcall_gas_gone, Op.LT(Op.GAS, tx_gas_limit // 64))
+ Op.SSTORE(slot_code_worked, value_code_worked)
+ Op.STOP
)

# Storage in 0 should be empty as the create/create2 should fail,
# and 1 in 1 to show execution continued and did not halt
post = {
contract_address: Account(
storage={
slot_create_address: EOFCREATE_FAILURE,
slot_code_worked: value_code_worked,
}
)
slot_all_subcall_gas_gone: 0,
},
nonce=1,
),
# Double check no accounts were created
compute_create_address(address=contract_address, nonce=1): Account.NONEXISTENT,
compute_create_address(
address=contract_address, initcode=deploy_code, salt=0, opcode=Op.CREATE2
): Account.NONEXISTENT,
}
tx = Transaction(
to=contract_address,
gas_limit=10_000_000,
gas_limit=tx_gas_limit,
gas_price=10,
protected=False,
sender=sender,
Expand Down
Loading