Skip to content

test_value_transfer_gas_calculation_homestead()

Documentation for tests/frontier/opcodes/test_call_and_callcode_gas_calculation.py::test_value_transfer_gas_calculation_homestead@b47f0253.

Generate fixtures for these test cases for Homestead with:

fill -v tests/frontier/opcodes/test_call_and_callcode_gas_calculation.py::test_value_transfer_gas_calculation_homestead --fork Homestead

Tests the nested CALL/CALLCODE/DELEGATECALL opcode gas consumption with a positive value transfer.

Source code in tests/frontier/opcodes/test_call_and_callcode_gas_calculation.py
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
@pytest.mark.parametrize(
    "callee_opcode", [Op.CALL, Op.CALLCODE, Op.DELEGATECALL]
)
# pre-Byzantium rules have one more condition to fail on:
# the check for `gas_left` to be at least `gas` allowance specified
# in the CALL. We will be setting that allowance to `1` and either
# making the call miss that amount or fail on the earlier gas check.
@pytest.mark.parametrize("gas_shortage", [0, 1, 2])
@pytest.mark.valid_at("Homestead")
def test_value_transfer_gas_calculation_homestead(
    state_test: StateTestFiller,
    pre: Alloc,
    caller_tx: Transaction,
    post: Dict[str, Account],
) -> None:
    """
    Tests the nested CALL/CALLCODE/DELEGATECALL opcode gas
    consumption with a positive value transfer.
    """
    state_test(env=Environment(), pre=pre, post=post, tx=caller_tx)

Parametrized Test Cases

This test generates 9 parametrized test cases across 1 fork.