Skip to content

feat(vm): record internal tx for precompile value calls#36

Closed
bladehan1 wants to merge 1 commit into
release_v4.8.2from
feat/precompile-internal-tx-release-v4.8.2
Closed

feat(vm): record internal tx for precompile value calls#36
bladehan1 wants to merge 1 commit into
release_v4.8.2from
feat/precompile-internal-tx-release-v4.8.2

Conversation

@bladehan1

@bladehan1 bladehan1 commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Replaces #35, which was marked as merged after release_v4.8.2 was 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:

  • Unit Tests: ./gradlew :framework:test --tests org.tron.common.runtime.vm.OperationsTest
  • Checkstyle: ./gradlew :framework:checkstyleMain :framework:checkstyleTest

Follow up

None.

Extra details

This PR is based on release_v4.8.2 and 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.

  • Bug Fixes
    • In org.tron.core.vm.program.Program, add an internal transaction when endowment > 0 in callToPrecompiledAddress, set note to "call", increment nonce, and include TRC10 token info for CALLTOKEN.
    • Keep existing balance transfer behavior; do not emit internal transactions for zero-value calls.
    • Add tests in org.tron.common.runtime.vm.OperationsTest covering 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.

Review in cubic

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d6c4013e-e315-40d0-8722-06d2ccf36146

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/precompile-internal-tx-release-v4.8.2

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Re-trigger cubic

Copy link
Copy Markdown
Owner Author

Closed in favor of #37, which uses the branch naming convention from CONTRIBUTING.md: feature/ prefix with underscore-separated words.

@bladehan1 bladehan1 closed this Jun 11, 2026
@bladehan1 bladehan1 deleted the feat/precompile-internal-tx-release-v4.8.2 branch June 11, 2026 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant