Skip to content

Commit 211f052

Browse files
pdobaczmarioevz
andauthored
feat(tests): Zero gasprice transaction vs account touch (#1736)
* feat(tests): Zero gasprice transaction vs account touch * Update tests/frontier/touch/test_touch.py --------- Co-authored-by: Mario Vega <[email protected]>
1 parent 843f4e8 commit 211f052

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

docs/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Test fixtures for use by clients are available for each release on the [Github r
3333
- ✨ Add a test case for base fee in block check after London ([#1702](https://github.com/ethereum/execution-specs/pull/1702)).
3434
- ✨ Add tests for `modexp` and `ripemd` precompiled contracts ([#1691](https://github.com/ethereum/execution-specs/pull/1691)).
3535
- ✨ Add `ecrecover` precompile tests originating form `evmone` unittests ([#1685](https://github.com/ethereum/execution-specs/pull/1685)).
36+
- ✨ Add test for old behavior of zero gasprice txs ([#1736](https://github.com/ethereum/execution-specs/pull/1736)).
3637
- ✨ Add stack overflow tests and expand `BLOCKHASH` tests ([#1728](https://github.com/ethereum/execution-specs/pull/1728)).
3738
- ✨ Add tests that EIP-1559 and EIP-2930 typed txs are invalid and void before their fork ([#1754](https://github.com/ethereum/execution-specs/pull/1754)).
3839

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, # Part of the test, do not change.
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)