Skip to content

Commit

Permalink
Move BankingPacket{Batch,Receiver} to new crate
Browse files Browse the repository at this point in the history
  • Loading branch information
ryoqun committed Jan 6, 2025
1 parent 91b2377 commit 2d7807f
Show file tree
Hide file tree
Showing 19 changed files with 79 additions and 29 deletions.
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions banking-bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
5 changes: 2 additions & 3 deletions banking-bench/src/main.rs
Original file line number Diff line number Diff line change
@@ -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},
Expand All @@ -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},
Expand Down
14 changes: 14 additions & 0 deletions banking-stage-ingress-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 }
4 changes: 4 additions & 0 deletions banking-stage-ingress-types/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
use {crossbeam_channel::Receiver, solana_perf::packet::PacketBatch, std::sync::Arc};

pub type BankingPacketBatch = Arc<Vec<PacketBatch>>;
pub type BankingPacketReceiver = Receiver<BankingPacketBatch>;
1 change: 1 addition & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
3 changes: 2 additions & 1 deletion core/benches/banking_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
};
Expand All @@ -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},
Expand Down
5 changes: 3 additions & 2 deletions core/benches/banking_trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions core/src/banking_simulation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions core/src/banking_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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},
Expand Down
2 changes: 1 addition & 1 deletion core/src/banking_stage/packet_deserializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion core/src/banking_stage/packet_receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,19 +435,17 @@ impl<C: LikeClusterInfo, R: ReceiveAndBuffer> SchedulerController<C, R> {
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,
Expand Down
4 changes: 1 addition & 3 deletions core/src/banking_trace.rs
Original file line number Diff line number Diff line change
@@ -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},
Expand All @@ -19,9 +19,7 @@ use {
thiserror::Error,
};

pub type BankingPacketBatch = Arc<Vec<PacketBatch>>;
pub type BankingPacketSender = TracedSender;
pub type BankingPacketReceiver = Receiver<BankingPacketBatch>;
pub type TracerThreadResult = Result<(), TraceError>;
pub type TracerThread = Option<JoinHandle<TracerThreadResult>>;
pub type DirByteLimit = u64;
Expand Down
3 changes: 2 additions & 1 deletion core/src/cluster_info_vote_listener.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand Down
3 changes: 2 additions & 1 deletion core/src/sigverify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
};

Expand Down
9 changes: 9 additions & 0 deletions programs/sbf/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions svm/examples/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2d7807f

Please sign in to comment.