Skip to content

Commit 046a9eb

Browse files
committed
Combine duplicate London header fields
1 parent 29457ba commit 046a9eb

File tree

1 file changed

+19
-31
lines changed

1 file changed

+19
-31
lines changed

eth/vm/forks/london/blocks.py

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -59,42 +59,30 @@
5959
LondonTransactionBuilder,
6060
)
6161

62+
UNMINED_LONDON_HEADER_FIELDS = [
63+
('parent_hash', hash32),
64+
('uncles_hash', hash32),
65+
('coinbase', address),
66+
('state_root', trie_root),
67+
('transaction_root', trie_root),
68+
('receipt_root', trie_root),
69+
('bloom', uint256),
70+
('difficulty', big_endian_int),
71+
('block_number', big_endian_int),
72+
('gas_limit', big_endian_int),
73+
('gas_used', big_endian_int),
74+
('timestamp', big_endian_int),
75+
('extra_data', binary),
76+
('base_fee_per_gas', big_endian_int),
77+
]
78+
6279

6380
class LondonMiningHeader(rlp.Serializable, MiningHeaderAPI):
64-
fields = [
65-
('parent_hash', hash32),
66-
('uncles_hash', hash32),
67-
('coinbase', address),
68-
('state_root', trie_root),
69-
('transaction_root', trie_root),
70-
('receipt_root', trie_root),
71-
('bloom', uint256),
72-
('difficulty', big_endian_int),
73-
('block_number', big_endian_int),
74-
('gas_limit', big_endian_int),
75-
('gas_used', big_endian_int),
76-
('timestamp', big_endian_int),
77-
('extra_data', binary),
78-
('base_fee_per_gas', big_endian_int),
79-
]
81+
fields = UNMINED_LONDON_HEADER_FIELDS
8082

8183

8284
class LondonBlockHeader(rlp.Serializable, BlockHeaderAPI):
83-
fields = [
84-
('parent_hash', hash32),
85-
('uncles_hash', hash32),
86-
('coinbase', address),
87-
('state_root', trie_root),
88-
('transaction_root', trie_root),
89-
('receipt_root', trie_root),
90-
('bloom', uint256),
91-
('difficulty', big_endian_int),
92-
('block_number', big_endian_int),
93-
('gas_limit', big_endian_int),
94-
('gas_used', big_endian_int),
95-
('timestamp', big_endian_int),
96-
('extra_data', binary),
97-
('base_fee_per_gas', big_endian_int),
85+
fields = UNMINED_LONDON_HEADER_FIELDS + [
9886
('mix_hash', binary),
9987
('nonce', Binary(8, allow_empty=True)),
10088
]

0 commit comments

Comments
 (0)