From ddccf28022d16a76862ef119d96c67fce205150b Mon Sep 17 00:00:00 2001 From: Godmode Galactus Date: Sat, 10 Dec 2022 15:33:57 +0100 Subject: [PATCH 1/8] sending transactions in batches in a new thread --- src/context.rs | 48 +++++++++++++++++++----- src/main.rs | 27 +++++++++++--- src/rpc.rs | 99 +++++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 141 insertions(+), 33 deletions(-) diff --git a/src/context.rs b/src/context.rs index 66ef583d..9fd06326 100644 --- a/src/context.rs +++ b/src/context.rs @@ -48,8 +48,32 @@ impl BlockInformation { } } +pub struct SignatureStatus { + pub status: Option, + pub error: Option, + pub created: Instant, +} + +impl SignatureStatus { + pub fn new() -> Self { + Self { + status: None, + error: None, + created: Instant::now(), + } + } + + pub fn new_from_commitment(commitment: CommitmentLevel) -> Self { + Self { + status: Some(commitment), + error: None, + created: Instant::now(), + } + } +} + pub struct LiteRpcContext { - pub signature_status: DashMap>, + pub signature_status: DashMap, pub finalized_block_info: BlockInformation, pub confirmed_block_info: BlockInformation, pub notification_sender: Sender, @@ -67,6 +91,11 @@ impl LiteRpcContext { notification_sender, } } + + pub fn remove_stale_data(&self, purgetime_in_seconds: u64) { + self.signature_status + .retain(|_k, v| v.created.elapsed().as_secs() < purgetime_in_seconds); + } } pub struct SignatureNotification { @@ -259,6 +288,8 @@ pub struct PerformanceCounter { pub confirmations_per_seconds: Arc, pub transactions_per_seconds: Arc, + pub transaction_sent_error: Arc, + last_count_for_confirmations: Arc, last_count_for_transactions_sent: Arc, } @@ -272,6 +303,7 @@ impl PerformanceCounter { transactions_per_seconds: Arc::new(AtomicU64::new(0)), last_count_for_confirmations: Arc::new(AtomicU64::new(0)), last_count_for_transactions_sent: Arc::new(AtomicU64::new(0)), + transaction_sent_error: Arc::new(AtomicU64::new(0)), } } @@ -297,11 +329,7 @@ impl PerformanceCounter { self.last_count_for_transactions_sent .store(total_transactions, Ordering::Relaxed); } - - pub fn update_sent_transactions_counter(&self) { - self.total_transactions_sent.fetch_add(1, Ordering::Relaxed); - } - + pub fn update_confirm_transaction_counter(&self) { self.total_confirmations.fetch_add(1, Ordering::Relaxed); } @@ -321,15 +349,17 @@ pub fn launch_performance_updating_thread( let confirmations_per_seconds = performance_counter .confirmations_per_seconds .load(Ordering::Acquire); + + let errors_on_sent = performance_counter.transaction_sent_error.load(Ordering::Acquire); + let total_transactions_per_seconds = performance_counter .transactions_per_seconds .load(Ordering::Acquire); - let runtime = start.elapsed(); if let Some(remaining) = wait_time.checked_sub(runtime) { println!( - "Sent {} transactions and confrimed {} transactions", - total_transactions_per_seconds, confirmations_per_seconds + "Sent {} transactions sucessfully {} with errors, and confrimed {} transactions", + total_transactions_per_seconds, errors_on_sent, confirmations_per_seconds ); thread::sleep(remaining); } diff --git a/src/main.rs b/src/main.rs index 1ab9b1a3..338fe24a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -use std::{net::SocketAddr, sync::Arc}; +use std::{net::SocketAddr, sync::Arc, thread::sleep}; use clap::Parser; use context::LiteRpcSubsrciptionControl; @@ -52,7 +52,7 @@ fn run(port: String, subscription_port: String, rpc_url: String, websocket_url: let performance_counter = PerformanceCounter::new(); launch_performance_updating_thread(performance_counter.clone()); - let (broadcast_sender, _broadcast_receiver) = broadcast::channel(128); + let (broadcast_sender, _broadcast_receiver) = broadcast::channel(10000); let (notification_sender, notification_reciever) = crossbeam_channel::unbounded(); let pubsub_control = Arc::new(LiteRpcSubsrciptionControl::new( @@ -71,15 +71,16 @@ fn run(port: String, subscription_port: String, rpc_url: String, websocket_url: subscription_port, performance_counter.clone(), ); - { + let broadcast_thread = { + // build broadcasting thread let pubsub_control = pubsub_control.clone(); std::thread::Builder::new() .name("broadcasting thread".to_string()) .spawn(move || { pubsub_control.start_broadcasting(); }) - .unwrap(); - } + .unwrap() + }; let mut io = MetaIoHandler::default(); let lite_rpc = lite_rpc::LightRpc; io.extend_with(lite_rpc.to_delegate()); @@ -90,6 +91,18 @@ fn run(port: String, subscription_port: String, rpc_url: String, websocket_url: notification_sender, performance_counter.clone(), ); + let cleaning_thread = { + // build cleaning thread + let context = request_processor.context.clone(); + std::thread::Builder::new() + .name("cleaning thread".to_string()) + .spawn(move || { + context.remove_stale_data(60 * 10); + sleep(std::time::Duration::from_secs(60 * 5)) + }) + .unwrap() + }; + let runtime = Arc::new( tokio::runtime::Builder::new_multi_thread() .worker_threads(1) @@ -111,7 +124,7 @@ fn run(port: String, subscription_port: String, rpc_url: String, websocket_url: request_processor.clone() }) .event_loop_executor(runtime.handle().clone()) - .threads(1) + .threads(4) .cors(DomainsValidation::AllowOnly(vec![ AccessControlAllowOrigin::Any, ])) @@ -123,6 +136,8 @@ fn run(port: String, subscription_port: String, rpc_url: String, websocket_url: } request_processor.free(); websocket_service.close().unwrap(); + broadcast_thread.join().unwrap(); + cleaning_thread.join().unwrap(); } fn ts_test() { diff --git a/src/rpc.rs b/src/rpc.rs index 8fed9bad..e88304d3 100644 --- a/src/rpc.rs +++ b/src/rpc.rs @@ -1,4 +1,5 @@ use dashmap::DashMap; +use futures::executor::block_on; use serde::{Deserialize, Serialize}; use solana_client::{ pubsub_client::{BlockSubscription, PubsubClientError}, @@ -9,11 +10,12 @@ use std::{ str::FromStr, sync::Mutex, thread::{Builder, JoinHandle}, + time::Duration, }; use crate::context::{ BlockInformation, LiteRpcContext, NotificationType, PerformanceCounter, SignatureNotification, - SlotNotification, + SignatureStatus, SlotNotification, }; use crossbeam_channel::Sender; use { @@ -22,7 +24,8 @@ use { jsonrpc_core::{Error, Metadata, Result}, jsonrpc_derive::rpc, solana_client::connection_cache::ConnectionCache, - solana_client::{rpc_client::RpcClient, tpu_client::TpuClient}, + solana_client::rpc_client::RpcClient, + solana_client::nonblocking::rpc_client::RpcClient as NonblockingRpcClient, solana_perf::packet::PACKET_DATA_SIZE, solana_rpc_client_api::{ config::*, @@ -33,6 +36,7 @@ use { signature::Signature, transaction::VersionedTransaction, }, + solana_tpu_client::nonblocking::tpu_client::TpuClient, solana_transaction_status::{TransactionBinaryEncoding, UiTransactionEncoding}, std::{ any::type_name, @@ -40,10 +44,11 @@ use { }, }; +const TPU_BATCH_SIZE: usize = 64; + #[derive(Clone)] pub struct LightRpcRequestProcessor { pub rpc_client: Arc, - pub tpu_client: Arc, pub last_valid_block_height: u64, pub ws_url: String, pub context: Arc, @@ -51,6 +56,7 @@ pub struct LightRpcRequestProcessor { joinables: Arc>>>, subscribed_clients: Arc>>, performance_counter: PerformanceCounter, + tpu_producer_channel: Sender>, } impl LightRpcRequestProcessor { @@ -60,15 +66,17 @@ impl LightRpcRequestProcessor { notification_sender: Sender, performance_counter: PerformanceCounter, ) -> LightRpcRequestProcessor { + + let nonblocking_rpc_client = Arc::new(NonblockingRpcClient::new(json_rpc_url.to_string())); let rpc_client = Arc::new(RpcClient::new(json_rpc_url)); let connection_cache = Arc::new(ConnectionCache::default()); let tpu_client = Arc::new( - TpuClient::new_with_connection_cache( - rpc_client.clone(), + block_on(TpuClient::new_with_connection_cache( + nonblocking_rpc_client, websocket_url, - TpuClientConfig::default(), + TpuClientConfig {fanout_slots : 100}, // value for max fanout slots connection_cache.clone(), - ) + )) .unwrap(), ); @@ -82,6 +90,8 @@ impl LightRpcRequestProcessor { let (client_finalized, receiver_finalized) = Self::subscribe_block(websocket_url, CommitmentLevel::Finalized).unwrap(); + let (tpu_producer, tpu_consumer) = crossbeam_channel::bounded(100000); + // create threads to listen for finalized and confrimed blocks let joinables = vec![ Self::build_thread_to_process_blocks( @@ -94,11 +104,11 @@ impl LightRpcRequestProcessor { &context, CommitmentLevel::Finalized, ), + Self::build_thread_to_process_transactions(tpu_client.clone(), tpu_consumer, performance_counter.clone()), ]; LightRpcRequestProcessor { rpc_client, - tpu_client, last_valid_block_height: 0, ws_url: websocket_url.to_string(), context, @@ -106,6 +116,7 @@ impl LightRpcRequestProcessor { joinables: Arc::new(Mutex::new(joinables)), subscribed_clients: Arc::new(Mutex::new(vec![client_confirmed, client_finalized])), performance_counter, + tpu_producer_channel: tpu_producer, } } @@ -153,9 +164,55 @@ impl LightRpcRequestProcessor { .unwrap() } + fn build_thread_to_process_transactions( + tpu_client: Arc, + receiver: Receiver>, + performance_counters : PerformanceCounter, + ) -> JoinHandle<()> { + Builder::new() + .name("tpu sender".to_string()) + .spawn(move || loop { + let recv_res = receiver.recv(); + match recv_res { + Ok(transaction) => { + let mut transactions_vec = vec![transaction]; + let mut time_remaining = Duration::from_micros(50000); + for _i in 1..TPU_BATCH_SIZE { + let start = std::time::Instant::now(); + let another = receiver.recv_timeout(time_remaining); + + match another { + Ok(x) => transactions_vec.push(x), + Err(_) => break, + } + match time_remaining.checked_sub(start.elapsed()) { + Some(x) => time_remaining = x, + None => break, + } + } + let count:u64 = transactions_vec.len() as u64; + let fut_res = block_on(tpu_client.try_send_wire_transaction_batch(transactions_vec)); + match fut_res + { + Ok(_) => performance_counters.total_confirmations.fetch_add( count, Ordering::Relaxed), + Err(e) => { + println!("Got error while sending transaction batch of size {}, error {}", count, e.to_string()); + performance_counters.transaction_sent_error.fetch_add(count, Ordering::Relaxed) + } + }; + } + Err(e) => { + println!("got error on tpu channel {}", e.to_string()); + break; + } + }; + }) + .unwrap() + } + fn process_block( reciever: Receiver>, - signature_status: &DashMap>, + signature_status: &DashMap, commitment: CommitmentLevel, notification_sender: &crossbeam_channel::Sender, block_information: &BlockInformation, @@ -210,7 +267,7 @@ impl LightRpcRequestProcessor { e.to_string() ); } - x.insert(Some(commitment)); + x.insert(SignatureStatus::new_from_commitment(commitment)); } dashmap::mapref::entry::Entry::Vacant(_x) => { // do nothing transaction not sent by lite rpc @@ -355,12 +412,18 @@ pub mod lite_rpc { let (wire_transaction, transaction) = decode_and_deserialize::(data, binary_encoding)?; - meta.context - .signature_status - .insert(transaction.signatures[0].to_string(), None); - meta.tpu_client.send_wire_transaction(wire_transaction); - meta.performance_counter.update_sent_transactions_counter(); - Ok(transaction.signatures[0].to_string()) + meta.context.signature_status.insert( + transaction.signatures[0].to_string(), + SignatureStatus::new(), + ); + + match meta.tpu_producer_channel.send(wire_transaction) { + Ok(_) => Ok(transaction.signatures[0].to_string()), + Err(e) => { + println!("got error while sending on channel {}", e.to_string()); + Err(jsonrpc_core::Error::new(jsonrpc_core::ErrorCode::InternalError)) + } + } } fn get_recent_blockhash( @@ -462,7 +525,7 @@ pub mod lite_rpc { .update_confirm_transaction_counter(); match k_value { - Some(value) => match *value { + Some(value) => match (*value).status { Some(commitment_for_signature) => Ok(RpcResponse { context: RpcResponseContext::new(slot), value: if commitment.eq(&CommitmentLevel::Finalized) { @@ -513,7 +576,7 @@ pub mod lite_rpc { let singature_status = meta.context.signature_status.get(x); let k_value = singature_status; match k_value { - Some(value) => match *value { + Some(value) => match (*value).status { Some(commitment_for_signature) => { let slot = meta .context From 4d1ecf3926b1926bbdca35abf6b2be6e773fe8b1 Mon Sep 17 00:00:00 2001 From: Godmode Galactus Date: Sat, 10 Dec 2022 16:38:51 +0100 Subject: [PATCH 2/8] updaing cargo file with the new repo compatible with lite rpc --- Cargo.lock | 368 +++++++++++++---------------------------------------- Cargo.toml | 52 ++++---- 2 files changed, 114 insertions(+), 306 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 46eaba55..e73e8fb6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -125,97 +125,6 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "983cd8b9d4b02a6dc6ffa557262eb5858a27a0038ffffe21a0f133eaa819a164" -[[package]] -name = "ark-bn254" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea691771ebbb28aea556c044e2e5c5227398d840cee0c34d4d20fa8eb2689e8c" -dependencies = [ - "ark-ec", - "ark-ff", - "ark-std", -] - -[[package]] -name = "ark-ec" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dea978406c4b1ca13c2db2373b05cc55429c3575b8b21f1b9ee859aa5b03dd42" -dependencies = [ - "ark-ff", - "ark-serialize", - "ark-std", - "derivative", - "num-traits", - "zeroize", -] - -[[package]] -name = "ark-ff" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b3235cc41ee7a12aaaf2c575a2ad7b46713a8a50bda2fc3b003a04845c05dd6" -dependencies = [ - "ark-ff-asm", - "ark-ff-macros", - "ark-serialize", - "ark-std", - "derivative", - "num-bigint 0.4.3", - "num-traits", - "paste", - "rustc_version 0.3.3", - "zeroize", -] - -[[package]] -name = "ark-ff-asm" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db02d390bf6643fb404d3d22d31aee1c4bc4459600aef9113833d17e786c6e44" -dependencies = [ - "quote 1.0.21", - "syn 1.0.103", -] - -[[package]] -name = "ark-ff-macros" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" -dependencies = [ - "num-bigint 0.4.3", - "num-traits", - "quote 1.0.21", - "syn 1.0.103", -] - -[[package]] -name = "ark-serialize" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6c2b318ee6e10f8c2853e73a83adc0ccb88995aa978d8a3408d492ab2ee671" -dependencies = [ - "ark-std", - "digest 0.9.0", -] - -[[package]] -name = "ark-std" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c" -dependencies = [ - "num-traits", - "rand 0.8.5", -] - -[[package]] -name = "array-bytes" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ad284aeb45c13f2fb4f084de4a420ebf447423bdf9386c0540ce33cb3ef4b8c" - [[package]] name = "arrayref" version = "0.3.6" @@ -1169,17 +1078,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e5c37193a1db1d8ed868c03ec7b152175f26160a5b740e5e484143877e0adf0" -[[package]] -name = "derivative" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" -dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", - "syn 1.0.103", -] - [[package]] name = "derive_more" version = "0.99.17" @@ -2384,6 +2282,12 @@ dependencies = [ "cc", ] +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + [[package]] name = "linux-raw-sys" version = "0.1.3" @@ -2974,12 +2878,6 @@ dependencies = [ "windows-sys 0.42.0", ] -[[package]] -name = "paste" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" - [[package]] name = "pbkdf2" version = "0.4.0" @@ -3034,16 +2932,6 @@ dependencies = [ "num", ] -[[package]] -name = "pest" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f400b0f7905bf702f9f3dc3df5a121b16c54e9e8012c082905fdf09a931861a" -dependencies = [ - "thiserror", - "ucd-trie", -] - [[package]] name = "petgraph" version = "0.6.2" @@ -3644,15 +3532,6 @@ dependencies = [ "semver 0.9.0", ] -[[package]] -name = "rustc_version" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" -dependencies = [ - "semver 0.11.0", -] - [[package]] name = "rustc_version" version = "0.4.0" @@ -3829,16 +3708,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser 0.7.0", -] - -[[package]] -name = "semver" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" -dependencies = [ - "semver-parser 0.10.2", + "semver-parser", ] [[package]] @@ -3853,15 +3723,6 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -[[package]] -name = "semver-parser" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" -dependencies = [ - "pest", -] - [[package]] name = "serde" version = "1.0.147" @@ -3916,15 +3777,14 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.9.14" +version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d232d893b10de3eb7258ff01974d6ee20663d8e833263c99409d4b13a0209da" +checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b" dependencies = [ "indexmap", - "itoa 1.0.4", "ryu", "serde", - "unsafe-libyaml", + "yaml-rust", ] [[package]] @@ -4104,7 +3964,7 @@ dependencies = [ [[package]] name = "solana-account-decoder" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "Inflector", "base64 0.13.1", @@ -4127,7 +3987,7 @@ dependencies = [ [[package]] name = "solana-address-lookup-table-program" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "bincode", "bytemuck", @@ -4147,7 +4007,7 @@ dependencies = [ [[package]] name = "solana-bloom" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "bv", "fnv", @@ -4165,13 +4025,14 @@ dependencies = [ [[package]] name = "solana-bpf-loader-program" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "bincode", "byteorder", "libsecp256k1", "log", "solana-measure", + "solana-metrics", "solana-program-runtime", "solana-sdk 1.15.0", "solana-zk-token-sdk 1.15.0", @@ -4182,7 +4043,7 @@ dependencies = [ [[package]] name = "solana-bucket-map" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "log", "memmap2", @@ -4196,7 +4057,7 @@ dependencies = [ [[package]] name = "solana-clap-utils" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "chrono", "clap 2.34.0", @@ -4213,7 +4074,7 @@ dependencies = [ [[package]] name = "solana-cli-config" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "dirs-next", "lazy_static", @@ -4228,39 +4089,23 @@ dependencies = [ [[package]] name = "solana-client" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ - "async-trait", - "bincode", - "enum_dispatch", - "futures 0.3.25", - "futures-util", - "indexmap", - "indicatif", "log", - "rand 0.7.3", - "rayon", "solana-measure", - "solana-metrics", - "solana-net-utils", "solana-pubsub-client", - "solana-quic-client", "solana-rpc-client", "solana-rpc-client-api", "solana-rpc-client-nonce-utils", "solana-sdk 1.15.0", - "solana-streamer", "solana-thin-client", "solana-tpu-client", - "solana-udp-client", - "thiserror", - "tokio", ] [[package]] name = "solana-compute-budget-program" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "solana-program-runtime", "solana-sdk 1.15.0", @@ -4269,7 +4114,7 @@ dependencies = [ [[package]] name = "solana-config-program" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "bincode", "chrono", @@ -4282,7 +4127,7 @@ dependencies = [ [[package]] name = "solana-entry" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "bincode", "crossbeam-channel", @@ -4304,7 +4149,7 @@ dependencies = [ [[package]] name = "solana-faucet" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "bincode", "byteorder", @@ -4361,7 +4206,7 @@ dependencies = [ [[package]] name = "solana-frozen-abi" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "ahash", "blake3", @@ -4406,7 +4251,7 @@ dependencies = [ [[package]] name = "solana-frozen-abi-macro" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "proc-macro2 1.0.47", "quote 1.0.21", @@ -4417,7 +4262,7 @@ dependencies = [ [[package]] name = "solana-gossip" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "bincode", "bv", @@ -4439,7 +4284,6 @@ dependencies = [ "serde_derive", "solana-bloom", "solana-clap-utils", - "solana-client", "solana-entry", "solana-frozen-abi 1.15.0", "solana-frozen-abi-macro 1.15.0", @@ -4463,7 +4307,7 @@ dependencies = [ [[package]] name = "solana-ledger" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "assert_matches", "bincode", @@ -4533,7 +4377,7 @@ dependencies = [ [[package]] name = "solana-logger" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "env_logger", "lazy_static", @@ -4543,7 +4387,7 @@ dependencies = [ [[package]] name = "solana-measure" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "log", "solana-sdk 1.15.0", @@ -4552,7 +4396,7 @@ dependencies = [ [[package]] name = "solana-merkle-tree" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "fast-math", "matches", @@ -4562,7 +4406,7 @@ dependencies = [ [[package]] name = "solana-metrics" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "crossbeam-channel", "gethostname", @@ -4575,7 +4419,7 @@ dependencies = [ [[package]] name = "solana-net-utils" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "bincode", "clap 3.2.23", @@ -4596,7 +4440,7 @@ dependencies = [ [[package]] name = "solana-perf" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "ahash", "bincode", @@ -4622,7 +4466,7 @@ dependencies = [ [[package]] name = "solana-poh" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "core_affinity", "crossbeam-channel", @@ -4689,12 +4533,8 @@ dependencies = [ [[package]] name = "solana-program" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ - "ark-bn254", - "ark-ec", - "ark-ff", - "array-bytes", "base64 0.13.1", "bincode", "bitflags", @@ -4741,7 +4581,7 @@ dependencies = [ [[package]] name = "solana-program-runtime" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "base64 0.13.1", "bincode", @@ -4753,7 +4593,6 @@ dependencies = [ "log", "num-derive", "num-traits", - "rand 0.7.3", "rustc_version 0.4.0", "serde", "solana-frozen-abi 1.15.0", @@ -4761,14 +4600,13 @@ dependencies = [ "solana-measure", "solana-metrics", "solana-sdk 1.15.0", - "solana_rbpf", "thiserror", ] [[package]] name = "solana-pubsub-client" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "crossbeam-channel", "futures-util", @@ -4789,36 +4627,10 @@ dependencies = [ "url 2.3.1", ] -[[package]] -name = "solana-quic-client" -version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" -dependencies = [ - "async-mutex", - "async-trait", - "futures 0.3.25", - "itertools", - "lazy_static", - "log", - "quinn", - "quinn-proto", - "quinn-udp", - "rustls", - "solana-measure", - "solana-metrics", - "solana-net-utils", - "solana-rpc-client-api", - "solana-sdk 1.15.0", - "solana-streamer", - "solana-tpu-client", - "thiserror", - "tokio", -] - [[package]] name = "solana-rayon-threadlimit" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "lazy_static", "num_cpus", @@ -4827,7 +4639,7 @@ dependencies = [ [[package]] name = "solana-remote-wallet" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "console", "dialoguer", @@ -4845,7 +4657,7 @@ dependencies = [ [[package]] name = "solana-rpc" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "base64 0.13.1", "bincode", @@ -4867,7 +4679,6 @@ dependencies = [ "serde_json", "soketto", "solana-account-decoder", - "solana-client", "solana-entry", "solana-faucet", "solana-gossip", @@ -4899,7 +4710,7 @@ dependencies = [ [[package]] name = "solana-rpc-client" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "async-trait", "base64 0.13.1", @@ -4924,7 +4735,7 @@ dependencies = [ [[package]] name = "solana-rpc-client-api" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "base64 0.13.1", "bs58", @@ -4945,7 +4756,7 @@ dependencies = [ [[package]] name = "solana-rpc-client-nonce-utils" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "clap 2.34.0", "solana-clap-utils", @@ -4957,7 +4768,7 @@ dependencies = [ [[package]] name = "solana-runtime" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "arrayref", "bincode", @@ -4991,7 +4802,6 @@ dependencies = [ "serde", "serde_derive", "solana-address-lookup-table-program", - "solana-bpf-loader-program", "solana-bucket-map", "solana-compute-budget-program", "solana-config-program", @@ -4999,7 +4809,6 @@ dependencies = [ "solana-frozen-abi-macro 1.15.0", "solana-measure", "solana-metrics", - "solana-perf", "solana-program-runtime", "solana-rayon-threadlimit", "solana-sdk 1.15.0", @@ -5070,7 +4879,7 @@ dependencies = [ [[package]] name = "solana-sdk" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "assert_matches", "base64 0.13.1", @@ -5095,7 +4904,6 @@ dependencies = [ "memmap2", "num-derive", "num-traits", - "num_enum", "pbkdf2 0.11.0", "qstring", "rand 0.7.3", @@ -5134,7 +4942,7 @@ dependencies = [ [[package]] name = "solana-sdk-macro" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "bs58", "proc-macro2 1.0.47", @@ -5146,11 +4954,10 @@ dependencies = [ [[package]] name = "solana-send-transaction-service" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "crossbeam-channel", "log", - "solana-client", "solana-measure", "solana-metrics", "solana-runtime", @@ -5161,21 +4968,29 @@ dependencies = [ [[package]] name = "solana-stake-program" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "bincode", "log", + "num-derive", + "num-traits", "rustc_version 0.4.0", + "serde", + "serde_derive", "solana-config-program", + "solana-frozen-abi 1.15.0", + "solana-frozen-abi-macro 1.15.0", + "solana-metrics", "solana-program-runtime", "solana-sdk 1.15.0", "solana-vote-program", + "thiserror", ] [[package]] name = "solana-storage-bigtable" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "backoff", "bincode", @@ -5208,7 +5023,7 @@ dependencies = [ [[package]] name = "solana-storage-proto" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "bincode", "bs58", @@ -5224,7 +5039,7 @@ dependencies = [ [[package]] name = "solana-streamer" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "crossbeam-channel", "futures-util", @@ -5254,7 +5069,7 @@ dependencies = [ [[package]] name = "solana-sys-tuner" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "clap 2.34.0", "libc", @@ -5270,7 +5085,7 @@ dependencies = [ [[package]] name = "solana-thin-client" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "bincode", "log", @@ -5283,16 +5098,25 @@ dependencies = [ [[package]] name = "solana-tpu-client" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ + "async-mutex", "async-trait", "bincode", + "enum_dispatch", + "futures 0.3.25", "futures-util", "indexmap", "indicatif", + "itertools", + "lazy_static", "log", + "quinn", + "quinn-proto", + "quinn-udp", "rand 0.7.3", "rayon", + "rustls", "solana-measure", "solana-metrics", "solana-net-utils", @@ -5300,6 +5124,7 @@ dependencies = [ "solana-rpc-client", "solana-rpc-client-api", "solana-sdk 1.15.0", + "solana-streamer", "thiserror", "tokio", ] @@ -5307,7 +5132,7 @@ dependencies = [ [[package]] name = "solana-transaction-status" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "Inflector", "base64 0.13.1", @@ -5329,24 +5154,10 @@ dependencies = [ "thiserror", ] -[[package]] -name = "solana-udp-client" -version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" -dependencies = [ - "async-trait", - "solana-net-utils", - "solana-sdk 1.15.0", - "solana-streamer", - "solana-tpu-client", - "thiserror", - "tokio", -] - [[package]] name = "solana-version" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "log", "rustc_version 0.4.0", @@ -5361,7 +5172,7 @@ dependencies = [ [[package]] name = "solana-vote-program" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "bincode", "log", @@ -5382,7 +5193,7 @@ dependencies = [ [[package]] name = "solana-zk-token-proof-program" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "bytemuck", "getrandom 0.1.16", @@ -5427,7 +5238,7 @@ dependencies = [ [[package]] name = "solana-zk-token-sdk" version = "1.15.0" -source = "git+https://github.com/solana-labs/solana.git#9327658007dd72e3eb5465c7c9f0fe0008ba27e0" +source = "git+https://github.com/blockworks-foundation/solana.git?branch=lite-rpc-compatible#624f5cfcd598a067042be251e45ac74286a5f035" dependencies = [ "aes-gcm-siv", "arrayref", @@ -5456,9 +5267,9 @@ dependencies = [ [[package]] name = "solana_rbpf" -version = "0.2.37" +version = "0.2.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0669f9f5c355899600732451c65cc717d0ef0c53717749f03520337c824fd8a1" +checksum = "334bb11faee82f0306e39944cb4ac85824b7d261f3d99d1f2f8bd09851644f0b" dependencies = [ "byteorder", "combine", @@ -6127,12 +5938,6 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" -[[package]] -name = "ucd-trie" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" - [[package]] name = "unicase" version = "2.6.0" @@ -6209,12 +6014,6 @@ dependencies = [ "void", ] -[[package]] -name = "unsafe-libyaml" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1e5fa573d8ac5f1a856f8d7be41d390ee973daf97c806b2c1a465e4e1406e68" - [[package]] name = "untrusted" version = "0.7.1" @@ -6617,6 +6416,15 @@ dependencies = [ "libc", ] +[[package]] +name = "yaml-rust" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +dependencies = [ + "linked-hash-map", +] + [[package]] name = "yasna" version = "0.5.0" diff --git a/Cargo.toml b/Cargo.toml index 2eb9c47a..66eaa4cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,32 +6,32 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -solana-client = { git = "https://github.com/solana-labs/solana.git" } -solana-sdk = { git = "https://github.com/solana-labs/solana.git" } -solana-clap-utils = { git = "https://github.com/solana-labs/solana.git" } -solana-cli-config = { git = "https://github.com/solana-labs/solana.git" } -solana-pubsub-client = { git = "https://github.com/solana-labs/solana.git" } -solana-account-decoder = { git = "https://github.com/solana-labs/solana.git" } -solana-entry = { git = "https://github.com/solana-labs/solana.git" } -solana-faucet = { git = "https://github.com/solana-labs/solana.git" } -solana-gossip = { git = "https://github.com/solana-labs/solana.git" } -solana-ledger = { git = "https://github.com/solana-labs/solana.git" } -solana-measure = { git = "https://github.com/solana-labs/solana.git" } -solana-metrics = { git = "https://github.com/solana-labs/solana.git" } -solana-perf = { git = "https://github.com/solana-labs/solana.git" } -solana-poh = { git = "https://github.com/solana-labs/solana.git" } -solana-rayon-threadlimit = { git = "https://github.com/solana-labs/solana.git" } -solana-rpc-client-api = { git = "https://github.com/solana-labs/solana.git" } -solana-runtime = { git = "https://github.com/solana-labs/solana.git" } -solana-send-transaction-service = { git = "https://github.com/solana-labs/solana.git" } -solana-stake-program = { git = "https://github.com/solana-labs/solana.git" } -solana-storage-bigtable = { git = "https://github.com/solana-labs/solana.git" } -solana-streamer = { git = "https://github.com/solana-labs/solana.git" } -solana-tpu-client = { git = "https://github.com/solana-labs/solana.git" } -solana-transaction-status = { git = "https://github.com/solana-labs/solana.git" } -solana-version = { git = "https://github.com/solana-labs/solana.git" } -solana-vote-program = { git = "https://github.com/solana-labs/solana.git" } -solana-rpc = { git = "https://github.com/solana-labs/solana.git" } +solana-client = { git = "https://github.com/blockworks-foundation/solana.git", branch="lite-rpc-compatible" } +solana-sdk = { git = "https://github.com/blockworks-foundation/solana.git", branch="lite-rpc-compatible" } +solana-clap-utils = { git = "https://github.com/blockworks-foundation/solana.git", branch="lite-rpc-compatible" } +solana-cli-config = { git = "https://github.com/blockworks-foundation/solana.git", branch="lite-rpc-compatible" } +solana-pubsub-client = { git = "https://github.com/blockworks-foundation/solana.git", branch="lite-rpc-compatible" } +solana-account-decoder = { git = "https://github.com/blockworks-foundation/solana.git", branch="lite-rpc-compatible" } +solana-entry = { git = "https://github.com/blockworks-foundation/solana.git", branch="lite-rpc-compatible" } +solana-faucet = { git = "https://github.com/blockworks-foundation/solana.git", branch="lite-rpc-compatible" } +solana-gossip = { git = "https://github.com/blockworks-foundation/solana.git", branch="lite-rpc-compatible" } +solana-ledger = { git = "https://github.com/blockworks-foundation/solana.git", branch="lite-rpc-compatible" } +solana-measure = { git = "https://github.com/blockworks-foundation/solana.git", branch="lite-rpc-compatible" } +solana-metrics = { git = "https://github.com/blockworks-foundation/solana.git", branch="lite-rpc-compatible" } +solana-perf = { git = "https://github.com/blockworks-foundation/solana.git", branch="lite-rpc-compatible" } +solana-poh = { git = "https://github.com/blockworks-foundation/solana.git", branch="lite-rpc-compatible" } +solana-rayon-threadlimit = { git = "https://github.com/blockworks-foundation/solana.git", branch="lite-rpc-compatible" } +solana-rpc-client-api = { git = "https://github.com/blockworks-foundation/solana.git", branch="lite-rpc-compatible" } +solana-runtime = { git = "https://github.com/blockworks-foundation/solana.git", branch="lite-rpc-compatible" } +solana-send-transaction-service = { git = "https://github.com/blockworks-foundation/solana.git", branch="lite-rpc-compatible" } +solana-stake-program = { git = "https://github.com/blockworks-foundation/solana.git", branch="lite-rpc-compatible" } +solana-storage-bigtable = { git = "https://github.com/blockworks-foundation/solana.git", branch="lite-rpc-compatible" } +solana-streamer = { git = "https://github.com/blockworks-foundation/solana.git", branch="lite-rpc-compatible" } +solana-tpu-client = { git = "https://github.com/blockworks-foundation/solana.git", branch="lite-rpc-compatible" } +solana-transaction-status = { git = "https://github.com/blockworks-foundation/solana.git", branch="lite-rpc-compatible" } +solana-version = { git = "https://github.com/blockworks-foundation/solana.git", branch="lite-rpc-compatible" } +solana-vote-program = { git = "https://github.com/blockworks-foundation/solana.git", branch="lite-rpc-compatible" } +solana-rpc = { git = "https://github.com/blockworks-foundation/solana.git", branch="lite-rpc-compatible" } tokio = { version = "1.14.1", features = ["full"]} futures = "0.3.25" From 7a4125aaa212a12ac24723e47770893d85548c0b Mon Sep 17 00:00:00 2001 From: Godmode Galactus Date: Sat, 10 Dec 2022 18:47:19 +0100 Subject: [PATCH 3/8] Making main tokio::main to support async/futures --- src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 338fe24a..7d02dfa2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -149,7 +149,8 @@ fn ts_test() { println!("{}", String::from_utf8_lossy(&res.stderr)); } -pub fn main() { +#[tokio::main] +pub async fn main() { let cli_command = Args::parse(); match cli_command.command { From ca616bcf2b493868038dcc7e4905410d1e2a1801 Mon Sep 17 00:00:00 2001 From: Godmode Galactus Date: Sun, 11 Dec 2022 18:06:39 +0100 Subject: [PATCH 4/8] making the batching of transactions work --- src/cli.rs | 37 ++++--------------- src/context.rs | 2 +- src/main.rs | 61 +++++++++---------------------- src/rpc.rs | 99 ++++++++++++++++++++++++++++---------------------- 4 files changed, 82 insertions(+), 117 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index 72a6b92a..16fcfe46 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -1,6 +1,5 @@ -use clap::Subcommand; - use clap::Parser; +use solana_cli_config::ConfigInput; /// Holds the configuration for a single run of the benchmark #[derive(Parser, Debug)] @@ -13,24 +12,18 @@ use clap::Parser; " )] pub struct Args { - #[clap(subcommand)] - pub command: Command, - /* - #[arg(short, long, default_value_t = String::from("8899"))] - pub port: String, - #[arg(short, long, default_value_t = String::from("8900"))] - pub subscription_port: String, + #[arg(short, long, default_value_t = 8899)] + pub port: u16, + #[arg(short, long, default_value_t = 8900)] + pub subscription_port: u16, #[arg(short, long, default_value_t = String::from("http://localhost:8899"))] pub rpc_url: String, - #[arg(short, long, default_value_t = String::new())] + #[arg(short, long, default_value_t = String::from("http://localhost:8900"))] pub websocket_url: String, - */ } -/* + impl Args { - pub fn resolve_address(&mut self) { - if self.rpc_url.is_empty() { let (_, rpc_url) = ConfigInput::compute_json_rpc_url_setting( self.rpc_url.as_str(), @@ -48,20 +41,4 @@ impl Args { self.websocket_url = ws_url; } } - -} -*/ -#[derive(Subcommand, Debug)] -pub enum Command { - Run { - #[arg(short, long, default_value_t = String::from("8899"))] - port: String, - #[arg(short, long, default_value_t = String::from("8900"))] - subscription_port: String, - #[arg(short, long, default_value_t = String::from("http://localhost:8899"))] - rpc_url: String, - #[arg(short, long, default_value_t = String::new())] - websocket_url: String, - }, - Test, } diff --git a/src/context.rs b/src/context.rs index 9fd06326..33c8dd08 100644 --- a/src/context.rs +++ b/src/context.rs @@ -329,7 +329,7 @@ impl PerformanceCounter { self.last_count_for_transactions_sent .store(total_transactions, Ordering::Relaxed); } - + pub fn update_confirm_transaction_counter(&self) { self.total_confirmations.fetch_add(1, Ordering::Relaxed); } diff --git a/src/main.rs b/src/main.rs index 7d02dfa2..22568812 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,8 @@ -use std::{net::SocketAddr, sync::Arc, thread::sleep}; +use std::{ + net::{IpAddr, Ipv4Addr, SocketAddr}, + sync::Arc, + thread::sleep, +}; use clap::Parser; use context::LiteRpcSubsrciptionControl; @@ -24,7 +28,7 @@ mod rpc; use cli::Args; -fn run(port: String, subscription_port: String, rpc_url: String, websocket_url: String) { +fn run(port: u16, subscription_port: u16, rpc_url: String, websocket_url: String) { let rpc_url = if rpc_url.is_empty() { let (_, rpc_url) = ConfigInput::compute_json_rpc_url_setting( rpc_url.as_str(), @@ -60,10 +64,8 @@ fn run(port: String, subscription_port: String, rpc_url: String, websocket_url: notification_reciever, )); - let subscription_port = format!("127.0.0.1:{}",subscription_port) - - .parse::() - .expect("Invalid subscription port"); + let subscription_port = + SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), subscription_port); // start websocket server let (_trigger, websocket_service) = LitePubSubService::new( @@ -114,9 +116,7 @@ fn run(port: String, subscription_port: String, rpc_url: String, websocket_url: ); let max_request_body_size: usize = 50 * (1 << 10); - let socket_addr = format!("127.0.0.1:{}",rpc_addr).parse::().unwrap(); - - + let socket_addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), port); { let request_processor = request_processor.clone(); let server = @@ -140,40 +140,15 @@ fn run(port: String, subscription_port: String, rpc_url: String, websocket_url: cleaning_thread.join().unwrap(); } -fn ts_test() { - let res = std::process::Command::new("yarn") - .args(["run", "test:test-validator"]) - .output() - .unwrap(); - println!("{}", String::from_utf8_lossy(&res.stdout)); - println!("{}", String::from_utf8_lossy(&res.stderr)); -} - -#[tokio::main] pub async fn main() { - let cli_command = Args::parse(); + let mut cli = Args::parse(); + cli.resolve_address(); + let Args { + port, + subscription_port, + rpc_url, + websocket_url, + } = cli; - match cli_command.command { - cli::Command::Run { - port, - subscription_port, - rpc_url, - websocket_url, - } => run(port, subscription_port, rpc_url, websocket_url), - cli::Command::Test => ts_test(), - } - //cli_config.resolve_address(); - //println!( - // "Using rpc server {} and ws server {}", - // cli_config.rpc_url, cli_config.websocket_url - //); - //let Args { - // rpc_url: json_rpc_url, - // websocket_url, - // port: rpc_addr, - // subscription_port, - // .. - //} = &cli_config; - - // start recieving notifications and broadcast them + run(port, subscription_port, rpc_url, websocket_url) } diff --git a/src/rpc.rs b/src/rpc.rs index e88304d3..24cb3370 100644 --- a/src/rpc.rs +++ b/src/rpc.rs @@ -1,11 +1,11 @@ use dashmap::DashMap; -use futures::executor::block_on; use serde::{Deserialize, Serialize}; use solana_client::{ pubsub_client::{BlockSubscription, PubsubClientError}, tpu_client::TpuClientConfig, }; use solana_pubsub_client::pubsub_client::{PubsubBlockClientSubscription, PubsubClient}; +use solana_sdk::transaction::Transaction; use std::{ str::FromStr, sync::Mutex, @@ -25,7 +25,7 @@ use { jsonrpc_derive::rpc, solana_client::connection_cache::ConnectionCache, solana_client::rpc_client::RpcClient, - solana_client::nonblocking::rpc_client::RpcClient as NonblockingRpcClient, + solana_client::tpu_client::TpuClient, solana_perf::packet::PACKET_DATA_SIZE, solana_rpc_client_api::{ config::*, @@ -34,9 +34,7 @@ use { solana_sdk::{ commitment_config::{CommitmentConfig, CommitmentLevel}, signature::Signature, - transaction::VersionedTransaction, }, - solana_tpu_client::nonblocking::tpu_client::TpuClient, solana_transaction_status::{TransactionBinaryEncoding, UiTransactionEncoding}, std::{ any::type_name, @@ -56,7 +54,7 @@ pub struct LightRpcRequestProcessor { joinables: Arc>>>, subscribed_clients: Arc>>, performance_counter: PerformanceCounter, - tpu_producer_channel: Sender>, + tpu_producer_channel: Sender, } impl LightRpcRequestProcessor { @@ -66,19 +64,8 @@ impl LightRpcRequestProcessor { notification_sender: Sender, performance_counter: PerformanceCounter, ) -> LightRpcRequestProcessor { - - let nonblocking_rpc_client = Arc::new(NonblockingRpcClient::new(json_rpc_url.to_string())); let rpc_client = Arc::new(RpcClient::new(json_rpc_url)); let connection_cache = Arc::new(ConnectionCache::default()); - let tpu_client = Arc::new( - block_on(TpuClient::new_with_connection_cache( - nonblocking_rpc_client, - websocket_url, - TpuClientConfig {fanout_slots : 100}, // value for max fanout slots - connection_cache.clone(), - )) - .unwrap(), - ); let context = Arc::new(LiteRpcContext::new(rpc_client.clone(), notification_sender)); @@ -104,9 +91,16 @@ impl LightRpcRequestProcessor { &context, CommitmentLevel::Finalized, ), - Self::build_thread_to_process_transactions(tpu_client.clone(), tpu_consumer, performance_counter.clone()), ]; + Self::build_thread_to_process_transactions( + json_rpc_url.to_string(), + websocket_url.to_string(), + connection_cache.clone(), + tpu_consumer, + performance_counter.clone(), + ); + LightRpcRequestProcessor { rpc_client, last_valid_block_height: 0, @@ -165,14 +159,28 @@ impl LightRpcRequestProcessor { } fn build_thread_to_process_transactions( - tpu_client: Arc, - receiver: Receiver>, - performance_counters : PerformanceCounter, - ) -> JoinHandle<()> { + json_rpc_url: String, + websocket_url: String, + connection_cache: Arc, + receiver: Receiver, + performance_counters: PerformanceCounter, + ) { Builder::new() - .name("tpu sender".to_string()) - .spawn(move || loop { + .name("thread working on confirmation block".to_string()) + .spawn(move || { + let nonblocking_rpc_client = + Arc::new(RpcClient::new(json_rpc_url.to_string())); + let tpu_client = TpuClient::new_with_connection_cache( + nonblocking_rpc_client, + websocket_url.as_str(), + TpuClientConfig::default(), // value for max fanout slots + connection_cache.clone(), + ); + let tpu_client = Arc::new(tpu_client.unwrap()); + + loop { let recv_res = receiver.recv(); + println!("recieved a transaction"); match recv_res { Ok(transaction) => { let mut transactions_vec = vec![transaction]; @@ -190,14 +198,18 @@ impl LightRpcRequestProcessor { None => break, } } - let count:u64 = transactions_vec.len() as u64; - let fut_res = block_on(tpu_client.try_send_wire_transaction_batch(transactions_vec)); - match fut_res - { - Ok(_) => performance_counters.total_confirmations.fetch_add( count, Ordering::Relaxed), + let count: u64 = transactions_vec.len() as u64; + let slice = transactions_vec.as_slice(); + let fut_res = tpu_client.try_send_transaction_batch(slice); + match fut_res { + Ok(_) => performance_counters + .total_transactions_sent + .fetch_add(count, Ordering::Relaxed), Err(e) => { println!("Got error while sending transaction batch of size {}, error {}", count, e.to_string()); - performance_counters.transaction_sent_error.fetch_add(count, Ordering::Relaxed) + performance_counters + .transaction_sent_error + .fetch_add(count, Ordering::Relaxed) } }; } @@ -206,8 +218,8 @@ impl LightRpcRequestProcessor { break; } }; - }) - .unwrap() + } + }).unwrap(); } fn process_block( @@ -325,7 +337,7 @@ pub mod lite_rpc { use std::str::FromStr; use itertools::Itertools; - use solana_sdk::{fee_calculator::FeeCalculator, pubkey::Pubkey}; + use solana_sdk::{fee_calculator::FeeCalculator, pubkey::Pubkey, transaction::Transaction}; use solana_transaction_status::{TransactionConfirmationStatus, TransactionStatus}; use super::*; @@ -409,19 +421,20 @@ pub mod lite_rpc { tx_encoding )) })?; - let (wire_transaction, transaction) = - decode_and_deserialize::(data, binary_encoding)?; + let (_wire_transaction, transaction) = + decode_and_deserialize::(data, binary_encoding)?; + let signature = transaction.signatures[0].to_string(); + meta.context + .signature_status + .insert(signature.clone(), SignatureStatus::new()); - meta.context.signature_status.insert( - transaction.signatures[0].to_string(), - SignatureStatus::new(), - ); - - match meta.tpu_producer_channel.send(wire_transaction) { - Ok(_) => Ok(transaction.signatures[0].to_string()), - Err(e) => { + match meta.tpu_producer_channel.send(transaction) { + Ok(_) => Ok(signature), + Err(e) => { println!("got error while sending on channel {}", e.to_string()); - Err(jsonrpc_core::Error::new(jsonrpc_core::ErrorCode::InternalError)) + Err(jsonrpc_core::Error::new( + jsonrpc_core::ErrorCode::InternalError, + )) } } } From 72e52dff9013759399a251033cbc3d57ffa8a434 Mon Sep 17 00:00:00 2001 From: Godmode Galactus Date: Sun, 11 Dec 2022 18:48:49 +0100 Subject: [PATCH 5/8] fixing minor compilation issues --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 22568812..9ecb2e98 100644 --- a/src/main.rs +++ b/src/main.rs @@ -140,7 +140,7 @@ fn run(port: u16, subscription_port: u16, rpc_url: String, websocket_url: String cleaning_thread.join().unwrap(); } -pub async fn main() { +pub fn main() { let mut cli = Args::parse(); cli.resolve_address(); let Args { From 6d14edd617e90c4d27675f5d2fcb4fca75b9cda0 Mon Sep 17 00:00:00 2001 From: Godmode Galactus Date: Sun, 11 Dec 2022 21:05:19 +0100 Subject: [PATCH 6/8] minor changes for socket addr --- src/main.rs | 4 ++-- src/rpc.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 9ecb2e98..cd8696cd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -65,7 +65,7 @@ fn run(port: u16, subscription_port: u16, rpc_url: String, websocket_url: String )); let subscription_port = - SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), subscription_port); + SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), subscription_port); // start websocket server let (_trigger, websocket_service) = LitePubSubService::new( @@ -116,7 +116,7 @@ fn run(port: u16, subscription_port: u16, rpc_url: String, websocket_url: String ); let max_request_body_size: usize = 50 * (1 << 10); - let socket_addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), port); + let socket_addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), port); { let request_processor = request_processor.clone(); let server = diff --git a/src/rpc.rs b/src/rpc.rs index 24cb3370..655b82bd 100644 --- a/src/rpc.rs +++ b/src/rpc.rs @@ -168,10 +168,10 @@ impl LightRpcRequestProcessor { Builder::new() .name("thread working on confirmation block".to_string()) .spawn(move || { - let nonblocking_rpc_client = + let rpc_client = Arc::new(RpcClient::new(json_rpc_url.to_string())); let tpu_client = TpuClient::new_with_connection_cache( - nonblocking_rpc_client, + rpc_client, websocket_url.as_str(), TpuClientConfig::default(), // value for max fanout slots connection_cache.clone(), From 6a70cf55488f8ae2fce19bf5d34283931a786eaf Mon Sep 17 00:00:00 2001 From: Godmode Galactus Date: Mon, 12 Dec 2022 09:15:46 +0100 Subject: [PATCH 7/8] Creating multiple threads to send tpu batches --- Cargo.lock | 5 +++-- Cargo.toml | 1 + src/context.rs | 25 +++++++++++++++++++------ src/rpc.rs | 35 ++++++++++++++++++++++++----------- 4 files changed, 47 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e73e8fb6..fc0452b5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -623,9 +623,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.22" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1" +checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" dependencies = [ "iana-time-zone", "js-sys", @@ -2301,6 +2301,7 @@ dependencies = [ "base64 0.13.1", "bincode", "bs58", + "chrono", "clap 4.0.29", "crossbeam-channel", "csv", diff --git a/Cargo.toml b/Cargo.toml index 66eaa4cd..8fb16604 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,6 +62,7 @@ spl-token-2022 = { version = "=0.4.3", features = ["no-entrypoint"] } stream-cancel = "0.8.1" thiserror = "1.0" tokio-util = { version = "0.6", features = ["codec", "compat"] } +chrono = "0.4.23" [dev-dependencies] csv = "1.1.6" diff --git a/src/context.rs b/src/context.rs index 33c8dd08..d830d5b9 100644 --- a/src/context.rs +++ b/src/context.rs @@ -1,3 +1,4 @@ +use chrono::DateTime; use crossbeam_channel::Sender; use dashmap::DashMap; use serde::Serialize; @@ -18,7 +19,7 @@ use std::{ Arc, RwLock, }, thread::{self, Builder, JoinHandle}, - time::{Duration, Instant}, + time::{Duration, Instant, SystemTime}, }; use tokio::sync::broadcast; @@ -284,14 +285,15 @@ impl LiteRpcSubsrciptionControl { pub struct PerformanceCounter { pub total_confirmations: Arc, pub total_transactions_sent: Arc, + pub transaction_sent_error: Arc, pub confirmations_per_seconds: Arc, pub transactions_per_seconds: Arc, - - pub transaction_sent_error: Arc, + pub send_transactions_errors_per_seconds: Arc, last_count_for_confirmations: Arc, last_count_for_transactions_sent: Arc, + last_count_for_sent_errors: Arc, } impl PerformanceCounter { @@ -304,6 +306,8 @@ impl PerformanceCounter { last_count_for_confirmations: Arc::new(AtomicU64::new(0)), last_count_for_transactions_sent: Arc::new(AtomicU64::new(0)), transaction_sent_error: Arc::new(AtomicU64::new(0)), + last_count_for_sent_errors: Arc::new(AtomicU64::new(0)), + send_transactions_errors_per_seconds: Arc::new(AtomicU64::new(0)), } } @@ -312,6 +316,8 @@ impl PerformanceCounter { let total_transactions: u64 = self.total_transactions_sent.load(Ordering::Relaxed); + let total_errors: u64 = self.transaction_sent_error.load(Ordering::Relaxed); + self.confirmations_per_seconds.store( total_confirmations - self.last_count_for_confirmations.load(Ordering::Relaxed), Ordering::Release, @@ -323,11 +329,17 @@ impl PerformanceCounter { .load(Ordering::Relaxed), Ordering::Release, ); + self.send_transactions_errors_per_seconds.store( + total_errors - self.last_count_for_sent_errors.load(Ordering::Relaxed), + Ordering::Release, + ); self.last_count_for_confirmations .store(total_confirmations, Ordering::Relaxed); self.last_count_for_transactions_sent .store(total_transactions, Ordering::Relaxed); + self.last_count_for_sent_errors + .store(total_errors, Ordering::Relaxed); } pub fn update_confirm_transaction_counter(&self) { @@ -350,16 +362,17 @@ pub fn launch_performance_updating_thread( .confirmations_per_seconds .load(Ordering::Acquire); - let errors_on_sent = performance_counter.transaction_sent_error.load(Ordering::Acquire); + let errors_on_sent = performance_counter.send_transactions_errors_per_seconds.load(Ordering::Acquire); let total_transactions_per_seconds = performance_counter .transactions_per_seconds .load(Ordering::Acquire); let runtime = start.elapsed(); if let Some(remaining) = wait_time.checked_sub(runtime) { + let datetime: DateTime = SystemTime::now().into(); println!( - "Sent {} transactions sucessfully {} with errors, and confrimed {} transactions", - total_transactions_per_seconds, errors_on_sent, confirmations_per_seconds + "{} : sent {} transactions sucessfully {} with errors, and confrimed {} transactions", + datetime.format("%H:%M:%S"), total_transactions_per_seconds, errors_on_sent, confirmations_per_seconds ); thread::sleep(remaining); } diff --git a/src/rpc.rs b/src/rpc.rs index 655b82bd..8ed68b8d 100644 --- a/src/rpc.rs +++ b/src/rpc.rs @@ -91,16 +91,29 @@ impl LightRpcRequestProcessor { &context, CommitmentLevel::Finalized, ), + Self::build_thread_to_process_transactions( + json_rpc_url.to_string(), + websocket_url.to_string(), + connection_cache.clone(), + tpu_consumer.clone(), + performance_counter.clone(), + ), + Self::build_thread_to_process_transactions( + json_rpc_url.to_string(), + websocket_url.to_string(), + connection_cache.clone(), + tpu_consumer.clone(), + performance_counter.clone(), + ), + Self::build_thread_to_process_transactions( + json_rpc_url.to_string(), + websocket_url.to_string(), + connection_cache.clone(), + tpu_consumer, + performance_counter.clone(), + ), ]; - Self::build_thread_to_process_transactions( - json_rpc_url.to_string(), - websocket_url.to_string(), - connection_cache.clone(), - tpu_consumer, - performance_counter.clone(), - ); - LightRpcRequestProcessor { rpc_client, last_valid_block_height: 0, @@ -164,7 +177,7 @@ impl LightRpcRequestProcessor { connection_cache: Arc, receiver: Receiver, performance_counters: PerformanceCounter, - ) { + ) -> JoinHandle<()> { Builder::new() .name("thread working on confirmation block".to_string()) .spawn(move || { @@ -184,7 +197,7 @@ impl LightRpcRequestProcessor { match recv_res { Ok(transaction) => { let mut transactions_vec = vec![transaction]; - let mut time_remaining = Duration::from_micros(50000); + let mut time_remaining = Duration::from_micros(5000); for _i in 1..TPU_BATCH_SIZE { let start = std::time::Instant::now(); let another = receiver.recv_timeout(time_remaining); @@ -219,7 +232,7 @@ impl LightRpcRequestProcessor { } }; } - }).unwrap(); + }).unwrap() } fn process_block( From 17294a00e0f688f96cd708e34e3526d122db10af Mon Sep 17 00:00:00 2001 From: Godmode Galactus Date: Mon, 12 Dec 2022 09:24:55 +0100 Subject: [PATCH 8/8] removing unwanted print statement --- src/rpc.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/rpc.rs b/src/rpc.rs index 8ed68b8d..81c96869 100644 --- a/src/rpc.rs +++ b/src/rpc.rs @@ -193,7 +193,6 @@ impl LightRpcRequestProcessor { loop { let recv_res = receiver.recv(); - println!("recieved a transaction"); match recv_res { Ok(transaction) => { let mut transactions_vec = vec![transaction];