diff --git a/Cargo.lock b/Cargo.lock index 077951e7a5..914c210f4c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9875,18 +9875,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.15" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81ba595b9f2772fbee2312de30eeb80ec773b4cb2f1e8098db024afadda6c06f" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.15" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "772666c41fb6dceaf520b564b962d738a8e1a83b41bd48945f50837aed78bb1d" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2 1.0.70", "quote 1.0.33", diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index 4495202136..3d7424f3ab 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -8537,18 +8537,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.15" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81ba595b9f2772fbee2312de30eeb80ec773b4cb2f1e8098db024afadda6c06f" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.15" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "772666c41fb6dceaf520b564b962d738a8e1a83b41bd48945f50837aed78bb1d" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2 1.0.70", "quote 1.0.33", diff --git a/tip-distributor/src/bin/claim-mev-tips.rs b/tip-distributor/src/bin/claim-mev-tips.rs index e517377c7d..833a5da27c 100644 --- a/tip-distributor/src/bin/claim-mev-tips.rs +++ b/tip-distributor/src/bin/claim-mev-tips.rs @@ -60,6 +60,10 @@ struct Args { /// Specifies whether to reclaim rent on behalf of validators from respective TDAs. #[arg(long, env)] should_reclaim_tdas: bool, + + /// The price to pay per compute unit aka "Priority Fee". + #[arg(long, env, default_value_t = 1)] + micro_lamports_per_compute_unit: u64, } #[tokio::main] @@ -90,6 +94,7 @@ async fn main() -> Result<(), ClaimMevError> { keypair.clone(), args.max_loop_retries, max_loop_duration, + args.micro_lamports_per_compute_unit, ) .await { @@ -133,6 +138,7 @@ async fn main() -> Result<(), ClaimMevError> { args.max_loop_retries, max_loop_duration, args.should_reclaim_tdas, + args.micro_lamports_per_compute_unit, ) .await { diff --git a/tip-distributor/src/claim_mev_workflow.rs b/tip-distributor/src/claim_mev_workflow.rs index 82cdba3827..22d2cebeaa 100644 --- a/tip-distributor/src/claim_mev_workflow.rs +++ b/tip-distributor/src/claim_mev_workflow.rs @@ -17,6 +17,7 @@ use { solana_sdk::{ account::Account, commitment_config::CommitmentConfig, + compute_budget::ComputeBudgetInstruction, instruction::Instruction, pubkey::Pubkey, signature::{Keypair, Signer}, @@ -78,6 +79,7 @@ pub async fn claim_mev_tips( keypair: Arc, max_loop_retries: u64, max_loop_duration: Duration, + micro_lamports_per_compute_unit: u64, ) -> Result<(), ClaimMevError> { let payer_pubkey = keypair.pubkey(); let blockhash_rpc_client = Arc::new(RpcClient::new_with_commitment( @@ -204,6 +206,7 @@ pub async fn claim_mev_tips( &tdas, &claimants, &claim_statuses, + micro_lamports_per_compute_unit, )?; datapoint_info!( "claim_mev_workflow-prepare_transactions", @@ -308,6 +311,7 @@ fn build_transactions( tdas: &HashMap, claimants: &HashMap, claim_statuses: &HashMap>, + micro_lamports_per_compute_unit: u64, ) -> Result< ( usize, /* skipped_merkle_root_count */ @@ -397,7 +401,11 @@ fn build_transactions( let transactions = instructions .into_iter() - .map(|ix| Transaction::new_with_payer(&[ix], Some(payer_pubkey))) + .map(|claim_ix| { + let priority_fee_ix = + ComputeBudgetInstruction::set_compute_unit_price(micro_lamports_per_compute_unit); + Transaction::new_with_payer(&[priority_fee_ix, claim_ix], Some(payer_pubkey)) + }) .collect::>(); Ok(( skipped_merkle_root_count, diff --git a/tip-distributor/src/reclaim_rent_workflow.rs b/tip-distributor/src/reclaim_rent_workflow.rs index 8d923e3980..6775a02041 100644 --- a/tip-distributor/src/reclaim_rent_workflow.rs +++ b/tip-distributor/src/reclaim_rent_workflow.rs @@ -23,6 +23,7 @@ use { solana_program::pubkey::Pubkey, solana_sdk::{ commitment_config::CommitmentConfig, + compute_budget::ComputeBudgetInstruction, signature::{Keypair, Signer}, transaction::Transaction, }, @@ -42,6 +43,7 @@ pub async fn reclaim_rent( max_loop_duration: Duration, // Optionally reclaim TipDistributionAccount rents on behalf of validators. should_reclaim_tdas: bool, + micro_lamports_per_compute_unit: u64, ) -> Result<(), ClaimMevError> { let blockhash_rpc_client = Arc::new(RpcClient::new_with_timeout_and_commitment( rpc_url.clone(), @@ -67,6 +69,7 @@ pub async fn reclaim_rent( &tip_distribution_program_id, &signer_pubkey, should_reclaim_tdas, + micro_lamports_per_compute_unit, ) .await?; datapoint_info!( @@ -138,6 +141,7 @@ async fn build_transactions( tip_distribution_program_id: &Pubkey, signer_pubkey: &Pubkey, should_reclaim_tdas: bool, + micro_lamports_per_compute_unit: u64, ) -> Result<(Vec, Duration, Duration), ClaimMevError> { info!("Fetching program accounts"); let (accounts, get_pa_elapsed) = measure!( @@ -197,7 +201,13 @@ async fn build_transactions( }) .collect::>() .chunks(4) - .map(|instructions| Transaction::new_with_payer(instructions, Some(signer_pubkey))) + .map(|close_claim_status_instructions| { + let mut instructions = vec![ComputeBudgetInstruction::set_compute_unit_price( + micro_lamports_per_compute_unit, + )]; + instructions.extend(close_claim_status_instructions.to_vec()); + Transaction::new_with_payer(&instructions, Some(signer_pubkey)) + }) .collect::>(); info!(