Skip to content

Commit 8ac655f

Browse files
author
unconst
committed
add block when the subnet transitioned to dtao
1 parent 3387795 commit 8ac655f

File tree

4 files changed

+641
-659
lines changed

4 files changed

+641
-659
lines changed

pallets/subtensor/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,10 @@ pub mod pallet {
970970
#[pallet::storage] // --- DMAP ( netuid ) --> subnet_name | Returns the name of the subnet.
971971
pub type SubnetName<T: Config> =
972972
StorageMap<_, Identity, u16, Vec<u8>, ValueQuery, DefaultUnicodeVecU8<T>>;
973-
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>>;
976+
974977
/// ============================
975978
/// ==== Global Parameters =====
976979
/// ============================

pallets/subtensor/src/migrations/migrate_rao.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ pub fn migrate_rao<T: Config>() -> Weight {
5959
// Set global weight to 18% from the start
6060
TaoWeight::<T>::set(332_041_393_326_771_929);
6161
for netuid in netuids.iter().clone() {
62+
DynamicBlock::<T>::insert(netuid, Pallet::<T>::get_current_block_as_u64() );
6263
if *netuid == 0 {
6364
// Give root a single RAO in pool to avoid any catestrophic division by zero.
6465
SubnetAlphaIn::<T>::insert(netuid, 1);

pallets/subtensor/src/subnets/subnet.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ 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 );
229230

230231
// --- 14. Init the pool by putting the lock as the initial alpha.
231232
TokenSymbol::<T>::insert(
@@ -247,7 +248,7 @@ impl<T: Config> Pallet<T> {
247248
SubnetAlphaIn::<T>::insert(netuid_to_register, pool_initial_tao);
248249
SubnetOwner::<T>::insert(netuid_to_register, coldkey.clone());
249250
SubnetOwnerHotkey::<T>::insert(netuid_to_register, hotkey.clone());
250-
251+
251252
if actual_tao_lock_amount_less_pool_tao > 0 {
252253
Self::burn_tokens(actual_tao_lock_amount_less_pool_tao);
253254
}

0 commit comments

Comments
 (0)