substrate
substrate copied to clipboard
Stop using deprecated `remove_prefix` to clear era information in Staking Pallet
We currently clear state for eras older than HistoryDepth by using the fn map.remove_prefix which is deprecated. Use map.clear_prefix that can be paged.
This is how we clear old era information today
/// Clear all era information for given era.
pub(crate) fn clear_era_information(era_index: EraIndex) {
#[allow(deprecated)]
<ErasStakers<T>>::remove_prefix(era_index, None);
#[allow(deprecated)]
<ErasStakersClipped<T>>::remove_prefix(era_index, None);
#[allow(deprecated)]
<ErasValidatorPrefs<T>>::remove_prefix(era_index, None);
#[allow(deprecated)]
<ClaimedRewards<T>>::remove_prefix(era_index, None);
#[allow(deprecated)]
<ErasStakersPaged<T>>::remove_prefix((era_index,), None);
#[allow(deprecated)]
<ErasStakersOverview<T>>::remove_prefix(era_index, None);
<ErasValidatorReward<T>>::remove(era_index);
<ErasRewardPoints<T>>::remove(era_index);
<ErasTotalStake<T>>::remove(era_index);
ErasStartSessionIndex::<T>::remove(era_index);
}
Can I handle this task?