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