Skip to content

test_auth_with_calldata_and_access_list()

Documentation for tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_state_gas_set_code.py::test_auth_with_calldata_and_access_list@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_auth_with_calldata_and_access_list --fork Amsterdam

Test authorization combined with calldata and access list.

Intrinsic gas includes calldata cost, access list cost, and authorization state gas. All components contribute to the total intrinsic gas requirement.

Source code in tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_state_gas_set_code.py
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
@pytest.mark.valid_from("EIP8037")
def test_auth_with_calldata_and_access_list(
    state_test: StateTestFiller,
    pre: Alloc,
    fork: Fork,
) -> None:
    """
    Test authorization combined with calldata and access list.

    Intrinsic gas includes calldata cost, access list cost, and
    authorization state gas. All components contribute to the total
    intrinsic gas requirement.
    """
    auth_state_gas = fork.transaction_intrinsic_state_gas(
        authorization_count=1,
    )
    sstore_state_gas = Op.SSTORE(new_value=1).state_cost(fork)

    storage = Storage()
    # Contract that reads calldata and stores it
    contract = pre.deploy_contract(
        code=(Op.SSTORE(storage.store_next(0x42), Op.CALLDATALOAD(0))),
    )

    signer = pre.fund_eoa()
    authorization_list = [
        AuthorizationTuple(
            address=contract,
            nonce=0,
            signer=signer,
        ),
    ]

    sender = pre.fund_eoa()
    tx = Transaction(
        to=contract,
        state_gas_reservoir=auth_state_gas + sstore_state_gas,
        data=b"\x00" * 31 + b"\x42",  # Calldata adds to intrinsic gas
        authorization_list=authorization_list,
        sender=sender,
    )

    post = {contract: Account(storage=storage)}
    state_test(pre=pre, post=post, tx=tx)

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.