diff --git a/keepers/validator-keeper/src/main.rs b/keepers/validator-keeper/src/main.rs index 38ec6899..f1e2eebb 100644 --- a/keepers/validator-keeper/src/main.rs +++ b/keepers/validator-keeper/src/main.rs @@ -130,8 +130,8 @@ async fn mev_earned_loop( // Continuously runs throughout an epoch, polling for tip distribution accounts from the prev epoch with uploaded merkle roots // and submitting update_mev_earned (technically update_mev_comission) txs when the uploaded merkle roots are detected match update_mev_earned( - client.clone(), - keypair.clone(), + &client, + &keypair, &commission_history_program_id, &tip_distribution_program_id, &mut validators_updated, @@ -399,16 +399,16 @@ async fn main() { } tokio::spawn(mev_commission_loop( - Arc::clone(&client), - Arc::clone(&keypair), + client.clone(), + keypair.clone(), args.program_id, args.tip_distribution_program_id, args.interval, )); tokio::spawn(mev_earned_loop( - Arc::clone(&client), - Arc::clone(&keypair), + client.clone(), + keypair.clone(), args.program_id, args.tip_distribution_program_id, args.interval, diff --git a/keepers/validator-keeper/src/mev_commission.rs b/keepers/validator-keeper/src/mev_commission.rs index 9645ac3f..469cf42b 100644 --- a/keepers/validator-keeper/src/mev_commission.rs +++ b/keepers/validator-keeper/src/mev_commission.rs @@ -195,8 +195,8 @@ pub async fn update_mev_commission( } pub async fn update_mev_earned( - client: Arc, - keypair: Arc, + client: &Arc, + keypair: &Arc, validator_history_program_id: &Pubkey, tip_distribution_program_id: &Pubkey, validators_updated: &mut HashMap, @@ -224,7 +224,7 @@ pub async fn update_mev_earned( .map(|vote_account| { ValidatorMevCommissionEntry::new( vote_account, - epoch - 1, // TDA derived from the prev epoch since the merkle roots are uploaded shortly after rollover + epoch.saturating_sub(1), // TDA derived from the prev epoch since the merkle roots are uploaded shortly after rollover validator_history_program_id, tip_distribution_program_id, &keypair.pubkey(), @@ -232,10 +232,9 @@ pub async fn update_mev_earned( }) .collect::>(); - let uploaded_merkleroot_entries = - get_entries_with_uploaded_merkleroot(client.clone(), &entries) - .await - .map_err(|e| (e.into(), CreateUpdateStats::default()))?; + let uploaded_merkleroot_entries = get_entries_with_uploaded_merkleroot(&client, &entries) + .await + .map_err(|e| (e.into(), CreateUpdateStats::default()))?; let entries_to_update = uploaded_merkleroot_entries .into_iter() @@ -288,7 +287,7 @@ async fn get_existing_entries( } async fn get_entries_with_uploaded_merkleroot( - client: Arc, + client: &Arc, entries: &[ValidatorMevCommissionEntry], ) -> Result, MultipleAccountsError> { /* Filters tip distribution tuples to the addresses, then fetches accounts to see which ones have an uploaded merkle root */ diff --git a/programs/validator-history/src/instructions/copy_tip_distribution_account.rs b/programs/validator-history/src/instructions/copy_tip_distribution_account.rs index 4dae3ba0..1fab553e 100644 --- a/programs/validator-history/src/instructions/copy_tip_distribution_account.rs +++ b/programs/validator-history/src/instructions/copy_tip_distribution_account.rs @@ -50,7 +50,7 @@ pub struct CopyTipDistributionAccount<'info> { } pub fn handler(ctx: Context, epoch: u64) -> Result<()> { - // Cannot set stake for future epochs + // cant set data in validator history for future epochs if epoch > Clock::get()?.epoch { return Err(ValidatorHistoryError::EpochOutOfRange.into()); }