Skip to content

fix(net): skip rejected transaction broadcasts - #50

Open
Federico2014 wants to merge 2 commits into
developfrom
feature/shielded_transaction_admission
Open

fix(net): skip rejected transaction broadcasts#50
Federico2014 wants to merge 2 commits into
developfrom
feature/shielded_transaction_admission

Conversation

@Federico2014

@Federico2014 Federico2014 commented Aug 5, 2026

Copy link
Copy Markdown
Owner

What does this PR do?

This PR propagates the local transaction admission result to RPC and P2P callers. When the Shielded transaction pending pool is full, RPC returns SERVER_BUSY, removes the prewritten transaction ID cache entry, and does not broadcast the transaction. The P2P handler logs and drops transactions that were not admitted locally.

Regression tests cover RPC rejection, admission-result propagation, and P2P no-broadcast behavior.

Why are these changes required?

Manager.pushTransaction returns false when the Shielded transaction pending pool reaches its limit. The previous RPC and P2P callers ignored this result and continued broadcasting a transaction that had not entered the local pending pool.

This PR intentionally leaves re-push behavior unchanged. rePushLoop reads the queue head with peek(), so retaining a capacity-rejected transaction would repeatedly select the same transaction and block every transaction behind it. Preserving eventual retry safely requires a separate delayed-retry mechanism with explicit fairness and lifecycle handling, which is outside the scope of this focused fix. Keeping the original re-push behavior also makes transient capacity rejection consistent across RPC, P2P, and re-push: the transaction is dropped rather than broadcast or retained.

This PR has been tested by:

  • Unit Tests: WalletMockTest, TronNetDelegateTest, and TransactionsMsgHandlerTest
  • Checkstyle: framework:checkstyleMain and framework:checkstyleTest
  • Manual Testing: Not performed

Follow up

A non-blocking delayed-retry design can be considered separately if preserving temporarily rejected re-push transactions becomes a requirement.

Extra details

No database schema, consensus, protocol, or configuration changes are included. The behavioral change is limited to local transaction admission and broadcast handling.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Federico2014, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 17 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: af39741c-26d4-4247-b351-6f72327f9c8f

📥 Commits

Reviewing files that changed from the base of the PR and between f87081b and b1f21c6.

📒 Files selected for processing (6)
  • framework/src/main/java/org/tron/core/Wallet.java
  • framework/src/main/java/org/tron/core/net/TronNetDelegate.java
  • framework/src/main/java/org/tron/core/net/messagehandler/TransactionsMsgHandler.java
  • framework/src/test/java/org/tron/core/WalletMockTest.java
  • framework/src/test/java/org/tron/core/net/TronNetDelegateTest.java
  • framework/src/test/java/org/tron/core/net/messagehandler/TransactionsMsgHandlerTest.java
📝 Walkthrough

Walkthrough

Changes

Transaction admission handling

Layer / File(s) Summary
Admission result propagation
framework/src/main/java/org/tron/core/db/Manager.java, framework/src/main/java/org/tron/core/net/TronNetDelegate.java, framework/src/test/java/org/tron/core/net/TronNetDelegateTest.java
pushTransaction now returns the database admission result. Its documentation and delegate tests describe and verify the result.
Admission failure handling
framework/src/main/java/org/tron/core/Wallet.java, framework/src/main/java/org/tron/core/net/messagehandler/TransactionsMsgHandler.java, framework/src/test/java/org/tron/core/WalletMockTest.java, framework/src/test/java/org/tron/core/net/messagehandler/TransactionsMsgHandlerTest.java
Wallet broadcasting returns SERVER_BUSY and invalidates the cache when the Shielded pending pool is full. Network handling stops rebroadcasting rejected transactions. Tests cover both paths.
Re-push admission handling
framework/src/main/java/org/tron/core/db/Manager.java, framework/src/test/java/org/tron/core/db/ManagerMockTest.java
Re-push processing retains temporarily rejected transactions and retries them later. Tests verify the returned admission status and queue retention.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: xxo1shine, halibobo1205

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.34% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: rejected transactions no longer proceed to broadcast.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/shielded_transaction_admission

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.

@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.

All reported issues were addressed across 7 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread framework/src/test/java/org/tron/core/WalletMockTest.java
@Federico2014
Federico2014 force-pushed the feature/shielded_transaction_admission branch from c9e2e37 to a6c2d84 Compare August 6, 2026 03:28
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@framework/src/main/java/org/tron/core/db/Manager.java`:
- Around line 293-301: Update rePushLoop and its getRePushTransactions
processing so a temporarily rejected transaction is removed from the queue and
scheduled for a later retry instead of remaining at the head during sleep; allow
subsequent transactions to be processed immediately while preserving eventual
retry behavior. Add coverage for a rejected Shielded transaction followed by an
admissible transaction, verifying the latter is re-pushed without head-of-line
blocking.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 97f5e428-e48d-4d86-9add-adb7dede9dcc

📥 Commits

Reviewing files that changed from the base of the PR and between c2e1eea and a6c2d84.

📒 Files selected for processing (8)
  • framework/src/main/java/org/tron/core/Wallet.java
  • framework/src/main/java/org/tron/core/db/Manager.java
  • framework/src/main/java/org/tron/core/net/TronNetDelegate.java
  • framework/src/main/java/org/tron/core/net/messagehandler/TransactionsMsgHandler.java
  • framework/src/test/java/org/tron/core/WalletMockTest.java
  • framework/src/test/java/org/tron/core/db/ManagerMockTest.java
  • framework/src/test/java/org/tron/core/net/TronNetDelegateTest.java
  • framework/src/test/java/org/tron/core/net/messagehandler/TransactionsMsgHandlerTest.java
🚧 Files skipped from review as they are similar to previous changes (6)
  • framework/src/test/java/org/tron/core/net/messagehandler/TransactionsMsgHandlerTest.java
  • framework/src/main/java/org/tron/core/Wallet.java
  • framework/src/test/java/org/tron/core/net/TronNetDelegateTest.java
  • framework/src/main/java/org/tron/core/net/messagehandler/TransactionsMsgHandler.java
  • framework/src/main/java/org/tron/core/net/TronNetDelegate.java
  • framework/src/test/java/org/tron/core/WalletMockTest.java

Comment thread framework/src/main/java/org/tron/core/db/Manager.java Outdated
@Federico2014
Federico2014 force-pushed the feature/shielded_transaction_admission branch from 6a34eb4 to e6095dc Compare August 6, 2026 04:00
@Federico2014
Federico2014 force-pushed the feature/shielded_transaction_admission branch from e6095dc to 9f2908d Compare August 6, 2026 04:08
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