Skip to content

Commit

Permalink
splits out gossip Protocol out of cluster_info.rs (#3488)
Browse files Browse the repository at this point in the history
Reorganizing this code in preparation of upcoming changes to 
gossip Protocol (de)serialization.
  • Loading branch information
behzadnouri authored Nov 6, 2024
1 parent 4e7f7f7 commit bdf95ad
Show file tree
Hide file tree
Showing 10 changed files with 757 additions and 699 deletions.
705 changes: 14 additions & 691 deletions gossip/src/cluster_info.rs

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion gossip/src/crds_data.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use {
crate::{
cluster_info::MAX_ACCOUNTS_HASHES,
contact_info::ContactInfo,
deprecated,
duplicate_shred::{DuplicateShred, DuplicateShredIndex, MAX_DUPLICATE_SHREDS},
Expand All @@ -24,6 +23,10 @@ use {

pub(crate) const MAX_WALLCLOCK: u64 = 1_000_000_000_000_000;
pub(crate) const MAX_SLOT: u64 = 1_000_000_000_000_000;
/// Maximum number of hashes in AccountsHashes a node publishes
/// such that the serialized size of the push/pull message stays below
/// PACKET_DATA_SIZE.
const MAX_ACCOUNTS_HASHES: usize = 16;

pub(crate) type VoteIndex = u8;
// TODO: Remove this in favor of vote_state::MAX_LOCKOUT_HISTORY once
Expand Down
2 changes: 1 addition & 1 deletion gossip/src/crds_gossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use {
crate::{
cluster_info::Ping,
cluster_info_metrics::GossipStats,
contact_info::ContactInfo,
crds::{Crds, GossipRoute},
Expand All @@ -17,6 +16,7 @@ use {
crds_value::CrdsValue,
duplicate_shred::{self, DuplicateShredIndex, MAX_DUPLICATE_SHREDS},
ping_pong::PingCache,
protocol::Ping,
},
itertools::Itertools,
rand::{CryptoRng, Rng},
Expand Down
4 changes: 2 additions & 2 deletions gossip/src/crds_gossip_pull.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@

use {
crate::{
cluster_info::Ping,
cluster_info_metrics::GossipStats,
contact_info::ContactInfo,
crds::{Crds, GossipRoute, VersionedCrdsValue},
crds_gossip,
crds_gossip_error::CrdsGossipError,
crds_value::CrdsValue,
ping_pong::PingCache,
protocol::Ping,
},
itertools::Itertools,
rand::{
Expand Down Expand Up @@ -655,9 +655,9 @@ pub(crate) mod tests {
use {
super::*,
crate::{
cluster_info::Protocol,
crds_data::{CrdsData, Vote},
legacy_contact_info::LegacyContactInfo,
protocol::Protocol,
},
itertools::Itertools,
rand::{seq::SliceRandom, SeedableRng},
Expand Down
3 changes: 2 additions & 1 deletion gossip/src/crds_gossip_push.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@

use {
crate::{
cluster_info::{Ping, CRDS_UNIQUE_PUBKEY_CAPACITY},
cluster_info::CRDS_UNIQUE_PUBKEY_CAPACITY,
crds::{Crds, CrdsError, Cursor, GossipRoute},
crds_gossip,
crds_value::CrdsValue,
ping_pong::PingCache,
protocol::Ping,
push_active_set::PushActiveSet,
received_cache::ReceivedCache,
},
Expand Down
2 changes: 1 addition & 1 deletion gossip/src/duplicate_shred_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ mod tests {
use {
super::*,
crate::{
cluster_info::DUPLICATE_SHRED_MAX_PAYLOAD_SIZE,
duplicate_shred::{from_shred, tests::new_rand_shred},
protocol::DUPLICATE_SHRED_MAX_PAYLOAD_SIZE,
},
crossbeam_channel::unbounded,
itertools::Itertools,
Expand Down
2 changes: 1 addition & 1 deletion gossip/src/epoch_slots.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use {
crate::{
cluster_info::MAX_CRDS_OBJECT_SIZE,
crds_data::{self, MAX_SLOT, MAX_WALLCLOCK},
protocol::MAX_CRDS_OBJECT_SIZE,
},
bincode::serialized_size,
bv::BitVec,
Expand Down
1 change: 1 addition & 0 deletions gossip/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub mod gossip_service;
#[macro_use]
mod legacy_contact_info;
pub mod ping_pong;
mod protocol;
mod push_active_set;
mod received_cache;
pub mod restart_crds_values;
Expand Down
Loading

0 comments on commit bdf95ad

Please sign in to comment.