Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoranYi committed Aug 20, 2022
2 parents 9508b23 + 510d195 commit 455fbdc
Show file tree
Hide file tree
Showing 104 changed files with 3,499 additions and 944 deletions.
207 changes: 116 additions & 91 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion account-decoder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ solana-config-program = { path = "../programs/config", version = "=1.12.0" }
solana-sdk = { path = "../sdk", version = "=1.12.0" }
solana-vote-program = { path = "../programs/vote", version = "=1.12.0" }
spl-token = { version = "=3.5.0", features = ["no-entrypoint"] }
spl-token-2022 = { version = "=0.4.2", features = ["no-entrypoint"] }
spl-token-2022 = { version = "=0.4.3", features = ["no-entrypoint"] }
thiserror = "1.0"
zstd = "0.11.2"

Expand Down
2 changes: 1 addition & 1 deletion accounts-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ fn main() {
for x in 0..iterations {
if clean {
let mut time = Measure::start("clean");
accounts.accounts_db.clean_accounts(None, false, None);
accounts.accounts_db.clean_accounts_for_tests();
time.stop();
println!("{}", time);
for slot in 0..num_slots {
Expand Down
6 changes: 3 additions & 3 deletions banking-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,10 @@ fn main() {
.help("Number of threads to use in the banking stage"),
)
.arg(
Arg::new("tpu_use_quic")
.long("tpu-use-quic")
Arg::new("tpu_disable_quic")
.long("tpu-disable-quic")
.takes_value(false)
.help("Forward messages to TPU using QUIC"),
.help("Disable forwarding messages to TPU using QUIC"),
)
.get_matches();

Expand Down
7 changes: 7 additions & 0 deletions bench-tps/src/bench_tps_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ pub trait BenchTpsClient {

/// Returns all information associated with the account of the provided pubkey
fn get_account(&self, pubkey: &Pubkey) -> Result<Account>;

/// Returns all information associated with the account of the provided pubkey, using explicit commitment
fn get_account_with_commitment(
&self,
pubkey: &Pubkey,
commitment_config: CommitmentConfig,
) -> Result<Account>;
}

mod bank_client;
Expand Down
14 changes: 14 additions & 0 deletions bench-tps/src/bench_tps_client/bank_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,18 @@ impl BenchTpsClient for BankClient {
})
})
}

