Skip to content

Commit

Permalink
Merge branch 'master' into first-available-block-benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
steveluscher authored Dec 9, 2024
2 parents fdd2808 + bd04d77 commit 9e3315f
Show file tree
Hide file tree
Showing 42 changed files with 1,213 additions and 413 deletions.
239 changes: 150 additions & 89 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ members = [
"sdk/ed25519-program",
"sdk/epoch-info",
"sdk/epoch-rewards",
"sdk/epoch-rewards-hasher",
"sdk/epoch-schedule",
"sdk/feature-gate-interface",
"sdk/feature-set",
Expand Down Expand Up @@ -332,14 +333,14 @@ humantime = "2.0.1"
hyper = "0.14.31"
hyper-proxy = "0.9.1"
im = "15.1.0"
index_list = "0.2.14"
index_list = "0.2.15"
indexmap = "2.7.0"
indicatif = "0.17.9"
itertools = "0.12.1"
jemallocator = { package = "tikv-jemallocator", version = "0.6.0", features = [
"unprefixed_malloc_on_supported_platforms",
] }
js-sys = "0.3.74"
js-sys = "0.3.76"
json5 = "0.4.1"
jsonrpc-core = "18.0.0"
jsonrpc-core-client = "18.0.0"
Expand Down Expand Up @@ -471,6 +472,7 @@ solana-entry = { path = "entry", version = "=2.2.0" }
solana-program-entrypoint = { path = "sdk/program-entrypoint", version = "=2.2.0" }
solana-epoch-info = { path = "sdk/epoch-info", version = "=2.2.0" }
solana-epoch-rewards = { path = "sdk/epoch-rewards", version = "=2.2.0" }
solana-epoch-rewards-hasher = { path = "sdk/epoch-rewards-hasher", version = "=2.2.0" }
solana-epoch-schedule = { path = "sdk/epoch-schedule", version = "=2.2.0" }
solana-faucet = { path = "faucet", version = "=2.2.0" }
solana-feature-gate-interface = { path = "sdk/feature-gate-interface", version = "=2.2.0" }
Expand Down Expand Up @@ -628,12 +630,12 @@ tar = "0.4.43"
tarpc = "0.29.0"
tempfile = "3.14.0"
test-case = "3.3.1"
thiserror = "2.0.4"
thiserror = "2.0.6"
tiny-bip39 = "0.8.2"
# Update solana-tokio patch below when updating this version
tokio = "1.29.1"
tokio-serde = "0.8"
tokio-stream = "0.1.16"
tokio-stream = "0.1.17"
tokio-tungstenite = "0.20.1"
tokio-util = "0.7"
toml = "0.8.12"
Expand Down
31 changes: 31 additions & 0 deletions accounts-cluster-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ pub enum RpcBench {
TokenAccountsByOwner,
Supply,
TokenAccountsByDelegate,
AccountInfo,
FirstAvailableBlock,
}

Expand All @@ -269,6 +270,7 @@ impl FromStr for RpcBench {

fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"account-info" => Ok(RpcBench::AccountInfo),
"first-available-block" => Ok(RpcBench::FirstAvailableBlock),
"slot" => Ok(RpcBench::Slot),
"supply" => Ok(RpcBench::Supply),
Expand Down Expand Up @@ -392,6 +394,35 @@ fn run_rpc_bench_loop(
break;
}
match rpc_bench {
RpcBench::AccountInfo => {
let start: u64 = max_closed.load(Ordering::Relaxed);
let end: u64 = max_created.load(Ordering::Relaxed);
let seed_range = start..end;
if seed_range.is_empty() {
info!("get_account_info: No accounts have yet been created; skipping");
continue;
}
let seed = thread_rng().gen_range(seed_range).to_string();
let account_pubkey =
Pubkey::create_with_seed(base_keypair_pubkey, &seed, program_id).unwrap();
let mut rpc_time = Measure::start("rpc-get-account-info");
match client.get_account(&account_pubkey) {
Ok(_account) => {
rpc_time.stop();
stats.success += 1;
stats.total_success_time_us += rpc_time.as_us();
}
Err(e) => {
rpc_time.stop();
stats.total_errors_time_us += rpc_time.as_us();
stats.errors += 1;
if last_error.elapsed().as_secs() > 2 {
info!("get_account_info error: {:?}", e);
last_error = Instant::now();
}
}
}
}
RpcBench::FirstAvailableBlock => {
let mut rpc_time = Measure::start("rpc-get-first-available-block");
match client.get_first_available_block() {
Expand Down
4 changes: 3 additions & 1 deletion builtins-default-costs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ solana-address-lookup-table-program = { workspace = true }
solana-bpf-loader-program = { workspace = true }
solana-compute-budget-program = { workspace = true }
solana-config-program = { workspace = true }
solana-feature-set = { workspace = true }
solana-frozen-abi = { workspace = true, optional = true, features = [
"frozen-abi",
] }
solana-loader-v4-program = { workspace = true }
solana-sdk = { workspace = true }
solana-pubkey = { workspace = true }
solana-sdk-ids = { workspace = true }
solana-stake-program = { workspace = true }
solana-system-program = { workspace = true }
solana-vote-program = { workspace = true }
Expand Down
18 changes: 10 additions & 8 deletions builtins-default-costs/benches/builtin_instruction_costs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ extern crate test;
use {
rand::Rng,
solana_builtins_default_costs::get_builtin_instruction_cost,
solana_sdk::{
solana_feature_set::FeatureSet,
solana_pubkey::Pubkey,
solana_sdk_ids::{
address_lookup_table, bpf_loader, bpf_loader_deprecated, bpf_loader_upgradeable,
compute_budget, ed25519_program, feature_set::FeatureSet, loader_v4, pubkey::Pubkey,
secp256k1_program,
compute_budget, config, ed25519_program, loader_v4, secp256k1_program, stake,
system_program, vote,
},
test::Bencher,
};
Expand All @@ -20,12 +22,12 @@ const NUM_TRANSACTIONS_PER_ITER: usize = 1024;

fn setup(all_features_enabled: bool) -> BenchSetup {
let pubkeys: [Pubkey; 12] = [
solana_stake_program::id(),
solana_config_program::id(),
solana_vote_program::id(),
solana_system_program::id(),
stake::id(),
config::id(),
vote::id(),
system_program::id(),
compute_budget::id(),
address_lookup_table::program::id(),
address_lookup_table::id(),
bpf_loader_upgradeable::id(),
bpf_loader_deprecated::id(),
bpf_loader::id(),
Expand Down
21 changes: 10 additions & 11 deletions builtins-default-costs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
use {
ahash::AHashMap,
lazy_static::lazy_static,
solana_sdk::{
solana_feature_set::{self as feature_set, FeatureSet},
solana_pubkey::Pubkey,
solana_sdk_ids::{
address_lookup_table, bpf_loader, bpf_loader_deprecated, bpf_loader_upgradeable,
compute_budget, ed25519_program,
feature_set::{self, FeatureSet},
loader_v4,
pubkey::Pubkey,
secp256k1_program,
compute_budget, config, ed25519_program, loader_v4, secp256k1_program, stake,
system_program, vote,
},
};

Expand All @@ -36,28 +35,28 @@ lazy_static! {
/// https://github.com/solana-labs/solana/issues/29595.
static ref BUILTIN_INSTRUCTION_COSTS: AHashMap<Pubkey, BuiltinCost> = [
(
solana_stake_program::id(),
stake::id(),
BuiltinCost {
native_cost: solana_stake_program::stake_instruction::DEFAULT_COMPUTE_UNITS,
core_bpf_migration_feature: Some(feature_set::migrate_stake_program_to_core_bpf::id()),
},
),
(
solana_config_program::id(),
config::id(),
BuiltinCost {
native_cost: solana_config_program::config_processor::DEFAULT_COMPUTE_UNITS,
core_bpf_migration_feature: Some(feature_set::migrate_config_program_to_core_bpf::id()),
},
),
(
solana_vote_program::id(),
vote::id(),
BuiltinCost {
native_cost: solana_vote_program::vote_processor::DEFAULT_COMPUTE_UNITS,
core_bpf_migration_feature: None,
},
),
(
solana_system_program::id(),
system_program::id(),
BuiltinCost {
native_cost: solana_system_program::system_processor::DEFAULT_COMPUTE_UNITS,
core_bpf_migration_feature: None,
Expand All @@ -71,7 +70,7 @@ lazy_static! {
},
),
(
address_lookup_table::program::id(),
address_lookup_table::id(),
BuiltinCost {
native_cost: solana_address_lookup_table_program::processor::DEFAULT_COMPUTE_UNITS,
core_bpf_migration_feature: Some(
Expand Down
16 changes: 15 additions & 1 deletion client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,31 @@ indicatif = { workspace = true }
log = { workspace = true }
quinn = { workspace = true }
rayon = { workspace = true }
solana-account = { workspace = true }
solana-client-traits = { workspace = true }
solana-commitment-config = { workspace = true }
solana-connection-cache = { workspace = true }
solana-epoch-info = { workspace = true }
solana-hash = { workspace = true }
solana-instruction = { workspace = true }
solana-keypair = { workspace = true }
solana-measure = { workspace = true }
solana-message = { workspace = true }
solana-pubkey = { workspace = true }
solana-pubsub-client = { workspace = true }
solana-quic-client = { workspace = true }
solana-quic-definitions = { workspace = true }
solana-rpc-client = { workspace = true, features = ["default"] }
solana-rpc-client-api = { workspace = true }
solana-rpc-client-nonce-utils = { workspace = true }
solana-sdk = { workspace = true, features = ["openssl-vendored"] }
solana-signature = { workspace = true }
solana-signer = { workspace = true }
solana-streamer = { workspace = true }
solana-thin-client = { workspace = true }
solana-time-utils = { workspace = true }
solana-tpu-client = { workspace = true, features = ["default"] }
solana-transaction = { workspace = true }
solana-transaction-error = { workspace = true }
solana-udp-client = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true, features = ["full"] }
Expand Down
10 changes: 5 additions & 5 deletions client/src/connection_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ use {
NewConnectionConfig,
},
},
solana_keypair::Keypair,
solana_pubkey::Pubkey,
solana_quic_client::{QuicConfig, QuicConnectionManager, QuicPool},
solana_sdk::{
pubkey::Pubkey, quic::NotifyKeyUpdate, signature::Keypair,
transport::Result as TransportResult,
},
solana_quic_definitions::NotifyKeyUpdate,
solana_streamer::streamer::StakedNodes,
solana_transaction_error::TransportResult,
solana_udp_client::{UdpConfig, UdpConnectionManager, UdpPool},
std::{
net::{IpAddr, Ipv4Addr, SocketAddr},
Expand Down Expand Up @@ -201,8 +201,8 @@ mod tests {
super::*,
crate::connection_cache::ConnectionCache,
crossbeam_channel::unbounded,
solana_keypair::Keypair,
solana_net_utils::bind_to_localhost,
solana_sdk::signature::Keypair,
solana_streamer::{
quic::{QuicServerParams, SpawnServerResult},
streamer::StakedNodes,
Expand Down
10 changes: 4 additions & 6 deletions client/src/nonblocking/tpu_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ use {
ConnectionCache as BackendConnectionCache, ConnectionManager, ConnectionPool,
NewConnectionConfig,
},
solana_message::Message,
solana_quic_client::{QuicConfig, QuicConnectionManager, QuicPool},
solana_rpc_client::nonblocking::rpc_client::RpcClient,
solana_sdk::{
message::Message,
signers::Signers,
transaction::{Transaction, TransactionError},
transport::Result as TransportResult,
},
solana_signer::signers::Signers,
solana_tpu_client::nonblocking::tpu_client::{Result, TpuClient as BackendTpuClient},
solana_transaction::Transaction,
solana_transaction_error::{TransactionError, TransportResult},
std::sync::Arc,
};

Expand Down
13 changes: 6 additions & 7 deletions client/src/send_and_confirm_transactions_in_parallel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use {
bincode::serialize,
dashmap::DashMap,
futures_util::future::join_all,
solana_hash::Hash,
solana_message::Message,
solana_quic_client::{QuicConfig, QuicConnectionManager, QuicPool},
solana_rpc_client::spinner::{self, SendTransactionProgress},
solana_rpc_client_api::{
Expand All @@ -14,14 +16,11 @@ use {
request::{RpcError, RpcResponseErrorData, MAX_GET_SIGNATURE_STATUSES_QUERY_ITEMS},
response::RpcSimulateTransactionResult,
},
solana_sdk::{
hash::Hash,
message::Message,
signature::{Signature, SignerError},
signers::Signers,
transaction::{Transaction, TransactionError},
},
solana_signature::Signature,
solana_signer::{signers::Signers, SignerError},
solana_tpu_client::tpu_client::{Result, TpuSenderError},
solana_transaction::Transaction,
solana_transaction_error::TransactionError,
std::{
sync::{
atomic::{AtomicU64, AtomicUsize, Ordering},
Expand Down
31 changes: 15 additions & 16 deletions client/src/thin_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,23 @@
#[allow(deprecated)]
use {
crate::connection_cache::{dispatch, ConnectionCache},
solana_account::Account,
solana_client_traits::{AsyncClient, Client, SyncClient},
solana_commitment_config::CommitmentConfig,
solana_epoch_info::EpochInfo,
solana_hash::Hash,
solana_instruction::Instruction,
solana_keypair::Keypair,
solana_message::Message,
solana_pubkey::Pubkey,
solana_quic_client::{QuicConfig, QuicConnectionManager, QuicPool},
solana_rpc_client::rpc_client::RpcClient,
solana_rpc_client_api::config::RpcProgramAccountsConfig,
solana_sdk::{
account::Account,
client::{AsyncClient, Client, SyncClient},
commitment_config::CommitmentConfig,
epoch_info::EpochInfo,
hash::Hash,
instruction::Instruction,
message::Message,
pubkey::Pubkey,
signature::{Keypair, Signature},
signers::Signers,
transaction::{self, Transaction, VersionedTransaction},
transport::Result as TransportResult,
},
solana_signature::Signature,
solana_signer::signers::Signers,
solana_thin_client::thin_client::ThinClient as BackendThinClient,
solana_transaction::{versioned::VersionedTransaction, Transaction},
solana_transaction_error::{TransactionResult, TransportResult},
solana_udp_client::{UdpConfig, UdpConnectionManager, UdpPool},
std::{net::SocketAddr, sync::Arc, time::Duration},
};
Expand Down Expand Up @@ -214,13 +213,13 @@ impl SyncClient for ThinClient {
dispatch!(fn get_signature_status(
&self,
signature: &Signature
) -> TransportResult<Option<transaction::Result<()>>>);
) -> TransportResult<Option<TransactionResult<()>>>);

dispatch!(fn get_signature_status_with_commitment(
&self,
signature: &Signature,
commitment_config: CommitmentConfig
) -> TransportResult<Option<transaction::Result<()>>>);
) -> TransportResult<Option<TransactionResult<()>>>);

dispatch!(fn get_slot(&self) -> TransportResult<u64>);

Expand Down
10 changes: 4 additions & 6 deletions client/src/tpu_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ use {
ConnectionCache as BackendConnectionCache, ConnectionManager, ConnectionPool,
NewConnectionConfig,
},
solana_message::Message,
solana_quic_client::{QuicConfig, QuicConnectionManager, QuicPool},
solana_rpc_client::rpc_client::RpcClient,
solana_sdk::{
message::Message,
signers::Signers,
transaction::{Transaction, TransactionError},
transport::Result as TransportResult,
},
solana_signer::signers::Signers,
solana_tpu_client::tpu_client::{Result, TpuClient as BackendTpuClient},
solana_transaction::Transaction,
solana_transaction_error::{TransactionError, TransportResult},
solana_udp_client::{UdpConfig, UdpConnectionManager, UdpPool},
std::sync::Arc,
};
Expand Down
Loading

0 comments on commit 9e3315f

Please sign in to comment.