Skip to content

Commit 6e79a74

Browse files
authored
Merge pull request #944 from ethereum/jsign-contract-creation-failed-initcode
verkle: add contract creation failure scenario
2 parents 281da6b + aae9307 commit 6e79a74

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

tests/verkle/eip6800_genesis_verkle_tree/test_contract_creation.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,52 @@ def test_contract_creation(
8181
post=post,
8282
blocks=blocks,
8383
)
84+
85+
86+
@pytest.mark.valid_from("Verkle")
87+
@pytest.mark.parametrize(
88+
"value",
89+
[0, 1],
90+
)
91+
def test_contract_creation_failed_initcode(
92+
blockchain_test: BlockchainTestFiller, fork: str, value: int
93+
):
94+
"""
95+
Test that contract creation with failed initcode.
96+
"""
97+
env = Environment(
98+
fee_recipient="0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
99+
difficulty=0x20000,
100+
gas_limit=10000000000,
101+
number=1,
102+
timestamp=1000,
103+
)
104+
pre = {
105+
TestAddress: Account(balance=1000000000000000000000),
106+
}
107+
tx = Transaction(
108+
ty=0x0,
109+
chain_id=0x01,
110+
nonce=0,
111+
to=None,
112+
gas_limit=100000000,
113+
gas_price=10,
114+
value=value,
115+
data=Op.REVERT(0, 0),
116+
)
117+
blocks = [Block(txs=[tx])]
118+
119+
contract_address = compute_create_address(address=TestAddress, nonce=tx.nonce)
120+
121+
post = {
122+
contract_address: Account(
123+
balance=value,
124+
),
125+
}
126+
127+
blockchain_test(
128+
genesis_environment=env,
129+
pre=pre,
130+
post=post,
131+
blocks=blocks,
132+
)

0 commit comments

Comments
 (0)