Skip to content

test_eof_calls_eof_mstore()

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

Test EOF contracts calling EOF contracts that return data

Source code in tests/prague/eip7692_eof_v1/eip7069_extcall/test_calls.py
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
@pytest.mark.parametrize(
    "opcode",
    [
        Op.EXTCALL,
        Op.EXTDELEGATECALL,
        Op.EXTSTATICCALL,
    ],
)
def test_eof_calls_eof_mstore(
    state_test: StateTestFiller,
    pre: Alloc,
    sender: EOA,
    opcode: Op,
):
    """Test EOF contracts calling EOF contracts that return data"""
    env = Environment()
    destination_contract_code = Container(
        sections=[
            Section.Code(
                code=Op.MSTORE8(0, int.from_bytes(value_returndata_magic, "big"))
                + Op.RETURN(0, 32),
            )
        ]
    )
    destination_contract_address = pre.deploy_contract(destination_contract_code)

    caller_contract = Container(
        sections=[
            Section.Code(
                code=Op.SSTORE(slot_call_result, opcode(address=destination_contract_address))
                + Op.SSTORE(slot_returndatasize, Op.RETURNDATASIZE)
                + Op.SSTORE(slot_returndata, Op.RETURNDATALOAD(0))
                + 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,  # type: ignore
        slot_call_result: EXTCALL_SUCCESS,  # type: ignore
        slot_returndatasize: 0x20,  # type: ignore
        slot_returndata: value_returndata_magic
        + b"\0" * (0x20 - len(value_returndata_magic)),  # type: ignore
    }

    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 opcode
opcode_EXTCALL EXTCALL
opcode_EXTDELEGATECALL EXTDELEGATECALL
opcode_EXTSTATICCALL EXTSTATICCALL
opcode_EXTCALL EXTCALL
opcode_EXTDELEGATECALL EXTDELEGATECALL
opcode_EXTSTATICCALL EXTSTATICCALL