Skip to content

Commit 1e74046

Browse files
pdobaczpacrob
authored andcommitted
fix(tests): Update legacy creation tx rules (ethereum#1492)
1 parent 656968f commit 1e74046

File tree

3 files changed

+11
-59
lines changed

3 files changed

+11
-59
lines changed

src/ethereum_clis/clis/evmone.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ class EvmoneExceptionMapper(ExceptionMapper):
8080
),
8181
TransactionException.NONCE_MISMATCH_TOO_LOW: "nonce too low",
8282
TransactionException.NONCE_MISMATCH_TOO_HIGH: "nonce too high",
83-
TransactionException.EOF_CREATION_TRANSACTION: "EOF initcode in creation transaction",
8483
# TODO EVMONE needs to differentiate when the section is missing in the header or body
8584
EOFException.MISSING_STOP_OPCODE: "err: no_terminating_instruction",
8685
EOFException.MISSING_CODE_HEADER: "err: code_section_missing",

src/ethereum_test_exceptions/exceptions.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,6 @@ class TransactionException(ExceptionBase):
327327
"""
328328
Transaction's initcode for a contract-creating transaction is too large.
329329
"""
330-
EOF_CREATION_TRANSACTION = auto()
331-
"""
332-
Creation transaction (to: nil) contains EOF initcode
333-
"""
334330
TYPE_3_TX_PRE_FORK = auto()
335331
"""
336332
Transaction type 3 included before activation fork.

tests/osaka/eip7692_eof_v1/eip7873_tx_create/test_creation_tx.py

Lines changed: 11 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import pytest
44

55
from ethereum_test_base_types.base_types import Address, Bytes
6-
from ethereum_test_exceptions.exceptions import TransactionException
76
from ethereum_test_tools import (
87
Account,
98
Alloc,
@@ -13,6 +12,7 @@
1312
)
1413
from ethereum_test_tools.code.generators import Initcode as LegacyInitcode
1514
from ethereum_test_types.eof.v1 import Container
15+
from ethereum_test_types.types import TransactionReceipt
1616
from tests.prague.eip7702_set_code_tx.spec import Spec
1717

1818
from .. import EOF_FORK_NAME
@@ -22,7 +22,7 @@
2222
)
2323

2424
REFERENCE_SPEC_GIT_PATH = "EIPS/eip-7873.md"
25-
REFERENCE_SPEC_VERSION = "1115fe6110fcc0efc823fb7f8f5cd86c42173efe"
25+
REFERENCE_SPEC_VERSION = "23d96ceff8f0690432ab91089ae257f08f32340f"
2626

2727
pytestmark = 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
)
13895
def 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

Comments
 (0)