Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relax DKG ceremony constraints #173

Merged
merged 8 commits into from
Feb 22, 2024

Conversation

piotr-roslaniec
Copy link

@piotr-roslaniec piotr-roslaniec commented Jan 31, 2024

Type of PR:

  • Feature

Required reviews:

  • 1

What this does:

  • DKG now operates under relaxed ceremony constraints, where instead of n-of-m we allow for n-of-[m, validators.len()] to be considered a successful ceremony
  • In this new regime, the old shares_num is effectively replaced by validators.len(), and from now on shares_num denotes the minimum number of shares (or validators) that the DKG ceremony accommodates

Issues fixed/closed:

Notes for reviewers:

@codecov-commenter
Copy link

codecov-commenter commented Jan 31, 2024

Codecov Report

Attention: 51 lines in your changes are missing coverage. Please review.

Comparison is base (72b8484) 78.28% compared to head (6b90715) 78.17%.
Report is 1 commits behind head on main.

Files Patch % Lines
ferveo/src/bindings_python.rs 65.11% 45 Missing ⚠️
ferveo/src/bindings_wasm.rs 0.00% 5 Missing ⚠️
ferveo/src/dkg.rs 98.21% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #173      +/-   ##
==========================================
- Coverage   78.28%   78.17%   -0.11%     
==========================================
  Files          24       24              
  Lines        5066     5224     +158     
==========================================
+ Hits         3966     4084     +118     
- Misses       1100     1140      +40     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@piotr-roslaniec piotr-roslaniec force-pushed the relax-dkg-ceremony branch 6 times, most recently from 550b198 to 175dda7 Compare February 1, 2024 12:41
@piotr-roslaniec piotr-roslaniec marked this pull request as ready for review February 1, 2024 16:26
@cygnusv cygnusv changed the base branch from main to fix-py-stub February 5, 2024 17:34
@cygnusv cygnusv changed the base branch from fix-py-stub to main February 5, 2024 17:35
ferveo-python/test/test_ferveo.py Show resolved Hide resolved
ferveo-python/test/test_ferveo.py Show resolved Hide resolved
shares_num=shares_num,
validators_num=validators_num,
threshold=threshold,
shares_to_use=validators_num - 1,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
shares_to_use=validators_num - 1,
shares_to_use=threshold - 1,

ferveo-python/test/test_ferveo.py Show resolved Hide resolved
ferveo-python/test/test_ferveo.py Show resolved Hide resolved
@@ -286,12 +286,20 @@ impl AggregatedTranscript {

pub fn verify(
&self,
shares_num: u32,
validators_num: u32,
Copy link
Member

Choose a reason for hiding this comment

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

It should be possible to verify any subset of size shares_num, but I guess you still need the original number of validators to get the proper evaluation domain, so it seems both parameters are needed?

#[test_case(4, 4; "number of shares (validators) is a power of 2")]
#[test_case(7, 7; "number of shares (validators) is not a power of 2")]
#[test_case(4, 6; "number of validators greater than the number of shares")]
fn test_server_api_tdec_precomputed(shares_num: u32, validators_num: u32) {
let rng = &mut StdRng::seed_from_u64(0);

// In precomputed variant, the security threshold is equal to the number of shares
Copy link
Member

Choose a reason for hiding this comment

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

Precomputed variant comment, definitely not for this PR. Opened #184

let insufficient_aggregate =
dkg.aggregate_transcripts(not_enough_messages).unwrap();
let result = insufficient_aggregate.verify(SHARES_NUM, &messages);
let result = insufficient_aggregate.verify(validators_num, &messages);
assert!(result.is_err());
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure this should fail only because the number of transcripts is insufficient. This test is probably expecting a failure due to an unrelated issue.

Copy link
Author

Choose a reason for hiding this comment

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

I rewrote assertions in these tests to provide more clarity on what is being checked.

ferveo/src/pvss.rs Show resolved Hide resolved
ferveo/src/pvss.rs Outdated Show resolved Hide resolved
@piotr-roslaniec piotr-roslaniec force-pushed the relax-dkg-ceremony branch 3 times, most recently from 6b90715 to 7d8dfde Compare February 22, 2024 08:43
@piotr-roslaniec piotr-roslaniec force-pushed the relax-dkg-ceremony branch 3 times, most recently from 99f0dad to 626159f Compare February 22, 2024 09:32
Copy link
Member

@cygnusv cygnusv left a comment

Choose a reason for hiding this comment

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

@piotr-roslaniec and I decided to move forward for the moment, but my comments in the review are still outstanding. Some of them only require light touches to tests (mainly those related to #179), while others require a bit more of work. Comments related to the precomputed variant are also outstanding (see #184) but are not a priority.

@cygnusv cygnusv merged commit a438438 into nucypher:main Feb 22, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Relax DKG ceremony constraints
3 participants