Rewrap all comments to 100 line width (#9490)

* reformat everything again

* manual formatting

* last manual fix

* Fix build
This commit is contained in:
Kian Paimani
2021-08-11 16:56:55 +02:00
committed by GitHub
parent 8180c58700
commit abd08e29ce
258 changed files with 1776 additions and 1447 deletions
@@ -165,8 +165,8 @@ pub struct AuthoritySet<H, N> {
/// is lower than the last finalized block (as signaled in the forced
/// change) must be applied beforehand.
pending_forced_changes: Vec<PendingChange<H, N>>,
/// Track at which blocks the set id changed. This is useful when we need to prove finality for a
/// given block since we can figure out what set the block belongs to and when the set
/// Track at which blocks the set id changed. This is useful when we need to prove finality for
/// a given block since we can figure out what set the block belongs to and when the set
/// started/ended.
authority_set_changes: AuthoritySetChanges<N>,
}
@@ -657,16 +657,16 @@ impl<H, N: Add<Output = N> + Clone> PendingChange<H, N> {
pub struct AuthoritySetChanges<N>(Vec<(u64, N)>);
/// The response when querying for a set id for a specific block. Either we get a set id
/// together with a block number for the last block in the set, or that the requested block is in the
/// latest set, or that we don't know what set id the given block belongs to.
/// together with a block number for the last block in the set, or that the requested block is in
/// the latest set, or that we don't know what set id the given block belongs to.
#[derive(Debug, PartialEq)]
pub enum AuthoritySetChangeId<N> {
/// The requested block is in the latest set.
Latest,
/// Tuple containing the set id and the last block number of that set.
Set(SetId, N),
/// We don't know which set id the request block belongs to (this can only happen due to missing
/// data).
/// We don't know which set id the request block belongs to (this can only happen due to
/// missing data).
Unknown,
}
@@ -912,7 +912,8 @@ mod tests {
assert_eq!(authorities.pending_changes().collect::<Vec<_>>(), vec![&change_a, &change_b]);
// finalizing "hash_c" won't enact the change signaled at "hash_a" but it will prune out "hash_b"
// finalizing "hash_c" won't enact the change signaled at "hash_a" but it will prune out
// "hash_b"
let status = authorities
.apply_standard_changes(
"hash_c",
@@ -483,8 +483,8 @@ struct Peers<N> {
/// gossiping.
first_stage_peers: HashSet<PeerId>,
/// The randomly picked set of peers we'll gossip to in the second stage of gossiping if the
/// first stage didn't allow us to spread the voting data enough to conclude the round. This set
/// should have size `sqrt(connected_peers)`.
/// first stage didn't allow us to spread the voting data enough to conclude the round. This
/// set should have size `sqrt(connected_peers)`.
second_stage_peers: HashSet<PeerId>,
/// The randomly picked set of `LUCKY_PEERS` light clients we'll gossip commit messages to.
lucky_light_peers: HashSet<PeerId>,
@@ -583,9 +583,11 @@ impl<N: Ord> Peers<N> {
fn reshuffle(&mut self) {
// we want to randomly select peers into three sets according to the following logic:
// - first set: LUCKY_PEERS random peers where at least LUCKY_PEERS/2 are authorities (unless
// - first set: LUCKY_PEERS random peers where at least LUCKY_PEERS/2 are authorities
// (unless
// we're not connected to that many authorities)
// - second set: max(LUCKY_PEERS, sqrt(peers)) peers where at least LUCKY_PEERS are authorities.
// - second set: max(LUCKY_PEERS, sqrt(peers)) peers where at least LUCKY_PEERS are
// authorities.
// - third set: LUCKY_PEERS random light client peers
let shuffled_peers = {
@@ -1220,8 +1222,10 @@ impl<Block: BlockT> Inner<Block> {
/// The initial logic for filtering round messages follows the given state
/// transitions:
///
/// - State 1: allowed to LUCKY_PEERS random peers (where at least LUCKY_PEERS/2 are authorities)
/// - State 2: allowed to max(LUCKY_PEERS, sqrt(random peers)) (where at least LUCKY_PEERS are authorities)
/// - State 1: allowed to LUCKY_PEERS random peers (where at least LUCKY_PEERS/2 are
/// authorities)
/// - State 2: allowed to max(LUCKY_PEERS, sqrt(random peers)) (where at least LUCKY_PEERS are
/// authorities)
/// - State 3: allowed to all peers
///
/// Transitions will be triggered on repropagation attempts by the underlying gossip layer.
@@ -1249,7 +1253,8 @@ impl<Block: BlockT> Inner<Block> {
/// The initial logic for filtering global messages follows the given state
/// transitions:
///
/// - State 1: allowed to max(LUCKY_PEERS, sqrt(peers)) (where at least LUCKY_PEERS are authorities)
/// - State 1: allowed to max(LUCKY_PEERS, sqrt(peers)) (where at least LUCKY_PEERS are
/// authorities)
/// - State 2: allowed to all peers
///
/// We are more lenient with global messages since there should be a lot
@@ -1625,7 +1630,8 @@ impl<Block: BlockT> sc_network_gossip::Validator<Block> for GossipValidator<Bloc
// it is expired.
match inner.live_topics.topic_info(&topic) {
None => return true,
Some((Some(_), _)) => return false, /* round messages don't require further checking. */
// round messages don't require further checking.
Some((Some(_), _)) => return false,
Some((None, _)) => {},
};
@@ -191,16 +191,16 @@ pub(crate) struct NetworkBridge<B: BlockT, N: Network<B>> {
neighbor_sender: periodic::NeighborPacketSender<B>,
/// `NeighborPacketWorker` processing packets sent through the `NeighborPacketSender`.
// `NetworkBridge` is required to be cloneable, thus one needs to be able to clone its children,
// thus one has to wrap `neighbor_packet_worker` with an `Arc` `Mutex`.
// `NetworkBridge` is required to be cloneable, thus one needs to be able to clone its
// children, thus one has to wrap `neighbor_packet_worker` with an `Arc` `Mutex`.
neighbor_packet_worker: Arc<Mutex<periodic::NeighborPacketWorker<B>>>,
/// Receiver side of the peer report stream populated by the gossip validator, forwarded to the
/// gossip engine.
// `NetworkBridge` is required to be cloneable, thus one needs to be able to clone its children,
// thus one has to wrap gossip_validator_report_stream with an `Arc` `Mutex`. Given that it is
// just an `UnboundedReceiver`, one could also switch to a multi-producer-*multi*-consumer
// channel implementation.
// `NetworkBridge` is required to be cloneable, thus one needs to be able to clone its
// children, thus one has to wrap gossip_validator_report_stream with an `Arc` `Mutex`. Given
// that it is just an `UnboundedReceiver`, one could also switch to a
// multi-producer-*multi*-consumer channel implementation.
gossip_validator_report_stream: Arc<Mutex<TracingUnboundedReceiver<PeerReport>>>,
telemetry: Option<TelemetryHandle>,
@@ -291,8 +291,8 @@ impl<B: BlockT, N: Network<B>> NetworkBridge<B, N> {
.note_round(round, |to, neighbor| self.neighbor_sender.send(to, neighbor));
}
/// Get a stream of signature-checked round messages from the network as well as a sink for round messages to the
/// network all within the current set.
/// Get a stream of signature-checked round messages from the network as well as a sink for
/// round messages to the network all within the current set.
pub(crate) fn round_communication(
&self,
keystore: Option<LocalIdKeystore>,
@@ -100,7 +100,8 @@ where
let mut out = Vec::new();
let chain_info = self.inner.info();
// request justifications for all pending changes for which change blocks have already been imported
// request justifications for all pending changes for which change blocks have already been
// imported
let pending_changes: Vec<_> =
self.authority_set.inner().pending_changes().cloned().collect();
@@ -171,7 +171,8 @@ impl<Block: BlockT> GrandpaJustification<Block> {
match ancestry_chain.ancestry(self.commit.target_hash, signed.precommit.target_hash) {
Ok(route) => {
// ancestry starts from parent hash but the precommit target hash has been visited
// ancestry starts from parent hash but the precommit target hash has been
// visited
visited_hashes.insert(signed.precommit.target_hash);
for hash in route {
visited_hashes.insert(hash);
@@ -361,7 +361,8 @@ where
match Future::poll(Pin::new(&mut self.observer), cx) {
Poll::Pending => {},
Poll::Ready(Ok(())) => {
// observer commit stream doesn't conclude naturally; this could reasonably be an error.
// observer commit stream doesn't conclude naturally; this could reasonably be an
// error.
return Poll::Ready(Ok(()))
},
Poll::Ready(Err(CommandOrError::Error(e))) => {
@@ -188,8 +188,8 @@ impl<Block: BlockT> WarpSyncProof<Block> {
}
/// Verifies the warp sync proof starting at the given set id and with the given authorities.
/// Verification stops when either the proof is exhausted or finality for the target header can be proven.
/// If the proof is valid the new set id and authorities is returned.
/// Verification stops when either the proof is exhausted or finality for the target header can
/// be proven. If the proof is valid the new set id and authorities is returned.
fn verify(
&self,
set_id: SetId,