Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Stop using deprecated remove_prefix to clear era information in Staking Pallet #13439

Closed

Description

@Ank4n

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);
	}
	

Activity

  1. added
    Z6-mentorAn easy task where a mentor is available. Please indicate in the issue who the mentor could be.
    Z1-easyCan be fixed primarily by duplicating and adapting code by an intermediate coder
    on Feb 22, 2023
  2. gflow33 commented on Mar 7, 2023

    @gflow33

    Can I handle this task?

  3. moved this from 📕 Backlog to ✅ Done in (Nominated) Proof of Stakeon May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Z1-easyCan be fixed primarily by duplicating and adapting code by an intermediate coderZ6-mentorAn easy task where a mentor is available. Please indicate in the issue who the mentor could be.

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions