Skip to content

perf(idkg): [CON-1575] reduce the number of signature share validations#9907

Merged
pierugo-dfinity merged 10 commits intomasterfrom
pierugo/idkg/reduce-sig-share-validations
Apr 23, 2026
Merged

perf(idkg): [CON-1575] reduce the number of signature share validations#9907
pierugo-dfinity merged 10 commits intomasterfrom
pierugo/idkg/reduce-sig-share-validations

Conversation

@pierugo-dfinity
Copy link
Copy Markdown
Contributor

@pierugo-dfinity pierugo-dfinity commented Apr 16, 2026

This PR reduces the number of signature share validations from N to f+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 each RequestId, the set of share signers already validated. Once that set reaches a cardinality of f+1, we stop validating more signature shares for that RequestId. 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.

@pierugo-dfinity pierugo-dfinity added the CI_ALL_BAZEL_TARGETS Runs all bazel targets label Apr 16, 2026
@github-actions github-actions Bot added the perf label Apr 16, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 IDkgMessage helper to sig_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.

Comment thread rs/consensus/idkg/src/signer.rs Outdated
Comment thread rs/consensus/idkg/src/signer.rs Outdated
pierugo-dfinity and others added 2 commits April 16, 2026 16:53
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@pierugo-dfinity pierugo-dfinity marked this pull request as ready for review April 21, 2026 09:10
@pierugo-dfinity pierugo-dfinity requested a review from a team as a code owner April 21, 2026 09:10
Comment thread rs/consensus/idkg/src/signer.rs Outdated
Comment thread rs/consensus/idkg/src/signer.rs Outdated
Comment thread rs/consensus/idkg/src/signer.rs Outdated
Comment thread rs/consensus/idkg/src/signer.rs Outdated
Comment thread rs/consensus/idkg/src/signer.rs Outdated
@pierugo-dfinity pierugo-dfinity added this pull request to the merge queue Apr 23, 2026
Merged via the queue into master with commit 6a31f4c Apr 23, 2026
37 checks passed
@pierugo-dfinity pierugo-dfinity deleted the pierugo/idkg/reduce-sig-share-validations branch April 23, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants