Skip to content

test_contract_create()

Documentation for tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_contract_create@343274cc.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_contract_create --fork Amsterdam

Test sending type-4 tx as a create transaction.

Source code in tests/prague/eip7702_set_code_tx/test_set_code_txs.py
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
@pytest.mark.exception_test
@pytest.mark.eels_base_coverage
def test_contract_create(
    state_test: StateTestFiller,
    pre: Alloc,
) -> None:
    """Test sending type-4 tx as a create transaction."""
    authorization_tuple = AuthorizationTuple(
        address=Address(0x01),
        nonce=0,
        signer=pre.fund_eoa(),
    )
    tx = Transaction(
        to=None,
        value=0,
        authorization_list=[authorization_tuple],
        error=TransactionException.TYPE_4_TX_CONTRACT_CREATION,
        sender=pre.fund_eoa(),
    )

    state_test(
        env=Environment(),
        pre=pre,
        tx=tx,
        post={},
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 3 forks.