Skip to content

Commit 71b05c1

Browse files
author
unconst
committed
add dynamic block
1 parent 8ac655f commit 71b05c1

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

pallets/subtensor/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,8 @@ pub mod pallet {
883883
pub type TotalIssuance<T> = StorageValue<_, u64, ValueQuery, DefaultTotalIssuance<T>>;
884884
#[pallet::storage] // --- ITEM ( total_stake )
885885
pub type TotalStake<T> = StorageValue<_, u64, ValueQuery>;
886+
#[pallet::storage] // --- ITEM ( dynamic_block ) -- block when dynamic was turned on.
887+
pub type DynamicBlock<T> = StorageValue<_, u64, ValueQuery>;
886888
#[pallet::storage] // --- DMAP ( netuid ) --> total_volume | The total amount of TAO bought and sold since the start of the network.
887889
pub type SubnetVolume<T: Config> =
888890
StorageMap<_, Identity, u16, u64, ValueQuery, DefaultZeroU64<T>>;
@@ -970,9 +972,6 @@ pub mod pallet {
970972
#[pallet::storage] // --- DMAP ( netuid ) --> subnet_name | Returns the name of the subnet.
971973
pub type SubnetName<T: Config> =
972974
StorageMap<_, Identity, u16, Vec<u8>, ValueQuery, DefaultUnicodeVecU8<T>>;
973-
#[pallet::storage] // --- DMAP ( netuid ) --> block_at_dtao_transition | Returns the block when the subnet transitioned to DTAO.
974-
pub type DynamicBlock<T: Config> =
975-
StorageMap<_, Identity, u16, u64, ValueQuery, DefaultUnicodeVecU8<T>>;
976975

977976
/// ============================
978977
/// ==== Global Parameters =====

pallets/subtensor/src/migrations/migrate_rao.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ pub fn migrate_rao<T: Config>() -> Weight {
3030
.collect();
3131
weight = weight.saturating_add(T::DbWeight::get().reads_writes(netuids.len() as u64, 0));
3232

33+
// Set the Dynamic block.
34+
DynamicBlock::<T>::insert(netuid, Pallet::<T>::get_current_block_as_u64() );
35+
3336
// Migrate all TAO to root.
3437
Stake::<T>::iter().for_each(|(hotkey, coldkey, stake)| {
3538
// Increase SubnetTAO on root.
@@ -59,7 +62,6 @@ pub fn migrate_rao<T: Config>() -> Weight {
5962
// Set global weight to 18% from the start
6063
TaoWeight::<T>::set(332_041_393_326_771_929);
6164
for netuid in netuids.iter().clone() {
62-
DynamicBlock::<T>::insert(netuid, Pallet::<T>::get_current_block_as_u64() );
6365
if *netuid == 0 {
6466
// Give root a single RAO in pool to avoid any catestrophic division by zero.
6567
SubnetAlphaIn::<T>::insert(netuid, 1);

pallets/subtensor/src/subnets/subnet.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ impl<T: Config> Pallet<T> {
226226
// --- 11. Set the creation terms.
227227
NetworkLastRegistered::<T>::set(current_block);
228228
NetworkRegisteredAt::<T>::insert(netuid_to_register, current_block);
229-
DynamicBlock::<T>::insert( netuid_to_register, current_block );
230229

231230
// --- 14. Init the pool by putting the lock as the initial alpha.
232231
TokenSymbol::<T>::insert(

0 commit comments

Comments
 (0)