Skip to content

test_contract_create()

Documentation for tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_contract_create@892e6d1e.

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
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
@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(
        gas_limit=100_000,
        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.