Skip to content

Commit 558f908

Browse files
Apply review suggestions
1 parent 55f30b2 commit 558f908

File tree

6 files changed

+13
-30
lines changed

6 files changed

+13
-30
lines changed

pallets/subtensor/src/coinbase/run_coinbase.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ impl<T: Config> Pallet<T> {
174174
let tao_weight: U96F32 = root_tao.saturating_mul(Self::get_tao_weight());
175175
log::debug!("tao_weight: {tao_weight:?}");
176176

177-
// --- 6. Seperate out root dividends in alpha and sell them into tao.
177+
// --- 6. Seperate out root dividends in alpha and keep them.
178178
// Then accumulate those dividends for later.
179179
for netuid_i in subnets_to_emit_to.iter() {
180180
// Get remaining alpha out.
@@ -237,15 +237,15 @@ impl<T: Config> Pallet<T> {
237237
let pending_alpha = PendingEmission::<T>::get(netuid);
238238
PendingEmission::<T>::insert(netuid, AlphaCurrency::ZERO);
239239

240-
// Get and drain the subnet pending root divs.
240+
// Get and drain the subnet pending root alpha divs.
241241
let pending_root_alpha = PendingRootAlphaDivs::<T>::get(netuid);
242242
PendingRootAlphaDivs::<T>::insert(netuid, AlphaCurrency::ZERO);
243243

244244
// Get owner cut and drain.
245245
let owner_cut = PendingOwnerCut::<T>::get(netuid);
246246
PendingOwnerCut::<T>::insert(netuid, AlphaCurrency::ZERO);
247247

248-
// Drain pending root divs, alpha emission, and owner cut.
248+
// Drain pending root alpha divs, alpha emission, and owner cut.
249249
Self::drain_pending_emission(netuid, pending_alpha, pending_root_alpha, owner_cut);
250250
} else {
251251
// Increment
@@ -306,7 +306,7 @@ impl<T: Config> Pallet<T> {
306306
// Setup.
307307
let zero: U96F32 = asfloat!(0.0);
308308

309-
// Accumulate root divs and alpha_divs. For each hotkey we compute their
309+
// Accumulate root alpha divs and alpha_divs. For each hotkey we compute their
310310
// local and root dividend proportion based on their alpha_stake/root_stake
311311
let mut total_root_divs: U96F32 = asfloat!(0);
312312
let mut total_alpha_divs: U96F32 = asfloat!(0);
@@ -532,7 +532,7 @@ impl<T: Config> Pallet<T> {
532532
// Get take prop
533533
let alpha_take: U96F32 =
534534
Self::get_hotkey_take_float(&hotkey).saturating_mul(root_alpha);
535-
// Remove take prop from root_tao
535+
// Remove take prop from root_alpha
536536
root_alpha = root_alpha.saturating_sub(alpha_take);
537537
// Give the validator their take.
538538
log::debug!("hotkey: {hotkey:?} alpha_take: {alpha_take:?}");
@@ -549,7 +549,7 @@ impl<T: Config> Pallet<T> {
549549
tou64!(root_alpha).into(),
550550
);
551551

552-
// Record root dividends for this validator on this subnet.
552+
// Record root alpha dividends for this validator on this subnet.
553553
AlphaDividendsPerSubnet::<T>::mutate(netuid, hotkey.clone(), |divs| {
554554
*divs = divs.saturating_add(tou64!(root_alpha).into());
555555
});

pallets/subtensor/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,7 @@ pub mod pallet {
13831383
/// --- MAP ( netuid ) --> pending_emission
13841384
pub type PendingEmission<T> =
13851385
StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultPendingEmission<T>>;
1386-
/// --- MAP ( netuid ) --> pending_root_emission
1386+
/// --- MAP ( netuid ) --> pending_root_alpha_emission
13871387
#[pallet::storage]
13881388
pub type PendingRootAlphaDivs<T> =
13891389
StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultZeroAlpha<T>>;

pallets/subtensor/src/macros/dispatches.rs

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2367,15 +2367,7 @@ mod dispatches {
23672367
Ok(())
23682368
}
23692369

2370-
/// --- Sets the root claim type for the coldkey.
2371-
/// # Args:
2372-
/// * 'origin': (<T as frame_system::Config>Origin):
2373-
/// - The signature of the caller's coldkey.
2374-
///
2375-
/// # Event:
2376-
/// * RootClaimTypeSet;
2377-
/// - On the successfully setting the root claim type for the coldkey.
2378-
///
2370+
/// --- Sets root claim number (sudo extrinsic).
23792371
#[pallet::call_index(123)]
23802372
#[pallet::weight((
23812373
Weight::from_parts(4_000_000, 0).saturating_add(T::DbWeight::get().writes(1_u64)),
@@ -2395,15 +2387,7 @@ mod dispatches {
23952387
Ok(())
23962388
}
23972389

2398-
/// --- Sets the root claim type for the coldkey.
2399-
/// # Args:
2400-
/// * 'origin': (<T as frame_system::Config>Origin):
2401-
/// - The signature of the caller's coldkey.
2402-
///
2403-
/// # Event:
2404-
/// * RootClaimTypeSet;
2405-
/// - On the successfully setting the root claim type for the coldkey.
2406-
///
2390+
/// --- Sets root claim threshold for subnet (sudo or owner origin).
24072391
#[pallet::call_index(124)]
24082392
#[pallet::weight((
24092393
Weight::from_parts(5_711_000, 0).saturating_add(T::DbWeight::get().writes(1_u64)),

pallets/subtensor/src/staking/claim_root.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl<T: Config> Pallet<T> {
101101
let root_claimed: I96F32 =
102102
I96F32::saturating_from_num(RootClaimed::<T>::get((hotkey, coldkey, netuid)));
103103

104-
// Substract the already claimed alpha.
104+
// Subtract the already claimed alpha.
105105
let owed: I96F32 = claimable.saturating_sub(root_claimed);
106106

107107
owed
@@ -131,7 +131,7 @@ impl<T: Config> Pallet<T> {
131131
root_claim_type: RootClaimTypeEnum,
132132
ignore_minimum_condition: bool,
133133
) {
134-
// Substract the root claimed.
134+
// Subtract the root claimed.
135135
let owed: I96F32 = Self::get_root_owed_for_hotkey_coldkey_float(hotkey, coldkey, netuid);
136136

137137
if !ignore_minimum_condition

pallets/subtensor/src/staking/helpers.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,9 @@ impl<T: Config> Pallet<T> {
326326
});
327327
}
328328

329-
/// The function clears Alpha map in batches. Each run will check ALPHA_MAP_CLEAN_BATCH_SIZE
329+
/// The function clears Alpha map in batches. Each run will check ALPHA_MAP_BATCH_SIZE
330330
/// alphas. It keeps the alpha value stored when it's >= than MIN_ALPHA.
331-
/// The function uses AlphaMapCleanLastKey as a storage for key iterator between runs.
331+
/// The function uses AlphaMapLastKey as a storage for key iterator between runs.
332332
pub fn populate_root_coldkey_staking_maps() {
333333
// Get starting key for the batch. Get the first key if we restart the process.
334334
let mut new_starting_raw_key = AlphaMapLastKey::<T>::get();

pallets/subtensor/src/tests/coinbase.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,6 @@ fn test_drain_base_with_subnet_with_two_stakers_registered_and_root_different_am
947947
SubtensorModule::drain_pending_emission(
948948
netuid,
949949
pending_alpha,
950-
// pending_tao,
951950
AlphaCurrency::ZERO,
952951
AlphaCurrency::ZERO,
953952
);

0 commit comments

Comments
 (0)