fix(evmasm): align gas estimates with TVM pricing - #145
Merged
CodeNinjaEvan merged 3 commits intoJul 28, 2026
Merged
Conversation
|
Thank you for your contribution to the Solidity compiler! A team member will follow up shortly. If you haven't read our contributing guidelines and our review checklist before, please do it now, this makes the reviewing process and accepting your contribution smoother. If you have any questions or need our help, feel free to post them in the PR or talk to us directly on the #solidity-dev channel on Matrix. |
The pre-tangerine-whistle fallback paths in both code generators still derived the retained-gas amount from Ethereum fork-dependent GasCosts::callGas(). Switch them to the fixed TVM price for consistency with the GasMeter alignment. Also add GasMeter unit coverage for the SELFDESTRUCT estimate (tvmSelfdestructGas + callNewAccountGas).
yanghang8612
marked this pull request as ready for review
July 28, 2026 05:51
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.
Summary
GasMeterpricing with java-tron/TVM Energy costs instead of inheriting Ethereum fork pricingSLOAD,SSTORE,BALANCE,EXTCODE*,CALL*,SELFDESTRUCT,TOKENBALANCE,ISCONTRACT, andCALLTOKENgasNeededByCallerfallback pathsoperationGasInTVMRoot cause
GasMeterreused Ethereum EVM-version-dependent costs such as EIP-1884, EIP-2200, and EIP-2929. TVM uses its own fixed Energy schedule for these opcodes, so compiler gas annotations and optimizer cost heuristics diverged substantially from java-tron execution costs. The pre-Tangerine call fallback paths also derived retained gas from the Ethereum-version-dependent call price.This change affects compiler-side estimates and optimizer heuristics only. It does not change the Energy charged by java-tron at runtime.
Validation
cmake --build build -j4 --target soltestbuild/test/soltest --run_test=EvmasmGasMeter -- --no-semantic-tests— 8 test cases passedgit diff --check release_0.8.30...HEAD