-
Notifications
You must be signed in to change notification settings - Fork 1
Proper threshold support #95
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
base: master
Are you sure you want to change the base?
Conversation
Pull Request Test Coverage Report for Build 13447280574Details
💛 - Coveralls |
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.
Left a few comments and suggestions even though it's a draft.
description, | ||
evidence: EvidenceEnum::InvalidEchoPack(InvalidEchoPackEvidence { | ||
normal_broadcast, | ||
invalid_echo_sender: from, | ||
invalid_echo_sender: failed_for, |
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.
Could this be renamed to echo_sender
you think? To me "failed for" is a bit ambiguous: "failed for who? for this node?".
.cloned() | ||
.collect::<BTreeSet<_>>(); | ||
|
||
let round_sends_echo_broadcast = !echo_broadcast.payload().is_none(); |
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.
Maybe add a is_some
to complement is_none
?
let round_sends_echo_broadcast = !echo_broadcast.payload().is_none(); | |
let round_sends_echo_broadcast = echo_broadcast.payload().is_some(); |
let mut banned = self.provable_errors.keys().cloned().collect::<BTreeSet<_>>(); | ||
banned.extend(self.unprovable_errors.keys().cloned()); | ||
banned |
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.
Question for my education: Is it possible for a party to be present in both the provable and unprovable sets?
Also, this could perhaps be written as
self.provable_errors
.keys()
.chain(self.unprovable_errors.keys())
.cloned()
.collect()
Not sure which is more readable tbh.
|
||
pub(crate) fn is_quorum(&self, ids: &BTreeSet<Id>) -> bool { | ||
// TODO: assuming `ids` are a subset of `self.ids`. Can we? | ||
ids.len() >= self.threshold |
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.
Worth making sure I think: ids.is_subset(&self.ids) && ids.len() >= self.threshold
let ids = self.ids.intersection(banned_ids).collect::<BTreeSet<_>>(); | ||
self.ids.len() - ids.len() >= self.threshold |
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.
Would this work here?
let intersection_count = self.ids.intersection(banned_ids).count();
self.ids.len() - intersection_count >= self.threshold
pub echo_round: EchoRoundCommunicationInfo<Id>, | ||
} | ||
|
||
/// Describes what other parties this rounds sends messages to, and what other parties it expects messages from. |
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.
/// Describes what other parties this rounds sends messages to, and what other parties it expects messages from. | |
/// Describes which other parties this rounds sends messages to, and which other parties it expects messages from. |
|
||
/// The specific way the node participates in the echo round following this round. | ||
/// | ||
/// `None` means that, if there is an echo round, the message destinations and expected messages senders |
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.
Writing None
here is a bit confusing given it's not an Option
. Maybe reword this as "An enum describing the way the node participates in the echo round following this round. It can take one of three values, None, SameAsMainRound and Custom, where None
means that, if there is an echo round, the message destinations and … …."? (Although: what does SameAsMainRound
even mean then?)
} | ||
} | ||
|
||
/// Encapsulates the communication info for the main round and the possible echo round. |
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 think it'd be better to beef up this doc comment and thin out the lower-level ones a bit, so that the doc reader can learn about the CommunicationInfo
struct's purpose and usage in one spot.
Fixes #11
Done:
TODO:
IdSet
that would tell us if quorum can never be reached given the already banned nodesCommunicationInfo
should be like for thatIdSet
to be a trait, allowing users to specify their own quorum conditions?protocol
andsession
levels #25?