Skip to content

test_vector_dupn_invalid_0x60()

Documentation for tests/amsterdam/eip8024_dupn_swapn_exchange/test_eip_vectors.py::test_vector_dupn_invalid_0x60@9c2813ee.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip8024_dupn_swapn_exchange/test_eip_vectors.py::test_vector_dupn_invalid_0x60 --fork Amsterdam

Test vector: e6605b [INVALID_DUPN, PUSH1 0x5b].

DUPN with immediate 0x60 (96) is in the invalid range (91-127). Execution should abort with exceptional halt.

Source code in tests/amsterdam/eip8024_dupn_swapn_exchange/test_eip_vectors.py
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
def test_vector_dupn_invalid_0x60(
    pre: Alloc,
    state_test: StateTestFiller,
) -> None:
    """
    Test vector: e6605b [INVALID_DUPN, PUSH1 0x5b].

    DUPN with immediate 0x60 (96) is in the invalid range (91-127).
    Execution should abort with exceptional halt.
    """
    sender = pre.fund_eoa()

    # Push enough items on stack for any potential operation
    code = Bytecode()
    for i in range(235):
        code += Op.PUSH1(i % 256)

    # DUPN with invalid immediate 0x60 - should abort
    # Hex: e6 60 5b
    code += Op.DUPN[b"\x60"]

    # This should never execute due to invalid immediate
    code += Op.PUSH1(0x5B)  # Would be PUSH1 0x5b if we got here
    code += Op.PUSH1(0x42) + Op.PUSH1(0) + Op.SSTORE
    code += Op.STOP

    contract_address = pre.deploy_contract(code=code)
    tx = Transaction(to=contract_address, sender=sender, gas_limit=10_000_000)

    # Transaction should fail, storage unchanged
    post = {contract_address: Account(storage={})}

    state_test(pre=pre, post=post, tx=tx)

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.