perf(idkg): [CON-1575] reduce the number of signature share validations#9907
Merged
pierugo-dfinity merged 10 commits intomasterfrom Apr 23, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR optimizes the IDKG threshold signer path to reduce unnecessary signature share validations by tracking already-validated signers per request and skipping validation once the reconstruction threshold is met.
Changes:
- Renamed the
IDkgMessagehelper tosig_share_request_id_and_signer(and broadened its use for share bookkeeping). - Added an in-memory cache (
validated_sig_share_signers) to avoid re-validating duplicate shares and to drop excess shares after the reconstruction threshold is reached. - Expanded test utilities and signer tests (including single-thread vs multi-thread behavior) and added a dev-dependency needed for the new tests.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
rs/types/types/src/consensus/idkg.rs |
Renames/clarifies the signature-share helper used to extract (RequestId, NodeId) for bookkeeping. |
rs/consensus/idkg/src/test_utils.rs |
Adds thread-count configurable signer dependency constructors for deterministic testing. |
rs/consensus/idkg/src/signer.rs |
Introduces the validated-signer cache and uses it to reduce signature share validations; updates purge logic and adds/updates tests. |
rs/consensus/idkg/Cargo.toml |
Adds a dev-dependency required by the new signer tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
eichhorl
reviewed
Apr 22, 2026
eichhorl
approved these changes
Apr 22, 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.
This PR reduces the number of signature share validations from
Ntof+1, which are enough to aggregate the full signature. The strategy is very similar to the one done in #6526 to reduce the number of dealing supports: we introduce an in-memory map that keeps track for eachRequestId, the set of share signers already validated. Once that set reaches a cardinality off+1, we stop validating more signature shares for thatRequestId. We follow the same approach as in #7069 to do all that in parallel: check with shared access to the lock, then perform the cryptographic validation and if valid, check again with exclusive access to the lock.