55
66import pytest
77
8+ from ethereum_test_forks import Fork
89from ethereum_test_tools import Account , Alloc , Block , BlockchainTestFiller , Transaction
910from ethereum_test_tools .vm .opcode import Opcodes as Op
10- from ethereum_test_forks import Fork
1111
1212REFERENCE_SPEC_GIT_PATH = "DUMMY/eip-DUMMY.md"
13- REFERENCE_SPEC_VERSION = "DUMMY_VERSION "
14-
13+ REFERENCE_SPEC_VERSION = "0.1 "
14+ GAS_LIMIT = 30_000_000 # Default gas limit seems to be >90M in this env
1515
1616@pytest .mark .valid_from ("Prague" )
1717def test_bloatnet (blockchain_test : BlockchainTestFiller , pre : Alloc , fork : Fork ):
1818 """
19- A test that calls a contract with many SSTOREs
19+ A test that calls a contract with many SSTOREs.
2020
2121 The first block will have many SSTORES that go from 0 -> 1
2222 and the 2nd block will have many SSTORES that go from 1 -> 2
@@ -27,13 +27,12 @@ def test_bloatnet(blockchain_test: BlockchainTestFiller, pre: Alloc, fork: Fork)
2727 storage_slot : int = 0
2828
2929 storage = {}
30- GasLimit = 30_000_000 # Default gas limit seems to be >90M in this env
3130
3231 totalgas = gas_costs .G_BASE * 2 # Initial gas for PUSH0 + CALLDATALOAD
3332 gas_increment = gas_costs .G_VERY_LOW * 2 + gas_costs .G_STORAGE_SET + gas_costs .G_COLD_SLOAD
3433 sstore_code = Op .PUSH0 + Op .CALLDATALOAD + Op .DUP1
3534 i = 0
36- while totalgas + gas_increment < GasLimit :
35+ while totalgas + gas_increment < GAS_LIMIT :
3736 totalgas += gas_increment
3837 # print(f"increment={gas_increment} < totalgas={totalgas} i={i}")
3938 sstore_code = sstore_code + Op .DUP1
@@ -58,15 +57,15 @@ def test_bloatnet(blockchain_test: BlockchainTestFiller, pre: Alloc, fork: Fork)
5857
5958 tx_0_1 = Transaction (
6059 to = contract_address ,
61- gas_limit = GasLimit ,
60+ gas_limit = GAS_LIMIT ,
6261 data = b'\x01 ' , # Single byte 0x01
6362 value = 0 ,
6463 sender = sender ,
6564 )
6665 tx_1_2 = Transaction (
6766 to = contract_address ,
68- gas_limit = 30000000 ,
69- data = b'\x02 ' , # Single byte 0x02, turns into 0x2000000000000000000000000000000000000000000000000000000000000000
67+ gas_limit = GAS_LIMIT ,
68+ data = b'\x02 ' , # Single byte 0x02, turns into 0x02 << 248
7069 value = 0 ,
7170 sender = sender ,
7271 )
0 commit comments