@@ -29,25 +29,25 @@ def test_bloatnet(blockchain_test: BlockchainTestFiller, pre: Alloc, fork: Fork)
2929 storage = {}
3030 GasLimit = 30_000_000 # Default gas limit seems to be >90M in this env
3131
32- totalgas = gas_costs .G_BASE * 2 # Initial gas for PUSH0 + POP
32+ totalgas = gas_costs .G_BASE * 2 # Initial gas for PUSH0 + CALLDATALOAD
3333 gas_increment = gas_costs .G_VERY_LOW * 2 + gas_costs .G_STORAGE_SET + gas_costs .G_COLD_SLOAD
34- sstore_code = Op .PUSH0
34+ sstore_code = Op .PUSH0 + Op . CALLDATALOAD + Op . DUP1
3535 i = 0
3636 while totalgas + gas_increment < GasLimit :
3737 totalgas += gas_increment
38- print (f"increment={ gas_increment } < totalgas={ totalgas } i={ i } " )
39- sstore_code = sstore_code + Op .PUSH1 ( 1 )
38+ # print(f"increment={gas_increment} < totalgas={totalgas} i={i}")
39+ sstore_code = sstore_code + Op .DUP1
4040 if i < 256 :
4141 sstore_code = sstore_code + Op .PUSH1 (i )
4242 else :
4343 sstore_code = sstore_code + Op .PUSH2 (i )
4444
4545 sstore_code = sstore_code + Op .SSTORE (unchecked = True )
4646
47- storage [storage_slot ] = 0x1
47+ storage [storage_slot ] = 0x02 << 248
4848 storage_slot += 1
4949 i += 1
50- sstore_code = sstore_code + Op .POP
50+ sstore_code = sstore_code + Op .POP # Drop last value on the stack
5151
5252 sender = pre .fund_eoa ()
5353 print (sender )
@@ -59,17 +59,18 @@ def test_bloatnet(blockchain_test: BlockchainTestFiller, pre: Alloc, fork: Fork)
5959 tx_0_1 = Transaction (
6060 to = contract_address ,
6161 gas_limit = GasLimit ,
62- data = b"" ,
62+ data = b'\x01 ' , # Single byte 0x01
63+ value = 0 ,
64+ sender = sender ,
65+ )
66+ tx_1_2 = Transaction (
67+ to = contract_address ,
68+ gas_limit = 30000000 ,
69+ data = b'\x02 ' , # Single byte 0x02, turns into 0x2000000000000000000000000000000000000000000000000000000000000000
6370 value = 0 ,
6471 sender = sender ,
6572 )
66- # tx_1_2 = Transaction(
67- # to=contract_address,
68- # gas_limit=30000000,
69- # data=b"",
70- # value=0,
71- # sender=sender,
72- # )
7373
7474 post = {contract_address : Account (storage = storage )}
75- blockchain_test (pre = pre , blocks = [Block (txs = [tx_0_1 ])], post = post )
75+
76+ blockchain_test (pre = pre , blocks = [Block (txs = [tx_0_1 , tx_1_2 ])], post = post )
0 commit comments