Skip to content

Instantly share code, notes, and snippets.

@jsign
Last active May 2, 2025 01:28
Show Gist options
  • Save jsign/a572fd2ccf5e7320322f7e79f2990685 to your computer and use it in GitHub Desktop.
Save jsign/a572fd2ccf5e7320322f7e79f2990685 to your computer and use it in GitHub Desktop.
@pytest.mark.zkevm
@pytest.mark.valid_from("Cancun")
@pytest.mark.parametrize(
"gas_limit",
[
36_000_000,
],
)
def test_worst_jumpdest(
blockchain_test: BlockchainTestFiller,
pre: Alloc,
fork: Fork,
gas_limit: int,
):
"""Test running a block with as many JUMPDEST calls as possible."""
env = Environment(gas_limit=gas_limit)
# code = sum([Op.JUMP(Op.ADD(5, Op.PC))+Op.JUMPDEST] * (MAX_CODE_SIZE // 6))
code = sum([Op.PUSH0+Op.POP] * (MAX_CODE_SIZE // 2))
code_address = pre.deploy_contract(code=bytes(code))
tx = Transaction(
to=code_address,
gas_limit=gas_limit,
gas_price=10,
sender=pre.fund_eoa(),
data=[],
value=0,
)
blockchain_test(
env=env,
pre=pre,
post={},
blocks=[Block(txs=[tx])],
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment