Skip to content

Commit 6ff68a8

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

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
@@ -622,34 +622,25 @@ def test_worst_selfdestruct_created(
622622
"""
623623
env = Environment()
624624

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

0 commit comments

Comments
 (0)