Skip to content

Commit 1fa785c

Browse files
committed
improvements
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
1 parent 0a19e7d commit 1fa785c

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

tests/zkevm/test_worst_stateful_opcodes.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -575,14 +575,15 @@ def test_worst_selfdestruct_existing(
575575
body=Op.POP(Op.CALL(address=Op.SHA3(32 - 20 - 1, 85)))
576576
+ Op.MSTORE(32, Op.ADD(Op.MLOAD(32), 1)),
577577
# 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),
580580
)
581581
+ Op.SSTORE(0, 42) # Done for successful tx execution assertion below.
582582
)
583583
assert len(code) <= fork.max_code_size()
584584

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})
586587
opcode_tx = Transaction(
587588
to=code_addr,
588589
gas_limit=attack_gas_limit,
@@ -663,12 +664,13 @@ def test_worst_selfdestruct_created(
663664
)
664665
),
665666
# 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),
668669
)
669670
+ Op.SSTORE(0, 42) # Done for successful tx execution assertion below.
670671
)
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})
672674
code_tx = Transaction(
673675
to=code_addr,
674676
gas_limit=env.gas_limit,

0 commit comments

Comments
 (0)