Skip to content

test_invalid_blob_tx_contract_creation()

Documentation for tests/cancun/eip4844_blobs/test_blob_txs.py::test_invalid_blob_tx_contract_creation@v4.1.0.

Generate fixtures for these test cases for Prague with:

fill -v tests/cancun/eip4844_blobs/test_blob_txs.py::test_invalid_blob_tx_contract_creation --fork Prague

Reject blocks that include blob transactions that have nil to value (contract creating).

Source code in tests/cancun/eip4844_blobs/test_blob_txs.py
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
@pytest.mark.parametrize(
    "tx_gas", [500_000], ids=[""]
)  # Increase gas to account for contract creation
@pytest.mark.valid_from("Cancun")
def test_invalid_blob_tx_contract_creation(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
    env: Environment,
    txs: List[Transaction],
    header_verify: Optional[Header],
):
    """Reject blocks that include blob transactions that have nil to value (contract creating)."""
    assert len(txs) == 1
    assert txs[0].blob_versioned_hashes is not None and len(txs[0].blob_versioned_hashes) == 1
    # Replace the transaction with a contract creating one, only in the RLP version
    contract_creating_tx = txs[0].copy(to=None).with_signature_and_sender()
    txs[0].rlp_override = contract_creating_tx.rlp
    blockchain_test(
        pre=pre,
        post={},
        blocks=[
            Block(
                txs=txs,
                exception=[
                    BlockException.RLP_STRUCTURES_ENCODING,
                    TransactionException.TYPE_3_TX_CONTRACT_CREATION,
                ],
                header_verify=header_verify,
            )
        ],
        genesis_environment=env,
    )

Parametrized Test Cases

This test case is only parametrized by fork.

Test ID (Abbreviated) tx_gas
...fork_Cancun-blockchain_test- 500000
...fork_Prague-blockchain_test- 500000
...fork_Osaka-blockchain_test- 500000