Skip to content

test_set_code_address_and_authority_warm_state_call_types()

Documentation for tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_set_code_address_and_authority_warm_state_call_types@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_address_and_authority_warm_state_call_types --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_address_and_authority_warm_state_call_types --until=Prague

Test set to code address and authority warm status after a call to authority address, or viceversa, using all available call opcodes without using GAS opcode (unavailable in EOF).

Source code in tests/prague/eip7702_set_code_tx/test_set_code_txs.py
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
@pytest.mark.with_all_call_opcodes()
@pytest.mark.parametrize(
    "set_code_address_first",
    [
        pytest.param(True, id="call_set_code_address_first_then_authority"),
        pytest.param(False, id="call_authority_first_then_set_code_address"),
    ],
)
def test_set_code_address_and_authority_warm_state_call_types(
    state_test: StateTestFiller,
    pre: Alloc,
    call_opcode: Op,
    set_code_address_first: bool,
):
    """
    Test set to code address and authority warm status after a call to
    authority address, or viceversa, using all available call opcodes
    without using `GAS` opcode (unavailable in EOF).
    """
    auth_signer = pre.fund_eoa(auth_account_start_balance)

    slot = count(1)
    slot_call_return_code = next(slot)
    slot_call_success = next(slot)

    set_code = Op.STOP
    set_code_to_address = pre.deploy_contract(set_code)

    call_set_code_to_address = Op.SSTORE(
        slot_call_return_code, call_opcode(address=set_code_to_address)
    )
    call_authority_address = Op.SSTORE(slot_call_return_code, call_opcode(address=auth_signer))

    callee_code = Bytecode()
    if set_code_address_first:
        callee_code += call_set_code_to_address + call_authority_address
    else:
        callee_code += call_authority_address + call_set_code_to_address
    callee_code += Op.SSTORE(slot_call_success, 1) + Op.STOP

    callee_address = pre.deploy_contract(callee_code)
    callee_storage = Storage()
    callee_storage[slot_call_return_code] = call_return_code(opcode=call_opcode, success=True)
    callee_storage[slot_call_success] = 1

    tx = Transaction(
        gas_limit=1_000_000,
        to=callee_address,
        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={
            callee_address: Account(storage=callee_storage),
            auth_signer: Account(
                nonce=1,
                code=Spec.delegation_designation(set_code_to_address),
                balance=auth_account_start_balance,
            ),
        },
    )

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 set_code_address_first
call_opcode_EXTCALL-evm_code_type_EOF_V1-call_set_code_address_first_then_authority EXTCALL EOF_V1 True
call_opcode_EXTCALL-evm_code_type_EOF_V1-call_authority_first_then_set_code_address EXTCALL EOF_V1 False
call_opcode_EXTCALL-evm_code_type_EOF_V1-call_set_code_address_first_then_authority EXTCALL EOF_V1 True
call_opcode_EXTCALL-evm_code_type_EOF_V1-call_authority_first_then_set_code_address EXTCALL EOF_V1 False
call_opcode_EXTSTATICCALL-evm_code_type_EOF_V1-call_set_code_address_first_then_authority EXTSTATICCALL EOF_V1 True
call_opcode_EXTSTATICCALL-evm_code_type_EOF_V1-call_authority_first_then_set_code_address EXTSTATICCALL EOF_V1 False
call_opcode_EXTSTATICCALL-evm_code_type_EOF_V1-call_set_code_address_first_then_authority EXTSTATICCALL EOF_V1 True
call_opcode_EXTSTATICCALL-evm_code_type_EOF_V1-call_authority_first_then_set_code_address EXTSTATICCALL EOF_V1 False
call_opcode_EXTDELEGATECALL-evm_code_type_EOF_V1-call_set_code_address_first_then_authority EXTDELEGATECALL EOF_V1 True
call_opcode_EXTDELEGATECALL-evm_code_type_EOF_V1-call_authority_first_then_set_code_address EXTDELEGATECALL EOF_V1 False
call_opcode_EXTDELEGATECALL-evm_code_type_EOF_V1-call_set_code_address_first_then_authority EXTDELEGATECALL EOF_V1 True
call_opcode_EXTDELEGATECALL-evm_code_type_EOF_V1-call_authority_first_then_set_code_address EXTDELEGATECALL EOF_V1 False
call_opcode_STATICCALL-evm_code_type_LEGACY-call_set_code_address_first_then_authority STATICCALL LEGACY True
call_opcode_STATICCALL-evm_code_type_LEGACY-call_authority_first_then_set_code_address STATICCALL LEGACY False
call_opcode_STATICCALL-evm_code_type_LEGACY-call_set_code_address_first_then_authority STATICCALL LEGACY True
call_opcode_STATICCALL-evm_code_type_LEGACY-call_authority_first_then_set_code_address STATICCALL LEGACY False
call_opcode_DELEGATECALL-evm_code_type_LEGACY-call_set_code_address_first_then_authority DELEGATECALL LEGACY True
call_opcode_DELEGATECALL-evm_code_type_LEGACY-call_authority_first_then_set_code_address DELEGATECALL LEGACY False
call_opcode_DELEGATECALL-evm_code_type_LEGACY-call_set_code_address_first_then_authority DELEGATECALL LEGACY True
call_opcode_DELEGATECALL-evm_code_type_LEGACY-call_authority_first_then_set_code_address DELEGATECALL LEGACY False
call_opcode_CALL-evm_code_type_LEGACY-call_set_code_address_first_then_authority CALL LEGACY True
call_opcode_CALL-evm_code_type_LEGACY-call_authority_first_then_set_code_address CALL LEGACY False
call_opcode_CALL-evm_code_type_LEGACY-call_set_code_address_first_then_authority CALL LEGACY True
call_opcode_CALL-evm_code_type_LEGACY-call_authority_first_then_set_code_address CALL LEGACY False
call_opcode_CALLCODE-evm_code_type_LEGACY-call_set_code_address_first_then_authority CALLCODE LEGACY True
call_opcode_CALLCODE-evm_code_type_LEGACY-call_authority_first_then_set_code_address CALLCODE LEGACY False
call_opcode_CALLCODE-evm_code_type_LEGACY-call_set_code_address_first_then_authority CALLCODE LEGACY True
call_opcode_CALLCODE-evm_code_type_LEGACY-call_authority_first_then_set_code_address CALLCODE LEGACY False