Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Initial version of the polite-grandpa networking protocol #2110

Merged
merged 58 commits into from
Apr 2, 2019
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
9e86f48
Consensus status packet
arkpar Mar 13, 2019
4a0ff34
Allow for repropagation after status
arkpar Mar 14, 2019
d33040e
More generic gossip
arkpar Mar 18, 2019
2b431c8
Merge branch 'master' of github.com:paritytech/substrate into a-neigh…
arkpar Mar 18, 2019
ebdaafd
Merge branch 'master' of github.com:paritytech/substrate into a-neigh…
arkpar Mar 21, 2019
2220244
add a basic view struct and gossip module
rphmeier Mar 12, 2019
db1c847
move gossip stuff to the gossip module
rphmeier Mar 12, 2019
f7aad66
integrate view into gossip
rphmeier Mar 12, 2019
6a2fc02
some reshuffling
rphmeier Mar 12, 2019
6bfa740
alter rules for keeping one commit at a time in view
rphmeier Mar 13, 2019
0b49f81
Allow sending addressed messages
arkpar Mar 21, 2019
b77bff7
don't cast outgoing votes if we know that we voted before
rphmeier Mar 13, 2019
9587ada
Handle one hop messages
arkpar Mar 21, 2019
da9778d
Merge branch 'a-neighbour-packet' into rh-polite-grandpa
rphmeier Mar 21, 2019
904a521
initial run at polite grandpa
rphmeier Mar 21, 2019
7e2005d
Merge branch 'master' of github.com:paritytech/substrate into a-neigh…
arkpar Mar 22, 2019
e2b2570
build WASM
rphmeier Mar 22, 2019
c8cf9e3
handle neighbor messages
rphmeier Mar 22, 2019
8ffb0bf
refactor validator's internals into an Inner struct
rphmeier Mar 22, 2019
13d00bb
gossip only knows to keep or discard messages. optimize should_send_to
rphmeier Mar 22, 2019
999c539
Periodic rebroadcast
arkpar Mar 22, 2019
b4cfc0d
implement `should_send_to` and message_expired
rphmeier Mar 22, 2019
04c7979
track peers' best received commit height
rphmeier Mar 22, 2019
da217ff
Pass peer id to topic steam
arkpar Mar 22, 2019
67032ac
Merge branch 'a-neighbour-packet' into rh-polite-grandpa
rphmeier Mar 22, 2019
b984177
Merge branch 'a-neighbour-packet' of github.com:paritytech/substrate …
rphmeier Mar 22, 2019
78bd66b
kill rebroadcasting network
rphmeier Mar 22, 2019
4b48dea
Notify about existing peers
arkpar Mar 22, 2019
8e6a5f6
clean up network APIs a bunch
rphmeier Mar 22, 2019
54c1a5a
implement gossip::send_message for direct messages
rphmeier Mar 23, 2019
466a4ff
refactor network trait
rphmeier Mar 23, 2019
dea01ef
implement gossip::send_message for direct messages
rphmeier Mar 23, 2019
4b39ecf
Merge branch 'master' of github.com:paritytech/substrate into a-neigh…
arkpar Mar 23, 2019
7ea22d2
Merge branch 'a-neighbour-packet' of github.com:paritytech/substrate …
rphmeier Mar 25, 2019
960c155
get all non set-change tests passing
rphmeier Mar 25, 2019
26dc8dc
treat unknown rebroadcasts as broadcasts
rphmeier Mar 25, 2019
06ee6cd
get all other main tests passing
rphmeier Mar 25, 2019
81763f1
remove unimplemented test
rphmeier Mar 25, 2019
52664a4
everything compiles
rphmeier Mar 25, 2019
27fd5a6
devops-parity updated wasm runtime blobs 4351158c and merged in maste…
devops-parity Mar 25, 2019
ee8b15f
treat unknown rebroadcasts as broadcasts
rphmeier Mar 25, 2019
9105f85
Rebradcast interval
arkpar Mar 26, 2019
2116ab1
Apply suggestions from code review
andresilva Mar 26, 2019
86262f6
Merge branch 'a-neighbour-packet' of github.com:paritytech/substrate …
arkpar Mar 26, 2019
34afaa9
Style
arkpar Mar 26, 2019
875a249
some module docs
rphmeier Mar 26, 2019
43ca14e
address some grumbles + docs
rphmeier Mar 26, 2019
419cedd
allow rebroadcast every few minutes
rphmeier Mar 26, 2019
c0d3815
devops-parity updated wasm runtime blobs 3635067c and merged in maste…
devops-parity Mar 26, 2019
f531291
send_topic && generic context
arkpar Mar 27, 2019
75e69f6
some tests for view change
rphmeier Mar 27, 2019
d8d1ea5
more grumbles & tests
rphmeier Mar 28, 2019
d031c36
devops-parity updated wasm runtime blobs 470e21f7 and merged in maste…
devops-parity Mar 28, 2019
b652fa8
Merge branch 'a-neighbour-packet' of github.com:paritytech/substrate …
rphmeier Mar 28, 2019
b3bf3a2
use send_peer
rphmeier Mar 28, 2019
8ba1883
devops-parity updated wasm runtime blobs 75eefb48 and merged in maste…
devops-parity Mar 28, 2019
429aff1
Merge branch 'master' into rh-polite-grandpa
rphmeier Apr 2, 2019
2a6195c
Merge branch 'rh-polite-grandpa' of github.com:paritytech/substrate i…
rphmeier Apr 2, 2019
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
543 changes: 0 additions & 543 deletions core/finality-grandpa/src/communication.rs

