fix and fmt

This commit is contained in:
aniketfuryrocks 2023-06-13 20:22:50 +05:30
parent 683db0dd49
commit 4712676fd1
No known key found for this signature in database
GPG Key ID: 1B75EA596D89FF06
4 changed files with 17 additions and 23 deletions

View File

@ -88,7 +88,7 @@ impl Bencher {
.sorted_by_key(|(_e, c)| *c)
.rev()
.take(5)
.map(|(e, c)| ((*e).clone(), c.clone()))
.map(|(e, c)| ((*e).clone(), *c))
.collect_vec();
Ok(Stats {

View File

@ -76,13 +76,10 @@ impl Args {
match res {
Ok((mut stream, _)) => loop {
let log = stream.next().await;
match log {
Some(log) => {
for log_s in log.value.logs {
println!("{}", log_s);
}
if let Some(log) = log {
for log_s in log.value.logs {
println!("{}", log_s);
}
None => {}
}
},
Err(e) => {

View File

@ -1,24 +1,23 @@
use crate::bencher::{Bencher, Benchmark, Run, Stats};
use crate::config::{Market, User};
use crate::test_registry::TestingTask;
use crate::utils::noop;
use crate::{
bencher::{Bencher, Benchmark, Run, Stats},
config::{Market, User},
test_registry::TestingTask,
utils::noop,
};
use async_trait::async_trait;
use rand::rngs::StdRng;
use rand::seq::SliceRandom;
use rand::{Rng, SeedableRng};
use rand::{rngs::StdRng, seq::SliceRandom, Rng, SeedableRng};
use serde::{Deserialize, Serialize};
use solana_rpc_client::nonblocking::rpc_client::RpcClient;
use solana_sdk::compute_budget;
use solana_sdk::hash::Hash;
use solana_sdk::{
compute_budget,
hash::Hash,
instruction::{AccountMeta, Instruction},
message::Message,
pubkey::Pubkey,
signer::Signer,
transaction::Transaction,
};
use std::mem::size_of;
use std::{str::FromStr, sync::Arc, time::Instant};
use std::{mem::size_of, str::FromStr, sync::Arc, time::Instant};
use tokio::sync::RwLock;
#[derive(Clone)]
@ -86,7 +85,7 @@ impl TestingTask for SimulateOpenbookV2PlaceOrder {
}
fn get_name(&self) -> String {
format!("Simulating openbook place orders")
"Simulating openbook place orders".to_string()
}
}
@ -148,9 +147,7 @@ impl Benchmark for SimulateOpenbookV2PlaceOrderBench {
assert!(bytes.len() + 8 == place_order_ix.len());
// copy the instruction data
for i in 0..bytes.len() {
place_order_ix[8 + i] = bytes[i];
}
place_order_ix[8..(bytes.len() + 8)].copy_from_slice(&bytes[..]);
let token_account = if side {
base_token_account

View File

@ -74,7 +74,7 @@ impl Benchmark for SendMemoTransactionsBench {
let payer = self.payers.choose(&mut rng).unwrap();
let blockhash = { *self.block_hash.read().await };
let tx = create_memo_tx(&msg, &payer, blockhash);
let tx = create_memo_tx(&msg, payer, blockhash);
match rpc_client.send_transaction(&tx).await {
Ok(_) => {
result.requests_completed += 1;