16
16
@pytest .fixture (params = MAINNET_VMS [9 :])
17
17
def london_plus_miner (request , base_db , genesis_state ):
18
18
klass = MiningChain .configure (
19
- __name__ = 'CrossoverTestChain ' ,
19
+ __name__ = 'LondonAt1 ' ,
20
20
vm_configuration = (
21
21
(
22
22
constants .GENESIS_BLOCK_NUMBER ,
@@ -33,8 +33,8 @@ def london_plus_miner(request, base_db, genesis_state):
33
33
difficulty = 1 ,
34
34
gas_limit = 21000 * 2 , # block limit is hit with two transactions
35
35
)
36
- # On the first London+ block, it will double the block limit so that the
37
- # block *target* is hit with 2 transactions
36
+ # On the first London+ block, it will double the block limit so that it
37
+ # can precisely hold 4 transactions.
38
38
return klass .from_genesis (base_db , header_fields , genesis_state )
39
39
40
40
@@ -52,7 +52,8 @@ def london_plus_miner(request, base_db, genesis_state):
52
52
def test_base_fee_evolution (
53
53
london_plus_miner , funded_address , funded_address_private_key , num_txns , expected_base_fee ):
54
54
chain = london_plus_miner
55
- assert chain .header .gas_limit == 21000 * 4
55
+ FOUR_TXN_GAS_LIMIT = 21000 * 4
56
+ assert chain .header .gas_limit == FOUR_TXN_GAS_LIMIT
56
57
57
58
vm = chain .get_vm ()
58
59
txns = [
@@ -66,15 +67,15 @@ def test_base_fee_evolution(
66
67
)
67
68
for nonce in range (num_txns )
68
69
]
69
- block_import , _ , _ = chain .mine_all (txns , gas_limit = 21000 * 4 )
70
+ block_import , _ , _ = chain .mine_all (txns , gas_limit = FOUR_TXN_GAS_LIMIT )
70
71
mined_header = block_import .imported_block .header
71
- assert mined_header .gas_limit == 21000 * 4
72
+ assert mined_header .gas_limit == FOUR_TXN_GAS_LIMIT
72
73
assert mined_header .gas_used == 21000 * num_txns
73
74
assert mined_header .base_fee_per_gas == 10 ** 9 # Initialize at 1 gwei
74
75
75
- # Next block should have an unchanged gas fee because usage was equal to target (half of limit)
76
- block_import , _ , _ = chain .mine_all ([], gas_limit = 21000 * 4 )
76
+ block_import , _ , _ = chain .mine_all ([], gas_limit = FOUR_TXN_GAS_LIMIT )
77
77
mined_header = block_import .imported_block .header
78
- assert mined_header .gas_limit == 21000 * 4
78
+ assert mined_header .gas_limit == FOUR_TXN_GAS_LIMIT
79
79
assert mined_header .gas_used == 0
80
+ # Check that the base fee evolved correctly, depending on how much gas was used in the parent
80
81
assert mined_header .base_fee_per_gas == expected_base_fee
0 commit comments