Skip to content

Commit

Permalink
migrates to the new contact-info
Browse files Browse the repository at this point in the history
  • Loading branch information
behzadnouri committed Apr 18, 2024
1 parent 16770cc commit 4f2bfb3
Show file tree
Hide file tree
Showing 26 changed files with 321 additions and 395 deletions.
3 changes: 1 addition & 2 deletions core/src/cluster_slots_service/cluster_slots.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use {
itertools::Itertools,
solana_gossip::{
cluster_info::ClusterInfo, crds::Cursor, epoch_slots::EpochSlots,
legacy_contact_info::LegacyContactInfo as ContactInfo,
cluster_info::ClusterInfo, contact_info::ContactInfo, crds::Cursor, epoch_slots::EpochSlots,
},
solana_runtime::{bank::Bank, epoch_stakes::NodeIdToVoteAccounts},
solana_sdk::{
Expand Down
4 changes: 1 addition & 3 deletions core/src/next_leader.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use {
solana_gossip::{
cluster_info::ClusterInfo, legacy_contact_info::LegacyContactInfo as ContactInfo,
},
solana_gossip::{cluster_info::ClusterInfo, contact_info::ContactInfo},
solana_poh::poh_recorder::PohRecorder,
solana_sdk::{clock::FORWARD_TRANSACTIONS_TO_LEADER_AT_SLOT_OFFSET, pubkey::Pubkey},
std::{net::SocketAddr, sync::RwLock},
Expand Down
2 changes: 1 addition & 1 deletion core/src/repair/serve_repair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use {
},
solana_gossip::{
cluster_info::{ClusterInfo, ClusterInfoError},
contact_info::{LegacyContactInfo as ContactInfo, LegacyContactInfo, Protocol},
contact_info::{ContactInfo, LegacyContactInfo, Protocol},
ping_pong::{self, PingCache, Pong},
weighted_shuffle::WeightedShuffle,
},
Expand Down
8 changes: 4 additions & 4 deletions core/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,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,
Expand Down Expand Up @@ -2531,7 +2531,7 @@ mod tests {
super::*,
crossbeam_channel::{bounded, RecvTimeoutError},
solana_entry::entry,
solana_gossip::contact_info::{ContactInfo, LegacyContactInfo},
solana_gossip::contact_info::ContactInfo,
solana_ledger::{
blockstore, create_new_tmp_ledger, genesis_utils::create_genesis_config_with_leader,
get_tmp_ledger_path_auto_delete,
Expand Down Expand Up @@ -2571,7 +2571,7 @@ mod tests {
&validator_ledger_path,
&voting_keypair.pubkey(),
Arc::new(RwLock::new(vec![voting_keypair])),
vec![LegacyContactInfo::try_from(&leader_node.info).unwrap()],
vec![leader_node.info],
&config,
true, // should_check_duplicate_instance
None, // rpc_to_plugin_manager_receiver
Expand Down Expand Up @@ -2656,7 +2656,7 @@ mod tests {
&validator_ledger_path,
&vote_account_keypair.pubkey(),
Arc::new(RwLock::new(vec![Arc::new(vote_account_keypair)])),
vec![LegacyContactInfo::try_from(&leader_node.info).unwrap()],
vec![leader_node.info.clone()],
&config,
true, // should_check_duplicate_instance.
None, // rpc_to_plugin_manager_receiver
Expand Down
22 changes: 4 additions & 18 deletions dos/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ use {
solana_core::repair::serve_repair::{RepairProtocol, RepairRequestHeader, ServeRepair},
solana_dos::cli::*,
solana_gossip::{
contact_info::Protocol,
contact_info::{ContactInfo, Protocol},
gossip_service::{discover, get_client},
legacy_contact_info::LegacyContactInfo as ContactInfo,
},
solana_measure::measure::Measure,
solana_rpc_client::rpc_client::RpcClient,
Expand Down Expand Up @@ -821,7 +820,6 @@ pub mod test {
super::*,
solana_core::validator::ValidatorConfig,
solana_faucet::faucet::run_local_faucet,
solana_gossip::contact_info::LegacyContactInfo,
solana_local_cluster::{
cluster::Cluster,
local_cluster::{ClusterConfig, LocalCluster},
Expand Down Expand Up @@ -936,11 +934,7 @@ pub mod test {
assert_eq!(cluster.validators.len(), num_nodes);

let nodes = cluster.get_node_pubkeys();
let node = cluster
.get_contact_info(&nodes[0])
.map(LegacyContactInfo::try_from)
.unwrap()
.unwrap();
let node = cluster.get_contact_info(&nodes[0]).unwrap().clone();
let nodes_slice = [node];

// send random transactions to TPU
Expand Down Expand Up @@ -973,11 +967,7 @@ pub mod test {
assert_eq!(cluster.validators.len(), num_nodes);

let nodes = cluster.get_node_pubkeys();
let node = cluster
.get_contact_info(&nodes[0])
.map(LegacyContactInfo::try_from)
.unwrap()
.unwrap();
let node = cluster.get_contact_info(&nodes[0]).unwrap().clone();
let nodes_slice = [node];

let client = Arc::new(cluster.build_tpu_quic_client().unwrap_or_else(|err| {
Expand Down Expand Up @@ -1107,11 +1097,7 @@ pub mod test {
cluster.transfer(&cluster.funding_keypair, &faucet_pubkey, 100_000_000);

let nodes = cluster.get_node_pubkeys();
let node = cluster
.get_contact_info(&nodes[0])
.map(LegacyContactInfo::try_from)
.unwrap()
.unwrap();
let node = cluster.get_contact_info(&nodes[0]).unwrap().clone();
let nodes_slice = [node];

let client = Arc::new(cluster.build_tpu_quic_client().unwrap_or_else(|err| {
Expand Down
Loading

0 comments on commit 4f2bfb3

Please sign in to comment.