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

Add list of spare and faulty nodes to PeerList #349

Merged
merged 3 commits into from
Jun 22, 2020

Conversation

romac
Copy link
Member

@romac romac commented Jun 19, 2020

Neither list are currently used but have been added to match the spec more closely.

  • Referenced an issue explaining the need for the change
  • Updated all relevant documentation in docs
  • Updated all code comments where relevant
  • Wrote tests
  • Updated CHANGES.md

@romac romac requested review from brapse, josef-widder and liamsi June 19, 2020 15:08
@romac romac mentioned this pull request Jun 19, 2020
11 tasks
Copy link
Member

@liamsi liamsi left a comment

Choose a reason for hiding this comment

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

Code looks 👌 I’d like to reread the current spec before approving (I’m lagging behind a bit here)

light-client/src/peer_list.rs Show resolved Hide resolved
primary: PeerId,
witnesses: HashSet<PeerId>,
Copy link
Member

Choose a reason for hiding this comment

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

witnesses are what is currently called Secondaries in the spec. Will the naming be aligned or is there a particular reason for the difference?

Copy link
Member Author

Choose a reason for hiding this comment

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

I picked witnesses to be consistent with the naming in the multi-peer JSON tests, but you are right that we should align them. Let's already merge this and I'll open an issue to track this and to discuss which name we want to keep.

Copy link
Member

@liamsi liamsi left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@brapse brapse merged commit 7b67d16 into master Jun 22, 2020
@brapse brapse deleted the romain/fork-detector-full-nodes branch June 22, 2020 14:00
}

/// Get a list of references to all the witnesses,
/// (ie. all peers which are not the primary).
pub fn witnesses(&self) -> Vec<&Instance> {
self.peers
self.instances
Copy link
Contributor

Choose a reason for hiding this comment

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

This method now seems to be wrong as it will return all Instance which are not primary (as per the docs above but not what we want when doing fork detection), therefore we might be returning faulty nodes, and we are going to contact all instances in this peer list. Effectively communicating with all full nodes instead of a subset defined in witnesses. This could probably be fixed in #397 @romac

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in e371271.

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.

4 participants