mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-01 03:21:02 +00:00
Rewrap all comments to 100 line width (#9490)
* reformat everything again * manual formatting * last manual fix * Fix build
This commit is contained in:
@@ -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>,
|
||||
|
||||
Reference in New Issue
Block a user