feat(vm): record internal tx for precompile value calls#36
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Closed in favor of #37, which uses the branch naming convention from CONTRIBUTING.md: |
Replaces #35, which was marked as merged after
release_v4.8.2was temporarily pushed to the feature commit by mistake.What does this PR do?
Records an internal transaction when a successful precompiled contract call carries TRX or TRC10 value.
Zero-value precompiled contract calls still do not emit internal transactions. TRX value calls are recorded with the transferred TRX value, and TRC10 value calls are recorded with token information, matching normal contract call internal transaction semantics.
Why are these changes required?
Precompiled contract calls can currently carry value through the CALL/CALLTOKEN path when the precompiled address already has an account. The balance change is committed on successful execution, but no internal transaction is recorded, which makes the transfer difficult to reconcile from transaction results.
This change keeps the existing value-transfer behavior while making successful precompiled value calls observable through internal transactions.
This PR has been tested by:
./gradlew :framework:test --tests org.tron.common.runtime.vm.OperationsTest./gradlew :framework:checkstyleMain :framework:checkstyleTestFollow up
None.
Extra details
This PR is based on
release_v4.8.2and contains one commit with two changed files.Summary by cubic
Record internal transactions for successful precompiled contract calls that transfer TRX or TRC10 value. This makes these transfers visible and consistent with normal contract call semantics; zero-value calls still do not emit internal transactions.
org.tron.core.vm.program.Program, add an internal transaction whenendowment > 0incallToPrecompiledAddress, set note to "call", increment nonce, and include TRC10 token info for CALLTOKEN.org.tron.common.runtime.vm.OperationsTestcovering zero-value (no internal tx) and TRX value calls (one internal tx with correct sender, recipient, and value).Written for commit b617af2. Summary will update on new commits.