test: flaky test for DamgardEtAl#3399
Conversation
|
PR title type suggestion: This PR changes only test files, so the type prefix should probably be |
Pull request overviewThis PR addresses flaky test Changes:
Reviewed changesPer-file summary
FindingsBlocking (must fix before merge):
Non-blocking (nits, follow-ups, suggestions):
|
|
PR title type suggestion: This PR changes only test files, so the type prefix should be Suggested title: |
|
PR title type suggestion: Since this PR only changes test files, the type prefix should be Suggested title: |
|
PR title type suggestion: This PR changes only test utilities, so the type prefix should probably be |
|
PR title type suggestion: This PR changes only test utilities, so the type prefix should probably be Suggested title: |
gilcu3
left a comment
There was a problem hiding this comment.
I think we should start by making the test generator deterministic, and then ensure that it generates a valid set of parameters for all our schemes more naturally, without having to patch values after they were generated
| // Floor the proposal's participant count at 3 so the result is compatible | ||
| // with every protocol — `DamgardEtAl` requires `n >= 2t - 1`, which forces | ||
| // `n >= 3` even at the minimum `t = 2`. `gen_threshold_params` enforces | ||
| // the same floor for the initial params; this keeps the proposal | ||
| // consistent. Clamping after sampling keeps the original `[0, 10)` range | ||
| // and only nudges the lowest values up when they'd produce an invalid n. | ||
| let min_added = if n_old_participants < 3 { | ||
| 3_i32.saturating_sub(n_old_participants.try_into().unwrap()) | ||
| } else { | ||
| 0 | ||
| }; | ||
| let max_added = max_added.max(min_added.try_into().unwrap()); |
There was a problem hiding this comment.
if DamgardEtAl requires n_old_participants < 3? I think the fix proposed is very convoluted and does not really solve part of the issue, which is that this test is not deterministic
There was a problem hiding this comment.
n_old_participants is computed as follows.
Where
let current_k = params.threshold().value() as usize;
let current_n = params.participants().len();
let n_old_participants: usize = rng.gen_range(current_k..current_n + 1);It could happen that
current_k = t = 2 and current_n = n = 3. As you see this can indeed imply that n_old_participants = 2.
Closes #3398