Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tpu-client-next to SendTransactionService #3444

Closed
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ solana-test-validator = { path = "test-validator", version = "=2.2.0" }
solana-thin-client = { path = "thin-client", version = "=2.2.0" }
solana-transaction-error = { path = "sdk/transaction-error", version = "=2.2.0" }
solana-tpu-client = { path = "tpu-client", version = "=2.2.0", default-features = false }
solana-tpu-client-next = { path = "tpu-client-next", version = "=2.2.0" }
solana-transaction-status = { path = "transaction-status", version = "=2.2.0" }
solana-transaction-status-client-types = { path = "transaction-status-client-types", version = "=2.2.0" }
solana-transaction-metrics-tracker = { path = "transaction-metrics-tracker", version = "=2.2.0" }
Expand Down
12 changes: 6 additions & 6 deletions banks-server/src/banks_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use {
solana_send_transaction_service::{
send_transaction_service::{SendTransactionService, TransactionInfo},
tpu_info::NullTpuInfo,
transaction_client::ConnectionCacheClient,
},
std::{
io,
Expand Down Expand Up @@ -453,17 +454,16 @@ pub async fn start_tcp_server(
.map(move |chan| {
let (sender, receiver) = unbounded();

SendTransactionService::new::<NullTpuInfo>(
let client = ConnectionCacheClient::<NullTpuInfo>::new(
connection_cache.clone(),
tpu_addr,
&bank_forks,
None,
receiver,
&connection_cache,
5_000,
None,
0,
exit.clone(),
);

SendTransactionService::new(&bank_forks, receiver, client, 5_000, exit.clone());

let server = BanksServer::new(
bank_forks.clone(),
block_commitment_cache.clone(),
Expand Down
1 change: 1 addition & 0 deletions programs/sbf/Cargo.lock

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

2 changes: 1 addition & 1 deletion quic-client/src/quic_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl AsyncTaskSemaphore {
lazy_static! {
static ref ASYNC_TASK_SEMAPHORE: AsyncTaskSemaphore =
AsyncTaskSemaphore::new(MAX_OUTSTANDING_TASK);
static ref RUNTIME: Runtime = tokio::runtime::Builder::new_multi_thread()
pub static ref RUNTIME: Runtime = tokio::runtime::Builder::new_multi_thread()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is to use the same runtime in ConnectionCache as in the tpu-client-next. Since blocking ConnectionCache uses this RUNTIME static, the less invasive was to make it pub and use where needed.

.thread_name("solQuicClientRt")
.enable_all()
.build()
Expand Down
31 changes: 13 additions & 18 deletions rpc/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ use {
solana_send_transaction_service::{
send_transaction_service::{SendTransactionService, TransactionInfo},
tpu_info::NullTpuInfo,
transaction_client::ConnectionCacheClient,
},
solana_stake_program,
solana_storage_bigtable::Error as StorageError,
Expand Down Expand Up @@ -372,16 +373,14 @@ impl JsonRpcRequestProcessor {
.tpu(connection_cache.protocol())
.unwrap();
let (sender, receiver) = unbounded();
SendTransactionService::new::<NullTpuInfo>(
let client = ConnectionCacheClient::<NullTpuInfo>::new(
connection_cache.clone(),
tpu_address,
&bank_forks,
None,
receiver,
&connection_cache,
1000,
None,
1,
exit.clone(),
);
SendTransactionService::new(&bank_forks, receiver, client, 1000, exit.clone());

let leader_schedule_cache = Arc::new(LeaderScheduleCache::new_from_bank(&bank));
let startup_verification_complete = Arc::clone(bank.get_startup_verification_complete());
Expand Down Expand Up @@ -6481,16 +6480,14 @@ pub mod tests {
Arc::new(AtomicU64::default()),
Arc::new(PrioritizationFeeCache::default()),
);
SendTransactionService::new::<NullTpuInfo>(
let client = ConnectionCacheClient::<NullTpuInfo>::new(
connection_cache.clone(),
tpu_address,
&bank_forks,
None,
receiver,
&connection_cache,
1000,
None,
1,
exit,
);
SendTransactionService::new(&bank_forks, receiver, client, 1000, exit);

let mut bad_transaction = system_transaction::transfer(
&mint_keypair,
Expand Down Expand Up @@ -6755,16 +6752,14 @@ pub mod tests {
Arc::new(AtomicU64::default()),
Arc::new(PrioritizationFeeCache::default()),
);
SendTransactionService::new::<NullTpuInfo>(
let client = ConnectionCacheClient::<NullTpuInfo>::new(
connection_cache.clone(),
tpu_address,
&bank_forks,
None,
receiver,
&connection_cache,
1000,
None,
1,
exit,
);
SendTransactionService::new(&bank_forks, receiver, client, 1000, exit);
assert_eq!(
request_processor.get_block_commitment(0),
RpcBlockCommitment {
Expand Down
18 changes: 13 additions & 5 deletions rpc/src/rpc_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ use {
exit::Exit, genesis_config::DEFAULT_GENESIS_DOWNLOAD_PATH, hash::Hash,
native_token::lamports_to_sol,
},
solana_send_transaction_service::send_transaction_service::{self, SendTransactionService},
solana_send_transaction_service::{
send_transaction_service::{self, SendTransactionService},
transaction_client::ConnectionCacheClient,
},
solana_storage_bigtable::CredentialType,
std::{
net::SocketAddr,
Expand Down Expand Up @@ -474,15 +477,20 @@ impl JsonRpcService {

let leader_info =
poh_recorder.map(|recorder| ClusterTpuInfo::new(cluster_info.clone(), recorder));
let _send_transaction_service = Arc::new(SendTransactionService::new_with_config(
let client = ConnectionCacheClient::new(
connection_cache,
tpu_address,
&bank_forks,
send_transaction_service_config.tpu_peers.clone(), //TODO(klykov): check if we can avoid cloning
leader_info,
send_transaction_service_config.leader_forward_count,
);
let _send_transaction_service = SendTransactionService::new_with_config(
&bank_forks,
receiver,
&connection_cache,
client,
send_transaction_service_config,
exit,
));
);

#[cfg(test)]
let test_request_processor = request_processor.clone();
Expand Down
9 changes: 8 additions & 1 deletion send-transaction-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,26 @@ license = { workspace = true }
edition = { workspace = true }

[dependencies]
# TODO(klykov): remove this dependency when trait for leader updater
# will be changed
async-trait = { workspace = true }
crossbeam-channel = { workspace = true }
itertools = { workspace = true }
log = { workspace = true }
solana-client = { workspace = true }
solana-connection-cache = { workspace = true }
solana-measure = { workspace = true }
solana-metrics = { workspace = true }
solana-runtime = { workspace = true }
solana-sdk = { workspace = true }
solana-tpu-client = { workspace = true }
solana-tpu-client-next = { workspace = true }
tokio = { workspace = true, features = ["full"] }
tokio-util = { workspace = true }

[dev-dependencies]
solana-logger = { workspace = true }
solana-runtime = { workspace = true, features = ["dev-context-only-utils"] }
solana-quic-client = { workspace = true }

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
2 changes: 2 additions & 0 deletions send-transaction-service/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#![allow(clippy::arithmetic_side_effects)]
pub mod send_transaction_service;
pub mod send_transaction_service_stats;
pub mod tpu_info;
pub mod transaction_client;

#[macro_use]
extern crate solana_metrics;
Loading
Loading