Skip to content

Commit 21bb88d

Browse files
refactor: update worst jump test case
1 parent fe1efbe commit 21bb88d

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

tests/zkevm/test_worst_compute.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -762,24 +762,12 @@ def code_loop_precompile_call(calldata: Bytecode, attack_block: Bytecode, fork:
762762
def test_worst_jumps(state_test: StateTestFiller, pre: Alloc, fork: Fork):
763763
"""Test running a JUMP-intensive contract."""
764764
env = Environment()
765-
max_code_size = fork.max_code_size()
766-
767-
def jump_seq(dest: int):
768-
return Op.JUMP(Op.PUSH2(dest)) + Op.JUMPDEST
769-
770-
bytes_per_seq = len(jump_seq())
771-
seqs_per_call = max_code_size // bytes_per_seq
772-
773-
# Create and deploy the jump-intensive contract
774-
jumps_code = sum([jump_seq(4 + 5 * i) for i in range(seqs_per_call)])
775-
jumps_address = pre.deploy_contract(code=bytes(jumps_code))
776765

777-
# Call the contract repeatedly until gas runs out.
778-
caller_code = While(body=Op.POP(Op.CALL(address=jumps_address)))
779-
caller_address = pre.deploy_contract(caller_code)
766+
jumps_code = Op.JUMPDEST + Op.JUMP(Op.PUSH0)
767+
jumps_address = pre.deploy_contract(jumps_code)
780768

781769
tx = Transaction(
782-
to=caller_address,
770+
to=jumps_address,
783771
gas_limit=env.gas_limit,
784772
sender=pre.fund_eoa(),
785773
)

0 commit comments

Comments
 (0)