Skip to content

test_insufficient_balance_blob_tx()

Documentation for tests/cancun/eip4844_blobs/test_blob_txs.py::test_insufficient_balance_blob_tx@20373115.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/cancun/eip4844_blobs/test_blob_txs.py::test_insufficient_balance_blob_tx --fork Amsterdam

Reject blocks where user cannot afford the blob gas specified (but max_fee_per_gas would be enough for current block).

  • Transactions with max fee equal or higher than current block base fee
  • Transactions with and without priority fee
  • Transactions with and without value
  • Transactions with and without calldata
  • Transactions with max fee per blob gas lower or higher than the priority fee
Source code in tests/cancun/eip4844_blobs/test_blob_txs.py
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
@pytest.mark.parametrize(
    "tx_access_list",
    [[], [AccessList(address=100, storage_keys=[100, 200])]],
    ids=["no_access_list", "access_list"],
)
@pytest.mark.parametrize("tx_max_fee_per_gas", [7, 14])
@pytest.mark.parametrize("tx_max_priority_fee_per_gas", [0, 7])
@pytest.mark.parametrize("tx_value", [0, 1])
@pytest.mark.parametrize(
    "tx_calldata",
    [b"", b"\x00", b"\x01"],
    ids=["no_calldata", "single_zero_calldata", "single_one_calldata"],
)
@pytest.mark.parametrize("tx_max_fee_per_blob_gas_multiplier", [1, 100, 10000])
@pytest.mark.parametrize(
    "account_balance_modifier", [-1], ids=["exact_balance_minus_1"]
)
@pytest.mark.parametrize(
    "tx_error", [TransactionException.INSUFFICIENT_ACCOUNT_FUNDS], ids=[""]
)
@pytest.mark.exception_test
@pytest.mark.valid_from("Cancun")
@pytest.mark.slow()
def test_insufficient_balance_blob_tx(
    state_test: StateTestFiller,
    state_env: Environment,
    pre: Alloc,
    txs: List[Transaction],
) -> None:
    """
    Reject blocks where user cannot afford the blob gas specified (but
    max_fee_per_gas would be enough for current block).

    - Transactions with max fee equal or higher than current block base fee
    - Transactions with and without priority fee
    - Transactions with and without value
    - Transactions with and without calldata
    - Transactions with max fee per blob gas lower or higher than the priority
        fee
    """
    assert len(txs) == 1
    state_test(
        pre=pre,
        post={},
        tx=txs[0],
        env=state_env,
    )

Parametrized Test Cases

This test generates 144 parametrized test cases across 4 forks.