Skip to content

test_cold_call_with_value()

Documentation for tests/amsterdam/eip8038_state_access_gas_cost_increase/test_eip_mainnet.py::test_cold_call_with_value@2867859a.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip8038_state_access_gas_cost_increase/test_eip_mainnet.py::test_cold_call_with_value --fork Amsterdam

A value-bearing cold CALL pays COLD_ACCOUNT_ACCESS plus CALL_VALUE and succeeds; the caller records the CALL success flag and the callee receives the forwarded value.

Source code in tests/amsterdam/eip8038_state_access_gas_cost_increase/test_eip_mainnet.py
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
@EIPChecklist.GasCostChanges.Test.GasUpdatesMeasurement()
def test_cold_call_with_value(
    state_test: StateTestFiller,
    pre: Alloc,
) -> None:
    """
    A value-bearing cold ``CALL`` pays ``COLD_ACCOUNT_ACCESS`` plus
    ``CALL_VALUE`` and succeeds; the caller records the ``CALL`` success
    flag and the callee receives the forwarded value.
    """
    callee = pre.deploy_contract(code=Op.STOP, balance=0)

    caller_storage = Storage()
    caller = pre.deploy_contract(
        code=(
            Op.SSTORE(
                caller_storage.store_next(1),
                Op.CALL(gas=100_000, address=callee, value=1),
            )
        ),
    )

    tx = Transaction(
        to=caller,
        gas_limit=1_000_000,
        value=1,
        sender=pre.fund_eoa(),
    )

    post = {
        caller: Account(storage=caller_storage),
        callee: Account(balance=1),
    }
    state_test(pre=pre, post=post, tx=tx)

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.