Skip to content

test_invalid_nonce_auth_still_charges_intrinsic_state_gas()

Documentation for tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_state_gas_set_code.py::test_invalid_nonce_auth_still_charges_intrinsic_state_gas@c74f1a67.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_state_gas_set_code.py::test_invalid_nonce_auth_still_charges_intrinsic_state_gas --fork Amsterdam

Test invalid-nonce authorization still charges intrinsic state gas.

An authorization with a wrong nonce is skipped during processing, but its intrinsic state gas (135 * cpsb) is still charged upfront as part of the transaction's intrinsic gas.

Source code in tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_state_gas_set_code.py
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
@pytest.mark.valid_from("EIP8037")
def test_invalid_nonce_auth_still_charges_intrinsic_state_gas(
    state_test: StateTestFiller,
    pre: Alloc,
    fork: Fork,
) -> None:
    """
    Test invalid-nonce authorization still charges intrinsic state gas.

    An authorization with a wrong nonce is skipped during processing,
    but its intrinsic state gas (135 * cpsb) is still charged upfront
    as part of the transaction's intrinsic gas.
    """
    auth_state_gas = fork.transaction_intrinsic_state_gas(
        authorization_count=1,
    )

    contract = pre.deploy_contract(code=Op.STOP)

    signer = pre.fund_eoa()
    authorization_list = [
        AuthorizationTuple(
            address=contract,
            nonce=99,  # Wrong nonce — auth will be skipped
            signer=signer,
        ),
    ]

    sender = pre.fund_eoa()
    tx = Transaction(
        to=contract,
        state_gas_reservoir=auth_state_gas,
        authorization_list=authorization_list,
        sender=sender,
    )

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

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.