feat: Enforcing strong typing and one explicit threshold: ReconstructionThr…#3350
feat: Enforcing strong typing and one explicit threshold: ReconstructionThr…#3350SimonRastikian wants to merge 7 commits into
Conversation
|
PR title type suggestion: This PR restructures how thresholds are typed and enforces type safety across the codebase. Since the primary intent is improving code structure rather than adding new user-facing functionality, the type prefix should probably be Suggested title: |
Pull request overviewRenames the single threshold abstraction ( Changes:
Reviewed changesPer-file summary
FindingsBlocking (must fix before merge):
Non-blocking (nits, follow-ups, suggestions):
|
|
PR title type suggestion: Based on the changed files, this appears to be a type system refactoring rather than a new feature. The title mentions 'enforcing strong typing,' which is typically a refactoring concern. Consider using |
netrome
left a comment
There was a problem hiding this comment.
Nice stuff, though it seems like there are some ambiguous thresholds remaining. Gotta catch em all - or what are your thoughts here?
| ThresholdParameters::new(participants, Threshold::new(participants_config.threshold)).unwrap() | ||
| ThresholdParameters::new( | ||
| participants, | ||
| Threshold::new(participants_config.threshold.inner()), |
There was a problem hiding this comment.
Hmm, this type has not been renamed. It feels weird to just cast the reconstruction threshold to this other type here. Shouldn't this also be the ReconstructionThreshold so we don't have any ambiguous "threshold" concepts remaining? Long term I guess this should become the governance threshold, but if this is the case, we should already have the governance threshold in participants_config imo where we now have ReconstructionThreshold.
So I suggest one of two things:
- Use
ReconstructionThresholdeverywhere. - Rename the existing primitive
Thresholdtype used in the contract for voting operations toGovernanceThresholdand separate the governance and reconstruction thresholds.
The second option seems like it deserves its own issue, so I'd lean on 1. here.
| /// The threshold for the MPC protocol — number of share-holders required | ||
| /// to reconstruct the secret. Wire format is a plain integer (the inner | ||
| /// type is `#[serde(transparent)]`), so this is wire-compatible with the | ||
| /// previous `u64` field. | ||
| pub threshold: ReconstructionThreshold, |
There was a problem hiding this comment.
Isn't this the governance threshold now? Do we want to have a separate notion between governance and reconstruction threshold? Otherwise, could we get rid of the existing Threshold type in our primitives crate favor of just having the ReconstructionThreshold everywhere?
Closes near/threshold-signatures#348
Our long lived issue :)