Skip to content

test_bal_pure_contract_call()

Documentation for tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists.py::test_bal_pure_contract_call@892e6d1e.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists.py::test_bal_pure_contract_call --fork Amsterdam

Test that BAL captures contract access for pure computation calls.

Source code in tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists.py
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
def test_bal_pure_contract_call(
    pre: Alloc,
    blockchain_test: BlockchainTestFiller,
    fork: Fork,
) -> None:
    """Test that BAL captures contract access for pure computation calls."""
    alice = pre.fund_eoa()
    pure_contract = pre.deploy_contract(code=Op.ADD(0x3, 0x2))

    intrinsic_gas_calculator = fork.transaction_intrinsic_cost_calculator()
    gas_limit = intrinsic_gas_calculator() + 5_000  # Buffer

    tx = Transaction(
        sender=alice, to=pure_contract, gas_limit=gas_limit, gas_price=0xA
    )

    block = Block(
        txs=[tx],
        expected_block_access_list=BlockAccessListExpectation(
            account_expectations={
                alice: BalAccountExpectation(
                    nonce_changes=[
                        BalNonceChange(block_access_index=1, post_nonce=1)
                    ],
                ),
                # Ensure called contract is tracked
                pure_contract: BalAccountExpectation.empty(),
            }
        ),
    )

    blockchain_test(pre=pre, blocks=[block], post={})

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.