Skip to content

test_value_transfer_gas_calculation()

Documentation for tests/frontier/opcodes/test_call_and_callcode_gas_calculation.py::test_value_transfer_gas_calculation@21fb11c8.

Generate fixtures for these test cases for Prague with:

fill -v tests/frontier/opcodes/test_call_and_callcode_gas_calculation.py::test_value_transfer_gas_calculation --fork Prague

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

Source code in tests/frontier/opcodes/test_call_and_callcode_gas_calculation.py
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
@pytest.mark.parametrize(
    "callee_opcode, caller_gas_limit, is_sufficient_gas",
    [
        (Op.CALL, CALL_SUFFICIENT_GAS, True),
        (Op.CALL, CALL_SUFFICIENT_GAS - 1, False),
        (Op.CALLCODE, CALLCODE_SUFFICIENT_GAS, True),
        (Op.CALLCODE, CALLCODE_SUFFICIENT_GAS - 1, False),
    ],
)
@pytest.mark.valid_from("London")
@pytest.mark.valid_until("Shanghai")
def test_value_transfer_gas_calculation(
    state_test: StateTestFiller,
    pre: Alloc,
    caller_tx: Transaction,
    post: Dict[str, Account],
):
    """Tests the nested CALL/CALLCODE opcode gas consumption with a positive value transfer."""
    state_test(env=Environment(), pre=pre, post=post, tx=caller_tx)

Parametrized Test Cases

This test case is only parametrized by fork and fixture format.

Test ID (Abbreviated) callee_opcode caller_gas_limit is_sufficient_gas
...fork_London-state_test-callee_opcode_CALL-caller_gas_limit_36620-is_sufficient_gas_True CALL 36620 True
...fork_London-state_test-callee_opcode_CALL-caller_gas_limit_36619-is_sufficient_gas_False CALL 36619 False
...fork_London-state_test-callee_opcode_CALLCODE-caller_gas_limit_11620-is_sufficient_gas_True CALLCODE 11620 True
...fork_London-state_test-callee_opcode_CALLCODE-caller_gas_limit_11619-is_sufficient_gas_False CALLCODE 11619 False
...fork_London-blockchain_test_from_state_test-callee_opcode_CALL-caller_gas_limit_36620-is_sufficient_gas_True CALL 36620 True
...fork_London-blockchain_test_from_state_test-callee_opcode_CALL-caller_gas_limit_36619-is_sufficient_gas_False CALL 36619 False
...fork_London-blockchain_test_from_state_test-callee_opcode_CALLCODE-caller_gas_limit_11620-is_sufficient_gas_True CALLCODE 11620 True
...fork_London-blockchain_test_from_state_test-callee_opcode_CALLCODE-caller_gas_limit_11619-is_sufficient_gas_False CALLCODE 11619 False
...fork_Paris-state_test-callee_opcode_CALL-caller_gas_limit_36620-is_sufficient_gas_True CALL 36620 True
...fork_Paris-state_test-callee_opcode_CALL-caller_gas_limit_36619-is_sufficient_gas_False CALL 36619 False
...fork_Paris-state_test-callee_opcode_CALLCODE-caller_gas_limit_11620-is_sufficient_gas_True CALLCODE 11620 True
...fork_Paris-state_test-callee_opcode_CALLCODE-caller_gas_limit_11619-is_sufficient_gas_False CALLCODE 11619 False
...fork_Paris-blockchain_test_from_state_test-callee_opcode_CALL-caller_gas_limit_36620-is_sufficient_gas_True CALL 36620 True
...fork_Paris-blockchain_test_from_state_test-callee_opcode_CALL-caller_gas_limit_36619-is_sufficient_gas_False CALL 36619 False
...fork_Paris-blockchain_test_from_state_test-callee_opcode_CALLCODE-caller_gas_limit_11620-is_sufficient_gas_True CALLCODE 11620 True
...fork_Paris-blockchain_test_from_state_test-callee_opcode_CALLCODE-caller_gas_limit_11619-is_sufficient_gas_False CALLCODE 11619 False
...fork_Shanghai-state_test-callee_opcode_CALL-caller_gas_limit_36620-is_sufficient_gas_True CALL 36620 True
...fork_Shanghai-state_test-callee_opcode_CALL-caller_gas_limit_36619-is_sufficient_gas_False CALL 36619 False
...fork_Shanghai-state_test-callee_opcode_CALLCODE-caller_gas_limit_11620-is_sufficient_gas_True CALLCODE 11620 True
...fork_Shanghai-state_test-callee_opcode_CALLCODE-caller_gas_limit_11619-is_sufficient_gas_False CALLCODE 11619 False
...fork_Shanghai-blockchain_test_from_state_test-callee_opcode_CALL-caller_gas_limit_36620-is_sufficient_gas_True CALL 36620 True
...fork_Shanghai-blockchain_test_from_state_test-callee_opcode_CALL-caller_gas_limit_36619-is_sufficient_gas_False CALL 36619 False
...fork_Shanghai-blockchain_test_from_state_test-callee_opcode_CALLCODE-caller_gas_limit_11620-is_sufficient_gas_True CALLCODE 11620 True
...fork_Shanghai-blockchain_test_from_state_test-callee_opcode_CALLCODE-caller_gas_limit_11619-is_sufficient_gas_False CALLCODE 11619 False