33import pytest
44
55from ethereum_test_base_types .base_types import Address , Bytes
6- from ethereum_test_exceptions .exceptions import TransactionException
76from ethereum_test_tools import (
87 Account ,
98 Alloc ,
1312)
1413from ethereum_test_tools .code .generators import Initcode as LegacyInitcode
1514from ethereum_test_types .eof .v1 import Container
15+ from ethereum_test_types .types import TransactionReceipt
1616from tests .prague .eip7702_set_code_tx .spec import Spec
1717
1818from .. import EOF_FORK_NAME
2222)
2323
2424REFERENCE_SPEC_GIT_PATH = "EIPS/eip-7873.md"
25- REFERENCE_SPEC_VERSION = "1115fe6110fcc0efc823fb7f8f5cd86c42173efe "
25+ REFERENCE_SPEC_VERSION = "23d96ceff8f0690432ab91089ae257f08f32340f "
2626
2727pytestmark = pytest .mark .valid_from (EOF_FORK_NAME )
2828
@@ -77,53 +77,6 @@ def test_legacy_create_tx_legacy_initcode_eof_bytecode(
7777 )
7878
7979
80- @pytest .mark .with_all_contract_creating_tx_types (selector = lambda tx_type : tx_type != 6 )
81- @pytest .mark .parametrize (
82- "initcode" ,
83- [
84- Bytes ("0xEF00" ),
85- Bytes ("0xEF0001" ),
86- smallest_runtime_subcontainer ,
87- smallest_initcode_subcontainer ,
88- ],
89- )
90- @pytest .mark .exception_test
91- def test_legacy_create_tx_eof_initcode (
92- state_test : StateTestFiller ,
93- pre : Alloc ,
94- tx_type : int ,
95- initcode : Bytes | Container ,
96- ):
97- """
98- Test that a legacy contract creation tx with EOF initcode (or anything starting with
99- `0xEF00` in data) is invalid.
100- """
101- env = Environment ()
102- sender = pre .fund_eoa ()
103-
104- tx = Transaction (
105- ty = tx_type ,
106- sender = sender ,
107- to = None ,
108- gas_limit = 100_000 ,
109- data = initcode ,
110- error = TransactionException .EOF_CREATION_TRANSACTION ,
111- )
112-
113- destination_contract_address = tx .created_contract
114-
115- post = {
116- destination_contract_address : Account .NONEXISTENT ,
117- }
118-
119- state_test (
120- env = env ,
121- pre = pre ,
122- post = post ,
123- tx = tx ,
124- )
125-
126-
12780@pytest .mark .with_all_contract_creating_tx_types (selector = lambda tx_type : tx_type != 6 )
12881@pytest .mark .parametrize (
12982 "initcode" ,
@@ -133,6 +86,10 @@ def test_legacy_create_tx_eof_initcode(
13386 Bytes ("0xEF0101" ),
13487 Spec .delegation_designation (Address (0xAA )),
13588 Bytes ("0xEF02" ),
89+ Bytes ("0xEF00" ),
90+ Bytes ("0xEF0001" ),
91+ smallest_runtime_subcontainer ,
92+ smallest_initcode_subcontainer ,
13693 ],
13794)
13895def test_legacy_create_tx_prefix_initcode (
@@ -143,25 +100,25 @@ def test_legacy_create_tx_prefix_initcode(
143100):
144101 """
145102 Test that a legacy contract creation tx behaves as it did before EIP-7873 for
146- initcode stating with `EF`, but not falling into the special case of `EF00` .
103+ initcode stating with `EF`.
147104 The transaction should be valid but fail on executing of the first byte `EF`.
148105 """
149106 env = Environment ()
150107 sender = pre .fund_eoa ()
108+ gas_limit = 100_000
151109
152110 tx = Transaction (
153111 ty = tx_type ,
154112 sender = sender ,
155113 to = None ,
156- gas_limit = 100_000 ,
114+ gas_limit = gas_limit ,
157115 data = initcode ,
116+ expected_receipt = TransactionReceipt (gas_used = gas_limit ),
158117 )
159118
160119 destination_contract_address = tx .created_contract
161120
162- post = {
163- destination_contract_address : Account .NONEXISTENT ,
164- }
121+ post = {destination_contract_address : Account .NONEXISTENT , sender : Account (nonce = 1 )}
165122
166123 state_test (
167124 env = env ,
0 commit comments