tracer/vm: return out of gas in case available too small#18963
Merged
AskAlexSharov merged 4 commits intomainfrom Feb 5, 2026
Merged
tracer/vm: return out of gas in case available too small#18963AskAlexSharov merged 4 commits intomainfrom
AskAlexSharov merged 4 commits intomainfrom
Conversation
AskAlexSharov
approved these changes
Feb 5, 2026
Giulio2002
pushed a commit
that referenced
this pull request
Feb 6, 2026
closes #13870 In the Ethereum Virtual Machine (EVM), the total gas cost for an operation is composed of a static part and a dynamic part. For CALL opcodes, the engine processes various dynamic components (e.g., memory expansion, account access, value transfer) before invoking the callGas() function to determine the gas budget for the sub-context. The current implementation performs the subtraction: availableGas - base. If availableGas is lower than the accumulated base cost, a uint64 underflow occurs. This issue is currently present in Geth, while Nethermind correctly handles this scenario by returning the static cost. This PR introduces a validation check prior to calling callGas(). By ensuring that availableGas is greater than or equal to the base cost, we prevent the underflow. If the gas is insufficient, an OutOfGas error is returned. As a result, the tracer now correctly reports the gasCost of the static part (e.g., 700 for a CALL) instead of an underflowed value. new rpc-test TAG is provided
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #13870
In the Ethereum Virtual Machine (EVM), the total gas cost for an operation is composed of a static part and a dynamic part. For CALL opcodes, the engine processes various dynamic components (e.g., memory expansion, account access, value transfer) before invoking the callGas() function to determine the gas budget for the sub-context.
The current implementation performs the subtraction: availableGas - base. If availableGas is lower than the accumulated base cost, a uint64 underflow occurs.
This issue is currently present in Geth, while Nethermind correctly handles this scenario by returning the static cost.
This PR introduces a validation check prior to calling callGas(). By ensuring that availableGas is greater than or equal to the base cost, we prevent the underflow. If the gas is insufficient, an OutOfGas error is returned.
As a result, the tracer now correctly reports the gasCost of the static part (e.g., 700 for a CALL) instead of an underflowed value.
new rpc-test TAG is provided