diff --git a/core/src/crds_gossip.rs b/core/src/crds_gossip.rs index d9c81fbc8..2c9300809 100644 --- a/core/src/crds_gossip.rs +++ b/core/src/crds_gossip.rs @@ -3,11 +3,13 @@ //! designed to run with a simulator or over a UDP network connection with messages up to a //! packet::PACKET_DATA_SIZE size. -use crate::crds::{Crds, VersionedCrdsValue}; -use crate::crds_gossip_error::CrdsGossipError; -use crate::crds_gossip_pull::{CrdsFilter, CrdsGossipPull}; -use crate::crds_gossip_push::{CrdsGossipPush, CRDS_GOSSIP_NUM_ACTIVE}; -use crate::crds_value::{CrdsValue, CrdsValueLabel}; +use crate::{ + crds::{Crds, VersionedCrdsValue}, + crds_gossip_error::CrdsGossipError, + crds_gossip_pull::{CrdsFilter, CrdsGossipPull}, + crds_gossip_push::{CrdsGossipPush, CRDS_GOSSIP_NUM_ACTIVE}, + crds_value::{CrdsValue, CrdsValueLabel}, +}; use solana_sdk::pubkey::Pubkey; use std::collections::{HashMap, HashSet}; diff --git a/core/src/crds_gossip_push.rs b/core/src/crds_gossip_push.rs index b5c9b28f6..12b9dd139 100644 --- a/core/src/crds_gossip_push.rs +++ b/core/src/crds_gossip_push.rs @@ -8,25 +8,24 @@ //! the local nodes wallclock window they are drooped silently. //! 2. The prune set is stored in a Bloom filter. -use crate::contact_info::ContactInfo; -use crate::crds::{Crds, VersionedCrdsValue}; -use crate::crds_gossip::{get_stake, get_weight, CRDS_GOSSIP_DEFAULT_BLOOM_ITEMS}; -use crate::crds_gossip_error::CrdsGossipError; -use crate::crds_value::{CrdsValue, CrdsValueLabel}; -use crate::weighted_shuffle::weighted_shuffle; +use crate::{ + contact_info::ContactInfo, + crds::{Crds, VersionedCrdsValue}, + crds_gossip::{get_stake, get_weight, CRDS_GOSSIP_DEFAULT_BLOOM_ITEMS}, + crds_gossip_error::CrdsGossipError, + crds_value::{CrdsValue, CrdsValueLabel}, + weighted_shuffle::weighted_shuffle, +}; use bincode::serialized_size; use indexmap::map::IndexMap; use itertools::Itertools; -use rand; -use rand::seq::SliceRandom; -use rand::{thread_rng, RngCore}; +use rand::{self, seq::SliceRandom, thread_rng, RngCore}; use solana_runtime::bloom::Bloom; -use solana_sdk::hash::Hash; -use solana_sdk::packet::PACKET_DATA_SIZE; -use solana_sdk::pubkey::Pubkey; -use solana_sdk::timing::timestamp; -use std::cmp; -use std::collections::{HashMap, HashSet}; +use solana_sdk::{hash::Hash, packet::PACKET_DATA_SIZE, pubkey::Pubkey, timing::timestamp}; +use std::{ + cmp, + collections::{HashMap, HashSet}, +}; pub const CRDS_GOSSIP_NUM_ACTIVE: usize = 30; pub const CRDS_GOSSIP_PUSH_FANOUT: usize = 6; diff --git a/core/src/crds_value.rs b/core/src/crds_value.rs index 93a5d4d11..848c12d67 100644 --- a/core/src/crds_value.rs +++ b/core/src/crds_value.rs @@ -1,14 +1,16 @@ use crate::contact_info::ContactInfo; use bincode::{serialize, serialized_size}; -use solana_sdk::clock::Slot; -use solana_sdk::pubkey::Pubkey; -use solana_sdk::signature::{Keypair, Signable, Signature}; -use solana_sdk::transaction::Transaction; -use std::borrow::Borrow; -use std::borrow::Cow; -use std::collections::BTreeSet; -use std::collections::HashSet; -use std::fmt; +use solana_sdk::{ + clock::Slot, + pubkey::Pubkey, + signature::{Keypair, Signable, Signature}, + transaction::Transaction, +}; +use std::{ + borrow::{Borrow, Cow}, + collections::{BTreeSet, HashSet}, + fmt, +}; pub type VoteIndex = u8; pub const MAX_VOTES: VoteIndex = 32; @@ -50,14 +52,12 @@ impl Signable for CrdsValue { } /// CrdsData that defines the different types of items CrdsValues can hold +/// * Merge Strategy - Latest wallclock is picked #[allow(clippy::large_enum_variant)] #[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] pub enum CrdsData { - /// * Merge Strategy - Latest wallclock is picked ContactInfo(ContactInfo), - /// * Merge Strategy - Latest wallclock is picked Vote(VoteIndex, Vote), - /// * Merge Strategy - Latest wallclock is picked EpochSlots(EpochSlots), }