feat: nested multi-sign tests and review fixes#4
Merged
RichardAH merged 13 commits intoFeb 13, 2026
Merged
Conversation
Transplant 3 xahaud review-fix commits (dbd5903e8, 23fd210e2, 8d9a38e44) on top of the initial rippled backport (0b5220b). - Add shared helper functions (isLeafSigner, isNestedSigner, isValidSignerEntry, countPresentFields) and depth constants (nestedMultiSignMaxDepth, legacyMultiSignMaxDepth) to STTx.h - Rewrite Transactor::checkMultiSign with recursive validation, cycle detection via ancestors set, and cyclic lockout relaxation - Update calculateBaseFee with depth guard and helper usage - Refactor STTx.cpp multiSignHelper to use helpers and add malformed signer entry detection - Replace TransactionSign.cpp signer validation with recursive validateSignersRecursive using helpers - Add test_countPresentFields unit test and nested fee calculation test cases (Test Cases 16-17) - Update STTx_test.cpp for optional sfSigningPubKey with validation-layer helper checks - Fix feature-disabled test expectation (telENV_RPC_FAILED)
- fix nested signer array bounds check using wrong variable (signers vs signersArray) in STTx.cpp multiSignHelper - move auth check before cyclic skip in Transactor.cpp so unauthorized cyclic signer entries are rejected instead of silently ignored - add tests for nested array cardinality (empty/oversized) - add tests for unauthorized vs authorized cyclic signer entries
Add testNestedMultiSignEdgeCases with 10 tests targeting uncovered code paths across the three validation layers: multiSignHelper (depth overflow, corrupt pubkey, malformed entries, unsorted signers), Transactor::checkMultiSign (fee calculation, non-phantom signers, cyclic quorum), and transactionSubmitMultiSigned (RPC shape and depth validation). Includes a direct checkSign test for the depth-exceeded path using manually-constructed STObjects.
Add nestedMultiSignMaxLeafSigners (64) to bound worst-case signature verification cost. The leaf counter in multiSignHelper increments before each verify() call and rejects with "Too many leaf signers." when exceeded. Only enforced when featureNestedMultiSign is enabled. Tests: leaf cap exceeded (65 leaves → temMALFORMED) and at-cap succeeds (64 leaves via 2×32 nested tree → tesSUCCESS).
checkSign rejects >64 leaves before the transaction enters the engine, so env() cannot extract a TER code and returns telENV_RPC_FAILED rather than temMALFORMED.
Plain assert is compiled out in release builds, dropping these consensus-critical invariant checks in production.
0b5220b to
e45514f
Compare
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.
No description provided.