Skip to content

Commit 2677e6d

Browse files
committed
IncentiveAlphaEmittedToMiners
2 parents 75ba336 + 86c1d31 commit 2677e6d

File tree

17 files changed

+294
-105
lines changed

17 files changed

+294
-105
lines changed

Cargo.lock

Lines changed: 40 additions & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pallets/subtensor/src/coinbase/root.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -414,19 +414,16 @@ impl<T: Config> Pallet<T> {
414414
// --- 2. Remove network count.
415415
SubnetworkN::<T>::remove(netuid);
416416

417-
// --- 3. Remove network modality storage.
418-
NetworkModality::<T>::remove(netuid);
419-
420-
// --- 4. Remove netuid from added networks.
417+
// --- 3. Remove netuid from added networks.
421418
NetworksAdded::<T>::remove(netuid);
422419

423-
// --- 5. Decrement the network counter.
420+
// --- 4. Decrement the network counter.
424421
TotalNetworks::<T>::mutate(|n: &mut u16| *n = n.saturating_sub(1));
425422

426-
// --- 6. Remove various network-related storages.
423+
// --- 5. Remove various network-related storages.
427424
NetworkRegisteredAt::<T>::remove(netuid);
428425

429-
// --- 7. Remove incentive mechanism memory.
426+
// --- 6. Remove incentive mechanism memory.
430427
let _ = Uids::<T>::clear_prefix(netuid, u32::MAX, None);
431428
let keys = Keys::<T>::iter_prefix(netuid).collect::<Vec<_>>();
432429
let _ = Keys::<T>::clear_prefix(netuid, u32::MAX, None);
@@ -435,13 +432,13 @@ impl<T: Config> Pallet<T> {
435432
let _ = Bonds::<T>::clear_prefix(netuid_index, u32::MAX, None);
436433
}
437434

438-
// --- 8. Removes the weights for this subnet (do not remove).
435+
// --- 7. Removes the weights for this subnet (do not remove).
439436
for subid in 0..subsubnets {
440437
let netuid_index = Self::get_subsubnet_storage_index(netuid, subid.into());
441438
let _ = Weights::<T>::clear_prefix(netuid_index, u32::MAX, None);
442439
}
443440

444-
// --- 9. Iterate over stored weights and fill the matrix.
441+
// --- 8. Iterate over stored weights and fill the matrix.
445442
for (uid_i, weights_i) in Weights::<T>::iter_prefix(NetUidStorageIndex::ROOT) {
446443
// Create a new vector to hold modified weights.
447444
let mut modified_weights = weights_i.clone();
@@ -455,7 +452,7 @@ impl<T: Config> Pallet<T> {
455452
Weights::<T>::insert(NetUidStorageIndex::ROOT, uid_i, modified_weights);
456453
}
457454

458-
// --- 10. Remove various network-related parameters.
455+
// --- 9. Remove various network-related parameters.
459456
Rank::<T>::remove(netuid);
460457
Trust::<T>::remove(netuid);
461458
Active::<T>::remove(netuid);
@@ -478,7 +475,7 @@ impl<T: Config> Pallet<T> {
478475
IsNetworkMember::<T>::remove(key, netuid);
479476
}
480477

481-
// --- 11. Erase network parameters.
478+
// --- 10. Erase network parameters.
482479
Tempo::<T>::remove(netuid);
483480
Kappa::<T>::remove(netuid);
484481
Difficulty::<T>::remove(netuid);
@@ -491,12 +488,12 @@ impl<T: Config> Pallet<T> {
491488
POWRegistrationsThisInterval::<T>::remove(netuid);
492489
BurnRegistrationsThisInterval::<T>::remove(netuid);
493490

494-
// --- 12. Add the balance back to the owner.
491+
// --- 11. Add the balance back to the owner.
495492
Self::add_balance_to_coldkey_account(&owner_coldkey, reserved_amount.into());
496493
Self::set_subnet_locked_balance(netuid, TaoCurrency::ZERO);
497494
SubnetOwner::<T>::remove(netuid);
498495

499-
// --- 13. Remove subnet identity if it exists.
496+
// --- 12. Remove subnet identity if it exists.
500497
if SubnetIdentitiesV3::<T>::contains_key(netuid) {
501498
SubnetIdentitiesV3::<T>::remove(netuid);
502499
Self::deposit_event(Event::SubnetIdentityRemoved(netuid));

pallets/subtensor/src/coinbase/run_coinbase.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,14 @@ impl<T: Config> Pallet<T> {
513513

514514
let owner: T::AccountId = Owner::<T>::get(&hotkey);
515515
let destination = AutoStakeDestination::<T>::get(&owner).unwrap_or(hotkey.clone());
516+
517+
Self::deposit_event(Event::<T>::AutoStakeAdded {
518+
netuid,
519+
destination: destination.clone(),
520+
hotkey,
521+
owner: owner.clone(),
522+
incentive,
523+
});
516524
Self::increase_stake_for_hotkey_and_coldkey_on_subnet(
517525
&destination,
518526
&owner,

0 commit comments

Comments
 (0)