Skip to content

test_bal_noop_storage_write()

Documentation for tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists.py::test_bal_noop_storage_write@20373115.

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_noop_storage_write --fork Amsterdam

Test that BAL correctly handles no-op storage write.

Source code in tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists.py
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
def test_bal_noop_storage_write(
    pre: Alloc,
    blockchain_test: BlockchainTestFiller,
    fork: Fork,
) -> None:
    """Test that BAL correctly handles no-op storage write."""
    alice = pre.fund_eoa()
    code = Op.SSTORE(
        0x01, 0x42, key_warm=False, original_value=0, new_value=0x42
    )
    storage_contract = pre.deploy_contract(code=code, storage={0x01: 0x42})

    intrinsic_gas_calculator = fork.transaction_intrinsic_cost_calculator()
    gas_limit = intrinsic_gas_calculator() + code.gas_cost(fork)

    tx = Transaction(
        sender=alice, to=storage_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)
                    ],
                ),
                storage_contract: BalAccountExpectation(
                    storage_reads=[0x01],
                    storage_changes=[],
                ),
            }
        ),
    )

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

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.