Skip to content

test_eip1559_tx_validity()

Documentation for tests/london/eip1559_fee_market_change/test_tx_type.py::test_eip1559_tx_validity@b47f0253.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/london/eip1559_fee_market_change/test_tx_type.py::test_eip1559_tx_validity --fork Amsterdam

Tests that an EIP-1559 tx has no effect before London.

Source code in tests/london/eip1559_fee_market_change/test_tx_type.py
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
@pytest.mark.ported_from(
    [
        "https://github.com/ethereum/legacytests/blob/master/Cancun/GeneralStateTests/stEIP1559/typeTwoBerlin.json"
    ],
    pr=["https://github.com/ethereum/execution-specs/pull/1754"],
)
@pytest.mark.parametrize_by_fork("valid", tx_validity)
def test_eip1559_tx_validity(
    state_test: StateTestFiller,
    fork: Fork,
    pre: Alloc,
    valid: bool,
) -> None:
    """
    Tests that an EIP-1559 tx has no effect before London.
    """
    account = pre.deploy_contract(
        code=Op.SSTORE(0, 1),
        storage={0: 0xDEADBEEF},
    )
    sender = pre.fund_eoa()

    tx = Transaction(
        to=account,
        sender=sender,
        gas_limit=100_000,
        max_priority_fee_per_gas=1,
        protected=fork.supports_protected_txs(),
        error=TransactionException.TYPE_2_TX_PRE_FORK if not valid else None,
    )

    post = {account: Account(storage={0: 0xDEADBEEF if not valid else 1})}
    if not valid:
        post[sender] = pre[sender]  # type: ignore

    state_test(pre=pre, post=post, tx=tx)

Parametrized Test Cases

This test generates 1 parametrized test case across 14 forks.