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
implementing removal/addition of parties #13
Conversation
src/lib.rs
Outdated
@@ -356,7 +352,69 @@ mod tests { | |||
simulation.run().unwrap() | |||
} | |||
|
|||
fn simulate_dkr(keys: &mut Vec<LocalKey>) { | |||
fn simulate_dkr_removal(keys: &mut Vec<LocalKey>, remove_party_indexes: Vec<usize>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indexes => indices
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏼
@@ -344,6 +327,19 @@ mod tests { | |||
simulate_signing(offline_sign, b"ZenGo"); | |||
} | |||
|
|||
#[test] | |||
fn test_remove_sign_rotate_sign() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to add here a line for description (or instead in the readme file) saying that removing a party is simply done by not broadcasting encrypted messages to this party. If enough parties decided not to broadcast for a specific party index - this party will not be able to reconstruct a rotated key
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏼
if refresh_message.remove_party_indexes.contains(party_index) { | ||
continue; | ||
} | ||
refresh_bucket.push(refresh_message.clone()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where referesh_bucket is used ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each bucket represents the list of messages that a party identified by the key of the bucket will receive (it's a mutable reference to a list: Imagine something like:
1 -> [m1, m2 m3, m4, m5]
2 -> [m1, m2, m3, m4, m5]
3 -> [m1, m2, m3, m4, m5]
4 -> [m1, m2, m3, m4, m5]
5 -> [m1, m2, m3, m4, m5]
If all the parties are not removing anyone. If they want to remove 4, they will be like
1 -> [m1, m2 m3, m4, m5]
2 -> [m1, m2, m3, m4, m5]
3 -> [m1, m2, m3, m4, m5]
4 -> [m4] // it has access only to it's own refresh message
5 -> [m1, m2, m3, m4, m5]
} | ||
|
||
for remove_party_index in remove_party_indexes.iter() { | ||
assert_eq!(broadcast_messages[remove_party_index].len(), 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is being checked in this assertion ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this test, everyone agrees to delete a party (or even multiple ones). I check that the only message that the party has access to it's their own (by default).
} | ||
|
||
RefreshMessage::collect( | ||
broadcast_messages[party].clone().as_slice(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The buckets are used here
|
||
for remove_party_index in remove_party_indices { | ||
let result = RefreshMessage::collect( | ||
&broadcast_messages[&remove_party_index], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The buckets are used here
No description provided.