diff --git a/Cargo.lock b/Cargo.lock index 6730cf067af3df..588cb8925ea2fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6031,6 +6031,7 @@ dependencies = [ name = "solana-banking-bench" version = "2.2.0" dependencies = [ + "assert_matches", "clap 3.2.23", "crossbeam-channel", "log", @@ -7898,6 +7899,7 @@ dependencies = [ "bincode", "bv", "caps", + "crossbeam-channel", "curve25519-dalek 4.1.3", "dlopen2", "fnv", diff --git a/banking-bench/Cargo.toml b/banking-bench/Cargo.toml index 67ca53f88324c9..fad676fcc24cab 100644 --- a/banking-bench/Cargo.toml +++ b/banking-bench/Cargo.toml @@ -9,13 +9,14 @@ license = { workspace = true } edition = { workspace = true } [dependencies] +assert_matches = { workspace = true } clap = { version = "3.1.8", features = ["derive", "cargo"] } crossbeam-channel = { workspace = true } log = { workspace = true } rand = { workspace = true } rayon = { workspace = true } solana-client = { workspace = true } -solana-core = { workspace = true } +solana-core = { workspace = true, features = ["dev-context-only-utils"] } solana-gossip = { workspace = true } solana-ledger = { workspace = true } solana-logger = { workspace = true } diff --git a/banking-bench/src/main.rs b/banking-bench/src/main.rs index 99722c7cf6082e..2b2c11ffe7e985 100644 --- a/banking-bench/src/main.rs +++ b/banking-bench/src/main.rs @@ -1,5 +1,6 @@ #![allow(clippy::arithmetic_side_effects)] use { + assert_matches::assert_matches, clap::{crate_description, crate_name, Arg, ArgEnum, Command}, crossbeam_channel::{unbounded, Receiver}, log::*, @@ -7,10 +8,8 @@ use { rayon::prelude::*, solana_client::connection_cache::ConnectionCache, solana_core::{ - banking_stage::BankingStage, - banking_trace::{ - BankingPacketBatch, BankingTracer, Channels, BANKING_TRACE_DIR_DEFAULT_BYTE_LIMIT, - }, + banking_stage::{update_bank_forks_and_poh_recorder_for_new_tpu_bank, BankingStage}, + banking_trace::{BankingTracer, Channels, BANKING_TRACE_DIR_DEFAULT_BYTE_LIMIT}, validator::BlockProductionMethod, }, solana_gossip::cluster_info::{ClusterInfo, Node}, @@ -21,7 +20,7 @@ use { leader_schedule_cache::LeaderScheduleCache, }, solana_measure::measure::Measure, - solana_perf::packet::{to_packet_batches, PacketBatch}, + solana_perf::packet::{to_packet_batches, BankingPacketBatch, PacketBatch}, solana_poh::poh_recorder::{create_test_recorder, PohRecorder, WorkingBankEntry}, solana_runtime::{ bank::Bank, bank_forks::BankForks, prioritization_fee_cache::PrioritizationFeeCache, @@ -349,7 +348,7 @@ fn main() { let (replay_vote_sender, _replay_vote_receiver) = unbounded(); let bank0 = Bank::new_for_benches(&genesis_config); let bank_forks = BankForks::new_rw_arc(bank0); - let mut bank = bank_forks.read().unwrap().working_bank(); + let mut bank = bank_forks.read().unwrap().working_bank_with_scheduler(); // set cost tracker limits to MAX so it will not filter out TXs bank.write_cost_tracker() @@ -552,21 +551,24 @@ fn main() { poh_time.stop(); let mut new_bank_time = Measure::start("new_bank"); + if let Some((result, _timings)) = bank.wait_for_completed_scheduler() { + assert_matches!(result, Ok(_)); + } let new_slot = bank.slot() + 1; - let new_bank = Bank::new_from_parent(bank, &collector, new_slot); + let new_bank = Bank::new_from_parent(bank.clone(), &collector, new_slot); new_bank_time.stop(); let mut insert_time = Measure::start("insert_time"); - bank_forks.write().unwrap().insert(new_bank); - bank = bank_forks.read().unwrap().working_bank(); + assert_matches!(poh_recorder.read().unwrap().bank(), None); + update_bank_forks_and_poh_recorder_for_new_tpu_bank( + &bank_forks, + &poh_recorder, + new_bank, + false, + ); + bank = bank_forks.read().unwrap().working_bank_with_scheduler(); + assert_matches!(poh_recorder.read().unwrap().bank(), Some(_)); insert_time.stop(); - - assert!(poh_recorder.read().unwrap().bank().is_none()); - poh_recorder - .write() - .unwrap() - .set_bank_for_test(bank.clone()); - assert!(poh_recorder.read().unwrap().bank().is_some()); debug!( "new_bank_time: {}us insert_time: {}us poh_time: {}us", new_bank_time.as_us(), diff --git a/core/Cargo.toml b/core/Cargo.toml index 0143180ced5b4d..164a28b77b1b1d 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -17,6 +17,7 @@ codecov = { repository = "solana-labs/solana", branch = "master", service = "git ahash = { workspace = true } anyhow = { workspace = true } arrayvec = { workspace = true } +assert_matches = { workspace = true } base64 = { workspace = true } bincode = { workspace = true } bs58 = { workspace = true } diff --git a/core/benches/banking_stage.rs b/core/benches/banking_stage.rs index 5d764f4b7c1d44..e869575ad39774 100644 --- a/core/benches/banking_stage.rs +++ b/core/benches/banking_stage.rs @@ -3,6 +3,7 @@ use { solana_core::{banking_trace::Channels, validator::BlockProductionMethod}, + solana_perf::packet::BankingPacketBatch, solana_vote_program::{vote_state::TowerSync, vote_transaction::new_tower_sync_transaction}, }; @@ -24,7 +25,7 @@ use { unprocessed_transaction_storage::{ThreadType, UnprocessedTransactionStorage}, BankingStage, BankingStageStats, }, - banking_trace::{BankingPacketBatch, BankingTracer}, + banking_trace::BankingTracer, }, solana_entry::entry::{next_hash, Entry}, solana_gossip::cluster_info::{ClusterInfo, Node}, diff --git a/core/benches/banking_trace.rs b/core/benches/banking_trace.rs index 66bfc84c630436..4ac8139dfce71c 100644 --- a/core/benches/banking_trace.rs +++ b/core/benches/banking_trace.rs @@ -7,9 +7,10 @@ use { for_test::{ drop_and_clean_temp_dir_unless_suppressed, sample_packet_batch, terminate_tracer, }, - receiving_loop_with_minimized_sender_overhead, BankingPacketBatch, BankingTracer, Channels, - TraceError, TracerThreadResult, BANKING_TRACE_DIR_DEFAULT_BYTE_LIMIT, + receiving_loop_with_minimized_sender_overhead, BankingTracer, Channels, TraceError, + TracerThreadResult, BANKING_TRACE_DIR_DEFAULT_BYTE_LIMIT, }, + solana_perf::packet::BankingPacketBatch, std::{ path::PathBuf, sync::{atomic::AtomicBool, Arc}, diff --git a/core/src/banking_simulation.rs b/core/src/banking_simulation.rs index 82a4e5e94a3e76..815b8e455df482 100644 --- a/core/src/banking_simulation.rs +++ b/core/src/banking_simulation.rs @@ -1,14 +1,16 @@ #![cfg(feature = "dev-context-only-utils")] use { crate::{ - banking_stage::{BankingStage, LikeClusterInfo}, + banking_stage::{ + update_bank_forks_and_poh_recorder_for_new_tpu_bank, BankingStage, LikeClusterInfo, + }, banking_trace::{ - BankingPacketBatch, BankingTracer, ChannelLabel, Channels, TimedTracedEvent, - TracedEvent, TracedSender, TracerThread, BANKING_TRACE_DIR_DEFAULT_BYTE_LIMIT, - BASENAME, + BankingTracer, ChannelLabel, Channels, TimedTracedEvent, TracedEvent, TracedSender, + TracerThread, BANKING_TRACE_DIR_DEFAULT_BYTE_LIMIT, BASENAME, }, validator::BlockProductionMethod, }, + assert_matches::assert_matches, bincode::deserialize_from, crossbeam_channel::{unbounded, Sender}, itertools::Itertools, @@ -23,6 +25,7 @@ use { leader_schedule_cache::LeaderScheduleCache, }, solana_net_utils::bind_to_localhost, + solana_perf::packet::BankingPacketBatch, solana_poh::{ poh_recorder::{PohRecorder, GRACE_TICKS_FACTOR, MAX_GRACE_SLOTS}, poh_service::{PohService, DEFAULT_HASHES_PER_BATCH, DEFAULT_PINNED_CPU_CORE}, @@ -450,6 +453,9 @@ impl SimulatorLoop { info!("Bank::new_from_parent()!"); logger.log_jitter(&bank); + if let Some((result, _execute_timings)) = bank.wait_for_completed_scheduler() { + assert_matches!(result, Ok(())); + } bank.freeze(); let new_slot = if bank.slot() == self.parent_slot { info!("initial leader block!"); @@ -484,16 +490,17 @@ impl SimulatorLoop { logger.log_frozen_bank_cost(&bank); } self.retransmit_slots_sender.send(bank.slot()).unwrap(); - self.bank_forks.write().unwrap().insert(new_bank); + update_bank_forks_and_poh_recorder_for_new_tpu_bank( + &self.bank_forks, + &self.poh_recorder, + new_bank, + false, + ); bank = self .bank_forks .read() .unwrap() .working_bank_with_scheduler(); - self.poh_recorder - .write() - .unwrap() - .set_bank(bank.clone_with_scheduler(), false); } else { logger.log_ongoing_bank_cost(&bank); } diff --git a/core/src/banking_stage.rs b/core/src/banking_stage.rs index 4dfc6bc8e5c733..b44394f37f8b3d 100644 --- a/core/src/banking_stage.rs +++ b/core/src/banking_stage.rs @@ -2,6 +2,8 @@ //! to construct a software pipeline. The stage uses all available CPU cores and //! can do its processing in parallel with signature verification on the GPU. +#[cfg(feature = "dev-context-only-utils")] +use qualifier_attr::qualifiers; use { self::{ committer::Committer, @@ -24,7 +26,6 @@ use { scheduler_controller::SchedulerController, scheduler_error::SchedulerError, }, }, - banking_trace::BankingPacketReceiver, validator::BlockProductionMethod, }, crossbeam_channel::{unbounded, Receiver, RecvTimeoutError, Sender}, @@ -33,10 +34,13 @@ use { solana_gossip::{cluster_info::ClusterInfo, contact_info::ContactInfo}, solana_ledger::blockstore_processor::TransactionStatusSender, solana_measure::measure_us, - solana_perf::{data_budget::DataBudget, packet::PACKETS_PER_BATCH}, + solana_perf::{ + data_budget::DataBudget, + packet::{BankingPacketReceiver, PACKETS_PER_BATCH}, + }, solana_poh::poh_recorder::{PohRecorder, TransactionRecorder}, solana_runtime::{ - bank_forks::BankForks, prioritization_fee_cache::PrioritizationFeeCache, + bank::Bank, bank_forks::BankForks, prioritization_fee_cache::PrioritizationFeeCache, vote_sender_types::ReplayVoteSender, }, solana_sdk::{pubkey::Pubkey, timing::AtomicInterval}, @@ -803,11 +807,25 @@ impl BankingStage { } } +#[cfg_attr(feature = "dev-context-only-utils", qualifiers(pub))] +pub(crate) fn update_bank_forks_and_poh_recorder_for_new_tpu_bank( + bank_forks: &RwLock, + poh_recorder: &RwLock, + tpu_bank: Bank, + track_transaction_indexes: bool, +) { + let tpu_bank = bank_forks.write().unwrap().insert(tpu_bank); + poh_recorder + .write() + .unwrap() + .set_bank(tpu_bank, track_transaction_indexes); +} + #[cfg(test)] mod tests { use { super::*, - crate::banking_trace::{BankingPacketBatch, BankingTracer, Channels}, + crate::banking_trace::{BankingTracer, Channels}, crossbeam_channel::{unbounded, Receiver}, itertools::Itertools, solana_entry::entry::{self, Entry, EntrySlice}, @@ -820,7 +838,7 @@ mod tests { get_tmp_ledger_path_auto_delete, leader_schedule_cache::LeaderScheduleCache, }, - solana_perf::packet::{to_packet_batches, PacketBatch}, + solana_perf::packet::{to_packet_batches, BankingPacketBatch, PacketBatch}, solana_poh::{ poh_recorder::{ create_test_recorder, PohRecorderError, Record, RecordTransactionsSummary, diff --git a/core/src/banking_stage/packet_deserializer.rs b/core/src/banking_stage/packet_deserializer.rs index 33f41cf377cc48..6274843b106d8c 100644 --- a/core/src/banking_stage/packet_deserializer.rs +++ b/core/src/banking_stage/packet_deserializer.rs @@ -5,9 +5,8 @@ use { immutable_deserialized_packet::{DeserializedPacketError, ImmutableDeserializedPacket}, packet_filter::PacketFilterFailure, }, - crate::banking_trace::{BankingPacketBatch, BankingPacketReceiver}, crossbeam_channel::RecvTimeoutError, - solana_perf::packet::PacketBatch, + solana_perf::packet::{BankingPacketBatch, BankingPacketReceiver, PacketBatch}, solana_sdk::saturating_add_assign, std::time::{Duration, Instant}, }; diff --git a/core/src/banking_stage/packet_receiver.rs b/core/src/banking_stage/packet_receiver.rs index e95b20c3df4f1e..e153425997d85c 100644 --- a/core/src/banking_stage/packet_receiver.rs +++ b/core/src/banking_stage/packet_receiver.rs @@ -6,9 +6,9 @@ use { unprocessed_transaction_storage::UnprocessedTransactionStorage, BankingStageStats, }, - crate::banking_trace::BankingPacketReceiver, crossbeam_channel::RecvTimeoutError, solana_measure::{measure::Measure, measure_us}, + solana_perf::packet::BankingPacketReceiver, solana_sdk::{saturating_add_assign, timing::timestamp}, std::{sync::atomic::Ordering, time::Duration}, }; diff --git a/core/src/banking_stage/transaction_scheduler/scheduler_controller.rs b/core/src/banking_stage/transaction_scheduler/scheduler_controller.rs index 0a7bcf34fc0a01..e3f46ad589dd09 100644 --- a/core/src/banking_stage/transaction_scheduler/scheduler_controller.rs +++ b/core/src/banking_stage/transaction_scheduler/scheduler_controller.rs @@ -435,18 +435,15 @@ impl SchedulerController { mod tests { use { super::*, - crate::{ - banking_stage::{ - consumer::TARGET_NUM_TRANSACTIONS_PER_BATCH, - packet_deserializer::PacketDeserializer, - scheduler_messages::{ConsumeWork, FinishedConsumeWork, TransactionBatchId}, - tests::create_slow_genesis_config, - transaction_scheduler::{ - prio_graph_scheduler::PrioGraphSchedulerConfig, - receive_and_buffer::SanitizedTransactionReceiveAndBuffer, - }, + crate::banking_stage::{ + consumer::TARGET_NUM_TRANSACTIONS_PER_BATCH, + packet_deserializer::PacketDeserializer, + scheduler_messages::{ConsumeWork, FinishedConsumeWork, TransactionBatchId}, + tests::create_slow_genesis_config, + transaction_scheduler::{ + prio_graph_scheduler::PrioGraphSchedulerConfig, + receive_and_buffer::SanitizedTransactionReceiveAndBuffer, }, - banking_trace::BankingPacketBatch, }, crossbeam_channel::{unbounded, Receiver, Sender}, itertools::Itertools, @@ -455,7 +452,7 @@ mod tests { blockstore::Blockstore, genesis_utils::GenesisConfigInfo, get_tmp_ledger_path_auto_delete, leader_schedule_cache::LeaderScheduleCache, }, - solana_perf::packet::{to_packet_batches, PacketBatch, NUM_PACKETS}, + solana_perf::packet::{to_packet_batches, BankingPacketBatch, PacketBatch, NUM_PACKETS}, solana_poh::poh_recorder::{PohRecorder, Record, WorkingBankEntry}, solana_runtime::bank::Bank, solana_runtime_transaction::runtime_transaction::RuntimeTransaction, diff --git a/core/src/banking_trace.rs b/core/src/banking_trace.rs index a997f02843ac2e..87d15b0dd987a5 100644 --- a/core/src/banking_trace.rs +++ b/core/src/banking_trace.rs @@ -3,7 +3,7 @@ use { chrono::{DateTime, Local}, crossbeam_channel::{unbounded, Receiver, SendError, Sender, TryRecvError}, rolling_file::{RollingCondition, RollingConditionBasic, RollingFileAppender}, - solana_perf::packet::PacketBatch, + solana_perf::packet::{BankingPacketBatch, BankingPacketReceiver}, solana_sdk::{hash::Hash, slot_history::Slot}, std::{ fs::{create_dir_all, remove_dir_all}, @@ -19,9 +19,7 @@ use { thiserror::Error, }; -pub type BankingPacketBatch = Arc>; pub type BankingPacketSender = TracedSender; -pub type BankingPacketReceiver = Receiver; pub type TracerThreadResult = Result<(), TraceError>; pub type TracerThread = Option>; pub type DirByteLimit = u64; diff --git a/core/src/cluster_info_vote_listener.rs b/core/src/cluster_info_vote_listener.rs index 87ac964c3978a9..219ed89c2d849e 100644 --- a/core/src/cluster_info_vote_listener.rs +++ b/core/src/cluster_info_vote_listener.rs @@ -1,6 +1,6 @@ use { crate::{ - banking_trace::{BankingPacketBatch, BankingPacketSender}, + banking_trace::BankingPacketSender, consensus::vote_stake_tracker::VoteStakeTracker, optimistic_confirmation_verifier::OptimisticConfirmationVerifier, replay_stage::DUPLICATE_THRESHOLD, @@ -16,7 +16,7 @@ use { solana_ledger::blockstore::Blockstore, solana_measure::measure::Measure, solana_metrics::inc_new_counter_debug, - solana_perf::packet::{self, PacketBatch}, + solana_perf::packet::{self, BankingPacketBatch, PacketBatch}, solana_rpc::{ optimistically_confirmed_bank_tracker::{BankNotification, BankNotificationSender}, rpc_subscriptions::RpcSubscriptions, @@ -194,6 +194,7 @@ impl ClusterInfoVoteListener { verified_packets_sender: BankingPacketSender, vote_tracker: Arc, bank_forks: Arc>, + mut root_bank_cache: RootBankCache, subscriptions: Arc, verified_vote_sender: VerifiedVoteSender, gossip_verified_vote_hash_sender: GossipVerifiedVoteHashSender, @@ -205,7 +206,6 @@ impl ClusterInfoVoteListener { let (verified_vote_transactions_sender, verified_vote_transactions_receiver) = unbounded(); let listen_thread = { let exit = exit.clone(); - let mut root_bank_cache = RootBankCache::new(bank_forks.clone()); Builder::new() .name("solCiVoteLstnr".to_string()) .spawn(move || { diff --git a/core/src/replay_stage.rs b/core/src/replay_stage.rs index 0e0125a300594f..23ca9f1b2cdb1e 100644 --- a/core/src/replay_stage.rs +++ b/core/src/replay_stage.rs @@ -2,6 +2,7 @@ use { crate::{ + banking_stage::update_bank_forks_and_poh_recorder_for_new_tpu_bank, banking_trace::BankingTracer, cluster_info_vote_listener::{ DuplicateConfirmedSlotsReceiver, GossipVerifiedVoteHashReceiver, VoteTracker, @@ -2220,11 +2221,12 @@ impl ReplayStage { // new()-ing of its child bank banking_tracer.hash_event(parent.slot(), &parent.last_blockhash(), &parent.hash()); - let tpu_bank = bank_forks.write().unwrap().insert(tpu_bank); - poh_recorder - .write() - .unwrap() - .set_bank(tpu_bank, track_transaction_indexes); + update_bank_forks_and_poh_recorder_for_new_tpu_bank( + bank_forks, + poh_recorder, + tpu_bank, + track_transaction_indexes, + ); true } else { error!("{} No next leader found", my_pubkey); diff --git a/core/src/sigverify.rs b/core/src/sigverify.rs index 61da8cf9ef70dd..da27846f5927e8 100644 --- a/core/src/sigverify.rs +++ b/core/src/sigverify.rs @@ -9,10 +9,15 @@ pub use solana_perf::sigverify::{ }; use { crate::{ - banking_trace::{BankingPacketBatch, BankingPacketSender}, + banking_trace::BankingPacketSender, sigverify_stage::{SigVerifier, SigVerifyServiceError}, }, - solana_perf::{cuda_runtime::PinnedVec, packet::PacketBatch, recycler::Recycler, sigverify}, + solana_perf::{ + cuda_runtime::PinnedVec, + packet::{BankingPacketBatch, PacketBatch}, + recycler::Recycler, + sigverify, + }, }; pub struct TransactionSigVerifier { diff --git a/core/src/tpu.rs b/core/src/tpu.rs index d715bb5c7b0534..ce0b77b9457568 100644 --- a/core/src/tpu.rs +++ b/core/src/tpu.rs @@ -33,6 +33,7 @@ use { solana_runtime::{ bank_forks::BankForks, prioritization_fee_cache::PrioritizationFeeCache, + root_bank_cache::RootBankCache, vote_sender_types::{ReplayVoteReceiver, ReplayVoteSender}, }, solana_sdk::{clock::Slot, pubkey::Pubkey, quic::NotifyKeyUpdate, signature::Keypair}, @@ -99,6 +100,7 @@ impl Tpu { shred_version: u16, vote_tracker: Arc, bank_forks: Arc>, + root_bank_cache: RootBankCache, verified_vote_sender: VerifiedVoteSender, gossip_verified_vote_hash_sender: GossipVerifiedVoteHashSender, replay_vote_receiver: ReplayVoteReceiver, @@ -258,6 +260,7 @@ impl Tpu { gossip_vote_sender, vote_tracker, bank_forks.clone(), + root_bank_cache, subscriptions.clone(), verified_vote_sender, gossip_verified_vote_hash_sender, diff --git a/core/src/validator.rs b/core/src/validator.rs index c3318ee070f2bc..29acf88f7a8e7a 100644 --- a/core/src/validator.rs +++ b/core/src/validator.rs @@ -105,6 +105,7 @@ use { bank_forks::BankForks, commitment::BlockCommitmentCache, prioritization_fee_cache::PrioritizationFeeCache, + root_bank_cache::RootBankCache, runtime_config::RuntimeConfig, snapshot_archive_info::SnapshotArchiveInfoGetter, snapshot_bank_utils::{self, DISABLED_SNAPSHOT_ARCHIVE_INTERVAL}, @@ -885,6 +886,28 @@ impl Validator { // (by both replay stage and banking stage) let prioritization_fee_cache = Arc::new(PrioritizationFeeCache::default()); + let leader_schedule_cache = Arc::new(leader_schedule_cache); + let startup_verification_complete; + let (poh_recorder, entry_receiver, record_receiver) = { + let bank = &bank_forks.read().unwrap().working_bank(); + startup_verification_complete = Arc::clone(bank.get_startup_verification_complete()); + PohRecorder::new_with_clear_signal( + bank.tick_height(), + bank.last_blockhash(), + bank.clone(), + None, + bank.ticks_per_slot(), + config.delay_leader_block_for_pending_fork, + blockstore.clone(), + blockstore.get_new_shred_signal(0), + &leader_schedule_cache, + &genesis_config.poh_config, + Some(poh_timing_point_sender), + exit.clone(), + ) + }; + let poh_recorder = Arc::new(RwLock::new(poh_recorder)); + match &config.block_verification_method { BlockVerificationMethod::BlockstoreProcessor => { info!("no scheduler pool is installed for block verification..."); @@ -910,7 +933,6 @@ impl Validator { } } - let leader_schedule_cache = Arc::new(leader_schedule_cache); let entry_notification_sender = entry_notifier_service .as_ref() .map(|service| service.sender()); @@ -986,27 +1008,6 @@ impl Validator { let max_slots = Arc::new(MaxSlots::default()); - let startup_verification_complete; - let (poh_recorder, entry_receiver, record_receiver) = { - let bank = &bank_forks.read().unwrap().working_bank(); - startup_verification_complete = Arc::clone(bank.get_startup_verification_complete()); - PohRecorder::new_with_clear_signal( - bank.tick_height(), - bank.last_blockhash(), - bank.clone(), - None, - bank.ticks_per_slot(), - config.delay_leader_block_for_pending_fork, - blockstore.clone(), - blockstore.get_new_shred_signal(0), - &leader_schedule_cache, - &genesis_config.poh_config, - Some(poh_timing_point_sender), - exit.clone(), - ) - }; - let poh_recorder = Arc::new(RwLock::new(poh_recorder)); - let staked_nodes = Arc::new(RwLock::new(StakedNodes::default())); let connection_cache = if use_quic { @@ -1409,6 +1410,7 @@ impl Validator { let cluster_slots = Arc::new(crate::cluster_slots_service::cluster_slots::ClusterSlots::default()); + let root_bank_cache = RootBankCache::new(bank_forks.clone()); let tvu = Tvu::new( vote_account, authorized_voter_keypairs, @@ -1517,6 +1519,7 @@ impl Validator { node.info.shred_version(), vote_tracker, bank_forks.clone(), + root_bank_cache, verified_vote_sender, gossip_verified_vote_hash_sender, replay_vote_receiver, diff --git a/perf/Cargo.toml b/perf/Cargo.toml index bf41c12bb99507..cce3287cf01e80 100644 --- a/perf/Cargo.toml +++ b/perf/Cargo.toml @@ -13,6 +13,7 @@ edition = { workspace = true } ahash = { workspace = true } bincode = { workspace = true } bv = { workspace = true, features = ["serde"] } +crossbeam-channel = { workspace = true } curve25519-dalek = { workspace = true } dlopen2 = { workspace = true } fnv = { workspace = true } diff --git a/perf/src/packet.rs b/perf/src/packet.rs index 650fb4cb8c5198..651cb9eedfad35 100644 --- a/perf/src/packet.rs +++ b/perf/src/packet.rs @@ -3,6 +3,7 @@ pub use solana_packet::{self, Meta, Packet, PacketFlags, PACKET_DATA_SIZE}; use { crate::{cuda_runtime::PinnedVec, recycler::Recycler}, bincode::config::Options, + crossbeam_channel::Receiver, rayon::prelude::{IntoParallelIterator, IntoParallelRefIterator, IntoParallelRefMutIterator}, serde::{de::DeserializeOwned, Deserialize, Serialize}, std::{ @@ -10,6 +11,7 @@ use { net::SocketAddr, ops::{Index, IndexMut}, slice::{Iter, IterMut, SliceIndex}, + sync::Arc, }, }; @@ -226,6 +228,9 @@ pub fn to_packet_batches(items: &[T], chunk_size: usize) -> Vec>; +pub type BankingPacketReceiver = Receiver; + #[cfg(test)] fn to_packet_batches_for_tests(items: &[T]) -> Vec { to_packet_batches(items, NUM_PACKETS) diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index 53dd530b87d7ab..f2cdb82fdf82ca 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -5436,6 +5436,7 @@ dependencies = [ "ahash 0.8.11", "anyhow", "arrayvec", + "assert_matches", "base64 0.22.1", "bincode", "bs58", @@ -6213,6 +6214,7 @@ dependencies = [ "bincode", "bv", "caps", + "crossbeam-channel", "curve25519-dalek 4.1.3", "dlopen2", "fnv", diff --git a/svm/examples/Cargo.lock b/svm/examples/Cargo.lock index 7cddb2847f6420..11d1ea43c736d0 100644 --- a/svm/examples/Cargo.lock +++ b/svm/examples/Cargo.lock @@ -5287,6 +5287,7 @@ dependencies = [ "ahash 0.8.11", "anyhow", "arrayvec", + "assert_matches", "base64 0.22.1", "bincode", "bs58", @@ -6033,6 +6034,7 @@ dependencies = [ "bincode", "bv", "caps", + "crossbeam-channel", "curve25519-dalek 4.1.3", "dlopen2", "fnv",