Skip to content

test_set_code_to_precompile_not_enough_gas_for_precompile_execution()

Documentation for tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_set_code_to_precompile_not_enough_gas_for_precompile_execution@44293f1e.

Generate fixtures for these test cases for Prague with:

fill -v tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_set_code_to_precompile_not_enough_gas_for_precompile_execution --fork Prague

Test set code to precompile and making direct call in same transaction with intrinsic gas only, no extra gas for precompile execution.

Source code in tests/prague/eip7702_set_code_tx/test_set_code_txs.py
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
@pytest.mark.with_all_precompiles
def test_set_code_to_precompile_not_enough_gas_for_precompile_execution(
    state_test: StateTestFiller,
    pre: Alloc,
    fork: Fork,
    precompile: int,
):
    """
    Test set code to precompile and making direct call in same transaction with intrinsic gas
    only, no extra gas for precompile execution.
    """
    auth_signer = pre.fund_eoa(amount=1)
    auth = AuthorizationTuple(address=Address(precompile), nonce=0, signer=auth_signer)

    intrinsic_gas = fork.transaction_intrinsic_cost_calculator()(
        authorization_list_or_count=[auth],
    )
    discount = min(
        Spec.PER_EMPTY_ACCOUNT_COST - Spec.PER_AUTH_BASE_COST,
        intrinsic_gas // 5,  # max discount EIP-3529
    )

    tx = Transaction(
        sender=pre.fund_eoa(),
        to=auth_signer,
        gas_limit=intrinsic_gas,
        value=1,
        authorization_list=[auth],
        # explicitly check expected gas, no precompile code executed
        expected_receipt=TransactionReceipt(gas_used=intrinsic_gas - discount),
    )

    state_test(
        pre=pre,
        tx=tx,
        post={
            auth_signer: Account(
                # implicitly checks no OOG, successful tx transfers ``value=1``
                balance=2,
                code=Spec.delegation_designation(Address(precompile)),
                nonce=1,
            ),
        },
    )

Parametrized Test Cases

The interactive table below is also available as a standalone page.

