Skip to content

Commit 1969fd3

Browse files
committed
feat(tests): Zero gasprice transaction vs account touch
1 parent 9563a51 commit 1969fd3

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

tests/frontier/touch/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Test for account touching behavior introduced in Frontier."""

tests/frontier/touch/test_touch.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
"""test account touch behavior."""
2+
3+
import pytest
4+
from execution_testing import (
5+
Account,
6+
Alloc,
7+
Environment,
8+
Op,
9+
StateTestFiller,
10+
Transaction,
11+
)
12+
13+
14+
@pytest.mark.valid_from("Frontier")
15+
@pytest.mark.valid_until("Berlin")
16+
def test_zero_gas_price_and_touching(
17+
state_test: StateTestFiller,
18+
pre: Alloc,
19+
) -> None:
20+
"""
21+
Test sending a zero gasprice transaction in early forks respects
22+
account touching rules.
23+
"""
24+
sender = pre.fund_eoa()
25+
value = 0x01
26+
27+
contract = pre.deploy_contract(
28+
code=(Op.SSTORE(0, value) + Op.STOP),
29+
)
30+
31+
tx = Transaction(
32+
gas_limit=500_000,
33+
to=contract,
34+
gas_price=0,
35+
sender=sender,
36+
protected=False,
37+
)
38+
39+
state_test(
40+
env=Environment(),
41+
pre=pre,
42+
tx=tx,
43+
post={contract: Account(storage={0: value})},
44+
)

0 commit comments

Comments
 (0)