From bda0427f28c7bf827d787ba996ab408591d55cf4 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Tue, 14 Jan 2025 16:00:50 +0900 Subject: [PATCH 1/3] Restore frozen_abi on TimedTracedEvent --- core/src/banking_trace.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/src/banking_trace.rs b/core/src/banking_trace.rs index 0c9fb856aecb87..f0927e97fc772d 100644 --- a/core/src/banking_trace.rs +++ b/core/src/banking_trace.rs @@ -59,6 +59,11 @@ pub struct BankingTracer { active_tracer: Option, } +#[cfg_attr( + feature = "frozen-abi", + derive(AbiExample), + frozen_abi(digest = "DAdZnX6ijBWaxKAyksq4nJa6PAZqT4RShZqLWTtNvyAM") +)] #[derive(Serialize, Deserialize, Debug)] pub struct TimedTracedEvent(pub std::time::SystemTime, pub TracedEvent); From 5e8ada650e4862bffd27a4ff07c43e2361217fb5 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Tue, 14 Jan 2025 16:01:30 +0900 Subject: [PATCH 2/3] Reorder some setup for unified scheduler --- banking-bench/src/main.rs | 15 ++++++++------- core/src/banking_simulation.rs | 14 +++++++------- core/src/tpu.rs | 6 +++--- core/src/validator.rs | 33 +++++++++++++++++---------------- 4 files changed, 35 insertions(+), 33 deletions(-) diff --git a/banking-bench/src/main.rs b/banking-bench/src/main.rs index 6196f713666e19..d20adcedb7b799 100644 --- a/banking-bench/src/main.rs +++ b/banking-bench/src/main.rs @@ -442,6 +442,13 @@ fn main() { BANKING_TRACE_DIR_DEFAULT_BYTE_LIMIT, ))) .unwrap(); + let prioritization_fee_cache = Arc::new(PrioritizationFeeCache::new(0u64)); + let cluster_info = { + let keypair = Arc::new(Keypair::new()); + let node = Node::new_localhost_with_pubkey(&keypair.pubkey()); + ClusterInfo::new(node.info, keypair, SocketAddrSpace::Unspecified) + }; + let cluster_info = Arc::new(cluster_info); let Channels { non_vote_sender, non_vote_receiver, @@ -450,12 +457,6 @@ fn main() { gossip_vote_sender, gossip_vote_receiver, } = banking_tracer.create_channels(false); - let cluster_info = { - let keypair = Arc::new(Keypair::new()); - let node = Node::new_localhost_with_pubkey(&keypair.pubkey()); - ClusterInfo::new(node.info, keypair, SocketAddrSpace::Unspecified) - }; - let cluster_info = Arc::new(cluster_info); let tpu_disable_quic = matches.is_present("tpu_disable_quic"); let connection_cache = if tpu_disable_quic { ConnectionCache::with_udp( @@ -481,7 +482,7 @@ fn main() { None, Arc::new(connection_cache), bank_forks.clone(), - &Arc::new(PrioritizationFeeCache::new(0u64)), + &prioritization_fee_cache, false, ); diff --git a/core/src/banking_simulation.rs b/core/src/banking_simulation.rs index e811c9c6df9bd8..d3f65e22cd1301 100644 --- a/core/src/banking_simulation.rs +++ b/core/src/banking_simulation.rs @@ -761,6 +761,10 @@ impl BankingSimulator { BANKING_TRACE_DIR_DEFAULT_BYTE_LIMIT, ); + // Create a partially-dummy ClusterInfo for the banking stage. + let cluster_info_for_banking = Arc::new(DummyClusterInfo { + id: simulated_leader.into(), + }); let Channels { non_vote_sender, non_vote_receiver, @@ -783,7 +787,7 @@ impl BankingSimulator { // We only need it to write shreds into the blockstore and it seems given ClusterInfo is // irrelevant for the neccesary minimum work for this simulation. let random_keypair = Arc::new(Keypair::new()); - let cluster_info = Arc::new(ClusterInfo::new( + let cluster_info_for_broadcast = Arc::new(ClusterInfo::new( Node::new_localhost_with_pubkey(&random_keypair.pubkey()).info, random_keypair, SocketAddrSpace::Unspecified, @@ -792,7 +796,7 @@ impl BankingSimulator { // inserting produced shreds into the blockstore. let broadcast_stage = BroadcastStageType::Standard.new_broadcast_stage( vec![bind_to_localhost().unwrap()], - cluster_info.clone(), + cluster_info_for_broadcast.clone(), entry_receiver, retransmit_slots_receiver, exit.clone(), @@ -803,14 +807,10 @@ impl BankingSimulator { ); info!("Start banking stage!..."); - // Create a partially-dummy ClusterInfo for the banking stage. - let cluster_info = Arc::new(DummyClusterInfo { - id: simulated_leader.into(), - }); let prioritization_fee_cache = &Arc::new(PrioritizationFeeCache::new(0u64)); let banking_stage = BankingStage::new_num_threads( block_production_method.clone(), - &cluster_info, + &cluster_info_for_banking, &poh_recorder, non_vote_receiver, tpu_vote_receiver, diff --git a/core/src/tpu.rs b/core/src/tpu.rs index d715bb5c7b0534..3a7d03dff20495 100644 --- a/core/src/tpu.rs +++ b/core/src/tpu.rs @@ -5,7 +5,7 @@ pub use solana_sdk::net::DEFAULT_TPU_COALESCE; use { crate::{ banking_stage::BankingStage, - banking_trace::{BankingTracer, Channels, TracerThread}, + banking_trace::{Channels, TracerThread}, cluster_info_vote_listener::{ ClusterInfoVoteListener, DuplicateConfirmedSlotsSender, GossipVerifiedVoteHashSender, VerifiedVoteSender, VoteTracker, @@ -112,7 +112,7 @@ impl Tpu { log_messages_bytes_limit: Option, staked_nodes: &Arc>, shared_staked_nodes_overrides: Arc>>, - banking_tracer: Arc, + banking_tracer_channels: Channels, tracer_thread_hdl: TracerThread, tpu_enable_udp: bool, tpu_max_connections_per_ipaddr_per_minute: u64, @@ -163,7 +163,7 @@ impl Tpu { tpu_vote_receiver, gossip_vote_sender, gossip_vote_receiver, - } = banking_tracer.create_channels(false); + } = banking_tracer_channels; // Streamer for Votes: let SpawnServerResult { diff --git a/core/src/validator.rs b/core/src/validator.rs index 802dcc5fefdc2b..b224558baae1e8 100644 --- a/core/src/validator.rs +++ b/core/src/validator.rs @@ -901,6 +901,22 @@ impl Validator { }; let poh_recorder = Arc::new(RwLock::new(poh_recorder)); + let (banking_tracer, tracer_thread) = + BankingTracer::new((config.banking_trace_dir_byte_limit > 0).then_some(( + &blockstore.banking_trace_path(), + exit.clone(), + config.banking_trace_dir_byte_limit, + )))?; + if banking_tracer.is_enabled() { + info!( + "Enabled banking trace (dir_byte_limit: {})", + config.banking_trace_dir_byte_limit + ); + } else { + info!("Disabled banking trace"); + } + let banking_tracer_channels = banking_tracer.create_channels(false); + match &config.block_verification_method { BlockVerificationMethod::BlockstoreProcessor => { info!("no scheduler pool is installed for block verification..."); @@ -1262,21 +1278,6 @@ impl Validator { let (gossip_verified_vote_hash_sender, gossip_verified_vote_hash_receiver) = unbounded(); let (duplicate_confirmed_slot_sender, duplicate_confirmed_slots_receiver) = unbounded(); - let (banking_tracer, tracer_thread) = - BankingTracer::new((config.banking_trace_dir_byte_limit > 0).then_some(( - &blockstore.banking_trace_path(), - exit.clone(), - config.banking_trace_dir_byte_limit, - )))?; - if banking_tracer.is_enabled() { - info!( - "Enabled banking trace (dir_byte_limit: {})", - config.banking_trace_dir_byte_limit - ); - } else { - info!("Disabled banking trace"); - } - let entry_notification_sender = entry_notifier_service .as_ref() .map(|service| service.sender_cloned()); @@ -1518,7 +1519,7 @@ impl Validator { config.runtime_config.log_messages_bytes_limit, &staked_nodes, config.staked_nodes_overrides.clone(), - banking_tracer, + banking_tracer_channels, tracer_thread, tpu_enable_udp, tpu_max_connections_per_ipaddr_per_minute, From 4c8f8f4dddb3dfa3a9b02ccd16fe334bce7bdf3b Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Tue, 14 Jan 2025 16:09:10 +0900 Subject: [PATCH 3/3] Remove redundant assert_matches dev dep --- core/Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/core/Cargo.toml b/core/Cargo.toml index 3425e63fd8fe1b..1290e6f889180e 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -106,7 +106,6 @@ tokio = { workspace = true, features = ["full"] } trees = { workspace = true } [dev-dependencies] -assert_matches = { workspace = true } fs_extra = { workspace = true } serde_json = { workspace = true } serial_test = { workspace = true }