Skip to content

test_multiple_refund_types_in_one_tx()

Documentation for tests/amsterdam/eip7778_block_gas_accounting_without_refunds/test_gas_accounting.py::test_multiple_refund_types_in_one_tx@622620d8.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip7778_block_gas_accounting_without_refunds/test_gas_accounting.py::test_multiple_refund_types_in_one_tx --fork Amsterdam

Test gas accounting for all refund types available in the given fork.

Source code in tests/amsterdam/eip7778_block_gas_accounting_without_refunds/test_gas_accounting.py
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
@TransactionFailure.with_all_tx_failures()
@pytest.mark.execute(pytest.mark.skip(reason="Requires specific gas price"))
def test_multiple_refund_types_in_one_tx(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
    fork: Fork,
    refund_tx_failure: TransactionFailure | None,
) -> None:
    """Test gas accounting for all refund types available in the given fork."""
    refunds_count = 10

    refund_types = set(fork.refund_types())

    refund_tx = RefundTransaction.build(
        fork=fork,
        sender=pre.fund_eoa(INITIAL_FUND),
        refund_types=refund_types,
        refunds_count=refunds_count,
        tx_failure=refund_tx_failure,
    )
    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 5 parametrized test cases across 1 fork.