Skip to content

Derive CiphernodesCommitteeSize from actual committee configuration instead of hardcoding Small #1335

Description

@coderabbitai

Problem

In crates/keyshare/src/threshold_keyshare.rs at line 802, the code currently hardcodes CiphernodesCommitteeSize::Small when building PK generation proof requests. This is a ticking time bomb for the following reasons:

  1. Runtime panics: CiphernodesCommitteeSize::Medium and CiphernodesCommitteeSize::Large both call unreachable!() in their values() method implementation, which will panic at runtime.

  2. Verification failures: Once the aggregator starts verifying proofs, any mismatch between the actual committee size and the hardcoded Small (n=5, h=5, threshold=2) will cause verification failures, as the circuit parameters for PK generation must match the real committee size.

Task

Replace the hardcoded CiphernodesCommitteeSize::Small literal by deriving the CiphernodesCommitteeSize from the actual committee/aggregator configuration:

  • Read the committee size or member count used by the aggregator/Committee struct
  • Map it to the appropriate CiphernodesCommitteeSize variant
  • Use that derived value wherever CiphernodesCommitteeSize::Small appears in threshold_keyshare.rs

This will ensure circuit parameters for PK generation match the real committee size and avoid verification mismatches.

Context

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions