Skip to content

test_legacy_calls_eof_sstore()

Documentation for tests/prague/eip7692_eof_v1/eip7069_extcall/test_calls.py::test_legacy_calls_eof_sstore@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_legacy_calls_eof_sstore --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_legacy_calls_eof_sstore --until=PragueEIP7692

Test legacy contracts calling EOF contracts that use SSTORE

Source code in tests/prague/eip7692_eof_v1/eip7069_extcall/test_calls.py
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
@pytest.mark.parametrize(
    "opcode",
    [
        Op.CALL,
        Op.DELEGATECALL,
        Op.CALLCODE,
        Op.STATICCALL,
    ],
)
def test_legacy_calls_eof_sstore(
    state_test: StateTestFiller,
    pre: Alloc,
    sender: EOA,
    opcode: Op,
):
    """Test legacy contracts calling EOF contracts that use SSTORE"""
    env = Environment()
    destination_contract_address = pre.deploy_contract(contract_eof_sstore)

    caller_contract = Op.SSTORE(
        slot_call_result, opcode(address=destination_contract_address)
    ) + Op.SSTORE(slot_code_worked, value_code_worked)

    calling_contract_address = pre.deploy_contract(caller_contract)

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

    calling_storage = Storage(
        {
            slot_code_worked: value_code_worked,  # type: ignore
            slot_call_result: LEGACY_CALL_SUCCESS,  # type: ignore
        }
    )
    destination_storage = Storage()

    if opcode == Op.CALL:
        destination_storage[slot_caller] = calling_contract_address
    elif opcode == Op.DELEGATECALL:
        calling_storage[slot_caller] = sender
    elif opcode == Op.CALLCODE:
        calling_storage[slot_caller] = calling_contract_address
    elif opcode == Op.STATICCALL:
        calling_storage[slot_call_result] = LEGACY_CALL_FAILURE

    post = {
        calling_contract_address: Account(storage=calling_storage),
        destination_contract_address: Account(storage=destination_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 opcode
opcode_CALL CALL
opcode_DELEGATECALL DELEGATECALL
opcode_CALLCODE CALLCODE
opcode_STATICCALL STATICCALL
opcode_CALL CALL
opcode_DELEGATECALL DELEGATECALL
opcode_CALLCODE CALLCODE
opcode_STATICCALL STATICCALL