Repository navigation
feat(net): enforce single contract and disallow unused auths field - #7064
Merged
lvs0075 merged 1 commit intoOct 27, 2026
Conversation
halibobo1205
requested review from
317787106,
bladehan1,
waynercheung and
xxo1shine
October 26, 2026 11:18
1 task
waynercheung
approved these changes
Oct 26, 2026
waynercheung
left a comment
Collaborator
There was a problem hiding this comment.
Verified locally at 0113f21: all 27 tests in TransactionsMsgHandlerTest and all 42 tests in ManagerTest passed. No blocking issues found.
| break; | ||
| } | ||
| TransactionCapsule capsule = new TransactionCapsule(trx); | ||
| if (capsule.hasAuths()) { |
Collaborator
There was a problem hiding this comment.
[NIT] Consider counting transactions skipped for auths and emitting one DEBUG summary per TRXS message when the count is nonzero. This would help diagnose missing transactions without adding per-transaction logs.
| Transaction withAuths = base.toBuilder().setRawData(base.getRawData().toBuilder() | ||
| .addAuths(Protocol.authority.getDefaultInstance())).build(); | ||
| ContractValidateException pending = assertThrows(ContractValidateException.class, | ||
| () -> dbManager.pushTransaction(new TransactionCapsule(withAuths))); |
Collaborator
There was a problem hiding this comment.
[NIT] Consider signing the transaction before the pending-rejection assertion and reusing that same signed transaction for the block-acceptance assertion. This would demonstrate the intended admission/block-validity boundary using an otherwise valid signed transaction.
xxo1shine
approved these changes
Oct 27, 2026
bladehan1
approved these changes
Oct 27, 2026
317787106
approved these changes
Oct 27, 2026
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.
Follow-up to #7022 (P2P side), as noted in #7022 (comment).
What does this PR do?
TransactionsMsgHandler.check()rejects aTRXSmessage withBAD_TRXif any of its transactions does not carry exactly one contract, usingActuatorConstant.CONTRACT_SIZE_NOT_EQUAL_TO_ONEfrom feat(api): improve request handling and validation #7022. Previously, only an empty contract list was rejected here; later,Manager.processTransactionrejected more than one contract.raw_data.authsare no longer admitted (TransactionCapsule.hasAuths()):TransactionsMsgHandler.processMessageskips them; the other transactions of the message are processed as before;Manager.pushTransactionrejects them at the start withContractValidateException, which also covers the broadcast APIs.Why are these changes required?
Both rules are already documented in the protocol (
docs/protobuf-protocol-document.md):contractsupports only size 1, andauthsis deprecated and unused by the node. #7022 checks the contract count up front on the API paths; this applies the same check when aTRXSmessage is received, and stops admitting transactions that set the deprecatedauthsfield to the pending pool.This PR has been tested by:
Follow up
Extra details
None