Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5d7f6d5
set up data types and control flow for statement distribution
rphmeier Jun 27, 2020
28f12c5
add some set-like methods to View
rphmeier Jun 27, 2020
f8992a2
implement sending to peers
rphmeier Jun 27, 2020
72b339b
start fixing equivocation handling
rphmeier Jun 29, 2020
6a16cd7
Add a section to the statement distribution subsystem on equivocation…
rphmeier Jun 30, 2020
ca3b523
fix typo and amend wording
rphmeier Jun 30, 2020
8464686
implement flood protection
rphmeier Jul 1, 2020
cac9adc
have peer knowledge tracker follow when peer first learns about a can…
rphmeier Jul 1, 2020
1be7e37
send dependents after circulating
rphmeier Jul 1, 2020
47f2df8
add another TODO
rphmeier Jul 1, 2020
cd30c21
trigger send in one more place
rphmeier Jul 1, 2020
a39ad10
refactors from review
rphmeier Jul 1, 2020
751122b
send new statements to candidate backing
rphmeier Jul 1, 2020
d413426
instantiate active head data with runtime API values
rphmeier Jul 1, 2020
7b82e1b
track our view changes and peer view changes
rphmeier Jul 1, 2020
94a69ff
apply a benefit to peers who send us statements we want
rphmeier Jul 1, 2020
a3b4b6a
remove unneeded TODO
rphmeier Jul 1, 2020
eb51e80
add some comments and improve Hash implementation
rphmeier Jul 1, 2020
b9876ae
start tests and fix `note_statement`
rphmeier Jul 2, 2020
f605ed2
test active_head seconding logic
rphmeier Jul 2, 2020
5650620
test that the per-peer tracking logic works
rphmeier Jul 2, 2020
dd00108
test per-peer knowledge tracker
rphmeier Jul 2, 2020
c93b545
test that peer view updates lead to messages being sent
rphmeier Jul 2, 2020
19ee505
test statement circulation
rphmeier Jul 2, 2020
9093736
address review comments
rphmeier Jul 2, 2020
6d18b62
have view set methods return references
rphmeier Jul 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
have view set methods return references
  • Loading branch information
rphmeier committed Jul 2, 2020
commit 6d18b622007058f0b5b2e31595d0a3c8caf77a5b
4 changes: 2 additions & 2 deletions node/network/statement-distribution/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -720,12 +720,12 @@ async fn update_peer_view_and_send_unlocked(

// Remove entries for all relay-parents in the old view but not the new.
for removed in old_view.difference(&peer_data.view) {
let _ = peer_data.view_knowledge.remove(&removed);
let _ = peer_data.view_knowledge.remove(removed);
}

// Add entries for all relay-parents in the new view but not the old.
// Furthermore, send all statements we have for those relay parents.
let new_view = peer_data.view.difference(&old_view).collect::<Vec<_>>();
let new_view = peer_data.view.difference(&old_view).copied().collect::<Vec<_>>();
for new in new_view.iter().copied() {
peer_data.view_knowledge.insert(new, Default::default());

Expand Down
8 changes: 4 additions & 4 deletions node/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ pub struct View(pub Vec<Hash>);

impl View {
/// Returns an iterator of the hashes present in `Self` but not in `other`.
pub fn difference<'a>(&'a self, other: &'a View) -> impl Iterator<Item = Hash> + 'a {
self.0.iter().cloned().filter(move |h| !other.contains(h))
pub fn difference<'a>(&'a self, other: &'a View) -> impl Iterator<Item = &'a Hash> + 'a {
self.0.iter().filter(move |h| !other.contains(h))
}

/// An iterator containing hashes present in both `Self` and in `other`.
pub fn intersection<'a>(&'a self, other: &'a View) -> impl Iterator<Item = Hash> + 'a {
self.0.iter().cloned().filter(move |h| other.contains(h))
pub fn intersection<'a>(&'a self, other: &'a View) -> impl Iterator<Item = &'a Hash> + 'a {
self.0.iter().filter(move |h| other.contains(h))
}

/// Whether the view contains a given hash.
Expand Down