From 60d67b0bbb5f3b1c507bc745905e737d3b2426ac Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 25 Jan 2023 17:35:49 +0000 Subject: [PATCH] renames ContactInfo to LegacyContactInfo (backport #29566) (#29898) * renames ContactInfo to LegacyContactInfo (#29566) Working towards adding a new ContactInfo where new sockets can be added in a backward compatible way. (cherry picked from commit 8c212f59ad4a1953ad7f4160be56f7ce11d422be) # Conflicts: # core/src/accounts_hash_verifier.rs # core/src/retransmit_stage.rs # core/tests/epoch_accounts_hash.rs # gossip/src/cluster_info.rs # gossip/src/crds_gossip_push.rs # validator/src/admin_rpc_service.rs * resolves mergify merge conflicts Co-authored-by: behzad nouri --- core/benches/cluster_info.rs | 2 +- core/benches/cluster_nodes.rs | 2 +- core/benches/retransmit_stage.rs | 2 +- core/src/accounts_hash_verifier.rs | 5 +- core/src/ancestor_hashes_service.rs | 2 +- core/src/banking_stage.rs | 6 +- core/src/broadcast_stage.rs | 2 +- .../broadcast_duplicates_run.rs | 2 +- .../broadcast_fake_shreds_run.rs | 2 +- core/src/cluster_nodes.rs | 4 +- core/src/cluster_slots.rs | 3 +- core/src/repair_service.rs | 4 +- core/src/retransmit_stage.rs | 4 +- core/src/serve_repair.rs | 16 ++-- core/src/validator.rs | 2 +- core/src/window_service.rs | 2 +- core/tests/snapshots.rs | 4 +- dos/src/main.rs | 2 +- gossip/src/cluster_info.rs | 39 ++++---- gossip/src/cluster_info_metrics.rs | 8 +- gossip/src/crds.rs | 76 +++++++-------- gossip/src/crds_entry.rs | 8 +- gossip/src/crds_gossip.rs | 6 +- gossip/src/crds_gossip_pull.rs | 95 +++++++++---------- gossip/src/crds_gossip_push.rs | 90 ++++++++---------- gossip/src/crds_value.rs | 53 +++++------ gossip/src/gossip_service.rs | 2 +- ...contact_info.rs => legacy_contact_info.rs} | 48 +++++----- gossip/src/lib.rs | 4 +- gossip/src/main.rs | 4 +- gossip/tests/cluster_info.rs | 2 +- gossip/tests/crds_gossip.rs | 24 ++--- gossip/tests/gossip.rs | 2 +- local-cluster/src/cluster.rs | 2 +- local-cluster/src/cluster_tests.rs | 2 +- local-cluster/src/local_cluster.rs | 3 +- rpc/src/cluster_tpu_info.rs | 2 +- rpc/src/rpc.rs | 6 +- rpc/src/rpc_health.rs | 4 +- rpc/src/rpc_service.rs | 2 +- validator/src/admin_rpc_service.rs | 4 +- validator/src/bootstrap.rs | 2 +- validator/src/main.rs | 2 +- 43 files changed, 281 insertions(+), 275 deletions(-) rename gossip/src/{contact_info.rs => legacy_contact_info.rs} (89%) diff --git a/core/benches/cluster_info.rs b/core/benches/cluster_info.rs index ea12f7d08959ce..2c6df51cca75b5 100644 --- a/core/benches/cluster_info.rs +++ b/core/benches/cluster_info.rs @@ -12,7 +12,7 @@ use { }, solana_gossip::{ cluster_info::{ClusterInfo, Node}, - contact_info::ContactInfo, + legacy_contact_info::LegacyContactInfo as ContactInfo, }, solana_ledger::{ genesis_utils::{create_genesis_config, GenesisConfigInfo}, diff --git a/core/benches/cluster_nodes.rs b/core/benches/cluster_nodes.rs index e9f74bc9b947b4..2201a73f2f7adb 100644 --- a/core/benches/cluster_nodes.rs +++ b/core/benches/cluster_nodes.rs @@ -8,7 +8,7 @@ use { cluster_nodes::{make_test_cluster, new_cluster_nodes, ClusterNodes}, retransmit_stage::RetransmitStage, }, - solana_gossip::contact_info::ContactInfo, + solana_gossip::legacy_contact_info::LegacyContactInfo as ContactInfo, solana_ledger::{ genesis_utils::{create_genesis_config, GenesisConfigInfo}, shred::{Shred, ShredFlags}, diff --git a/core/benches/retransmit_stage.rs b/core/benches/retransmit_stage.rs index bad02d043a51f5..ff647525dfc2d9 100644 --- a/core/benches/retransmit_stage.rs +++ b/core/benches/retransmit_stage.rs @@ -10,7 +10,7 @@ use { solana_entry::entry::Entry, solana_gossip::{ cluster_info::{ClusterInfo, Node}, - contact_info::ContactInfo, + legacy_contact_info::LegacyContactInfo as ContactInfo, }, solana_ledger::{ genesis_utils::{create_genesis_config, GenesisConfigInfo}, diff --git a/core/src/accounts_hash_verifier.rs b/core/src/accounts_hash_verifier.rs index b8bc425c4a33d3..70e967f7387dad 100644 --- a/core/src/accounts_hash_verifier.rs +++ b/core/src/accounts_hash_verifier.rs @@ -334,7 +334,10 @@ impl AccountsHashVerifier { mod tests { use { super::*, - solana_gossip::{cluster_info::make_accounts_hashes_message, contact_info::ContactInfo}, + solana_gossip::{ + cluster_info::make_accounts_hashes_message, + legacy_contact_info::LegacyContactInfo as ContactInfo, + }, solana_runtime::{ rent_collector::RentCollector, snapshot_utils::{ArchiveFormat, SnapshotVersion}, diff --git a/core/src/ancestor_hashes_service.rs b/core/src/ancestor_hashes_service.rs index 48e1c07dd1478e..6ecf140decbd5f 100644 --- a/core/src/ancestor_hashes_service.rs +++ b/core/src/ancestor_hashes_service.rs @@ -771,7 +771,7 @@ mod test { }, solana_gossip::{ cluster_info::{ClusterInfo, Node}, - contact_info::ContactInfo, + legacy_contact_info::LegacyContactInfo as ContactInfo, }, solana_ledger::{blockstore::make_many_slot_entries, get_tmp_ledger_path, shred::Nonce}, solana_runtime::{accounts_background_service::AbsRequestSender, bank_forks::BankForks}, diff --git a/core/src/banking_stage.rs b/core/src/banking_stage.rs index 0b7b4e21f8e170..fb865b7ac86536 100644 --- a/core/src/banking_stage.rs +++ b/core/src/banking_stage.rs @@ -24,7 +24,9 @@ use { min_max_heap::MinMaxHeap, solana_client::{connection_cache::ConnectionCache, tpu_connection::TpuConnection}, solana_entry::entry::hash_transactions, - solana_gossip::{cluster_info::ClusterInfo, contact_info::ContactInfo}, + solana_gossip::{ + cluster_info::ClusterInfo, legacy_contact_info::LegacyContactInfo as ContactInfo, + }, solana_ledger::{ blockstore_processor::TransactionStatusSender, token_balances::collect_token_balances, }, @@ -2308,7 +2310,7 @@ mod tests { crossbeam_channel::{unbounded, Receiver}, solana_address_lookup_table_program::state::{AddressLookupTable, LookupTableMeta}, solana_entry::entry::{next_entry, next_versioned_entry, Entry, EntrySlice}, - solana_gossip::{cluster_info::Node, contact_info::ContactInfo}, + solana_gossip::cluster_info::Node, solana_ledger::{ blockstore::{entries_to_test_shreds, Blockstore}, genesis_utils::{create_genesis_config, GenesisConfigInfo}, diff --git a/core/src/broadcast_stage.rs b/core/src/broadcast_stage.rs index a42c8a68851037..3609569b7ca85e 100644 --- a/core/src/broadcast_stage.rs +++ b/core/src/broadcast_stage.rs @@ -16,7 +16,7 @@ use { itertools::Itertools, solana_gossip::{ cluster_info::{ClusterInfo, ClusterInfoError}, - contact_info::ContactInfo, + legacy_contact_info::LegacyContactInfo as ContactInfo, }, solana_ledger::{blockstore::Blockstore, shred::Shred}, solana_measure::measure::Measure, diff --git a/core/src/broadcast_stage/broadcast_duplicates_run.rs b/core/src/broadcast_stage/broadcast_duplicates_run.rs index 0c414c38eb99fb..29f901c3ad4e66 100644 --- a/core/src/broadcast_stage/broadcast_duplicates_run.rs +++ b/core/src/broadcast_stage/broadcast_duplicates_run.rs @@ -3,7 +3,7 @@ use { crate::cluster_nodes::ClusterNodesCache, itertools::Itertools, solana_entry::entry::Entry, - solana_gossip::contact_info::ContactInfo, + solana_gossip::legacy_contact_info::LegacyContactInfo as ContactInfo, solana_ledger::shred::{ProcessShredsStats, ReedSolomonCache, Shredder}, solana_sdk::{ hash::Hash, diff --git a/core/src/broadcast_stage/broadcast_fake_shreds_run.rs b/core/src/broadcast_stage/broadcast_fake_shreds_run.rs index 69aaf410af9123..f035abf13b90ca 100644 --- a/core/src/broadcast_stage/broadcast_fake_shreds_run.rs +++ b/core/src/broadcast_stage/broadcast_fake_shreds_run.rs @@ -159,7 +159,7 @@ impl BroadcastRun for BroadcastFakeShredsRun { mod tests { use { super::*, - solana_gossip::contact_info::ContactInfo, + solana_gossip::legacy_contact_info::LegacyContactInfo as ContactInfo, solana_streamer::socket::SocketAddrSpace, std::net::{IpAddr, Ipv4Addr, SocketAddr}, }; diff --git a/core/src/cluster_nodes.rs b/core/src/cluster_nodes.rs index d500b9452e1dba..633d746687d507 100644 --- a/core/src/cluster_nodes.rs +++ b/core/src/cluster_nodes.rs @@ -6,10 +6,10 @@ use { rand_chacha::ChaChaRng, solana_gossip::{ cluster_info::{compute_retransmit_peers, ClusterInfo, DATA_PLANE_FANOUT}, - contact_info::ContactInfo, crds::GossipRoute, crds_gossip_pull::CRDS_GOSSIP_PULL_CRDS_TIMEOUT_MS, crds_value::{CrdsData, CrdsValue}, + legacy_contact_info::LegacyContactInfo as ContactInfo, weighted_shuffle::WeightedShuffle, }, solana_ledger::shred::ShredId, @@ -486,7 +486,7 @@ pub fn make_test_cluster( let mut gossip_crds = cluster_info.gossip.crds.write().unwrap(); // First node is pushed to crds table by ClusterInfo constructor. for node in nodes.iter().skip(1) { - let node = CrdsData::ContactInfo(node.clone()); + let node = CrdsData::LegacyContactInfo(node.clone()); let node = CrdsValue::new_unsigned(node); assert_eq!( gossip_crds.insert(node, now, GossipRoute::LocalMessage), diff --git a/core/src/cluster_slots.rs b/core/src/cluster_slots.rs index 6f43a2ac8d2092..be22ed7024fa3a 100644 --- a/core/src/cluster_slots.rs +++ b/core/src/cluster_slots.rs @@ -1,7 +1,8 @@ use { itertools::Itertools, solana_gossip::{ - cluster_info::ClusterInfo, contact_info::ContactInfo, crds::Cursor, epoch_slots::EpochSlots, + cluster_info::ClusterInfo, crds::Cursor, epoch_slots::EpochSlots, + legacy_contact_info::LegacyContactInfo as ContactInfo, }, solana_runtime::{bank::Bank, epoch_stakes::NodeIdToVoteAccounts}, solana_sdk::{ diff --git a/core/src/repair_service.rs b/core/src/repair_service.rs index 07c4d89967dc43..854a81854460f4 100644 --- a/core/src/repair_service.rs +++ b/core/src/repair_service.rs @@ -727,7 +727,9 @@ impl RepairService { mod test { use { super::*, - solana_gossip::{cluster_info::Node, contact_info::ContactInfo}, + solana_gossip::{ + cluster_info::Node, legacy_contact_info::LegacyContactInfo as ContactInfo, + }, solana_ledger::{ blockstore::{ make_chaining_slot_entries, make_many_slot_entries, make_slot_entries, Blockstore, diff --git a/core/src/retransmit_stage.rs b/core/src/retransmit_stage.rs index c0db208195fd09..8f4374f93071bb 100644 --- a/core/src/retransmit_stage.rs +++ b/core/src/retransmit_stage.rs @@ -11,7 +11,9 @@ use { lru::LruCache, rayon::{prelude::*, ThreadPool, ThreadPoolBuilder}, solana_client::rpc_response::SlotUpdate, - solana_gossip::{cluster_info::ClusterInfo, contact_info::ContactInfo}, + solana_gossip::{ + cluster_info::ClusterInfo, legacy_contact_info::LegacyContactInfo as ContactInfo, + }, solana_ledger::{ leader_schedule_cache::LeaderScheduleCache, shred::{self, ShredId}, diff --git a/core/src/serve_repair.rs b/core/src/serve_repair.rs index 7acd9f0d0f4b8e..5e466f39b00d86 100644 --- a/core/src/serve_repair.rs +++ b/core/src/serve_repair.rs @@ -15,7 +15,7 @@ use { }, solana_gossip::{ cluster_info::{ClusterInfo, ClusterInfoError}, - contact_info::ContactInfo, + legacy_contact_info::{LegacyContactInfo as ContactInfo, LegacyContactInfo}, ping_pong::{self, PingCache, Pong}, weighted_shuffle::WeightedShuffle, }, @@ -204,13 +204,13 @@ pub(crate) type Ping = ping_pong::Ping<[u8; REPAIR_PING_TOKEN_SIZE]>; /// Window protocol messages #[derive(Serialize, Deserialize, Debug)] pub enum RepairProtocol { - LegacyWindowIndex(ContactInfo, Slot, u64), - LegacyHighestWindowIndex(ContactInfo, Slot, u64), - LegacyOrphan(ContactInfo, Slot), - LegacyWindowIndexWithNonce(ContactInfo, Slot, u64, Nonce), - LegacyHighestWindowIndexWithNonce(ContactInfo, Slot, u64, Nonce), - LegacyOrphanWithNonce(ContactInfo, Slot, Nonce), - LegacyAncestorHashes(ContactInfo, Slot, Nonce), + LegacyWindowIndex(LegacyContactInfo, Slot, u64), + LegacyHighestWindowIndex(LegacyContactInfo, Slot, u64), + LegacyOrphan(LegacyContactInfo, Slot), + LegacyWindowIndexWithNonce(LegacyContactInfo, Slot, u64, Nonce), + LegacyHighestWindowIndexWithNonce(LegacyContactInfo, Slot, u64, Nonce), + LegacyOrphanWithNonce(LegacyContactInfo, Slot, Nonce), + LegacyAncestorHashes(LegacyContactInfo, Slot, Nonce), Pong(ping_pong::Pong), WindowIndex { header: RepairRequestHeader, diff --git a/core/src/validator.rs b/core/src/validator.rs index 9d06c9d61577e4..74da81d07b2967 100644 --- a/core/src/validator.rs +++ b/core/src/validator.rs @@ -33,9 +33,9 @@ use { ClusterInfo, Node, DEFAULT_CONTACT_DEBUG_INTERVAL_MILLIS, DEFAULT_CONTACT_SAVE_INTERVAL_MILLIS, }, - contact_info::ContactInfo, crds_gossip_pull::CRDS_GOSSIP_PULL_CRDS_TIMEOUT_MS, gossip_service::GossipService, + legacy_contact_info::LegacyContactInfo as ContactInfo, }, solana_ledger::{ bank_forks_utils, diff --git a/core/src/window_service.rs b/core/src/window_service.rs index 5e7d0e4bd5b0dc..9fccd86d6e8db6 100644 --- a/core/src/window_service.rs +++ b/core/src/window_service.rs @@ -483,7 +483,7 @@ mod test { use { super::*, solana_entry::entry::{create_ticks, Entry}, - solana_gossip::contact_info::ContactInfo, + solana_gossip::legacy_contact_info::LegacyContactInfo as ContactInfo, solana_ledger::{ blockstore::{make_many_slot_entries, Blockstore}, get_tmp_ledger_path, diff --git a/core/tests/snapshots.rs b/core/tests/snapshots.rs index 505ccb81d518ef..0e57371a37ce69 100644 --- a/core/tests/snapshots.rs +++ b/core/tests/snapshots.rs @@ -10,7 +10,9 @@ use { accounts_hash_verifier::AccountsHashVerifier, snapshot_packager_service::SnapshotPackagerService, }, - solana_gossip::{cluster_info::ClusterInfo, contact_info::ContactInfo}, + solana_gossip::{ + cluster_info::ClusterInfo, legacy_contact_info::LegacyContactInfo as ContactInfo, + }, solana_runtime::{ accounts_background_service::{ AbsRequestHandler, AbsRequestSender, AccountsBackgroundService, SnapshotRequestHandler, diff --git a/dos/src/main.rs b/dos/src/main.rs index f86ca781d710e0..fa9c897f966372 100644 --- a/dos/src/main.rs +++ b/dos/src/main.rs @@ -53,8 +53,8 @@ use { solana_core::serve_repair::{RepairProtocol, RepairRequestHeader, ServeRepair}, solana_dos::cli::*, solana_gossip::{ - contact_info::ContactInfo, gossip_service::{discover, get_multi_client}, + legacy_contact_info::LegacyContactInfo as ContactInfo, }, solana_measure::measure::Measure, solana_sdk::{ diff --git a/gossip/src/cluster_info.rs b/gossip/src/cluster_info.rs index a7ca2793dac1ac..6c72c03c8b6247 100644 --- a/gossip/src/cluster_info.rs +++ b/gossip/src/cluster_info.rs @@ -24,7 +24,6 @@ use { cluster_info_metrics::{ submit_gossip_stats, Counter, GossipStats, ScopedTimer, TimedGuard, }, - contact_info::ContactInfo, crds::{Crds, Cursor, GossipRoute}, crds_gossip::CrdsGossip, crds_gossip_error::CrdsGossipError, @@ -36,6 +35,7 @@ use { duplicate_shred::DuplicateShred, epoch_slots::EpochSlots, gossip_error::GossipError, + legacy_contact_info::LegacyContactInfo as ContactInfo, ping_pong::{self, PingCache, Pong}, socketaddr, socketaddr_any, weighted_shuffle::WeightedShuffle, @@ -267,7 +267,7 @@ pub fn make_accounts_hashes_message( pub(crate) type Ping = ping_pong::Ping<[u8; GOSSIP_PING_TOKEN_SIZE]>; // TODO These messages should go through the gpu pipeline for spam filtering -#[frozen_abi(digest = "C1nR7B7CgMyUYo6h3z2KXcS38JSwF6y8jmZ6Y9Cz7XEd")] +#[frozen_abi(digest = "32XMrR8yTPMsw7TASQDinrbcB4bdVGyLeTvQrk95hS4i")] #[derive(Serialize, Deserialize, Debug, AbiEnumVisitor, AbiExample)] #[allow(clippy::large_enum_variant)] pub(crate) enum Protocol { @@ -377,7 +377,7 @@ impl Sanitize for Protocol { fn retain_staked(values: &mut Vec, stakes: &HashMap) { values.retain(|value| { match value.data { - CrdsData::ContactInfo(_) => true, + CrdsData::LegacyContactInfo(_) => true, // May Impact new validators starting up without any stake yet. CrdsData::Vote(_, _) => true, // Unstaked nodes can still help repair. @@ -471,7 +471,7 @@ impl ClusterInfo { let now = timestamp(); self.my_contact_info.write().unwrap().wallclock = now; let entries: Vec<_> = vec![ - CrdsData::ContactInfo(self.my_contact_info()), + CrdsData::LegacyContactInfo(self.my_contact_info()), CrdsData::NodeInstance(self.instance.read().unwrap().with_wallclock(now)), ] .into_iter() @@ -524,7 +524,8 @@ impl ClusterInfo { // TODO kill insert_info, only used by tests pub fn insert_info(&self, contact_info: ContactInfo) { - let value = CrdsValue::new_signed(CrdsData::ContactInfo(contact_info), &self.keypair()); + let value = + CrdsValue::new_signed(CrdsData::LegacyContactInfo(contact_info), &self.keypair()); let mut gossip_crds = self.gossip.crds.write().unwrap(); let _ = gossip_crds.insert(value, timestamp(), GossipRoute::LocalMessage); } @@ -1359,7 +1360,7 @@ impl ClusterInfo { fn insert_self(&self) { let value = CrdsValue::new_signed( - CrdsData::ContactInfo(self.my_contact_info()), + CrdsData::LegacyContactInfo(self.my_contact_info()), &self.keypair(), ); let mut gossip_crds = self.gossip.crds.write().unwrap(); @@ -1495,7 +1496,7 @@ impl ClusterInfo { self.gossip.mark_pull_request_creation_time(peer.id, now); } } - let self_info = CrdsData::ContactInfo(self.my_contact_info()); + let self_info = CrdsData::LegacyContactInfo(self.my_contact_info()); let self_info = CrdsValue::new_signed(self_info, &self.keypair()); let pulls = pulls .into_iter() @@ -2033,7 +2034,7 @@ impl ClusterInfo { score }; let score = match response.data { - CrdsData::ContactInfo(_) => 2 * score, + CrdsData::LegacyContactInfo(_) => 2 * score, _ => score, }; ((addr, response), score) @@ -3081,7 +3082,7 @@ fn filter_on_shred_version( if crds.get_shred_version(from) == Some(self_shred_version) { values.retain(|value| match &value.data { // Allow contact-infos so that shred-versions are updated. - CrdsData::ContactInfo(_) => true, + CrdsData::LegacyContactInfo(_) => true, CrdsData::NodeInstance(_) => true, // Only retain values with the same shred version. _ => crds.get_shred_version(&value.pubkey()) == Some(self_shred_version), @@ -3090,7 +3091,7 @@ fn filter_on_shred_version( values.retain(|value| match &value.data { // Allow node to update its own contact info in case their // shred-version changes - CrdsData::ContactInfo(node) => node.id == *from, + CrdsData::LegacyContactInfo(node) => node.id == *from, CrdsData::NodeInstance(_) => true, _ => false, }) @@ -3103,7 +3104,7 @@ fn filter_on_shred_version( match &mut msg { Protocol::PullRequest(_, caller) => match &caller.data { // Allow spy nodes with shred-verion == 0 to pull from other nodes. - CrdsData::ContactInfo(node) + CrdsData::LegacyContactInfo(node) if node.shred_version == 0 || node.shred_version == self_shred_version => { Some(msg) @@ -3424,7 +3425,7 @@ RPC Enabled Nodes: 1"#; fn test_crds_values(pubkey: Pubkey) -> Vec { let entrypoint = ContactInfo::new_localhost(&pubkey, timestamp()); - let entrypoint_crdsvalue = CrdsValue::new_unsigned(CrdsData::ContactInfo(entrypoint)); + let entrypoint_crdsvalue = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(entrypoint)); vec![entrypoint_crdsvalue] } @@ -3627,7 +3628,7 @@ RPC Enabled Nodes: 1"#; let cluster_info = ClusterInfo::new(d, Arc::new(Keypair::new()), SocketAddrSpace::Unspecified); let d = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), timestamp()); - let label = CrdsValueLabel::ContactInfo(d.id); + let label = CrdsValueLabel::LegacyContactInfo(d.id); cluster_info.insert_info(d); let gossip_crds = cluster_info.gossip.crds.read().unwrap(); assert!(gossip_crds.get::<&CrdsValue>(&label).is_some()); @@ -4004,7 +4005,7 @@ RPC Enabled Nodes: 1"#; node.shred_version = 42; let epoch_slots = EpochSlots::new_rand(&mut rng, Some(node_pubkey)); let entries = vec![ - CrdsValue::new_unsigned(CrdsData::ContactInfo(node)), + CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(node)), CrdsValue::new_unsigned(CrdsData::EpochSlots(0, epoch_slots)), ]; { @@ -4061,7 +4062,7 @@ RPC Enabled Nodes: 1"#; } // now add this message back to the table and make sure after the next pull, the entrypoint is unset let entrypoint_crdsvalue = - CrdsValue::new_unsigned(CrdsData::ContactInfo(entrypoint.clone())); + CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(entrypoint.clone())); let cluster_info = Arc::new(cluster_info); let timeouts = cluster_info.gossip.make_timeouts( cluster_info.id(), @@ -4082,7 +4083,7 @@ RPC Enabled Nodes: 1"#; #[test] fn test_split_messages_small() { - let value = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::default())); + let value = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo::default())); test_split_messages(value); } @@ -4184,7 +4185,7 @@ RPC Enabled Nodes: 1"#; } fn check_pull_request_size(filter: CrdsFilter) { - let value = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::default())); + let value = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo::default())); let protocol = Protocol::PullRequest(filter, value); assert!(serialized_size(&protocol).unwrap() <= PACKET_DATA_SIZE as u64); } @@ -4351,7 +4352,7 @@ RPC Enabled Nodes: 1"#; .expect("unable to serialize default filter") as usize; let protocol = Protocol::PullRequest( CrdsFilter::default(), - CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::default())), + CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo::default())), ); let protocol_size = serialized_size(&protocol).expect("unable to serialize gossip protocol") as usize; @@ -4690,7 +4691,7 @@ RPC Enabled Nodes: 1"#; let mut rand_ci = ContactInfo::new_rand(&mut rng, Some(keypair.pubkey())); rand_ci.shred_version = shred_version; rand_ci.wallclock = timestamp(); - CrdsValue::new_signed(CrdsData::ContactInfo(rand_ci), &keypair) + CrdsValue::new_signed(CrdsData::LegacyContactInfo(rand_ci), &keypair) }) .take(NO_ENTRIES) .collect(); diff --git a/gossip/src/cluster_info_metrics.rs b/gossip/src/cluster_info_metrics.rs index 7026ec41b6984b..44f02577680418 100644 --- a/gossip/src/cluster_info_metrics.rs +++ b/gossip/src/cluster_info_metrics.rs @@ -613,8 +613,8 @@ pub(crate) fn submit_gossip_stats( ); datapoint_info!( "cluster_info_crds_stats", - ("ContactInfo-push", crds_stats.push.counts[0], i64), - ("ContactInfo-pull", crds_stats.pull.counts[0], i64), + ("LegacyContactInfo-push", crds_stats.push.counts[0], i64), + ("LegacyContactInfo-pull", crds_stats.pull.counts[0], i64), ("Vote-push", crds_stats.push.counts[1], i64), ("Vote-pull", crds_stats.pull.counts[1], i64), ("LowestSlot-push", crds_stats.push.counts[2], i64), @@ -656,8 +656,8 @@ pub(crate) fn submit_gossip_stats( ); datapoint_info!( "cluster_info_crds_stats_fails", - ("ContactInfo-push", crds_stats.push.fails[0], i64), - ("ContactInfo-pull", crds_stats.pull.fails[0], i64), + ("LegacyContactInfo-push", crds_stats.push.fails[0], i64), + ("LegacyContactInfo-pull", crds_stats.pull.fails[0], i64), ("Vote-push", crds_stats.push.fails[1], i64), ("Vote-pull", crds_stats.pull.fails[1], i64), ("LowestSlot-push", crds_stats.push.fails[2], i64), diff --git a/gossip/src/crds.rs b/gossip/src/crds.rs index 8507c44fbd78ef..9864182ec6beb1 100644 --- a/gossip/src/crds.rs +++ b/gossip/src/crds.rs @@ -26,10 +26,10 @@ use { crate::{ - contact_info::ContactInfo, crds_entry::CrdsEntry, crds_shards::CrdsShards, crds_value::{CrdsData, CrdsValue, CrdsValueLabel}, + legacy_contact_info::LegacyContactInfo as ContactInfo, }, bincode::serialize, indexmap::{ @@ -216,7 +216,7 @@ impl Crds { let entry_index = entry.index(); self.shards.insert(entry_index, &value); match &value.value.data { - CrdsData::ContactInfo(node) => { + CrdsData::LegacyContactInfo(node) => { self.nodes.insert(entry_index); self.shred_versions.insert(pubkey, node.shred_version); } @@ -243,11 +243,14 @@ impl Crds { self.shards.remove(entry_index, entry.get()); self.shards.insert(entry_index, &value); match &value.value.data { - CrdsData::ContactInfo(node) => { + CrdsData::LegacyContactInfo(node) => { self.shred_versions.insert(pubkey, node.shred_version); // self.nodes does not need to be updated since the // entry at this index was and stays contact-info. - debug_assert_matches!(entry.get().value.data, CrdsData::ContactInfo(_)); + debug_assert_matches!( + entry.get().value.data, + CrdsData::LegacyContactInfo(_) + ); } CrdsData::Vote(_, _) => { self.votes.remove(&entry.get().ordinal); @@ -307,7 +310,7 @@ impl Crds { /// Returns ContactInfo of all known nodes. pub(crate) fn get_nodes_contact_info(&self) -> impl Iterator { self.get_nodes().map(|v| match &v.value.data { - CrdsData::ContactInfo(info) => info, + CrdsData::LegacyContactInfo(info) => info, _ => panic!("this should not happen!"), }) } @@ -436,7 +439,7 @@ impl Crds { // It suffices to only overwrite the origin's timestamp since that is // used when purging old values. If the origin does not exist in the // table, fallback to exhaustive update on all associated records. - let origin = CrdsValueLabel::ContactInfo(*pubkey); + let origin = CrdsValueLabel::LegacyContactInfo(*pubkey); if let Some(origin) = self.table.get_mut(&origin) { if origin.local_timestamp < now { origin.local_timestamp = now; @@ -468,7 +471,7 @@ impl Crds { let timeout = timeouts.get(pubkey).copied().unwrap_or(default_timeout); // If the origin's contact-info hasn't expired yet then preserve // all associated values. - let origin = CrdsValueLabel::ContactInfo(*pubkey); + let origin = CrdsValueLabel::LegacyContactInfo(*pubkey); if let Some(origin) = self.table.get(&origin) { if now < origin.local_timestamp.saturating_add(timeout) { return vec![]; @@ -503,7 +506,7 @@ impl Crds { self.purged.push_back((value.value_hash, now)); self.shards.remove(index, &value); match value.value.data { - CrdsData::ContactInfo(_) => { + CrdsData::LegacyContactInfo(_) => { self.nodes.swap_remove(&index); } CrdsData::Vote(_, _) => { @@ -540,7 +543,7 @@ impl Crds { self.shards.remove(size, value); self.shards.insert(index, value); match value.value.data { - CrdsData::ContactInfo(_) => { + CrdsData::LegacyContactInfo(_) => { self.nodes.swap_remove(&size); self.nodes.insert(index); } @@ -674,7 +677,7 @@ impl CrdsDataStats { fn ordinal(entry: &VersionedCrdsValue) -> usize { match &entry.value.data { - CrdsData::ContactInfo(_) => 0, + CrdsData::LegacyContactInfo(_) => 0, CrdsData::Vote(_, _) => 1, CrdsData::LowestSlot(_, _) => 2, CrdsData::SnapshotHashes(_) => 3, @@ -714,8 +717,8 @@ mod tests { use { super::*, crate::{ - contact_info::ContactInfo, crds_value::{new_rand_timestamp, NodeInstance, SnapshotHashes}, + socketaddr, }, rand::{thread_rng, Rng, SeedableRng}, rand_chacha::ChaChaRng, @@ -730,7 +733,7 @@ mod tests { #[test] fn test_insert() { let mut crds = Crds::default(); - let val = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::default())); + let val = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo::default())); assert_eq!( crds.insert(val.clone(), 0, GossipRoute::LocalMessage), Ok(()) @@ -742,7 +745,7 @@ mod tests { #[test] fn test_update_old() { let mut crds = Crds::default(); - let val = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::default())); + let val = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo::default())); assert_eq!( crds.insert(val.clone(), 0, GossipRoute::LocalMessage), Ok(()) @@ -757,13 +760,12 @@ mod tests { #[test] fn test_update_new() { let mut crds = Crds::default(); - let original = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( - &Pubkey::default(), - 0, - ))); + let original = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo( + ContactInfo::new_localhost(&Pubkey::default(), 0), + )); let value_hash = hash(&serialize(&original).unwrap()); assert_matches!(crds.insert(original, 0, GossipRoute::LocalMessage), Ok(())); - let val = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( + let val = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo::new_localhost( &Pubkey::default(), 1, ))); @@ -777,7 +779,7 @@ mod tests { #[test] fn test_update_timestamp() { let mut crds = Crds::default(); - let val = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( + let val = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo::new_localhost( &Pubkey::default(), 0, ))); @@ -787,7 +789,7 @@ mod tests { ); assert_eq!(crds.table[&val.label()].ordinal, 0); - let val2 = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::default())); + let val2 = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo::default())); let value_hash = hash(&serialize(&val2).unwrap()); assert_eq!(val2.label().pubkey(), val.label().pubkey()); assert_eq!( @@ -807,7 +809,7 @@ mod tests { let mut ci = ContactInfo::default(); ci.wallclock += 1; - let val3 = CrdsValue::new_unsigned(CrdsData::ContactInfo(ci)); + let val3 = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ci)); assert_eq!(crds.insert(val3, 3, GossipRoute::LocalMessage), Ok(())); assert_eq!(*crds.purged.back().unwrap(), (value_hash, 3)); assert_eq!(crds.table[&val2.label()].local_timestamp, 3); @@ -876,7 +878,7 @@ mod tests { fn test_find_old_records_default() { let thread_pool = ThreadPoolBuilder::new().build().unwrap(); let mut crds = Crds::default(); - let val = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::default())); + let val = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo::default())); assert_eq!( crds.insert(val.clone(), 1, GossipRoute::LocalMessage), Ok(()) @@ -928,7 +930,7 @@ mod tests { fn test_remove_default() { let thread_pool = ThreadPoolBuilder::new().build().unwrap(); let mut crds = Crds::default(); - let val = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::default())); + let val = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo::default())); assert_matches!( crds.insert(val.clone(), 1, GossipRoute::LocalMessage), Ok(_) @@ -946,7 +948,7 @@ mod tests { fn test_find_old_records_staked() { let thread_pool = ThreadPoolBuilder::new().build().unwrap(); let mut crds = Crds::default(); - let val = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::default())); + let val = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo::default())); assert_eq!( crds.insert(val.clone(), 1, GossipRoute::LocalMessage), Ok(()) @@ -1099,7 +1101,7 @@ mod tests { let num_nodes = crds .table .values() - .filter(|v| matches!(v.value.data, CrdsData::ContactInfo(_))) + .filter(|v| matches!(v.value.data, CrdsData::LegacyContactInfo(_))) .count(); let num_votes = crds .table @@ -1229,7 +1231,7 @@ mod tests { let mut node = ContactInfo::new_rand(&mut rng, Some(pubkey)); let wallclock = node.wallclock; node.shred_version = 42; - let node = CrdsData::ContactInfo(node); + let node = CrdsData::LegacyContactInfo(node); let node = CrdsValue::new_unsigned(node); assert_eq!( crds.insert(node, timestamp(), GossipRoute::LocalMessage), @@ -1240,7 +1242,7 @@ mod tests { let mut node = ContactInfo::new_rand(&mut rng, Some(pubkey)); node.wallclock = wallclock - 1; // outdated. node.shred_version = 8; - let node = CrdsData::ContactInfo(node); + let node = CrdsData::LegacyContactInfo(node); let node = CrdsValue::new_unsigned(node); assert_eq!( crds.insert(node, timestamp(), GossipRoute::LocalMessage), @@ -1251,7 +1253,7 @@ mod tests { let mut node = ContactInfo::new_rand(&mut rng, Some(pubkey)); node.wallclock = wallclock + 1; // so that it overrides the prev one. node.shred_version = 8; - let node = CrdsData::ContactInfo(node); + let node = CrdsData::LegacyContactInfo(node); let node = CrdsValue::new_unsigned(node); assert_eq!( crds.insert(node, timestamp(), GossipRoute::LocalMessage), @@ -1269,7 +1271,7 @@ mod tests { assert_eq!(crds.get_shred_version(&pubkey), Some(8)); // Remove contact-info. Shred version should stay there since there // are still values associated with the pubkey. - crds.remove(&CrdsValueLabel::ContactInfo(pubkey), timestamp()); + crds.remove(&CrdsValueLabel::LegacyContactInfo(pubkey), timestamp()); assert_eq!(crds.get::<&ContactInfo>(pubkey), None); assert_eq!(crds.get_shred_version(&pubkey), Some(8)); // Remove the remaining entry with the same pubkey. @@ -1342,7 +1344,7 @@ mod tests { fn test_remove_staked() { let thread_pool = ThreadPoolBuilder::new().build().unwrap(); let mut crds = Crds::default(); - let val = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::default())); + let val = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo::default())); assert_matches!( crds.insert(val.clone(), 1, GossipRoute::LocalMessage), Ok(_) @@ -1363,7 +1365,7 @@ mod tests { #[test] #[allow(clippy::neg_cmp_op_on_partial_ord)] fn test_equal() { - let val = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::default())); + let val = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo::default())); let v1 = VersionedCrdsValue::new(val.clone(), Cursor::default(), 1); let v2 = VersionedCrdsValue::new(val, Cursor::default(), 1); assert_eq!(v1, v2); @@ -1375,7 +1377,7 @@ mod tests { #[allow(clippy::neg_cmp_op_on_partial_ord)] fn test_hash_order() { let v1 = VersionedCrdsValue::new( - CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( + CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo::new_localhost( &Pubkey::default(), 0, ))), @@ -1386,7 +1388,7 @@ mod tests { { let mut contact_info = ContactInfo::new_localhost(&Pubkey::default(), 0); contact_info.rpc = socketaddr!("0.0.0.0:0"); - CrdsValue::new_unsigned(CrdsData::ContactInfo(contact_info)) + CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(contact_info)) }, Cursor::default(), 1, // local_timestamp @@ -1409,7 +1411,7 @@ mod tests { #[allow(clippy::neg_cmp_op_on_partial_ord)] fn test_wallclock_order() { let v1 = VersionedCrdsValue::new( - CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( + CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo::new_localhost( &Pubkey::default(), 1, ))), @@ -1417,7 +1419,7 @@ mod tests { 1, // local_timestamp ); let v2 = VersionedCrdsValue::new( - CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( + CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo::new_localhost( &Pubkey::default(), 0, ))), @@ -1435,7 +1437,7 @@ mod tests { #[allow(clippy::neg_cmp_op_on_partial_ord)] fn test_label_order() { let v1 = VersionedCrdsValue::new( - CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( + CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo::new_localhost( &solana_sdk::pubkey::new_rand(), 0, ))), @@ -1443,7 +1445,7 @@ mod tests { 1, // local_timestamp ); let v2 = VersionedCrdsValue::new( - CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( + CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo::new_localhost( &solana_sdk::pubkey::new_rand(), 0, ))), diff --git a/gossip/src/crds_entry.rs b/gossip/src/crds_entry.rs index c2b5235b80ed3c..0d0b0281504c5a 100644 --- a/gossip/src/crds_entry.rs +++ b/gossip/src/crds_entry.rs @@ -1,11 +1,11 @@ use { crate::{ - contact_info::ContactInfo, crds::VersionedCrdsValue, crds_value::{ CrdsData, CrdsValue, CrdsValueLabel, IncrementalSnapshotHashes, LegacyVersion, LowestSlot, SnapshotHashes, Version, }, + legacy_contact_info::LegacyContactInfo, }, indexmap::IndexMap, solana_sdk::pubkey::Pubkey, @@ -53,7 +53,7 @@ impl_crds_entry!(CrdsValue, |entry| Some(&entry?.value)); impl_crds_entry!(VersionedCrdsValue, |entry| entry); // Lookup by Pubkey. -impl_crds_entry!(ContactInfo, CrdsData::ContactInfo(node), node); +impl_crds_entry!(LegacyContactInfo, CrdsData::LegacyContactInfo(node), node); impl_crds_entry!(LegacyVersion, CrdsData::LegacyVersion(version), version); impl_crds_entry!(LowestSlot, CrdsData::LowestSlot(_, slot), slot); impl_crds_entry!(Version, CrdsData::Version(version), version); @@ -114,8 +114,8 @@ mod tests { assert_eq!(crds.get::<&VersionedCrdsValue>(&key).unwrap().value, *entry); let key = entry.pubkey(); match &entry.data { - CrdsData::ContactInfo(node) => { - assert_eq!(crds.get::<&ContactInfo>(key), Some(node)) + CrdsData::LegacyContactInfo(node) => { + assert_eq!(crds.get::<&LegacyContactInfo>(key), Some(node)) } CrdsData::LowestSlot(_, slot) => { assert_eq!(crds.get::<&LowestSlot>(key), Some(slot)) diff --git a/gossip/src/crds_gossip.rs b/gossip/src/crds_gossip.rs index f3620c83410b90..3c8ad948aaeaa0 100644 --- a/gossip/src/crds_gossip.rs +++ b/gossip/src/crds_gossip.rs @@ -8,13 +8,13 @@ use { crate::{ cluster_info::Ping, cluster_info_metrics::GossipStats, - contact_info::ContactInfo, crds::{Crds, GossipRoute}, crds_gossip_error::CrdsGossipError, crds_gossip_pull::{CrdsFilter, CrdsGossipPull, ProcessPullStats}, crds_gossip_push::{CrdsGossipPush, CRDS_GOSSIP_NUM_ACTIVE}, crds_value::{CrdsData, CrdsValue}, duplicate_shred::{self, DuplicateShredIndex, LeaderScheduleFn, MAX_DUPLICATE_SHREDS}, + legacy_contact_info::LegacyContactInfo as ContactInfo, ping_pong::PingCache, }, itertools::Itertools, @@ -379,7 +379,7 @@ where mod test { use { super::*, - crate::{contact_info::ContactInfo, crds_value::CrdsData}, + crate::crds_value::CrdsData, solana_sdk::{hash::hash, timing::timestamp}, }; @@ -395,7 +395,7 @@ mod test { .write() .unwrap() .insert( - CrdsValue::new_unsigned(CrdsData::ContactInfo(ci.clone())), + CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ci.clone())), 0, GossipRoute::LocalMessage, ) diff --git a/gossip/src/crds_gossip_pull.rs b/gossip/src/crds_gossip_pull.rs index 7be82fa23879ed..0288e98a019880 100644 --- a/gossip/src/crds_gossip_pull.rs +++ b/gossip/src/crds_gossip_pull.rs @@ -15,11 +15,11 @@ use { crate::{ cluster_info::{Ping, CRDS_UNIQUE_PUBKEY_CAPACITY}, cluster_info_metrics::GossipStats, - contact_info::ContactInfo, crds::{Crds, GossipRoute, VersionedCrdsValue}, crds_gossip::{self, get_stake, get_weight}, crds_gossip_error::CrdsGossipError, crds_value::CrdsValue, + legacy_contact_info::LegacyContactInfo as ContactInfo, ping_pong::PingCache, }, itertools::Itertools, @@ -662,8 +662,8 @@ pub(crate) mod tests { super::*, crate::{ cluster_info::MAX_BLOOM_SIZE, - contact_info::ContactInfo, crds_value::{CrdsData, Vote}, + socketaddr, }, itertools::Itertools, rand::{seq::SliceRandom, thread_rng, SeedableRng}, @@ -722,17 +722,16 @@ pub(crate) mod tests { let mut crds = Crds::default(); let mut stakes = HashMap::new(); let node = CrdsGossipPull::default(); - let me = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( + let me = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo::new_localhost( &solana_sdk::pubkey::new_rand(), 0, ))); crds.insert(me.clone(), 0, GossipRoute::LocalMessage) .unwrap(); for i in 1..=30 { - let entry = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( - &solana_sdk::pubkey::new_rand(), - 0, - ))); + let entry = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo( + ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), 0), + )); let id = entry.label().pubkey(); crds.insert(entry.clone(), 0, GossipRoute::LocalMessage) .unwrap(); @@ -763,25 +762,25 @@ pub(crate) mod tests { let gossip = socketaddr!("127.0.0.1:1234"); - let me = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo { + let me = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo { id: solana_sdk::pubkey::new_rand(), shred_version: 123, gossip, ..ContactInfo::default() })); - let spy = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo { + let spy = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo { id: solana_sdk::pubkey::new_rand(), shred_version: 0, gossip, ..ContactInfo::default() })); - let node_123 = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo { + let node_123 = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo { id: solana_sdk::pubkey::new_rand(), shred_version: 123, gossip, ..ContactInfo::default() })); - let node_456 = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo { + let node_456 = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo { id: solana_sdk::pubkey::new_rand(), shred_version: 456, gossip, @@ -843,12 +842,12 @@ pub(crate) mod tests { let node = CrdsGossipPull::default(); let gossip = socketaddr!("127.0.0.1:1234"); - let me = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo { + let me = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo { id: solana_sdk::pubkey::new_rand(), gossip, ..ContactInfo::default() })); - let node_123 = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo { + let node_123 = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo { id: solana_sdk::pubkey::new_rand(), gossip, ..ContactInfo::default() @@ -1006,10 +1005,9 @@ pub(crate) mod tests { let thread_pool = ThreadPoolBuilder::new().build().unwrap(); let crds = RwLock::::default(); let node_keypair = Keypair::new(); - let entry = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( - &node_keypair.pubkey(), - 0, - ))); + let entry = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo( + ContactInfo::new_localhost(&node_keypair.pubkey(), 0), + )); let node = CrdsGossipPull::default(); let mut pings = Vec::new(); let ping_cache = Mutex::new(PingCache::new( @@ -1060,7 +1058,7 @@ pub(crate) mod tests { .lock() .unwrap() .mock_pong(new.id, new.gossip, Instant::now()); - let new = CrdsValue::new_unsigned(CrdsData::ContactInfo(new)); + let new = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(new)); crds.write() .unwrap() .insert(new.clone(), now, GossipRoute::LocalMessage) @@ -1083,7 +1081,7 @@ pub(crate) mod tests { node.mark_pull_request_creation_time(new.contact_info().unwrap().id, now); let offline = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), now); - let offline = CrdsValue::new_unsigned(CrdsData::ContactInfo(offline)); + let offline = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(offline)); crds.write() .unwrap() .insert(offline, now, GossipRoute::LocalMessage) @@ -1118,20 +1116,19 @@ pub(crate) mod tests { ); let mut crds = Crds::default(); let node_keypair = Keypair::new(); - let entry = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( - &node_keypair.pubkey(), - 0, - ))); + let entry = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo( + ContactInfo::new_localhost(&node_keypair.pubkey(), 0), + )); let node = CrdsGossipPull::default(); crds.insert(entry, now, GossipRoute::LocalMessage).unwrap(); let old = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), 0); ping_cache.mock_pong(old.id, old.gossip, Instant::now()); - let old = CrdsValue::new_unsigned(CrdsData::ContactInfo(old)); + let old = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(old)); crds.insert(old.clone(), now, GossipRoute::LocalMessage) .unwrap(); let new = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), 0); ping_cache.mock_pong(new.id, new.gossip, Instant::now()); - let new = CrdsValue::new_unsigned(CrdsData::ContactInfo(new)); + let new = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(new)); crds.insert(new.clone(), now, GossipRoute::LocalMessage) .unwrap(); let crds = RwLock::new(crds); @@ -1216,10 +1213,9 @@ pub(crate) mod tests { Duration::from_secs(20 * 60) / 64, // rate_limit_delay 128, // capacity ); - let entry = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( - &node_keypair.pubkey(), - 0, - ))); + let entry = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo( + ContactInfo::new_localhost(&node_keypair.pubkey(), 0), + )); let caller = entry.clone(); let node = CrdsGossipPull::default(); node_crds @@ -1227,7 +1223,7 @@ pub(crate) mod tests { .unwrap(); let new = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), 0); ping_cache.mock_pong(new.id, new.gossip, Instant::now()); - let new = CrdsValue::new_unsigned(CrdsData::ContactInfo(new)); + let new = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(new)); node_crds.insert(new, 0, GossipRoute::LocalMessage).unwrap(); let node_crds = RwLock::new(node_crds); let mut pings = Vec::new(); @@ -1259,7 +1255,7 @@ pub(crate) mod tests { assert_eq!(rsp[0].len(), 0); - let new = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( + let new = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo::new_localhost( &solana_sdk::pubkey::new_rand(), CRDS_GOSSIP_PULL_MSG_TIMEOUT_MS, ))); @@ -1288,7 +1284,7 @@ pub(crate) mod tests { // Should return new value since caller is new. let now = CRDS_GOSSIP_PULL_MSG_TIMEOUT_MS + 1; let caller = ContactInfo::new_localhost(&Pubkey::new_unique(), now); - let caller = CrdsValue::new_unsigned(CrdsData::ContactInfo(caller)); + let caller = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(caller)); filters .iter() .map(|(_, filter)| (caller.clone(), filter.clone())) @@ -1315,10 +1311,9 @@ pub(crate) mod tests { let thread_pool = ThreadPoolBuilder::new().build().unwrap(); let node_keypair = Keypair::new(); let mut node_crds = Crds::default(); - let entry = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( - &node_keypair.pubkey(), - 0, - ))); + let entry = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo( + ContactInfo::new_localhost(&node_keypair.pubkey(), 0), + )); let caller = entry.clone(); let node = CrdsGossipPull::default(); node_crds @@ -1331,7 +1326,7 @@ pub(crate) mod tests { ); let new = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), 0); ping_cache.mock_pong(new.id, new.gossip, Instant::now()); - let new = CrdsValue::new_unsigned(CrdsData::ContactInfo(new)); + let new = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(new)); node_crds.insert(new, 0, GossipRoute::LocalMessage).unwrap(); let node_crds = RwLock::new(node_crds); let mut pings = Vec::new(); @@ -1375,10 +1370,9 @@ pub(crate) mod tests { let thread_pool = ThreadPoolBuilder::new().build().unwrap(); let node_keypair = Keypair::new(); let mut node_crds = Crds::default(); - let entry = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( - &node_keypair.pubkey(), - 1, - ))); + let entry = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo( + ContactInfo::new_localhost(&node_keypair.pubkey(), 1), + )); let caller = entry.clone(); let node_pubkey = entry.label().pubkey(); let node = CrdsGossipPull::default(); @@ -1392,14 +1386,14 @@ pub(crate) mod tests { ); let new = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), 1); ping_cache.mock_pong(new.id, new.gossip, Instant::now()); - let new = CrdsValue::new_unsigned(CrdsData::ContactInfo(new)); + let new = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(new)); node_crds.insert(new, 0, GossipRoute::LocalMessage).unwrap(); let mut dest_crds = Crds::default(); let new_id = solana_sdk::pubkey::new_rand(); let new = ContactInfo::new_localhost(&new_id, 1); ping_cache.mock_pong(new.id, new.gossip, Instant::now()); - let new = CrdsValue::new_unsigned(CrdsData::ContactInfo(new)); + let new = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(new)); dest_crds .insert(new.clone(), 0, GossipRoute::LocalMessage) .unwrap(); @@ -1408,7 +1402,7 @@ pub(crate) mod tests { // node contains a key from the dest node, but at an older local timestamp let same_key = ContactInfo::new_localhost(&new_id, 0); ping_cache.mock_pong(same_key.id, same_key.gossip, Instant::now()); - let same_key = CrdsValue::new_unsigned(CrdsData::ContactInfo(same_key)); + let same_key = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(same_key)); assert_eq!(same_key.label(), new.label()); assert!(same_key.wallclock() < new.wallclock()); node_crds @@ -1492,17 +1486,16 @@ pub(crate) mod tests { fn test_gossip_purge() { let thread_pool = ThreadPoolBuilder::new().build().unwrap(); let mut node_crds = Crds::default(); - let entry = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( - &solana_sdk::pubkey::new_rand(), - 0, - ))); + let entry = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo( + ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), 0), + )); let node_label = entry.label(); let node_pubkey = node_label.pubkey(); let node = CrdsGossipPull::default(); node_crds .insert(entry, 0, GossipRoute::LocalMessage) .unwrap(); - let old = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( + let old = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo::new_localhost( &solana_sdk::pubkey::new_rand(), 0, ))); @@ -1632,7 +1625,7 @@ pub(crate) mod tests { let node = CrdsGossipPull::default(); let peer_pubkey = solana_sdk::pubkey::new_rand(); - let peer_entry = CrdsValue::new_unsigned(CrdsData::ContactInfo( + let peer_entry = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo( ContactInfo::new_localhost(&peer_pubkey, 0), )); let mut timeouts = HashMap::new(); @@ -1652,7 +1645,7 @@ pub(crate) mod tests { ); let node_crds = RwLock::::default(); - let unstaked_peer_entry = CrdsValue::new_unsigned(CrdsData::ContactInfo( + let unstaked_peer_entry = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo( ContactInfo::new_localhost(&peer_pubkey, 0), )); // check that old contact infos fail if they are too old, regardless of "timeouts" diff --git a/gossip/src/crds_gossip_push.rs b/gossip/src/crds_gossip_push.rs index a5db5cbd1a6b22..ae67027e96a1ca 100644 --- a/gossip/src/crds_gossip_push.rs +++ b/gossip/src/crds_gossip_push.rs @@ -14,10 +14,10 @@ use { crate::{ cluster_info::{Ping, CRDS_UNIQUE_PUBKEY_CAPACITY}, - contact_info::ContactInfo, crds::{Crds, Cursor, GossipRoute}, crds_gossip::{self, get_stake, get_weight}, crds_value::CrdsValue, + legacy_contact_info::LegacyContactInfo as ContactInfo, ping_pong::PingCache, weighted_shuffle::WeightedShuffle, }, @@ -521,7 +521,7 @@ impl CrdsGossipPush { mod tests { use { super::*, - crate::{contact_info::ContactInfo, crds_value::CrdsData}, + crate::{crds_value::CrdsData, socketaddr}, std::time::Duration, }; @@ -544,9 +544,9 @@ mod tests { stakes.insert(self_id, 100); stakes.insert(origin, 100); - let value = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( - &origin, 0, - ))); + let value = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo( + ContactInfo::new_localhost(&origin, 0), + )); let low_staked_peers = (0..10).map(|_| solana_sdk::pubkey::new_rand()); let mut low_staked_set = HashSet::new(); low_staked_peers.for_each(|p| { @@ -599,10 +599,9 @@ mod tests { fn test_process_push_one() { let crds = RwLock::::default(); let push = CrdsGossipPush::default(); - let value = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( - &solana_sdk::pubkey::new_rand(), - 0, - ))); + let value = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo( + ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), 0), + )); let label = value.label(); // push a new message assert_eq!( @@ -622,7 +621,7 @@ mod tests { let push = CrdsGossipPush::default(); let mut ci = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), 0); ci.wallclock = 1; - let value = CrdsValue::new_unsigned(CrdsData::ContactInfo(ci.clone())); + let value = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ci.clone())); // push a new message assert_eq!( @@ -632,7 +631,7 @@ mod tests { // push an old version ci.wallclock = 0; - let value = CrdsValue::new_unsigned(CrdsData::ContactInfo(ci)); + let value = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ci)); assert!(push .process_push_message(&crds, vec![(Pubkey::default(), vec![value])], 0) .is_empty()); @@ -646,14 +645,14 @@ mod tests { // push a version to far in the future ci.wallclock = timeout + 1; - let value = CrdsValue::new_unsigned(CrdsData::ContactInfo(ci.clone())); + let value = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ci.clone())); assert!(push .process_push_message(&crds, vec![(Pubkey::default(), vec![value])], 0) .is_empty()); // push a version to far in the past ci.wallclock = 0; - let value = CrdsValue::new_unsigned(CrdsData::ContactInfo(ci)); + let value = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ci)); assert!(push .process_push_message(&crds, vec![(Pubkey::default(), vec![value])], timeout + 1) .is_empty()); @@ -665,7 +664,7 @@ mod tests { let mut ci = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), 0); let origin = ci.id; ci.wallclock = 0; - let value_old = CrdsValue::new_unsigned(CrdsData::ContactInfo(ci.clone())); + let value_old = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ci.clone())); // push a new message assert_eq!( @@ -675,7 +674,7 @@ mod tests { // push an old version ci.wallclock = 1; - let value = CrdsValue::new_unsigned(CrdsData::ContactInfo(ci)); + let value = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ci)); assert_eq!( push.process_push_message(&crds, vec![(Pubkey::default(), vec![value])], 0), [origin].into_iter().collect() @@ -697,7 +696,7 @@ mod tests { let mut ping_cache = new_ping_cache(); let value1 = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), 0); ping_cache.mock_pong(value1.id, value1.gossip, Instant::now()); - let value1 = CrdsValue::new_unsigned(CrdsData::ContactInfo(value1)); + let value1 = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(value1)); assert_eq!( crds.insert(value1.clone(), now, GossipRoute::LocalMessage), @@ -727,7 +726,7 @@ mod tests { .lock() .unwrap() .mock_pong(value2.id, value2.gossip, Instant::now()); - let value2 = CrdsValue::new_unsigned(CrdsData::ContactInfo(value2)); + let value2 = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(value2)); assert!(active_set.get(&value2.label().pubkey()).is_none()); drop(active_set); assert_eq!( @@ -765,7 +764,7 @@ mod tests { .lock() .unwrap() .mock_pong(value2.id, value2.gossip, Instant::now()); - let value2 = CrdsValue::new_unsigned(CrdsData::ContactInfo(value2)); + let value2 = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(value2)); assert_eq!( crds.write() .unwrap() @@ -796,10 +795,9 @@ mod tests { let push = CrdsGossipPush::default(); let mut stakes = HashMap::new(); for i in 1..=100 { - let peer = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( - &solana_sdk::pubkey::new_rand(), - time, - ))); + let peer = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo( + ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), time), + )); let id = peer.label().pubkey(); crds.insert(peer.clone(), time, GossipRoute::LocalMessage) .unwrap(); @@ -830,25 +828,25 @@ mod tests { let gossip = socketaddr!("127.0.0.1:1234"); - let me = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo { + let me = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo { id: solana_sdk::pubkey::new_rand(), shred_version: 123, gossip, ..ContactInfo::default() })); - let spy = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo { + let spy = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo { id: solana_sdk::pubkey::new_rand(), shred_version: 0, gossip, ..ContactInfo::default() })); - let node_123 = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo { + let node_123 = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo { id: solana_sdk::pubkey::new_rand(), shred_version: 123, gossip, ..ContactInfo::default() })); - let node_456 = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo { + let node_456 = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo { id: solana_sdk::pubkey::new_rand(), shred_version: 456, gossip, @@ -902,12 +900,12 @@ mod tests { let node = CrdsGossipPush::default(); let gossip = socketaddr!("127.0.0.1:1234"); - let me = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo { + let me = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo { id: solana_sdk::pubkey::new_rand(), gossip, ..ContactInfo::default() })); - let node_123 = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo { + let node_123 = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ContactInfo { id: solana_sdk::pubkey::new_rand(), gossip, ..ContactInfo::default() @@ -967,7 +965,7 @@ mod tests { let mut ping_cache = new_ping_cache(); let peer = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), 0); ping_cache.mock_pong(peer.id, peer.gossip, Instant::now()); - let peer = CrdsValue::new_unsigned(CrdsData::ContactInfo(peer)); + let peer = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(peer)); assert_eq!( crds.insert(peer.clone(), now, GossipRoute::LocalMessage), Ok(()) @@ -987,10 +985,9 @@ mod tests { &SocketAddrSpace::Unspecified, ); - let new_msg = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( - &solana_sdk::pubkey::new_rand(), - 0, - ))); + let new_msg = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo( + ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), 0), + )); let mut expected = HashMap::new(); expected.insert(peer.label().pubkey(), vec![new_msg.clone()]); let origin = new_msg.pubkey(); @@ -1014,7 +1011,7 @@ mod tests { let mut peer = ContactInfo::new_rand(&mut rng, /*pubkey=*/ None); peer.wallclock = wallclock; ping_cache.mock_pong(peer.id, peer.gossip, Instant::now()); - CrdsValue::new_unsigned(CrdsData::ContactInfo(peer)) + CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(peer)) }) .collect(); let origin: Vec<_> = peers.iter().map(|node| node.pubkey()).collect(); @@ -1064,10 +1061,9 @@ mod tests { let mut crds = Crds::default(); let self_id = solana_sdk::pubkey::new_rand(); let push = CrdsGossipPush::default(); - let peer = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( - &solana_sdk::pubkey::new_rand(), - 0, - ))); + let peer = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo( + ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), 0), + )); assert_eq!( crds.insert(peer.clone(), 0, GossipRoute::LocalMessage), Ok(()) @@ -1087,10 +1083,9 @@ mod tests { &SocketAddrSpace::Unspecified, ); - let new_msg = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( - &solana_sdk::pubkey::new_rand(), - 0, - ))); + let new_msg = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo( + ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), 0), + )); let expected = HashMap::new(); let origin = new_msg.pubkey(); assert_eq!( @@ -1108,10 +1103,9 @@ mod tests { fn test_purge_old_pending_push_messages() { let mut crds = Crds::default(); let push = CrdsGossipPush::default(); - let peer = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( - &solana_sdk::pubkey::new_rand(), - 0, - ))); + let peer = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo( + ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), 0), + )); assert_eq!(crds.insert(peer, 0, GossipRoute::LocalMessage), Ok(())); let crds = RwLock::new(crds); let ping_cache = Mutex::new(new_ping_cache()); @@ -1130,7 +1124,7 @@ mod tests { let mut ci = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), 0); ci.wallclock = 1; - let new_msg = CrdsValue::new_unsigned(CrdsData::ContactInfo(ci)); + let new_msg = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ci)); let expected = HashMap::new(); let origin = new_msg.pubkey(); assert_eq!( @@ -1146,7 +1140,7 @@ mod tests { let push = CrdsGossipPush::default(); let mut ci = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), 0); ci.wallclock = 0; - let value = CrdsValue::new_unsigned(CrdsData::ContactInfo(ci)); + let value = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ci)); let label = value.label(); // push a new message assert_eq!( diff --git a/gossip/src/crds_value.rs b/gossip/src/crds_value.rs index 1e40a2954eb950..ec63ac51399ba6 100644 --- a/gossip/src/crds_value.rs +++ b/gossip/src/crds_value.rs @@ -1,10 +1,10 @@ use { crate::{ cluster_info::MAX_SNAPSHOT_HASHES, - contact_info::ContactInfo, deprecated, duplicate_shred::{DuplicateShred, DuplicateShredIndex, MAX_DUPLICATE_SHREDS}, epoch_slots::EpochSlots, + legacy_contact_info::LegacyContactInfo, }, bincode::{serialize, serialized_size}, rand::{CryptoRng, Rng}, @@ -81,7 +81,7 @@ impl Signable for CrdsValue { #[allow(clippy::large_enum_variant)] #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, AbiExample, AbiEnumVisitor)] pub enum CrdsData { - ContactInfo(ContactInfo), + LegacyContactInfo(LegacyContactInfo), Vote(VoteIndex, Vote), LowestSlot(/*DEPRECATED:*/ u8, LowestSlot), SnapshotHashes(SnapshotHashes), @@ -97,7 +97,7 @@ pub enum CrdsData { impl Sanitize for CrdsData { fn sanitize(&self) -> Result<(), SanitizeError> { match self { - CrdsData::ContactInfo(val) => val.sanitize(), + CrdsData::LegacyContactInfo(val) => val.sanitize(), CrdsData::Vote(ix, val) => { if *ix >= MAX_VOTES { return Err(SanitizeError::ValueOutOfBounds); @@ -147,7 +147,7 @@ impl CrdsData { // TODO: Assign ranges to each arm proportional to their frequency in // the mainnet crds table. match kind { - 0 => CrdsData::ContactInfo(ContactInfo::new_rand(rng, pubkey)), + 0 => CrdsData::LegacyContactInfo(LegacyContactInfo::new_rand(rng, pubkey)), // Index for LowestSlot is deprecated and should be zero. 1 => CrdsData::LowestSlot(0, LowestSlot::new_rand(rng, pubkey)), 2 => CrdsData::SnapshotHashes(SnapshotHashes::new_rand(rng, pubkey)), @@ -481,7 +481,7 @@ impl Sanitize for NodeInstance { /// These are labels for values in a record that is associated with `Pubkey` #[derive(PartialEq, Hash, Eq, Clone, Debug)] pub enum CrdsValueLabel { - ContactInfo(Pubkey), + LegacyContactInfo(Pubkey), Vote(VoteIndex, Pubkey), LowestSlot(Pubkey), SnapshotHashes(Pubkey), @@ -497,7 +497,9 @@ pub enum CrdsValueLabel { impl fmt::Display for CrdsValueLabel { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - CrdsValueLabel::ContactInfo(_) => write!(f, "ContactInfo({})", self.pubkey()), + CrdsValueLabel::LegacyContactInfo(_) => { + write!(f, "LegacyContactInfo({})", self.pubkey()) + } CrdsValueLabel::Vote(ix, _) => write!(f, "Vote({}, {})", ix, self.pubkey()), CrdsValueLabel::LowestSlot(_) => write!(f, "LowestSlot({})", self.pubkey()), CrdsValueLabel::SnapshotHashes(_) => write!(f, "SnapshotHashes({})", self.pubkey()), @@ -517,7 +519,7 @@ impl fmt::Display for CrdsValueLabel { impl CrdsValueLabel { pub fn pubkey(&self) -> Pubkey { match self { - CrdsValueLabel::ContactInfo(p) => *p, + CrdsValueLabel::LegacyContactInfo(p) => *p, CrdsValueLabel::Vote(_, p) => *p, CrdsValueLabel::LowestSlot(p) => *p, CrdsValueLabel::SnapshotHashes(p) => *p, @@ -566,7 +568,7 @@ impl CrdsValue { /// This is used to time out push messages. pub fn wallclock(&self) -> u64 { match &self.data { - CrdsData::ContactInfo(contact_info) => contact_info.wallclock, + CrdsData::LegacyContactInfo(contact_info) => contact_info.wallclock, CrdsData::Vote(_, vote) => vote.wallclock, CrdsData::LowestSlot(_, obj) => obj.wallclock, CrdsData::SnapshotHashes(hash) => hash.wallclock, @@ -581,7 +583,7 @@ impl CrdsValue { } pub fn pubkey(&self) -> Pubkey { match &self.data { - CrdsData::ContactInfo(contact_info) => contact_info.id, + CrdsData::LegacyContactInfo(contact_info) => contact_info.id, CrdsData::Vote(_, vote) => vote.from, CrdsData::LowestSlot(_, slots) => slots.from, CrdsData::SnapshotHashes(hash) => hash.from, @@ -596,7 +598,7 @@ impl CrdsValue { } pub fn label(&self) -> CrdsValueLabel { match &self.data { - CrdsData::ContactInfo(_) => CrdsValueLabel::ContactInfo(self.pubkey()), + CrdsData::LegacyContactInfo(_) => CrdsValueLabel::LegacyContactInfo(self.pubkey()), CrdsData::Vote(ix, _) => CrdsValueLabel::Vote(*ix, self.pubkey()), CrdsData::LowestSlot(_, _) => CrdsValueLabel::LowestSlot(self.pubkey()), CrdsData::SnapshotHashes(_) => CrdsValueLabel::SnapshotHashes(self.pubkey()), @@ -611,9 +613,9 @@ impl CrdsValue { } } } - pub fn contact_info(&self) -> Option<&ContactInfo> { + pub fn contact_info(&self) -> Option<&LegacyContactInfo> { match &self.data { - CrdsData::ContactInfo(contact_info) => Some(contact_info), + CrdsData::LegacyContactInfo(contact_info) => Some(contact_info), _ => None, } } @@ -683,7 +685,6 @@ pub(crate) fn sanitize_wallclock(wallclock: u64) -> Result<(), SanitizeError> { mod test { use { super::*, - crate::contact_info::ContactInfo, bincode::{deserialize, Options}, rand::SeedableRng, rand_chacha::ChaChaRng, @@ -699,10 +700,10 @@ mod test { #[test] fn test_keys_and_values() { let mut rng = rand::thread_rng(); - let v = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::default())); + let v = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(LegacyContactInfo::default())); assert_eq!(v.wallclock(), 0); let key = v.contact_info().unwrap().id; - assert_eq!(v.label(), CrdsValueLabel::ContactInfo(key)); + assert_eq!(v.label(), CrdsValueLabel::LegacyContactInfo(key)); let v = Vote::new(Pubkey::default(), new_test_vote_tx(&mut rng), 0).unwrap(); let v = CrdsValue::new_unsigned(CrdsData::Vote(0, v)); @@ -756,10 +757,9 @@ mod test { let mut rng = rand::thread_rng(); let keypair = Keypair::new(); let wrong_keypair = Keypair::new(); - let mut v = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( - &keypair.pubkey(), - timestamp(), - ))); + let mut v = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo( + LegacyContactInfo::new_localhost(&keypair.pubkey(), timestamp()), + )); verify_signatures(&mut v, &keypair, &wrong_keypair); let v = Vote::new(keypair.pubkey(), new_test_vote_tx(&mut rng), timestamp()).unwrap(); let mut v = CrdsValue::new_unsigned(CrdsData::Vote(0, v)); @@ -1035,8 +1035,8 @@ mod test { assert_eq!(node.overrides(&other_crds), None); assert_eq!(other.overrides(&node_crds), None); // Differnt crds value is not a duplicate. - let other = ContactInfo::new_rand(&mut rng, Some(pubkey)); - let other = CrdsValue::new_unsigned(CrdsData::ContactInfo(other)); + let other = LegacyContactInfo::new_rand(&mut rng, Some(pubkey)); + let other = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(other)); assert!(!node.check_duplicate(&other)); assert_eq!(node.overrides(&other), None); } @@ -1045,13 +1045,10 @@ mod test { fn test_should_force_push() { let mut rng = rand::thread_rng(); let pubkey = Pubkey::new_unique(); - assert!( - !CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_rand( - &mut rng, - Some(pubkey), - ))) - .should_force_push(&pubkey) - ); + assert!(!CrdsValue::new_unsigned(CrdsData::LegacyContactInfo( + LegacyContactInfo::new_rand(&mut rng, Some(pubkey)) + )) + .should_force_push(&pubkey)); let node = CrdsValue::new_unsigned(CrdsData::NodeInstance(NodeInstance::new( &mut rng, pubkey, diff --git a/gossip/src/gossip_service.rs b/gossip/src/gossip_service.rs index d487cf546ef7ca..85f9e0166e49b0 100644 --- a/gossip/src/gossip_service.rs +++ b/gossip/src/gossip_service.rs @@ -1,7 +1,7 @@ //! The `gossip_service` module implements the network control plane. use { - crate::{cluster_info::ClusterInfo, contact_info::ContactInfo}, + crate::{cluster_info::ClusterInfo, legacy_contact_info::LegacyContactInfo as ContactInfo}, crossbeam_channel::{unbounded, Sender}, rand::{thread_rng, Rng}, solana_client::{connection_cache::ConnectionCache, thin_client::ThinClient}, diff --git a/gossip/src/contact_info.rs b/gossip/src/legacy_contact_info.rs similarity index 89% rename from gossip/src/contact_info.rs rename to gossip/src/legacy_contact_info.rs index eb261607cd5970..456355e15e1681 100644 --- a/gossip/src/contact_info.rs +++ b/gossip/src/legacy_contact_info.rs @@ -15,7 +15,7 @@ use { #[derive( Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, AbiExample, Deserialize, Serialize, )] -pub struct ContactInfo { +pub struct LegacyContactInfo { pub id: Pubkey, /// gossip address pub gossip: SocketAddr, @@ -43,7 +43,7 @@ pub struct ContactInfo { pub shred_version: u16, } -impl Sanitize for ContactInfo { +impl Sanitize for LegacyContactInfo { fn sanitize(&self) -> std::result::Result<(), SanitizeError> { if self.wallclock >= MAX_WALLCLOCK { return Err(SanitizeError::ValueOutOfBounds); @@ -68,9 +68,9 @@ macro_rules! socketaddr_any { }; } -impl Default for ContactInfo { +impl Default for LegacyContactInfo { fn default() -> Self { - ContactInfo { + LegacyContactInfo { id: Pubkey::default(), gossip: socketaddr_any!(), tvu: socketaddr_any!(), @@ -88,7 +88,7 @@ impl Default for ContactInfo { } } -impl ContactInfo { +impl LegacyContactInfo { pub fn new_localhost(id: &Pubkey, now: u64) -> Self { Self { id: *id, @@ -107,18 +107,18 @@ impl ContactInfo { } } - /// New random ContactInfo for tests and simulations. + /// New random LegacyContactInfo for tests and simulations. pub fn new_rand(rng: &mut R, pubkey: Option) -> Self { let delay = 10 * 60 * 1000; // 10 minutes let now = timestamp() - delay + rng.gen_range(0, 2 * delay); let pubkey = pubkey.unwrap_or_else(solana_sdk::pubkey::new_rand); - let mut node = ContactInfo::new_localhost(&pubkey, now); + let mut node = LegacyContactInfo::new_localhost(&pubkey, now); node.gossip.set_port(rng.gen_range(1024, u16::MAX)); node } #[cfg(test)] - /// ContactInfo with multicast addresses for adversarial testing. + /// LegacyContactInfo with multicast addresses for adversarial testing. pub fn new_multicast() -> Self { let addr = socketaddr!("224.0.1.255:1000"); assert!(addr.ip().is_multicast()); @@ -180,13 +180,13 @@ impl ContactInfo { Self::new_with_pubkey_socketaddr(&keypair.pubkey(), bind_addr) } - // Construct a ContactInfo that's only usable for gossip + // Construct a LegacyContactInfo that's only usable for gossip pub fn new_gossip_entry_point(gossip_addr: &SocketAddr) -> Self { Self { id: Pubkey::default(), gossip: *gossip_addr, wallclock: timestamp(), - ..ContactInfo::default() + ..LegacyContactInfo::default() } } @@ -219,8 +219,8 @@ impl ContactInfo { &self, socket_addr_space: &SocketAddrSpace, ) -> Option<(SocketAddr, SocketAddr)> { - if ContactInfo::is_valid_address(&self.rpc, socket_addr_space) - && ContactInfo::is_valid_address(&self.tpu, socket_addr_space) + if LegacyContactInfo::is_valid_address(&self.rpc, socket_addr_space) + && LegacyContactInfo::is_valid_address(&self.tpu, socket_addr_space) { Some((self.rpc, self.tpu)) } else { @@ -236,31 +236,31 @@ mod tests { #[test] fn test_is_valid_address() { let bad_address_port = socketaddr!("127.0.0.1:0"); - assert!(!ContactInfo::is_valid_address( + assert!(!LegacyContactInfo::is_valid_address( &bad_address_port, &SocketAddrSpace::Unspecified )); let bad_address_unspecified = socketaddr!(0, 1234); - assert!(!ContactInfo::is_valid_address( + assert!(!LegacyContactInfo::is_valid_address( &bad_address_unspecified, &SocketAddrSpace::Unspecified )); let bad_address_multicast = socketaddr!([224, 254, 0, 0], 1234); - assert!(!ContactInfo::is_valid_address( + assert!(!LegacyContactInfo::is_valid_address( &bad_address_multicast, &SocketAddrSpace::Unspecified )); let loopback = socketaddr!("127.0.0.1:1234"); - assert!(ContactInfo::is_valid_address( + assert!(LegacyContactInfo::is_valid_address( &loopback, &SocketAddrSpace::Unspecified )); - // assert!(!ContactInfo::is_valid_ip_internal(loopback.ip(), false)); + // assert!(!LegacyContactInfo::is_valid_ip_internal(loopback.ip(), false)); } #[test] fn test_default() { - let ci = ContactInfo::default(); + let ci = LegacyContactInfo::default(); assert!(ci.gossip.ip().is_unspecified()); assert!(ci.tvu.ip().is_unspecified()); assert!(ci.tpu_forwards.ip().is_unspecified()); @@ -272,7 +272,7 @@ mod tests { } #[test] fn test_multicast() { - let ci = ContactInfo::new_multicast(); + let ci = LegacyContactInfo::new_multicast(); assert!(ci.gossip.ip().is_multicast()); assert!(ci.tvu.ip().is_multicast()); assert!(ci.tpu_forwards.ip().is_multicast()); @@ -285,7 +285,7 @@ mod tests { #[test] fn test_entry_point() { let addr = socketaddr!("127.0.0.1:10"); - let ci = ContactInfo::new_gossip_entry_point(&addr); + let ci = LegacyContactInfo::new_gossip_entry_point(&addr); assert_eq!(ci.gossip, addr); assert!(ci.tvu.ip().is_unspecified()); assert!(ci.tpu_forwards.ip().is_unspecified()); @@ -298,7 +298,7 @@ mod tests { #[test] fn test_socketaddr() { let addr = socketaddr!("127.0.0.1:10"); - let ci = ContactInfo::new_with_socketaddr(&addr); + let ci = LegacyContactInfo::new_with_socketaddr(&addr); assert_eq!(ci.tpu, addr); assert_eq!(ci.tpu_vote.port(), 17); assert_eq!(ci.gossip.port(), 11); @@ -312,7 +312,7 @@ mod tests { #[test] fn replayed_data_new_with_socketaddr_with_pubkey() { let keypair = Keypair::new(); - let d1 = ContactInfo::new_with_pubkey_socketaddr( + let d1 = LegacyContactInfo::new_with_pubkey_socketaddr( &keypair.pubkey(), &socketaddr!("127.0.0.1:1234"), ); @@ -337,7 +337,7 @@ mod tests { #[test] fn test_valid_client_facing() { - let mut ci = ContactInfo::default(); + let mut ci = LegacyContactInfo::default(); assert_eq!( ci.valid_client_facing_addr(&SocketAddrSpace::Unspecified), None @@ -355,7 +355,7 @@ mod tests { #[test] fn test_sanitize() { - let mut ci = ContactInfo::default(); + let mut ci = LegacyContactInfo::default(); assert_eq!(ci.sanitize(), Ok(())); ci.wallclock = MAX_WALLCLOCK; assert_eq!(ci.sanitize(), Err(SanitizeError::ValueOutOfBounds)); diff --git a/gossip/src/lib.rs b/gossip/src/lib.rs index 7b37240f896a8e..2435c70d6d6e6f 100644 --- a/gossip/src/lib.rs +++ b/gossip/src/lib.rs @@ -3,8 +3,6 @@ pub mod cluster_info; pub mod cluster_info_metrics; -#[macro_use] -pub mod contact_info; pub mod crds; pub mod crds_entry; pub mod crds_gossip; @@ -18,6 +16,8 @@ pub mod duplicate_shred; pub mod epoch_slots; pub mod gossip_error; pub mod gossip_service; +#[macro_use] +pub mod legacy_contact_info; pub mod ping_pong; pub mod weighted_shuffle; diff --git a/gossip/src/main.rs b/gossip/src/main.rs index f2bb071b2aa82d..8904e1ab974f2c 100644 --- a/gossip/src/main.rs +++ b/gossip/src/main.rs @@ -9,7 +9,9 @@ use { input_parsers::keypair_of, input_validators::{is_keypair_or_ask_keyword, is_port, is_pubkey}, }, - solana_gossip::{contact_info::ContactInfo, gossip_service::discover}, + solana_gossip::{ + gossip_service::discover, legacy_contact_info::LegacyContactInfo as ContactInfo, + }, solana_sdk::pubkey::Pubkey, solana_streamer::socket::SocketAddrSpace, std::{ diff --git a/gossip/tests/cluster_info.rs b/gossip/tests/cluster_info.rs index 1b45ec2aa591ca..15583a63b247ab 100644 --- a/gossip/tests/cluster_info.rs +++ b/gossip/tests/cluster_info.rs @@ -8,7 +8,7 @@ use { serial_test::serial, solana_gossip::{ cluster_info::{compute_retransmit_peers, ClusterInfo}, - contact_info::ContactInfo, + legacy_contact_info::LegacyContactInfo as ContactInfo, weighted_shuffle::WeightedShuffle, }, solana_sdk::{pubkey::Pubkey, signer::keypair::Keypair}, diff --git a/gossip/tests/crds_gossip.rs b/gossip/tests/crds_gossip.rs index 41957285fe2ca2..0295ff03f66e17 100644 --- a/gossip/tests/crds_gossip.rs +++ b/gossip/tests/crds_gossip.rs @@ -7,13 +7,13 @@ use { solana_gossip::{ cluster_info, cluster_info_metrics::GossipStats, - contact_info::ContactInfo, crds::GossipRoute, crds_gossip::*, crds_gossip_error::CrdsGossipError, crds_gossip_pull::{ProcessPullStats, CRDS_GOSSIP_PULL_CRDS_TIMEOUT_MS}, crds_gossip_push::CRDS_GOSSIP_PUSH_MSG_TIMEOUT_MS, crds_value::{CrdsData, CrdsValue, CrdsValueLabel}, + legacy_contact_info::LegacyContactInfo as ContactInfo, ping_pong::PingCache, }, solana_rayon_threadlimit::get_thread_count, @@ -98,12 +98,12 @@ fn stakes(network: &Network) -> HashMap { fn star_network_create(num: usize) -> Network { let node_keypair = Arc::new(Keypair::new()); let contact_info = ContactInfo::new_localhost(&node_keypair.pubkey(), 0); - let entry = CrdsValue::new_unsigned(CrdsData::ContactInfo(contact_info.clone())); + let entry = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(contact_info.clone())); let mut network: HashMap<_, _> = (1..num) .map(|_| { let node_keypair = Arc::new(Keypair::new()); let contact_info = ContactInfo::new_localhost(&node_keypair.pubkey(), 0); - let new = CrdsValue::new_unsigned(CrdsData::ContactInfo(contact_info.clone())); + let new = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(contact_info.clone())); let node = CrdsGossip::default(); { let mut node_crds = node.crds.write().unwrap(); @@ -133,7 +133,7 @@ fn star_network_create(num: usize) -> Network { fn rstar_network_create(num: usize) -> Network { let node_keypair = Arc::new(Keypair::new()); let contact_info = ContactInfo::new_localhost(&node_keypair.pubkey(), 0); - let entry = CrdsValue::new_unsigned(CrdsData::ContactInfo(contact_info.clone())); + let entry = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(contact_info.clone())); let origin = CrdsGossip::default(); let id = entry.label().pubkey(); origin @@ -146,7 +146,7 @@ fn rstar_network_create(num: usize) -> Network { .map(|_| { let node_keypair = Arc::new(Keypair::new()); let contact_info = ContactInfo::new_localhost(&node_keypair.pubkey(), 0); - let new = CrdsValue::new_unsigned(CrdsData::ContactInfo(contact_info.clone())); + let new = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(contact_info.clone())); let node = CrdsGossip::default(); node.crds .write() @@ -173,7 +173,7 @@ fn ring_network_create(num: usize) -> Network { .map(|_| { let node_keypair = Arc::new(Keypair::new()); let contact_info = ContactInfo::new_localhost(&node_keypair.pubkey(), 0); - let new = CrdsValue::new_unsigned(CrdsData::ContactInfo(contact_info.clone())); + let new = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(contact_info.clone())); let node = CrdsGossip::default(); node.crds .write() @@ -189,7 +189,7 @@ fn ring_network_create(num: usize) -> Network { let start_info = { let start = &network[&keys[k]]; let start_id = keys[k]; - let label = CrdsValueLabel::ContactInfo(start_id); + let label = CrdsValueLabel::LegacyContactInfo(start_id); let gossip_crds = start.gossip.crds.read().unwrap(); gossip_crds.get::<&CrdsValue>(&label).unwrap().clone() }; @@ -208,7 +208,7 @@ fn connected_staked_network_create(stakes: &[u64]) -> Network { .map(|n| { let node_keypair = Arc::new(Keypair::new()); let contact_info = ContactInfo::new_localhost(&node_keypair.pubkey(), 0); - let new = CrdsValue::new_unsigned(CrdsData::ContactInfo(contact_info.clone())); + let new = CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(contact_info.clone())); let node = CrdsGossip::default(); node.crds .write() @@ -225,7 +225,7 @@ fn connected_staked_network_create(stakes: &[u64]) -> Network { .iter() .map(|k| { let start = &network[k]; - let start_label = CrdsValueLabel::ContactInfo(*k); + let start_label = CrdsValueLabel::LegacyContactInfo(*k); let gossip_crds = start.gossip.crds.read().unwrap(); gossip_crds.get::<&CrdsValue>(&start_label).unwrap().clone() }) @@ -292,7 +292,7 @@ fn network_simulator(thread_pool: &ThreadPool, network: &mut Network, max_conver node.gossip.process_push_message( vec![( Pubkey::default(), - vec![CrdsValue::new_unsigned(CrdsData::ContactInfo(m))], + vec![CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(m))], )], now, ); @@ -508,7 +508,7 @@ fn network_run_pull( ) .unwrap_or_default(); let from_pubkey = from.keypair.pubkey(); - let label = CrdsValueLabel::ContactInfo(from_pubkey); + let label = CrdsValueLabel::LegacyContactInfo(from_pubkey); let gossip_crds = from.gossip.crds.read().unwrap(); let self_info = gossip_crds.get::<&CrdsValue>(&label).unwrap().clone(); requests @@ -730,7 +730,7 @@ fn test_prune_errors() { .write() .unwrap() .insert( - CrdsValue::new_unsigned(CrdsData::ContactInfo(ci.clone())), + CrdsValue::new_unsigned(CrdsData::LegacyContactInfo(ci.clone())), 0, GossipRoute::LocalMessage, ) diff --git a/gossip/tests/gossip.rs b/gossip/tests/gossip.rs index f3e136cdba7f72..954a88b023e972 100644 --- a/gossip/tests/gossip.rs +++ b/gossip/tests/gossip.rs @@ -6,9 +6,9 @@ use { rayon::iter::*, solana_gossip::{ cluster_info::{ClusterInfo, Node}, - contact_info::ContactInfo, crds::Cursor, gossip_service::GossipService, + legacy_contact_info::LegacyContactInfo as ContactInfo, }, solana_perf::packet::Packet, solana_runtime::bank_forks::BankForks, diff --git a/local-cluster/src/cluster.rs b/local-cluster/src/cluster.rs index b5bcf658fb38e9..0cee27e6c99e79 100644 --- a/local-cluster/src/cluster.rs +++ b/local-cluster/src/cluster.rs @@ -1,7 +1,7 @@ use { solana_client::thin_client::ThinClient, solana_core::validator::{Validator, ValidatorConfig}, - solana_gossip::{cluster_info::Node, contact_info::ContactInfo}, + solana_gossip::{cluster_info::Node, legacy_contact_info::LegacyContactInfo as ContactInfo}, solana_sdk::{pubkey::Pubkey, signature::Keypair}, solana_streamer::socket::SocketAddrSpace, std::{path::PathBuf, sync::Arc}, diff --git a/local-cluster/src/cluster_tests.rs b/local-cluster/src/cluster_tests.rs index 7f8c4331a95afb..25edf397905ea6 100644 --- a/local-cluster/src/cluster_tests.rs +++ b/local-cluster/src/cluster_tests.rs @@ -11,10 +11,10 @@ use { solana_entry::entry::{Entry, EntrySlice}, solana_gossip::{ cluster_info, - contact_info::ContactInfo, crds_value::{self, CrdsData, CrdsValue}, gossip_error::GossipError, gossip_service::discover_cluster, + legacy_contact_info::LegacyContactInfo as ContactInfo, }, solana_ledger::blockstore::Blockstore, solana_sdk::{ diff --git a/local-cluster/src/local_cluster.rs b/local-cluster/src/local_cluster.rs index 5389f9dca6c8e6..6b46dbaa820857 100644 --- a/local-cluster/src/local_cluster.rs +++ b/local-cluster/src/local_cluster.rs @@ -18,7 +18,8 @@ use { validator::{Validator, ValidatorConfig, ValidatorStartProgress}, }, solana_gossip::{ - cluster_info::Node, contact_info::ContactInfo, gossip_service::discover_cluster, + cluster_info::Node, gossip_service::discover_cluster, + legacy_contact_info::LegacyContactInfo as ContactInfo, }, solana_ledger::create_new_tmp_ledger, solana_runtime::{ diff --git a/rpc/src/cluster_tpu_info.rs b/rpc/src/cluster_tpu_info.rs index 7e1982cf50b945..5889399b63d2b8 100644 --- a/rpc/src/cluster_tpu_info.rs +++ b/rpc/src/cluster_tpu_info.rs @@ -59,7 +59,7 @@ impl TpuInfo for ClusterTpuInfo { mod test { use { super::*, - solana_gossip::contact_info::ContactInfo, + solana_gossip::legacy_contact_info::LegacyContactInfo as ContactInfo, solana_ledger::{ blockstore::Blockstore, get_tmp_ledger_path, leader_schedule_cache::LeaderScheduleCache, }, diff --git a/rpc/src/rpc.rs b/rpc/src/rpc.rs index bb527349677b74..6fe5086007d6ed 100644 --- a/rpc/src/rpc.rs +++ b/rpc/src/rpc.rs @@ -31,7 +31,9 @@ use { }, solana_entry::entry::Entry, solana_faucet::faucet::request_airdrop_transaction, - solana_gossip::{cluster_info::ClusterInfo, contact_info::ContactInfo}, + solana_gossip::{ + cluster_info::ClusterInfo, legacy_contact_info::LegacyContactInfo as ContactInfo, + }, solana_ledger::{ blockstore::{Blockstore, SignatureInfosForAddress}, blockstore_db::BlockstoreError, @@ -4634,7 +4636,7 @@ pub mod tests { rpc_filter::{Memcmp, MemcmpEncodedBytes}, }, solana_entry::entry::next_versioned_entry, - solana_gossip::{contact_info::ContactInfo, socketaddr}, + solana_gossip::socketaddr, solana_ledger::{ blockstore_meta::PerfSample, blockstore_processor::fill_blockstore_slot_with_ticks, diff --git a/rpc/src/rpc_health.rs b/rpc/src/rpc_health.rs index 89acc2e06ee697..5653ca4d7d4967 100644 --- a/rpc/src/rpc_health.rs +++ b/rpc/src/rpc_health.rs @@ -129,8 +129,8 @@ impl RpcHealth { #[cfg(test)] pub(crate) fn stub() -> Arc { use { - solana_gossip::contact_info::ContactInfo, solana_sdk::signer::keypair::Keypair, - solana_streamer::socket::SocketAddrSpace, + solana_gossip::legacy_contact_info::LegacyContactInfo as ContactInfo, + solana_sdk::signer::keypair::Keypair, solana_streamer::socket::SocketAddrSpace, }; Arc::new(Self::new( Arc::new(ClusterInfo::new( diff --git a/rpc/src/rpc_service.rs b/rpc/src/rpc_service.rs index a1acec205e2302..be529a5954b6fb 100644 --- a/rpc/src/rpc_service.rs +++ b/rpc/src/rpc_service.rs @@ -570,9 +570,9 @@ mod tests { crate::rpc::create_validator_exit, solana_client::rpc_config::RpcContextConfig, solana_gossip::{ - contact_info::ContactInfo, crds::GossipRoute, crds_value::{CrdsData, CrdsValue, SnapshotHashes}, + legacy_contact_info::LegacyContactInfo as ContactInfo, }, solana_ledger::{ genesis_utils::{create_genesis_config, GenesisConfigInfo}, diff --git a/validator/src/admin_rpc_service.rs b/validator/src/admin_rpc_service.rs index f226b5853522e8..1951780d6ed6f7 100644 --- a/validator/src/admin_rpc_service.rs +++ b/validator/src/admin_rpc_service.rs @@ -9,7 +9,9 @@ use { solana_core::{ consensus::Tower, tower_storage::TowerStorage, validator::ValidatorStartProgress, }, - solana_gossip::{cluster_info::ClusterInfo, contact_info::ContactInfo}, + solana_gossip::{ + cluster_info::ClusterInfo, legacy_contact_info::LegacyContactInfo as ContactInfo, + }, solana_runtime::bank_forks::BankForks, solana_sdk::{ exit::Exit, diff --git a/validator/src/bootstrap.rs b/validator/src/bootstrap.rs index b315494ffd8331..9868346e520f18 100644 --- a/validator/src/bootstrap.rs +++ b/validator/src/bootstrap.rs @@ -7,9 +7,9 @@ use { solana_genesis_utils::download_then_check_genesis_hash, solana_gossip::{ cluster_info::{ClusterInfo, Node}, - contact_info::ContactInfo, crds_value, gossip_service::GossipService, + legacy_contact_info::LegacyContactInfo as ContactInfo, }, solana_runtime::{ snapshot_archive_info::SnapshotArchiveInfoGetter, diff --git a/validator/src/main.rs b/validator/src/main.rs index bcf3de9b5c7612..ac62c809afdea8 100644 --- a/validator/src/main.rs +++ b/validator/src/main.rs @@ -31,7 +31,7 @@ use { tpu::DEFAULT_TPU_COALESCE_MS, validator::{is_snapshot_config_valid, Validator, ValidatorConfig, ValidatorStartProgress}, }, - solana_gossip::{cluster_info::Node, contact_info::ContactInfo}, + solana_gossip::{cluster_info::Node, legacy_contact_info::LegacyContactInfo as ContactInfo}, solana_ledger::blockstore_options::{ BlockstoreCompressionType, BlockstoreRecoveryMode, LedgerColumnOptions, ShredStorageType, DEFAULT_ROCKS_FIFO_SHRED_STORAGE_SIZE_BYTES,