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@88e9fb8f.

Generate fixtures for these test cases for Osaka 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 Osaka

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
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
@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,
) -> None:
    """
    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_0x0000000000000000000000000000000000000100-state_test 0x000000000000000000000000000000 0000000100
...fork_Osaka-precompile_0x0000000000000000000000000000000000000100-blockchain_test_from_state_test 0x000000000000000000000000000000 0000000100
...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