fn get_account_with_commitment(
&self,
pubkey: &Pubkey,
commitment_config: CommitmentConfig,
) -> Result<Account> {
SyncClient::get_account_with_commitment(self, pubkey, commitment_config)
.map_err(|err| err.into())
.and_then(|account| {
account.ok_or_else(|| {
BenchTpsError::Custom(format!("AccountNotFound: pubkey={}", pubkey))
})
})
}
}
17 changes: 16 additions & 1 deletion bench-tps/src/bench_tps_client/rpc_client.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use {
crate::bench_tps_client::{BenchTpsClient, Result},
crate::bench_tps_client::{BenchTpsClient, BenchTpsError, Result},
solana_client::rpc_client::RpcClient,
solana_sdk::{
account::Account, commitment_config::CommitmentConfig, epoch_info::EpochInfo, hash::Hash,
Expand Down Expand Up @@ -84,4 +84,19 @@ impl BenchTpsClient for RpcClient {
fn get_account(&self, pubkey: &Pubkey) -> Result<Account> {
RpcClient::get_account(self, pubkey).map_err(|err| err.into())
}

fn get_account_with_commitment(
&self,
pubkey: &Pubkey,
commitment_config: CommitmentConfig,
) -> Result<Account> {
RpcClient::get_account_with_commitment(self, pubkey, commitment_config)
.map(|res| res.value)
.map_err(|err| err.into())
.and_then(|account| {
account.ok_or_else(|| {
BenchTpsError::Custom(format!("AccountNotFound: pubkey={}", pubkey))
})
})
}
}
16 changes: 15 additions & 1 deletion bench-tps/src/bench_tps_client/thin_client.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use {
crate::bench_tps_client::{BenchTpsClient, Result},
crate::bench_tps_client::{BenchTpsClient, BenchTpsError, Result},
solana_client::thin_client::ThinClient,
solana_sdk::{
account::Account,
Expand Down Expand Up @@ -90,4 +90,18 @@ impl BenchTpsClient for ThinClient {
.get_account(pubkey)
.map_err(|err| err.into())
}

fn get_account_with_commitment(
&self,
pubkey: &Pubkey,
commitment_config: CommitmentConfig,
) -> Result<Account> {
SyncClient::get_account_with_commitment(self, pubkey, commitment_config)
.map_err(|err| err.into())
.and_then(|account| {
account.ok_or_else(|| {
BenchTpsError::Custom(format!("AccountNotFound: pubkey={}", pubkey))
})
})
}
}
18 changes: 17 additions & 1 deletion bench-tps/src/bench_tps_client/tpu_client.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use {
crate::bench_tps_client::{BenchTpsClient, Result},
crate::bench_tps_client::{BenchTpsClient, BenchTpsError, Result},
solana_client::tpu_client::TpuClient,
solana_sdk::{
account::Account, commitment_config::CommitmentConfig, epoch_info::EpochInfo, hash::Hash,
Expand Down Expand Up @@ -102,4 +102,20 @@ impl BenchTpsClient for TpuClient {
.get_account(pubkey)
.map_err(|err| err.into())
}

fn get_account_with_commitment(
&self,
pubkey: &Pubkey,
commitment_config: CommitmentConfig,
) -> Result<Account> {
self.rpc_client()
.get_account_with_commitment(pubkey, commitment_config)
.map(|res| res.value)
.map_err(|err| err.into())
.and_then(|account| {
account.ok_or_else(|| {
BenchTpsError::Custom(format!("AccountNotFound: pubkey={}", pubkey))
})
})
}
}
10 changes: 5 additions & 5 deletions bench-tps/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,10 @@ pub fn build_args<'a, 'b>(version: &'b str) -> App<'a, 'b> {
.help("Submit transactions with a TpuClient")
)
.arg(
Arg::with_name("tpu_use_quic")
.long("tpu-use-quic")
Arg::with_name("tpu_disable_quic")
.long("tpu-disable-quic")
.takes_value(false)
.help("Submit transactions via QUIC; only affects ThinClient (default) \
.help("Do not submit transactions via QUIC; only affects ThinClient (default) \
or TpuClient sends"),
)
.arg(
Expand Down Expand Up @@ -358,8 +358,8 @@ pub fn extract_args(matches: &ArgMatches) -> Config {
args.external_client_type = ExternalClientType::RpcClient;
}

if matches.is_present("tpu_use_quic") {
args.use_quic = true;
if matches.is_present("tpu_disable_quic") {
args.use_quic = false;
}

if let Some(v) = matches.value_of("tpu_connection_pool_size") {
Expand Down
1 change: 1 addition & 0 deletions bench-tps/tests/bench_tps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ fn test_bench_tps_test_validator(config: Config) {

#[test]
#[serial]
#[ignore]
fn test_bench_tps_local_cluster_solana() {
test_bench_tps_local_cluster(Config {
tx_count: 100,
Expand Down
18 changes: 10 additions & 8 deletions ci/docker-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@ if [[ -n $CI ]]; then
# Share the real ~/.cargo between docker containers in CI for speed
ARGS+=(--volume "$HOME:/home")

# sccache
ARGS+=(
--env "RUSTC_WRAPPER=/home/.cargo/bin/sccache"
--env AWS_ACCESS_KEY_ID
--env AWS_SECRET_ACCESS_KEY
--env SCCACHE_BUCKET
--env SCCACHE_REGION
)
if [[ -n $BUILDKITE ]]; then
# sccache
ARGS+=(
--env "RUSTC_WRAPPER=/home/.cargo/bin/sccache"
--env AWS_ACCESS_KEY_ID
--env AWS_SECRET_ACCESS_KEY
--env SCCACHE_BUCKET
--env SCCACHE_REGION
)
fi
else
# Avoid sharing ~/.cargo when building locally to avoid a mixed macOS/Linux
# ~/.cargo
Expand Down
69 changes: 69 additions & 0 deletions cli-output/src/cli_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2111,6 +2111,75 @@ impl fmt::Display for CliUpgradeableBuffers {
}
}

#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct CliAddressLookupTable {
pub lookup_table_address: String,
pub authority: Option<String>,
pub deactivation_slot: u64,
pub last_extended_slot: u64,
pub addresses: Vec<String>,
}
impl QuietDisplay for CliAddressLookupTable {}
impl VerboseDisplay for CliAddressLookupTable {}
impl fmt::Display for CliAddressLookupTable {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(f)?;
writeln_name_value(f, "Lookup Table Address:", &self.lookup_table_address)?;
if let Some(authority) = &self.authority {
writeln_name_value(f, "Authority:", authority)?;
} else {
writeln_name_value(f, "Authority:", "None (frozen)")?;
}
if self.deactivation_slot == u64::MAX {
writeln_name_value(f, "Deactivation Slot:", "None (still active)")?;
} else {
writeln_name_value(f, "Deactivation Slot:", &self.deactivation_slot.to_string())?;
}
if self.last_extended_slot == 0 {
writeln_name_value(f, "Last Extended Slot:", "None (empty)")?;
} else {
writeln_name_value(
f,
"Last Extended Slot:",
&self.last_extended_slot.to_string(),
)?;
}
if self.addresses.is_empty() {
writeln_name_value(f, "Address Table Entries:", "None (empty)")?;
} else {
writeln!(f, "{}", style("Address Table Entries:".to_string()).bold())?;
writeln!(f)?;
writeln!(
f,
"{}",
style(format!(" {:<5} {}", "Index", "Address")).bold()
)?;
for (index, address) in self.addresses.iter().enumerate() {
writeln!(f, " {:<5} {}", index, address)?;
}
}
Ok(())
}
}

#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliAddressLookupTableCreated {
pub lookup_table_address: String,
pub signature: String,
}
impl QuietDisplay for CliAddressLookupTableCreated {}
impl VerboseDisplay for CliAddressLookupTableCreated {}
impl fmt::Display for CliAddressLookupTableCreated {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(f)?;
writeln_name_value(f, "Signature:", &self.signature)?;
writeln_name_value(f, "Lookup Table Address:", &self.lookup_table_address)?;
Ok(())
}
}

#[derive(Debug, Default)]
pub struct ReturnSignersConfig {
pub dump_transaction_message: bool,
Expand Down
1 change: 1 addition & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ serde = "1.0.143"
serde_derive = "1.0.103"
serde_json = "1.0.83"
solana-account-decoder = { path = "../account-decoder", version = "=1.12.0" }
solana-address-lookup-table-program = { path = "../programs/address-lookup-table", version = "=1.12.0" }
solana-bpf-loader-program = { path = "../programs/bpf_loader", version = "=1.12.0" }
solana-clap-utils = { path = "../clap-utils", version = "=1.12.0" }
solana-cli-config = { path = "../cli-config", version = "=1.12.0" }
Expand Down
Loading

0 comments on commit 455fbdc

Please sign in to comment.