fix(framework): handle shielded admission and validate note logs - #6980
Open
Federico2014 wants to merge 1 commit into
Open
Federico2014 wants to merge 1 commit into
Federico2014 wants to merge 1 commit into
Conversation
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.
What does this PR do?
Propagate local transaction admission results to RPC and P2P callers, and add defensive length validation to Shielded TRC20 note scanning.
Manager.pushTransactionreturnsfalse, RPC returnsresult=falsewithSERVER_BUSYand skips broadcast. The response message and logs describe local admission rejection without assuming a specific Manager rejection reason.TronNetDelegate.pushTransaction; the P2P handler drops rejected transactions without rebroadcasting or penalizing the peer.MintNewLeaf,TransferNewLeaf, andBurnNewLeaflogs in IVK and OVK scanning. Use consistent length conditions and preserve the separateTokenBurnvalidation.Why are these changes required?
A full native shielded pending pool makes
Manager.pushTransactionreturnfalse. Previously, RPC and P2P callers ignored that result and continued broadcasting; RPC could report success even though the transaction had not been admitted locally.Note scanning already identifies supported events by contract address and topics. The explicit length check is defensive hardening that makes the expected ABI layout clear: four 32-byte fields plus
bytes32[21]ciphertext data total 800 bytes, including 12 bytes of ciphertext padding.This PR has been tested by:
WalletMockTest.testBroadcastTransactionShieldedPendingPoolFull,ShieldedTRC20BuilderTest.testScanShieldedTRC20NotesSkipsInvalidLogLengths, and all fourNoteEncDecryTest.testGetNoteTxFromLogListByOvk*tests.SERVER_BUSY, retained txid cache entries, duplicate rejection on retry, and skipped broadcast. Existing delegate and P2P regression tests cover result propagation and no peer penalty on local rejection.:framework:checkstyleMainpassed.TQEuSEVRk1GtfExm5q9T8a1w84GvgQJ13V; their note logs were each 800 bytes. No live transaction submission was performed.Follow up
Txid cache cleanup after admission rejection or validation exceptions, concurrent reservation ownership, and retry control will be handled in a separate PR. This PR preserves the existing cache lifecycle: with caching enabled, rejected transactions retain their txid entries, so retries can return
DUP_TRANSACTION_ERROReven after pending capacity recovers.Rejection metrics and delayed retry for re-push transactions can be considered separately.
Extra details
Admission handling applies to native
ShieldedTransferContracttransactions when that feature is enabled; log validation applies to Shielded TRC20 contract events.RPC rejection now uses the existing
SERVER_BUSYcode instead of incorrectly reporting success. The Java return type ofTronNetDelegate.pushTransactionchanges fromvoidtoboolean: source callers may ignore the result, overriding subclasses must adapt, and previously compiled Java consumers must be recompiled. HTTP/gRPC schemas are unaffected by that Java signature change.Re-push behavior is unchanged. No database schema, consensus, protocol, or configuration changes are included.