diff --git a/Cargo.lock b/Cargo.lock index d12773560566f9..3431ab4de783eb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -79,6 +79,14 @@ dependencies = [ "solana-version", ] +[[package]] +name = "agave-banking-stage-ingress-types" +version = "2.2.0" +dependencies = [ + "crossbeam-channel", + "solana-perf", +] + [[package]] name = "agave-cargo-registry" version = "2.2.0" @@ -6053,6 +6061,7 @@ dependencies = [ name = "solana-banking-bench" version = "2.2.0" dependencies = [ + "agave-banking-stage-ingress-types", "assert_matches", "clap 3.2.23", "crossbeam-channel", @@ -6782,6 +6791,7 @@ dependencies = [ name = "solana-core" version = "2.2.0" dependencies = [ + "agave-banking-stage-ingress-types", "ahash 0.8.11", "anyhow", "arrayvec", diff --git a/Cargo.toml b/Cargo.toml index aef63e4807a863..9af98ac6710e1c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,7 @@ members = [ "accounts-db/store-histogram", "accounts-db/store-tool", "banking-bench", + "banking-stage-ingress-types", "banks-client", "banks-interface", "banks-server", @@ -255,6 +256,7 @@ check-cfg = [ [workspace.dependencies] Inflector = "0.11.4" +agave-banking-stage-ingress-types = { path = "banking-stage-ingress-types", version = "=2.2.0" } agave-transaction-view = { path = "transaction-view", version = "=2.2.0" } aquamarine = "0.3.3" aes-gcm-siv = "0.11.1" diff --git a/banking-bench/Cargo.toml b/banking-bench/Cargo.toml index 3bcaff24673478..f1785b4c738adf 100644 --- a/banking-bench/Cargo.toml +++ b/banking-bench/Cargo.toml @@ -9,6 +9,7 @@ license = { workspace = true } edition = { workspace = true } [dependencies] +agave-banking-stage-ingress-types = { workspace = true } assert_matches = { workspace = true } clap = { version = "3.1.8", features = ["derive", "cargo"] } crossbeam-channel = { workspace = true } diff --git a/banking-bench/src/main.rs b/banking-bench/src/main.rs index 97eacc07a807f5..90f3f712b58b3d 100644 --- a/banking-bench/src/main.rs +++ b/banking-bench/src/main.rs @@ -1,5 +1,6 @@ #![allow(clippy::arithmetic_side_effects)] use { + agave_banking_stage_ingress_types::BankingPacketBatch, assert_matches::assert_matches, clap::{crate_description, crate_name, Arg, ArgEnum, Command}, crossbeam_channel::{unbounded, Receiver}, @@ -9,9 +10,7 @@ use { solana_client::connection_cache::ConnectionCache, solana_core::{ banking_stage::BankingStage, - banking_trace::{ - BankingPacketBatch, BankingTracer, Channels, BANKING_TRACE_DIR_DEFAULT_BYTE_LIMIT, - }, + banking_trace::{BankingTracer, Channels, BANKING_TRACE_DIR_DEFAULT_BYTE_LIMIT}, validator::BlockProductionMethod, }, solana_gossip::cluster_info::{ClusterInfo, Node}, diff --git a/banking-stage-ingress-types/Cargo.toml b/banking-stage-ingress-types/Cargo.toml new file mode 100644 index 00000000000000..b27ab6d6b7e17a --- /dev/null +++ b/banking-stage-ingress-types/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "agave-banking-stage-ingress-types" +description = "Agave banking stage ingress types" +documentation = "https://docs.rs/agave-banking-stage-ingress-types" +version = { workspace = true } +authors = { workspace = true } +repository = { workspace = true } +homepage = { workspace = true } +license = { workspace = true } +edition = { workspace = true } + +[dependencies] +crossbeam-channel = { workspace = true } +solana-perf = { workspace = true } diff --git a/banking-stage-ingress-types/src/lib.rs b/banking-stage-ingress-types/src/lib.rs new file mode 100644 index 00000000000000..0fcfb6f31ed391 --- /dev/null +++ b/banking-stage-ingress-types/src/lib.rs @@ -0,0 +1,4 @@ +use {crossbeam_channel::Receiver, solana_perf::packet::PacketBatch, std::sync::Arc}; + +pub type BankingPacketBatch = Arc>; +pub type BankingPacketReceiver = Receiver; diff --git a/core/Cargo.toml b/core/Cargo.toml index 0f630d49d5c954..e1a6ddb1a6f928 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -14,6 +14,7 @@ edition = { workspace = true } codecov = { repository = "solana-labs/solana", branch = "master", service = "github" } [dependencies] +agave-banking-stage-ingress-types = { workspace = true } ahash = { workspace = true } anyhow = { workspace = true } arrayvec = { workspace = true } diff --git a/core/benches/banking_stage.rs b/core/benches/banking_stage.rs index 5d764f4b7c1d44..dfad8bc8c227cf 100644 --- a/core/benches/banking_stage.rs +++ b/core/benches/banking_stage.rs @@ -2,6 +2,7 @@ #![feature(test)] use { + agave_banking_stage_ingress_types::BankingPacketBatch, solana_core::{banking_trace::Channels, validator::BlockProductionMethod}, 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..62b396354ce957 100644 --- a/core/benches/banking_trace.rs +++ b/core/benches/banking_trace.rs @@ -3,12 +3,13 @@ extern crate test; use { + agave_banking_stage_ingress_types::BankingPacketBatch, solana_core::banking_trace::{ 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, }, std::{ path::PathBuf, diff --git a/core/src/banking_simulation.rs b/core/src/banking_simulation.rs index 82a4e5e94a3e76..4c4fa107611248 100644 --- a/core/src/banking_simulation.rs +++ b/core/src/banking_simulation.rs @@ -3,12 +3,12 @@ use { crate::{ banking_stage::{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, }, + agave_banking_stage_ingress_types::BankingPacketBatch, bincode::deserialize_from, crossbeam_channel::{unbounded, Sender}, itertools::Itertools, diff --git a/core/src/banking_stage.rs b/core/src/banking_stage.rs index 3d3e7b186c3597..bb76c1d53ac774 100644 --- a/core/src/banking_stage.rs +++ b/core/src/banking_stage.rs @@ -23,9 +23,9 @@ use { scheduler_controller::SchedulerController, scheduler_error::SchedulerError, }, }, - banking_trace::BankingPacketReceiver, validator::BlockProductionMethod, }, + agave_banking_stage_ingress_types::BankingPacketReceiver, crossbeam_channel::{unbounded, Receiver, RecvTimeoutError, Sender}, histogram::Histogram, solana_client::connection_cache::ConnectionCache, @@ -720,7 +720,8 @@ impl BankingStage { mod tests { use { super::*, - crate::banking_trace::{BankingPacketBatch, BankingTracer, Channels}, + crate::banking_trace::{BankingTracer, Channels}, + agave_banking_stage_ingress_types::BankingPacketBatch, crossbeam_channel::{unbounded, Receiver}, itertools::Itertools, solana_entry::entry::{self, Entry, EntrySlice}, diff --git a/core/src/banking_stage/packet_deserializer.rs b/core/src/banking_stage/packet_deserializer.rs index 33f41cf377cc48..3c1a56b43b01de 100644 --- a/core/src/banking_stage/packet_deserializer.rs +++ b/core/src/banking_stage/packet_deserializer.rs @@ -5,7 +5,7 @@ use { immutable_deserialized_packet::{DeserializedPacketError, ImmutableDeserializedPacket}, packet_filter::PacketFilterFailure, }, - crate::banking_trace::{BankingPacketBatch, BankingPacketReceiver}, + agave_banking_stage_ingress_types::{BankingPacketBatch, BankingPacketReceiver}, crossbeam_channel::RecvTimeoutError, solana_perf::packet::PacketBatch, solana_sdk::saturating_add_assign, diff --git a/core/src/banking_stage/packet_receiver.rs b/core/src/banking_stage/packet_receiver.rs index e95b20c3df4f1e..e9e760ede455fe 100644 --- a/core/src/banking_stage/packet_receiver.rs +++ b/core/src/banking_stage/packet_receiver.rs @@ -6,7 +6,7 @@ use { unprocessed_transaction_storage::UnprocessedTransactionStorage, BankingStageStats, }, - crate::banking_trace::BankingPacketReceiver, + agave_banking_stage_ingress_types::BankingPacketReceiver, crossbeam_channel::RecvTimeoutError, solana_measure::{measure::Measure, measure_us}, solana_sdk::{saturating_add_assign, timing::timestamp}, diff --git a/core/src/banking_stage/transaction_scheduler/scheduler_controller.rs b/core/src/banking_stage/transaction_scheduler/scheduler_controller.rs index 0a7bcf34fc0a01..8cd38b81ab3e67 100644 --- a/core/src/banking_stage/transaction_scheduler/scheduler_controller.rs +++ b/core/src/banking_stage/transaction_scheduler/scheduler_controller.rs @@ -435,19 +435,17 @@ 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, }, + agave_banking_stage_ingress_types::BankingPacketBatch, crossbeam_channel::{unbounded, Receiver, Sender}, itertools::Itertools, solana_gossip::cluster_info::ClusterInfo, diff --git a/core/src/banking_trace.rs b/core/src/banking_trace.rs index a997f02843ac2e..f7a97c28b4e43f 100644 --- a/core/src/banking_trace.rs +++ b/core/src/banking_trace.rs @@ -1,9 +1,9 @@ use { + agave_banking_stage_ingress_types::{BankingPacketBatch, BankingPacketReceiver}, bincode::serialize_into, chrono::{DateTime, Local}, crossbeam_channel::{unbounded, Receiver, SendError, Sender, TryRecvError}, rolling_file::{RollingCondition, RollingConditionBasic, RollingFileAppender}, - solana_perf::packet::PacketBatch, 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 40b6304a7455cc..1f82c765741cb7 100644 --- a/core/src/cluster_info_vote_listener.rs +++ b/core/src/cluster_info_vote_listener.rs @@ -1,12 +1,13 @@ use { crate::{ - banking_trace::{BankingPacketBatch, BankingPacketSender}, + banking_trace::BankingPacketSender, consensus::vote_stake_tracker::VoteStakeTracker, optimistic_confirmation_verifier::OptimisticConfirmationVerifier, replay_stage::DUPLICATE_THRESHOLD, result::{Error, Result}, sigverify, }, + agave_banking_stage_ingress_types::BankingPacketBatch, crossbeam_channel::{unbounded, Receiver, RecvTimeoutError, Select, Sender}, log::*, solana_gossip::{ diff --git a/core/src/sigverify.rs b/core/src/sigverify.rs index 61da8cf9ef70dd..4c638dcf19f711 100644 --- a/core/src/sigverify.rs +++ b/core/src/sigverify.rs @@ -9,9 +9,10 @@ pub use solana_perf::sigverify::{ }; use { crate::{ - banking_trace::{BankingPacketBatch, BankingPacketSender}, + banking_trace::BankingPacketSender, sigverify_stage::{SigVerifier, SigVerifyServiceError}, }, + agave_banking_stage_ingress_types::BankingPacketBatch, solana_perf::{cuda_runtime::PinnedVec, packet::PacketBatch, recycler::Recycler, sigverify}, }; diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index f5c3afa24b5960..59ddb6d61dbc5a 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -63,6 +63,14 @@ dependencies = [ "zeroize", ] +[[package]] +name = "agave-banking-stage-ingress-types" +version = "2.2.0" +dependencies = [ + "crossbeam-channel", + "solana-perf", +] + [[package]] name = "agave-geyser-plugin-interface" version = "2.2.0" @@ -5449,6 +5457,7 @@ dependencies = [ name = "solana-core" version = "2.2.0" dependencies = [ + "agave-banking-stage-ingress-types", "ahash 0.8.11", "anyhow", "arrayvec", diff --git a/svm/examples/Cargo.lock b/svm/examples/Cargo.lock index 56c0ccc16b7a88..10fe2bb241f742 100644 --- a/svm/examples/Cargo.lock +++ b/svm/examples/Cargo.lock @@ -63,6 +63,14 @@ dependencies = [ "zeroize", ] +[[package]] +name = "agave-banking-stage-ingress-types" +version = "2.2.0" +dependencies = [ + "crossbeam-channel", + "solana-perf", +] + [[package]] name = "agave-geyser-plugin-interface" version = "2.2.0" @@ -5300,6 +5308,7 @@ dependencies = [ name = "solana-core" version = "2.2.0" dependencies = [ + "agave-banking-stage-ingress-types", "ahash 0.8.11", "anyhow", "arrayvec",