Skip to content

test_block_gas_accounting_all_transaction_types()

Documentation for tests/amsterdam/eip7778_block_gas_accounting_without_refunds/test_transaction_types.py::test_block_gas_accounting_all_transaction_types@622620d8.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip7778_block_gas_accounting_without_refunds/test_transaction_types.py::test_block_gas_accounting_all_transaction_types --fork Amsterdam

Pin block gas accounting for a refund carried by each tx type.

Source code in tests/amsterdam/eip7778_block_gas_accounting_without_refunds/test_transaction_types.py
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
@EIPChecklist.BlockLevelConstraint.Test.Content.TransactionTypes()
@TransactionFailure.with_all_tx_failures()
@pytest.mark.with_all_tx_types()
@pytest.mark.with_all_refund_types()
def test_block_gas_accounting_all_transaction_types(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
    fork: Fork,
    tx_type: int,
    refund_type: RefundTypes,
    refund_tx_failure: TransactionFailure | None,
    authorization_list: list[AuthorizationTuple] | None,
) -> None:
    """Pin block gas accounting for a refund carried by each tx type."""
    refund_tx = RefundTransaction.build(
        fork=fork,
        sender=pre.fund_eoa(INITIAL_FUND),
        refund_types={refund_type},
        refunds_count=REFUNDS_COUNT,
        tx_failure=refund_tx_failure,
        ty=tx_type,
        authorization_list=authorization_list,
    )
    refund_tx.set_pre(pre)

    blockchain_test(
        pre=pre,
        blocks=[
            Block(
                txs=[refund_tx],
                expected_gas_used=refund_tx.block_gas_used(),
            )
        ],
        post=refund_tx.post(pre),
    )

Parametrized Test Cases

This test generates 25 parametrized test cases across 1 fork.