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@bc691d13.

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
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
@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=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-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
...fork_Osaka-blockchain_test_from_state_test-fail_opcode_REVERT-opcode_EXTCALL REVERT EXTCALL
...fork_Osaka-blockchain_test_from_state_test-fail_opcode_REVERT-opcode_EXTDELEGATECALL REVERT EXTDELEGATECALL
...fork_Osaka-blockchain_test_from_state_test-fail_opcode_INVALID-opcode_EXTCALL INVALID EXTCALL
...fork_Osaka-blockchain_test_from_state_test-fail_opcode_INVALID-opcode_EXTDELEGATECALL INVALID EXTDELEGATECALL