Skip to content

test_eof_calls_eof_then_fails()

Documentation for tests/osaka/eip7692_eof_v1/eip7069_extcall/test_calls.py::test_eof_calls_eof_then_fails@49a16fac.

Generate fixtures for these test cases for Osaka with:

fill -v tests/osaka/eip7692_eof_v1/eip7069_extcall/test_calls.py::test_eof_calls_eof_then_fails --fork Osaka

Test EOF contracts calling EOF contracts and failing after the call.

Source code in tests/osaka/eip7692_eof_v1/eip7069_extcall/test_calls.py
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
@pytest.mark.parametrize(
    "opcode",
    [
        Op.EXTCALL,
        Op.EXTDELEGATECALL,
    ],
)
@pytest.mark.parametrize("fail_opcode", [Op.REVERT, Op.INVALID])
def test_eof_calls_eof_then_fails(
    state_test: StateTestFiller,
    pre: Alloc,
    sender: EOA,
    opcode: Op,
    fail_opcode: Op,
):
    """Test EOF contracts calling EOF contracts and failing after the call."""
    env = Environment()
    destination_contract_address = pre.deploy_contract(contract_eof_sstore)

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

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

    post = {
        calling_contract_address: Account(storage=Storage()),
        destination_contract_address: Account(storage=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.

Test ID (Abbreviated) fail_opcode opcode
...fork_Osaka-blockchain_test-fail_opcode_REVERT-opcode_EXTCALL REVERT EXTCALL
...fork_Osaka-blockchain_test-fail_opcode_REVERT-opcode_EXTDELEGATECALL REVERT EXTDELEGATECALL
...fork_Osaka-blockchain_test-fail_opcode_INVALID-opcode_EXTCALL INVALID EXTCALL
...fork_Osaka-blockchain_test-fail_opcode_INVALID-opcode_EXTDELEGATECALL INVALID EXTDELEGATECALL
...fork_Osaka-state_test-fail_opcode_REVERT-opcode_EXTCALL REVERT EXTCALL
...fork_Osaka-state_test-fail_opcode_REVERT-opcode_EXTDELEGATECALL REVERT EXTDELEGATECALL
...fork_Osaka-state_test-fail_opcode_INVALID-opcode_EXTCALL INVALID EXTCALL
...fork_Osaka-state_test-fail_opcode_INVALID-opcode_EXTDELEGATECALL INVALID EXTDELEGATECALL