This file was deleted.

722 changes: 722 additions & 0 deletions core/finality-grandpa/src/communication/gossip.rs

Large diffs are not rendered by default.

550 changes: 550 additions & 0 deletions core/finality-grandpa/src/communication/mod.rs

Large diffs are not rendered by default.

34 changes: 16 additions & 18 deletions core/finality-grandpa/src/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pub(crate) struct Environment<B, E, Block: BlockT, N: Network<Block>, RA> {
pub(crate) config: Config,
pub(crate) authority_set: SharedAuthoritySet<Block::Hash, NumberFor<Block>>,
pub(crate) consensus_changes: SharedConsensusChanges<Block::Hash, NumberFor<Block>>,
pub(crate) network: N,
pub(crate) network: crate::communication::NetworkBridge<Block, N>,
pub(crate) set_id: u64,
pub(crate) last_completed: LastCompletedRound<Block::Hash, NumberFor<Block>>,
}
Expand Down Expand Up @@ -231,32 +231,24 @@ impl<B, E, Block: BlockT<Hash=H256>, N, RA> voter::Environment<Block::Hash, Numb
let prevote_timer = Delay::new(now + self.config.gossip_duration * 2);
let precommit_timer = Delay::new(now + self.config.gossip_duration * 4);

let incoming = crate::communication::checked_message_stream::<Block, _>(
self.network.messages_for(round, self.set_id),
self.voters.clone(),
);

let local_key = self.config.local_key.as_ref()
.filter(|pair| self.voters.contains_key(&pair.public().into()));

let (out_rx, outgoing) = crate::communication::outgoing_messages::<Block, _>(
round,
self.set_id,
local_key.cloned(),
let (incoming, outgoing) = self.network.round_communication(
crate::communication::Round(round),
crate::communication::SetId(self.set_id),
self.voters.clone(),
self.network.clone(),
local_key.cloned(),
crate::communication::HasVoted::No,
);

// schedule incoming messages from the network to be held until
// corresponding blocks are imported.
let incoming = UntilVoteTargetImported::new(
let incoming = Box::new(UntilVoteTargetImported::new(
self.inner.import_notification_stream(),
self.inner.clone(),
incoming,
);

// join incoming network messages with locally originating ones.
let incoming = Box::new(out_rx.select(incoming).map_err(Into::into));
).map_err(Into::into));

// schedule network message cleanup when sink drops.
let outgoing = Box::new(outgoing.sink_map_err(Into::into));
Expand Down Expand Up @@ -305,15 +297,21 @@ impl<B, E, Block: BlockT<Hash=H256>, N, RA> voter::Environment<Block::Hash, Numb
return Ok(());
}

finalize_block(
let res = finalize_block(
&*self.inner,
&self.authority_set,
&self.consensus_changes,
Some(As::sa(self.config.justification_period)),
hash,
number,
(round, commit).into(),
)
);

if let Ok(_) = res {
self.network.note_commit_finalized(number);
}

res
}

fn round_commit_timer(&self) -> Self::Timer {
Expand Down
Loading