Skip to content

test_set_code_to_tstore_reentry()

Documentation for tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_set_code_to_tstore_reentry@verkle@v0.0.6.

Generate fixtures for these test cases for Prague with:

Prague only:

fill -v tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_set_code_to_tstore_reentry --fork=Prague --evm-bin=/path/to/evm-tool-dev-version

For all forks up to and including Prague:

fill -v tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_set_code_to_tstore_reentry --until=Prague

Test the executing a simple TSTORE in a set-code transaction, which also performs a re-entry to TLOAD the value.

Source code in tests/prague/eip7702_set_code_tx/test_set_code_txs.py
320
321
322
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
@pytest.mark.parametrize(
    "return_opcode",
    [
        Op.RETURN,
        Op.REVERT,
    ],
)
@pytest.mark.with_all_call_opcodes
def test_set_code_to_tstore_reentry(
    state_test: StateTestFiller,
    pre: Alloc,
    call_opcode: Op,
    return_opcode: Op,
    evm_code_type: EVMCodeType,
):
    """
    Test the executing a simple TSTORE in a set-code transaction, which also performs a
    re-entry to TLOAD the value.
    """
    auth_signer = pre.fund_eoa(auth_account_start_balance)

    tload_value = 0x1234
    set_code = Conditional(
        condition=Op.ISZERO(Op.TLOAD(1)),
        if_true=Op.TSTORE(1, tload_value)
        + call_opcode(address=Op.ADDRESS)
        + Op.RETURNDATACOPY(0, 0, 32)
        + Op.SSTORE(2, Op.MLOAD(0)),
        if_false=Op.MSTORE(0, Op.TLOAD(1)) + return_opcode(size=32),
        evm_code_type=evm_code_type,
    )
    set_code_to_address = pre.deploy_contract(set_code)

    tx = Transaction(
        gas_limit=100_000,
        to=auth_signer,
        value=0,
        authorization_list=[
            AuthorizationTuple(
                address=set_code_to_address,
                nonce=0,
                signer=auth_signer,
            ),
        ],
        sender=pre.fund_eoa(),
    )

    state_test(
        env=Environment(),
        pre=pre,
        tx=tx,
        post={
            auth_signer: Account(
                nonce=1,
                code=Spec.delegation_designation(set_code_to_address),
                storage={2: tload_value},
            ),
        },
    )

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 call_opcode evm_code_type return_opcode
call_opcode_EXTCALL-evm_code_type_EOF_V1-return_opcode_RETURN EXTCALL EOF_V1 RETURN
call_opcode_EXTCALL-evm_code_type_EOF_V1-return_opcode_REVERT EXTCALL EOF_V1 REVERT
call_opcode_EXTCALL-evm_code_type_EOF_V1-return_opcode_RETURN EXTCALL EOF_V1 RETURN
call_opcode_EXTCALL-evm_code_type_EOF_V1-return_opcode_REVERT EXTCALL EOF_V1 REVERT
call_opcode_EXTSTATICCALL-evm_code_type_EOF_V1-return_opcode_RETURN EXTSTATICCALL EOF_V1 RETURN
call_opcode_EXTSTATICCALL-evm_code_type_EOF_V1-return_opcode_REVERT EXTSTATICCALL EOF_V1 REVERT
call_opcode_EXTSTATICCALL-evm_code_type_EOF_V1-return_opcode_RETURN EXTSTATICCALL EOF_V1 RETURN
call_opcode_EXTSTATICCALL-evm_code_type_EOF_V1-return_opcode_REVERT EXTSTATICCALL EOF_V1 REVERT
call_opcode_EXTDELEGATECALL-evm_code_type_EOF_V1-return_opcode_RETURN EXTDELEGATECALL EOF_V1 RETURN
call_opcode_EXTDELEGATECALL-evm_code_type_EOF_V1-return_opcode_REVERT EXTDELEGATECALL EOF_V1 REVERT
call_opcode_EXTDELEGATECALL-evm_code_type_EOF_V1-return_opcode_RETURN EXTDELEGATECALL EOF_V1 RETURN
call_opcode_EXTDELEGATECALL-evm_code_type_EOF_V1-return_opcode_REVERT EXTDELEGATECALL EOF_V1 REVERT
call_opcode_STATICCALL-evm_code_type_LEGACY-return_opcode_RETURN STATICCALL LEGACY RETURN
call_opcode_STATICCALL-evm_code_type_LEGACY-return_opcode_REVERT STATICCALL LEGACY REVERT
call_opcode_STATICCALL-evm_code_type_LEGACY-return_opcode_RETURN STATICCALL LEGACY RETURN
call_opcode_STATICCALL-evm_code_type_LEGACY-return_opcode_REVERT STATICCALL LEGACY REVERT
call_opcode_DELEGATECALL-evm_code_type_LEGACY-return_opcode_RETURN DELEGATECALL LEGACY RETURN
call_opcode_DELEGATECALL-evm_code_type_LEGACY-return_opcode_REVERT DELEGATECALL LEGACY REVERT
call_opcode_DELEGATECALL-evm_code_type_LEGACY-return_opcode_RETURN DELEGATECALL LEGACY RETURN
call_opcode_DELEGATECALL-evm_code_type_LEGACY-return_opcode_REVERT DELEGATECALL LEGACY REVERT
call_opcode_CALL-evm_code_type_LEGACY-return_opcode_RETURN CALL LEGACY RETURN
call_opcode_CALL-evm_code_type_LEGACY-return_opcode_REVERT CALL LEGACY REVERT
call_opcode_CALL-evm_code_type_LEGACY-return_opcode_RETURN CALL LEGACY RETURN
call_opcode_CALL-evm_code_type_LEGACY-return_opcode_REVERT CALL LEGACY REVERT
call_opcode_CALLCODE-evm_code_type_LEGACY-return_opcode_RETURN CALLCODE LEGACY RETURN
call_opcode_CALLCODE-evm_code_type_LEGACY-return_opcode_REVERT CALLCODE LEGACY REVERT
call_opcode_CALLCODE-evm_code_type_LEGACY-return_opcode_RETURN CALLCODE LEGACY RETURN
call_opcode_CALLCODE-evm_code_type_LEGACY-return_opcode_REVERT CALLCODE LEGACY REVERT