Skip to content

Commit f54dc29

Browse files
committed
improvement
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
1 parent 6ecbaa0 commit f54dc29

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

tests/zkevm/test_worst_stateful_opcodes.py

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -620,34 +620,25 @@ def test_worst_selfdestruct_created(
620620
"""
621621
env = Environment()
622622

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
631627
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)
638629
+ While(
639630
body=Op.POP(
640631
Op.CALL(
641632
address=Op.CREATE(
642633
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,
645636
)
646637
)
647638
),
648639
# Stop before we run out of gas for the whole tx execution.
649640
# 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),
651642
)
652643
+ Op.SSTORE(0, 42) # Done for successful tx execution assertion below.
653644
)

0 commit comments

Comments
 (0)