@@ -575,14 +575,15 @@ def test_worst_selfdestruct_existing(
575
575
body = Op .POP (Op .CALL (address = Op .SHA3 (32 - 20 - 1 , 85 )))
576
576
+ Op .MSTORE (32 , Op .ADD (Op .MLOAD (32 ), 1 )),
577
577
# Stop before we run out of gas for the whole tx execution.
578
- # The value was discovered practically rounded to the next 1000 multiple.
579
- condition = Op .GT (Op .GAS , 28_000 ),
578
+ # The value was found by trial-error rounded to the next 1000 multiple.
579
+ condition = Op .GT (Op .GAS , 12_000 ),
580
580
)
581
581
+ Op .SSTORE (0 , 42 ) # Done for successful tx execution assertion below.
582
582
)
583
583
assert len (code ) <= fork .max_code_size ()
584
584
585
- code_addr = pre .deploy_contract (code = code )
585
+ # The 0 storage slot is initialize to avoid creation costs in SSTORE above.
586
+ code_addr = pre .deploy_contract (code = code , storage = {0 : 1 })
586
587
opcode_tx = Transaction (
587
588
to = code_addr ,
588
589
gas_limit = attack_gas_limit ,
@@ -663,12 +664,13 @@ def test_worst_selfdestruct_created(
663
664
)
664
665
),
665
666
# Stop before we run out of gas for the whole tx execution.
666
- # The value was discovered practically rounded to the next 1000 multiple.
667
- condition = Op .GT (Op .GAS , 40_000 ),
667
+ # The value was found by trial-error rounded to the next 1000 multiple.
668
+ condition = Op .GT (Op .GAS , 33_000 ),
668
669
)
669
670
+ Op .SSTORE (0 , 42 ) # Done for successful tx execution assertion below.
670
671
)
671
- code_addr = pre .deploy_contract (code = code )
672
+ # The 0 storage slot is initialize to avoid creation costs in SSTORE above.
673
+ code_addr = pre .deploy_contract (code = code , storage = {0 : 1 })
672
674
code_tx = Transaction (
673
675
to = code_addr ,
674
676
gas_limit = env .gas_limit ,
0 commit comments