-
Notifications
You must be signed in to change notification settings - Fork 11.4k
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
[node] Log less gossip #1780
[node] Log less gossip #1780
Conversation
sui_types/src/committee.rs
Outdated
@@ -68,4 +70,26 @@ impl Committee { | |||
// then (N + 2) / 3 = f + 1 + k/3 = f + 1 | |||
(self.total_votes + 2) / 3 | |||
} | |||
|
|||
/// Given a sequence of (AuthorityName, value) for values that are ordered, provide the |
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.
/// Given a sequence of (AuthorityName, value) for values that are ordered, provide the | |
/// Given a sequence of (AuthorityName, value) for values, provide the |
sui_types/src/committee.rs
Outdated
|
||
/// Given a sequence of (AuthorityName, value) for values that are ordered, provide the | ||
/// value at the particular threshold by stake. This orders all provided values and pick | ||
/// the appropriate value that has under it threshold stake. You may use the function |
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.
Probably needs more explanation on the semantics of robust_value
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.
Added quite a bit more
sui_types/src/committee.rs
Outdated
/// Given a sequence of (AuthorityName, value) for values that are ordered, provide the | ||
/// value at the particular threshold by stake. This orders all provided values and pick | ||
/// the appropriate value that has under it threshold stake. You may use the function | ||
/// `quorum_threshold` or `validity_threshold` to pick the f+1 or 2f+1 thresholds |
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.
/// `quorum_threshold` or `validity_threshold` to pick the f+1 or 2f+1 thresholds | |
/// `quorum_threshold` or `validity_threshold` to pick the 2f+1 or f+1 thresholds |
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.
oops.
sui_types/src/committee.rs
Outdated
|
||
let vec: Vec<_> = items | ||
.map(|(a, v)| (v, self.voting_rights[a.borrow()], *a.borrow())) | ||
.sorted() |
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.
Should we sort in descending order? What would be the difference between ascending and descending?
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.
It really depends on the semantics of the value and what you need from the robust value. I have added more explanation on the function doc.
sui_types/src/committee.rs
Outdated
let vec: Vec<_> = items | ||
.map(|(a, v)| (v, self.voting_rights[a.borrow()], *a.borrow())) | ||
.sorted() | ||
.collect(); |
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.
No need to call collect
since we will be iterating
|
||
// Only try to connect 20 times, after that re-assess whether | ||
// there are enough people to connect to. | ||
if k > 20 { |
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.
Make 20 a constant?
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 actually added a proper check here instead of a hack: now we check if we already have used 2/3 stake in terms of who we follow, and exit the loop if we do. And wait for someone to be unfollowed to look again.
Many thanks for the review @lxfind -- as ever super thorough! Going in to make changes. |
@@ -41,46 +41,89 @@ pub async fn gossip_process<A>(active_authority: &ActiveAuthority<A>, degree: us | |||
where | |||
A: AuthorityAPI + Send + Sync + 'static + Clone, | |||
{ | |||
// A copy of the committee | |||
let committee = &active_authority.net.committee; | |||
|
|||
// Number of tasks at most "degree" and no more than committee - 1 | |||
let target_num_tasks: usize = usize::min( | |||
active_authority.state.committee.voting_rights.len() - 1, | |||
degree, |
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 am concerned about capping the gossip peers at 4. If the number of gossip peers is too small, then we may form partitioned graphs and messages may not get synced across the network. How about we always choose this as a function of the total peer size?
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 all peers were to have equal stake, then picking k*Log(N) for a small k should do the trick. However our peers have unequal stake, and we sample them accordingly, so we will need to work out the maths on the basis of stake to set this.
Thanks everyone for the comments + review! |
* Implement backoff for gossip Co-authored-by: George Danezis <george@danez.is>
* Implement backoff for gossip Co-authored-by: George Danezis <george@danez.is>
The PR implements a mechanism for the active authority to keep track of failed peers and connections, as well as retries, and to slow down connecting to others when a quorum of nodes is not yet live, as when the network starts.