Remove deprecated slow epoch boundary methods (#21568)

This commit is contained in:
Justin Starry
2021-12-03 12:59:10 -05:00
committed by GitHub
parent 377efefead
commit 1430b58a6d
8 changed files with 24 additions and 509 deletions

View File

@ -1098,81 +1098,6 @@ fn stake_weighted_credits_observed(
}
}
// utility function, used by runtime
// returns a tuple of (stakers_reward,voters_reward)
#[doc(hidden)]
#[deprecated(note = "remove after optimize_epoch_boundary_updates feature is active")]
pub fn redeem_rewards_slow(
rewarded_epoch: Epoch,
stake_account: &mut AccountSharedData,
vote_account: &mut AccountSharedData,
vote_state: &VoteState,
point_value: &PointValue,
stake_history: Option<&StakeHistory>,
inflation_point_calc_tracer: Option<impl Fn(&InflationPointCalculationEvent)>,
fix_activating_credits_observed: bool,
) -> Result<(u64, u64), InstructionError> {
if let StakeState::Stake(meta, mut stake) = stake_account.state()? {
if let Some(inflation_point_calc_tracer) = inflation_point_calc_tracer.as_ref() {
inflation_point_calc_tracer(
&InflationPointCalculationEvent::EffectiveStakeAtRewardedEpoch(
stake.stake(rewarded_epoch, stake_history),
),
);
inflation_point_calc_tracer(&InflationPointCalculationEvent::RentExemptReserve(
meta.rent_exempt_reserve,
));
inflation_point_calc_tracer(&InflationPointCalculationEvent::Commission(
vote_state.commission,
));
}
if let Some((stakers_reward, voters_reward)) = redeem_stake_rewards(
rewarded_epoch,
&mut stake,
point_value,
vote_state,
stake_history,
inflation_point_calc_tracer,
fix_activating_credits_observed,
) {
stake_account.checked_add_lamports(stakers_reward)?;
vote_account.checked_add_lamports(voters_reward)?;
stake_account.set_state(&StakeState::Stake(meta, stake))?;
Ok((stakers_reward, voters_reward))
} else {
Err(StakeError::NoCreditsToRedeem.into())
}
} else {
Err(InstructionError::InvalidAccountData)
}
}
// utility function, used by runtime
#[doc(hidden)]
#[deprecated(note = "remove after optimize_epoch_boundary_updates feature is active")]
pub fn calculate_points_slow(
stake_account: &AccountSharedData,
vote_account: &AccountSharedData,
stake_history: Option<&StakeHistory>,
) -> Result<u128, InstructionError> {
if let StakeState::Stake(_meta, stake) = stake_account.state()? {
let vote_state: VoteState =
StateMut::<VoteStateVersions>::state(vote_account)?.convert_to_current();
Ok(calculate_stake_points(
&stake,
&vote_state,
stake_history,
null_tracer(),
))
} else {
Err(InstructionError::InvalidAccountData)
}
}
// utility function, used by runtime
// returns a tuple of (stakers_reward,voters_reward)
#[doc(hidden)]