Skip to content

test_eof_calls_legacy_sstore()

Documentation for tests/prague/eip7692_eof_v1/eip7069_extcall/test_calls.py::test_eof_calls_legacy_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_eof_calls_legacy_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_eof_calls_legacy_sstore --until=PragueEIP7692

Test EOF contracts calling Legacy contracts that use SSTORE

Source code in tests/prague/eip7692_eof_v1/eip7069_extcall/test_calls.py
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
@pytest.mark.parametrize(
    "opcode",
    [
        Op.EXTCALL,
        Op.EXTDELEGATECALL,
        Op.EXTSTATICCALL,
    ],
)
def test_eof_calls_legacy_sstore(
    state_test: StateTestFiller,
    pre: Alloc,
    sender: EOA,
    opcode: Op,
):
    """Test EOF contracts calling Legacy contracts that use SSTORE"""
    env = Environment()
    destination_contract_code = Op.SSTORE(slot_caller, Op.CALLER()) + Op.STOP
    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_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
    }
    destination_storage = {}

    if opcode == Op.EXTCALL:
        destination_storage[slot_caller] = calling_contract_address
    elif opcode == Op.EXTDELEGATECALL:
        # EOF delegate call to legacy is a light failure by rule
        calling_storage[slot_call_result] = EXTCALL_REVERT
    elif opcode == Op.EXTSTATICCALL:
        calling_storage[slot_call_result] = EXTCALL_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_EXTCALL EXTCALL
opcode_EXTDELEGATECALL EXTDELEGATECALL
opcode_EXTSTATICCALL EXTSTATICCALL
opcode_EXTCALL EXTCALL
opcode_EXTDELEGATECALL EXTDELEGATECALL
opcode_EXTSTATICCALL EXTSTATICCALL