subtensor
subtensor copied to clipboard
remove stake records with value 0
This is the definition of the storage item Stake.
#[pallet::storage] // --- DMAP ( hot, cold ) --> stake | Returns the stake under a coldkey prefixed by hotkey.
pub type Stake<T: Config> = StorageDoubleMap<
_,
Blake2_128Concat,
T::AccountId,
Identity,
T::AccountId,
u64,
ValueQuery,
DefaultAccountTake<T>,
>;
I have run a simple script to get all the records of this storage item and it showed that more than 60% of the records are having value 0.
33234 out of 53273 items are zero
It is defined with the option ValueQuery, with default value 0, so we don't need to keep these records.
@camfairchild @Eugene-hu @shibshib @S0AndS0
Would be good to remove zero valued items in the next runtime upgrade by storage migration.
We'll include this in our dependency update and refactor branch, thank you for contributing.
Please close in favour of https://github.com/opentensor/subtensor/pull/361
We'll also need a migration to remove zero values that are already in the state. I am going to add it in dynamic branch for dtao.
closing in favour of #361