Skip to content

Commit

Permalink
measure acct fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
esemeniuc committed Oct 4, 2023
1 parent 40399e4 commit 4e97980
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tip-distributor/src/claim_mev_workflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ pub async fn claim_mev_tips(
let rpc_client =
RpcClient::new_with_commitment(rpc_url.to_string(), CommitmentConfig::finalized());

// heuristic to make sure we have enough funds to cover the rent costs if epoch has many validators
let tree_nodes = merkle_trees
.generated_merkle_trees
.iter()
Expand All @@ -77,6 +76,7 @@ pub async fn claim_mev_tips(
let mut instructions =
Vec::with_capacity(tree_nodes.iter().filter(|node| node.amount > 0).count());

let account_fetch_start = Instant::now();
let tdas = get_batched_accounts(
&rpc_client,
merkle_trees
Expand Down Expand Up @@ -160,6 +160,7 @@ pub async fn claim_mev_tips(
)
.await
.unwrap();
let account_fetch_elapsed = account_fetch_start.elapsed();

for tree in merkle_trees.generated_merkle_trees {
let fetched_tip_distribution_account = match tdas.get(&tree.tip_distribution_account) {
Expand Down Expand Up @@ -238,7 +239,7 @@ pub async fn claim_mev_tips(
}
let instructions_len = instructions.len();

// balance check
// balance check heuristic to make sure we have enough funds to cover the rent costs if epoch has many validators
{
let start_balance = rpc_client
.get_balance(&keypair.pubkey())
Expand Down Expand Up @@ -297,6 +298,11 @@ pub async fn claim_mev_tips(
("below_min_rent_count", below_min_rent_count, i64),
("instruction_count", instructions_len, i64),
("transaction_count", transactions.len(), i64),
(
"account_fetch_latency_us",
account_fetch_elapsed.as_micros(),
i64
),
("latency_us", transaction_prepare_elapsed.as_micros(), i64),
);

Expand Down

0 comments on commit 4e97980

Please sign in to comment.