Test ID (Abbreviated) precompile
...fork_Prague-precompile_0x000000000000000000000000000000000000000b-state_test 0x000000000000000000000000000000 000000000b
...fork_Prague-precompile_0x000000000000000000000000000000000000000b-blockchain_test_from_state_test 0x000000000000000000000000000000 000000000b
...fork_Prague-precompile_0x000000000000000000000000000000000000000c-state_test 0x000000000000000000000000000000 000000000c
...fork_Prague-precompile_0x000000000000000000000000000000000000000c-blockchain_test_from_state_test 0x000000000000000000000000000000 000000000c
...fork_Prague-precompile_0x000000000000000000000000000000000000000d-state_test 0x000000000000000000000000000000 000000000d
...fork_Prague-precompile_0x000000000000000000000000000000000000000d-blockchain_test_from_state_test 0x000000000000000000000000000000 000000000d
...fork_Prague-precompile_0x000000000000000000000000000000000000000e-state_test 0x000000000000000000000000000000 000000000e
...fork_Prague-precompile_0x000000000000000000000000000000000000000e-blockchain_test_from_state_test 0x000000000000000000000000000000 000000000e
...fork_Prague-precompile_0x000000000000000000000000000000000000000f-state_test 0x000000000000000000000000000000 000000000f
...fork_Prague-precompile_0x000000000000000000000000000000000000000f-blockchain_test_from_state_test 0x000000000000000000000000000000 000000000f
...fork_Prague-precompile_0x0000000000000000000000000000000000000010-state_test 0x000000000000000000000000000000 0000000010
...fork_Prague-precompile_0x0000000000000000000000000000000000000010-blockchain_test_from_state_test 0x000000000000000000000000000000 0000000010
...fork_Prague-precompile_0x0000000000000000000000000000000000000011-state_test 0x000000000000000000000000000000 0000000011
...fork_Prague-precompile_0x0000000000000000000000000000000000000011-blockchain_test_from_state_test 0x000000000000000000000000000000 0000000011
...fork_Prague-precompile_0x000000000000000000000000000000000000000a-state_test 0x000000000000000000000000000000 000000000a
...fork_Prague-precompile_0x000000000000000000000000000000000000000a-blockchain_test_from_state_test 0x000000000000000000000000000000 000000000a
...fork_Prague-precompile_0x0000000000000000000000000000000000000009-state_test 0x000000000000000000000000000000 0000000009
...fork_Prague-precompile_0x0000000000000000000000000000000000000009-blockchain_test_from_state_test 0x000000000000000000000000000000 0000000009
...fork_Prague-precompile_0x0000000000000000000000000000000000000005-state_test 0x000000000000000000000000000000 0000000005
...fork_Prague-precompile_0x0000000000000000000000000000000000000005-blockchain_test_from_state_test 0x000000000000000000000000000000 0000000005
...fork_Prague-precompile_0x0000000000000000000000000000000000000006-state_test 0x000000000000000000000000000000 0000000006
...fork_Prague-precompile_0x0000000000000000000000000000000000000006-blockchain_test_from_state_test 0x000000000000000000000000000000 0000000006
...fork_Prague-precompile_0x0000000000000000000000000000000000000007-state_test 0x000000000000000000000000000000 0000000007
...fork_Prague-precompile_0x0000000000000000000000000000000000000007-blockchain_test_from_state_test 0x000000000000000000000000000000 0000000007
...fork_Prague-precompile_0x0000000000000000000000000000000000000008-state_test 0x000000000000000000000000000000 0000000008
...fork_Prague-precompile_0x0000000000000000000000000000000000000008-blockchain_test_from_state_test 0x000000000000000000000000000000 0000000008
...fork_Prague-precompile_0x0000000000000000000000000000000000000001-state_test 0x000000000000000000000000000000 0000000001
...fork_Prague-precompile_0x0000000000000000000000000000000000000001-blockchain_test_from_state_test 0x000000000000000000000000000000 0000000001
...fork_Prague-precompile_0x0000000000000000000000000000000000000002-state_test 0x000000000000000000000000000000 0000000002
...fork_Prague-precompile_0x0000000000000000000000000000000000000002-blockchain_test_from_state_test 0x000000000000000000000000000000 0000000002
...fork_Prague-precompile_0x0000000000000000000000000000000000000003-state_test 0x000000000000000000000000000000 0000000003
...fork_Prague-precompile_0x0000000000000000000000000000000000000003-blockchain_test_from_state_test 0x000000000000000000000000000000 0000000003
...fork_Prague-precompile_0x0000000000000000000000000000000000000004-state_test 0x000000000000000000000000000000 0000000004
...fork_Prague-precompile_0x0000000000000000000000000000000000000004-blockchain_test_from_state_test 0x000000000000000000000000000000 0000000004
...fork_Osaka-precompile_0x000000000000000000000000000000000000000b-state_test 0x000000000000000000000000000000 000000000b
...fork_Osaka-precompile_0x000000000000000000000000000000000000000b-blockchain_test_from_state_test 0x000000000000000000000000000000 000000000b
...fork_Osaka-precompile_0x000000000000000000000000000000000000000c-state_test 0x000000000000000000000000000000 000000000c
...fork_Osaka-precompile_0x000000000000000000000000000000000000000c-blockchain_test_from_state_test 0x000000000000000000000000000000 000000000c
...fork_Osaka-precompile_0x000000000000000000000000000000000000000d-state_test 0x000000000000000000000000000000 000000000d
...fork_Osaka-precompile_0x000000000000000000000000000000000000000d-blockchain_test_from_state_test 0x000000000000000000000000000000 000000000d
...fork_Osaka-precompile_0x000000000000000000000000000000000000000e-state_test 0x000000000000000000000000000000 000000000e
...fork_Osaka-precompile_0x000000000000000000000000000000000000000e-blockchain_test_from_state_test 0x000000000000000000000000000000 000000000e
...fork_Osaka-precompile_0x000000000000000000000000000000000000000f-state_test 0x000000000000000000000000000000 000000000f
...fork_Osaka-precompile_0x000000000000000000000000000000000000000f-blockchain_test_from_state_test 0x000000000000000000000000000000 000000000f
...fork_Osaka-precompile_0x0000000000000000000000000000000000000010-state_test 0x000000000000000000000000000000 0000000010
...fork_Osaka-precompile_0x0000000000000000000000000000000000000010-blockchain_test_from_state_test 0x000000000000000000000000000000 0000000010
...fork_Osaka-precompile_0x0000000000000000000000000000000000000011-state_test 0x000000000000000000000000000000 0000000011
...fork_Osaka-precompile_0x0000000000000000000000000000000000000011-blockchain_test_from_state_test 0x000000000000000000000000000000 0000000011
...fork_Osaka-precompile_0x000000000000000000000000000000000000000a-state_test 0x000000000000000000000000000000 000000000a
...fork_Osaka-precompile_0x000000000000000000000000000000000000000a-blockchain_test_from_state_test 0x000000000000000000000000000000 000000000a
...fork_Osaka-precompile_0x0000000000000000000000000000000000000009-state_test 0x000000000000000000000000000000 0000000009
...fork_Osaka-precompile_0x0000000000000000000000000000000000000009-blockchain_test_from_state_test 0x000000000000000000000000000000 0000000009
...fork_Osaka-precompile_0x0000000000000000000000000000000000000005-state_test 0x000000000000000000000000000000 0000000005
...fork_Osaka-precompile_0x0000000000000000000000000000000000000005-blockchain_test_from_state_test 0x000000000000000000000000000000 0000000005
...fork_Osaka-precompile_0x0000000000000000000000000000000000000006-state_test 0x000000000000000000000000000000 0000000006
...fork_Osaka-precompile_0x0000000000000000000000000000000000000006-blockchain_test_from_state_test 0x000000000000000000000000000000 0000000006
...fork_Osaka-precompile_0x0000000000000000000000000000000000000007-state_test 0x000000000000000000000000000000 0000000007
...fork_Osaka-precompile_0x0000000000000000000000000000000000000007-blockchain_test_from_state_test 0x000000000000000000000000000000 0000000007
...fork_Osaka-precompile_0x0000000000000000000000000000000000000008-state_test 0x000000000000000000000000000000 0000000008
...fork_Osaka-precompile_0x0000000000000000000000000000000000000008-blockchain_test_from_state_test 0x000000000000000000000000000000 0000000008
...fork_Osaka-precompile_0x0000000000000000000000000000000000000001-state_test 0x000000000000000000000000000000 0000000001
...fork_Osaka-precompile_0x0000000000000000000000000000000000000001-blockchain_test_from_state_test 0x000000000000000000000000000000 0000000001
...fork_Osaka-precompile_0x0000000000000000000000000000000000000002-state_test 0x000000000000000000000000000000 0000000002
...fork_Osaka-precompile_0x0000000000000000000000000000000000000002-blockchain_test_from_state_test 0x000000000000000000000000000000 0000000002
...fork_Osaka-precompile_0x0000000000000000000000000000000000000003-state_test 0x000000000000000000000000000000 0000000003
...fork_Osaka-precompile_0x0000000000000000000000000000000000000003-blockchain_test_from_state_test 0x000000000000000000000000000000 0000000003
...fork_Osaka-precompile_0x0000000000000000000000000000000000000004-state_test 0x000000000000000000000000000000 0000000004
...fork_Osaka-precompile_0x0000000000000000000000000000000000000004-blockchain_test_from_state_test 0x000000000000000000000000000000 0000000004