5
5
6
6
import pytest
7
7
8
+ from ethereum_test_forks import Fork
8
9
from ethereum_test_tools import Account , Alloc , Block , BlockchainTestFiller , Transaction
9
10
from ethereum_test_tools .vm .opcode import Opcodes as Op
10
- from ethereum_test_forks import Fork
11
11
12
12
REFERENCE_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
15
15
16
16
@pytest .mark .valid_from ("Prague" )
17
17
def test_bloatnet (blockchain_test : BlockchainTestFiller , pre : Alloc , fork : Fork ):
18
18
"""
19
- A test that calls a contract with many SSTOREs
19
+ A test that calls a contract with many SSTOREs.
20
20
21
21
The first block will have many SSTORES that go from 0 -> 1
22
22
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)
27
27
storage_slot : int = 0
28
28
29
29
storage = {}
30
- GasLimit = 30_000_000 # Default gas limit seems to be >90M in this env
31
30
32
31
totalgas = gas_costs .G_BASE * 2 # Initial gas for PUSH0 + CALLDATALOAD
33
32
gas_increment = gas_costs .G_VERY_LOW * 2 + gas_costs .G_STORAGE_SET + gas_costs .G_COLD_SLOAD
34
33
sstore_code = Op .PUSH0 + Op .CALLDATALOAD + Op .DUP1
35
34
i = 0
36
- while totalgas + gas_increment < GasLimit :
35
+ while totalgas + gas_increment < GAS_LIMIT :
37
36
totalgas += gas_increment
38
37
# print(f"increment={gas_increment} < totalgas={totalgas} i={i}")
39
38
sstore_code = sstore_code + Op .DUP1
@@ -58,15 +57,15 @@ def test_bloatnet(blockchain_test: BlockchainTestFiller, pre: Alloc, fork: Fork)
58
57
59
58
tx_0_1 = Transaction (
60
59
to = contract_address ,
61
- gas_limit = GasLimit ,
60
+ gas_limit = GAS_LIMIT ,
62
61
data = b'\x01 ' , # Single byte 0x01
63
62
value = 0 ,
64
63
sender = sender ,
65
64
)
66
65
tx_1_2 = Transaction (
67
66
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
70
69
value = 0 ,
71
70
sender = sender ,
72
71
)
0 commit comments