@@ -620,34 +620,25 @@ def test_worst_selfdestruct_created(
620
620
"""
621
621
env = Environment ()
622
622
623
- # Template code that will be used to deploy a large number of contracts.
624
- initcode = (
625
- Op .MSTORE8 (0 , 0x41 ) # COINBASE
626
- + Op .MSTORE8 (1 , 0xFF ) # SELFDESTRUCT
627
- + Op .RETURN (0 , 2 )
628
- )
629
- initcode_address = pre .deploy_contract (code = initcode )
630
-
623
+ # SELFDESTRUCT(COINBASE) contract deployment
624
+ # code = Op.MSTORE8(0, 0x41) + Op.MSTORE8(1, 0xFF) + Op.RETURN(0, 2)
625
+ initcode = 0x604160005360FF60015360026000F3
626
+ initcode_length = (initcode .bit_length () + 7 ) // 8
631
627
code = (
632
- Op .EXTCODECOPY (
633
- address = initcode_address ,
634
- dest_offset = 0 ,
635
- offset = 0 ,
636
- size = Op .EXTCODESIZE (initcode_address ),
637
- )
628
+ Op .MSTORE (0 , initcode )
638
629
+ While (
639
630
body = Op .POP (
640
631
Op .CALL (
641
632
address = Op .CREATE (
642
633
value = 1 if value_bearing else 0 ,
643
- offset = 0 ,
644
- size = Op . EXTCODESIZE ( initcode_address ) ,
634
+ offset = 32 - initcode_length ,
635
+ size = initcode_length ,
645
636
)
646
637
)
647
638
),
648
639
# Stop before we run out of gas for the whole tx execution.
649
640
# The value was found by trial-error rounded to the next 1000 multiple.
650
- condition = Op .GT (Op .GAS , 24_000 ),
641
+ condition = Op .GT (Op .GAS , 25_000 ),
651
642
)
652
643
+ Op .SSTORE (0 , 42 ) # Done for successful tx execution assertion below.
653
644
)
0 commit comments