Skip to content

test_eof_calls_revert_abort()

Documentation for tests/prague/eip7692_eof_v1/eip7069_extcall/test_calls.py::test_eof_calls_revert_abort@verkle@v0.0.6.

Generate fixtures for these test cases for Pragueeip7692 with:

Pragueeip7692 only:

fill -v tests/prague/eip7692_eof_v1/eip7069_extcall/test_calls.py::test_eof_calls_revert_abort --fork=PragueEIP7692 --evm-bin=/path/to/evm-tool-dev-version

For all forks up to and including Pragueeip7692:

fill -v tests/prague/eip7692_eof_v1/eip7069_extcall/test_calls.py::test_eof_calls_revert_abort --until=PragueEIP7692

Test EOF contracts calling contracts that revert or abort

Source code in tests/prague/eip7692_eof_v1/eip7069_extcall/test_calls.py
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
@pytest.mark.parametrize(
    "opcode",
    [
        Op.EXTCALL,
        Op.EXTDELEGATECALL,
        Op.EXTSTATICCALL,
    ],
)
@pytest.mark.parametrize(
    "destination_opcode",
    [Op.REVERT, Op.INVALID],
)
@pytest.mark.parametrize("destination_is_eof", [True, False])
def test_eof_calls_revert_abort(
    state_test: StateTestFiller,
    pre: Alloc,
    sender: EOA,
    opcode: Op,
    destination_opcode: Op,
    destination_is_eof: bool,
):
    """Test EOF contracts calling contracts that revert or abort"""
    env = Environment()

    destination_contract_address = pre.deploy_contract(
        Container.Code(destination_opcode(offset=0, size=0))
        if destination_is_eof
        else destination_opcode(offset=0, size=0)
    )

    caller_contract = Container.Code(
        Op.SSTORE(slot_call_result, opcode(address=destination_contract_address))
        + Op.SSTORE(slot_code_worked, value_code_worked)
        + Op.STOP,
    )
    calling_contract_address = pre.deploy_contract(caller_contract)

    tx = Transaction(
        sender=sender,
        to=Address(calling_contract_address),
        gas_limit=50000000,
        data="",
    )

    calling_storage = {
        slot_code_worked: value_code_worked,
        slot_call_result: EXTCALL_REVERT
        if destination_opcode == Op.REVERT
        or (opcode == Op.EXTDELEGATECALL and not destination_is_eof)
        else EXTCALL_FAILURE,
    }

    post = {
        calling_contract_address: Account(storage=calling_storage),
        destination_contract_address: Account(storage={}),
    }

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

Parametrized Test Cases

The interactive table below is also available as a standalone page.

Skipped Parameters

For more concise readability, the table below does not list the following parameter values: fork, blockchain_test, state_test, state_test_only, eof_test, eof_state_test.

Test ID destination_is_eof destination_opcode opcode
destination_is_eof_True-destination_opcode_REVERT-opcode_EXTCALL True REVERT EXTCALL
destination_is_eof_True-destination_opcode_REVERT-opcode_EXTDELEGATECALL True REVERT EXTDELEGATECALL
destination_is_eof_True-destination_opcode_REVERT-opcode_EXTSTATICCALL True REVERT EXTSTATICCALL
destination_is_eof_True-destination_opcode_INVALID-opcode_EXTCALL True INVALID EXTCALL
destination_is_eof_True-destination_opcode_INVALID-opcode_EXTDELEGATECALL True INVALID EXTDELEGATECALL
destination_is_eof_True-destination_opcode_INVALID-opcode_EXTSTATICCALL True INVALID EXTSTATICCALL
destination_is_eof_False-destination_opcode_REVERT-opcode_EXTCALL False REVERT EXTCALL
destination_is_eof_False-destination_opcode_REVERT-opcode_EXTDELEGATECALL False REVERT EXTDELEGATECALL
destination_is_eof_False-destination_opcode_REVERT-opcode_EXTSTATICCALL False REVERT EXTSTATICCALL
destination_is_eof_False-destination_opcode_INVALID-opcode_EXTCALL False INVALID EXTCALL
destination_is_eof_False-destination_opcode_INVALID-opcode_EXTDELEGATECALL False INVALID EXTDELEGATECALL
destination_is_eof_False-destination_opcode_INVALID-opcode_EXTSTATICCALL False INVALID EXTSTATICCALL
destination_is_eof_True-destination_opcode_REVERT-opcode_EXTCALL True REVERT EXTCALL
destination_is_eof_True-destination_opcode_REVERT-opcode_EXTDELEGATECALL True REVERT EXTDELEGATECALL
destination_is_eof_True-destination_opcode_REVERT-opcode_EXTSTATICCALL True REVERT EXTSTATICCALL
destination_is_eof_True-destination_opcode_INVALID-opcode_EXTCALL True INVALID EXTCALL
destination_is_eof_True-destination_opcode_INVALID-opcode_EXTDELEGATECALL True INVALID EXTDELEGATECALL
destination_is_eof_True-destination_opcode_INVALID-opcode_EXTSTATICCALL True INVALID EXTSTATICCALL
destination_is_eof_False-destination_opcode_REVERT-opcode_EXTCALL False REVERT EXTCALL
destination_is_eof_False-destination_opcode_REVERT-opcode_EXTDELEGATECALL False REVERT EXTDELEGATECALL
destination_is_eof_False-destination_opcode_REVERT-opcode_EXTSTATICCALL False REVERT EXTSTATICCALL
destination_is_eof_False-destination_opcode_INVALID-opcode_EXTCALL False INVALID EXTCALL
destination_is_eof_False-destination_opcode_INVALID-opcode_EXTDELEGATECALL False INVALID EXTDELEGATECALL
destination_is_eof_False-destination_opcode_INVALID-opcode_EXTSTATICCALL False INVALID EXTSTATICCALL