Skip to content

Commit e3dfc76

Browse files
committed
verify intermidiate block state in blockchain test
1 parent 5c49d93 commit e3dfc76

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

frontier/examples/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Test examples, patterns, templates to use in .py tests."""
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
"""Test the SELFDESTRUCT opcode."""
2+
3+
import pytest
4+
5+
from ethereum_test_tools import (
6+
Account,
7+
Alloc,
8+
Block,
9+
BlockchainTestFiller,
10+
Environment,
11+
Transaction,
12+
)
13+
14+
15+
@pytest.mark.valid_from("Frontier")
16+
@pytest.mark.valid_until("Homestead")
17+
def test_block_intermidiate_state(blockchain_test: BlockchainTestFiller, pre: Alloc):
18+
"""Verify intermidiate block states."""
19+
env = Environment()
20+
sender = pre.fund_eoa()
21+
22+
tx = Transaction(gas_limit=100_000, to=None, data=b"", sender=sender)
23+
tx_2 = Transaction(gas_limit=100_000, to=None, data=b"", sender=sender)
24+
25+
block_1 = Block(
26+
txs=[tx],
27+
expected_post_state={
28+
sender: Account(
29+
nonce=1,
30+
),
31+
},
32+
)
33+
34+
block_2 = Block(txs=[])
35+
36+
block_3 = Block(
37+
txs=[tx_2],
38+
expected_post_state={
39+
sender: Account(
40+
nonce=2,
41+
),
42+
},
43+
)
44+
45+
blockchain_test(
46+
genesis_environment=env,
47+
pre=pre,
48+
post=block_3.expected_post_state,
49+
blocks=[block_1, block_2, block_3],
50+
)

0 commit comments

Comments
 (0)