Skip to content

Commit f0f34fb

Browse files
committed
fix clippy pt 1
1 parent 7e46bb5 commit f0f34fb

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

pallets/subtensor/src/coinbase/run_coinbase.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,28 @@ use substrate_fixed::types::I96F32;
55
impl<T: Config> Pallet<T> {
66
/// The `coinbase` function performs a four-part emission distribution process involving
77
/// subnets, epochs, hotkeys, and nominators.
8-
// It is divided into several steps, each handling a specific part of the distribution:
9-
10-
// Step 1: Compute the block-wise emission for each subnet.
11-
// This involves calculating how much (TAO) should be emitted into each subnet using the
12-
// root epoch function.
13-
14-
// Step 2: Accumulate the subnet block emission.
15-
// After calculating the block-wise emission, these values are accumulated to keep track
16-
// of how much each subnet should emit before the next distribution phase. This accumulation
17-
// is a running total that gets updated each block.
18-
19-
// Step 3: Distribute the accumulated emissions through epochs.
20-
// Subnets periodically distribute their accumulated emissions to hotkeys (active validators/miners)
21-
// in the network on a `tempo` --- the time between epochs. This step runs Yuma consensus to
22-
// determine how emissions are split among hotkeys based on their contributions and roles.
23-
// The accumulation of hotkey emissions is done through the `accumulate_hotkey_emission` function.
24-
// The function splits the rewards for a hotkey amongst itself and its `parents`. The parents are
25-
// the hotkeys that are delegating their stake to the hotkey.
26-
27-
// Step 4: Further distribute emissions from hotkeys to nominators.
28-
// Finally, the emissions received by hotkeys are further distributed to their nominators,
29-
// who are stakeholders that support the hotkeys.
8+
/// It is divided into several steps, each handling a specific part of the distribution:
9+
///
10+
/// Step 1: Compute the block-wise emission for each subnet.
11+
/// This involves calculating how much (TAO) should be emitted into each subnet using the
12+
/// root epoch function.
13+
///
14+
/// Step 2: Accumulate the subnet block emission.
15+
/// After calculating the block-wise emission, these values are accumulated to keep track
16+
/// of how much each subnet should emit before the next distribution phase. This accumulation
17+
/// is a running total that gets updated each block.
18+
///
19+
/// Step 3: Distribute the accumulated emissions through epochs.
20+
/// Subnets periodically distribute their accumulated emissions to hotkeys (active validators/miners)
21+
/// in the network on a `tempo` --- the time between epochs. This step runs Yuma consensus to
22+
/// determine how emissions are split among hotkeys based on their contributions and roles.
23+
/// The accumulation of hotkey emissions is done through the `accumulate_hotkey_emission` function.
24+
/// The function splits the rewards for a hotkey amongst itself and its `parents`. The parents are
25+
/// the hotkeys that are delegating their stake to the hotkey.
26+
///
27+
/// Step 4: Further distribute emissions from hotkeys to nominators.
28+
/// Finally, the emissions received by hotkeys are further distributed to their nominators,
29+
/// who are stakeholders that support the hotkeys.
3030
pub fn run_coinbase() {
3131
// --- 0. Get current block.
3232
let current_block: u64 = Self::get_current_block_as_u64();
@@ -134,7 +134,7 @@ impl<T: Config> Pallet<T> {
134134
&hotkey,
135135
*netuid,
136136
validator_emission, // Amount received from validating
137-
mining_emission, // Amount recieved from mining.
137+
mining_emission, // Amount received from mining.
138138
);
139139
log::debug!("Accumulated emissions on hotkey {:?} for netuid {:?}: mining {:?}, validator {:?}", hotkey, *netuid, mining_emission, validator_emission);
140140
}

pallets/subtensor/src/epoch/math.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,26 +113,26 @@ pub fn vec_max_upscale_to_u16(vec: &[I32F32]) -> Vec<u16> {
113113
})
114114
.collect();
115115
}
116-
return vec
116+
vec
117117
.iter()
118118
.map(|e: &I32F32| {
119119
e.saturating_mul(u16_max)
120120
.saturating_div(*val)
121121
.round()
122122
.to_num::<u16>()
123123
})
124-
.collect();
124+
.collect()
125125
}
126126
None => {
127127
let sum: I32F32 = vec.iter().sum();
128-
return vec
128+
vec
129129
.iter()
130130
.map(|e: &I32F32| {
131131
e.saturating_mul(u16_max)
132132
.saturating_div(sum)
133133
.to_num::<u16>()
134134
})
135-
.collect();
135+
.collect()
136136
}
137137
}
138138
}
@@ -246,7 +246,7 @@ pub fn is_topk(vector: &[I32F32], k: usize) -> Vec<bool> {
246246
pub fn normalize(x: &[I32F32]) -> Vec<I32F32> {
247247
let x_sum: I32F32 = sum(x);
248248
if x_sum != I32F32::from_num(0.0_f32) {
249-
return x.iter().map(|xi| xi.saturating_div(x_sum)).collect();
249+
x.iter().map(|xi| xi.saturating_div(x_sum)).collect()
250250
} else {
251251
x.to_vec()
252252
}

0 commit comments

Comments
 (0)