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@9c2813ee.

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
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
@pytest.mark.parametrize(
    "refund_tx_reverts",
    [
        pytest.param(True, id="refund_tx_reverts"),
        pytest.param(False, id=""),
    ],
)
@pytest.mark.execute(pytest.mark.skip(reason="Requires specific gas price"))
@pytest.mark.valid_from("Amsterdam")
def test_multiple_refund_types_in_one_tx(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
    fork: Fork,
    refund_tx_reverts: bool,
) -> None:
    """Test gas accounting for all refund types available in the given fork."""
    refunds_count = 10

    post = Alloc()
    refund_types = set(fork.refund_types())

    (_, gas_used_pre_refund, call_data_floor_cost, refund_tx) = (
        build_refund_tx(
            fork=fork,
            pre=pre,
            post=post,
            refund_types=refund_types,
            refunds_count=refunds_count,
            refund_tx_reverts=refund_tx_reverts,
        )
    )

    refund_tx_block_gas_used = max(gas_used_pre_refund, call_data_floor_cost)

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

Parametrized Test Cases

This test generates 2 parametrized test cases across 1 fork.