Skip to content

test_bal_callcode_with_value_in_static_context()

Documentation for tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_opcodes.py::test_bal_callcode_with_value_in_static_context@892e6d1e.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_opcodes.py::test_bal_callcode_with_value_in_static_context --fork Amsterdam

CALLCODE with nonzero value succeeds in static context.

EIP-214 explicitly excludes CALLCODE from write-protection.

Source code in tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_opcodes.py
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
def test_bal_callcode_with_value_in_static_context(
    pre: Alloc,
    blockchain_test: BlockchainTestFiller,
) -> None:
    """
    CALLCODE with nonzero value succeeds in static context.

    EIP-214 explicitly excludes CALLCODE from write-protection.
    """
    target = pre.deploy_contract(code=Op.STOP)

    caller = pre.deploy_contract(
        code=Op.CALLCODE(gas=100_000, address=target, value=1) + Op.STOP,
        balance=10**18,
    )

    blockchain_test_under_static_call(
        pre,
        blockchain_test,
        static_call_target=caller,
        bal_expectations={
            target: BalAccountExpectation.empty(),
        },
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.