Skip to content

Commit 7a5072a

Browse files
committed
fix clippy
1 parent dd58804 commit 7a5072a

File tree

4 files changed

+31
-28
lines changed

4 files changed

+31
-28
lines changed

pallets/subtensor/src/coinbase/run_coinbase.rs

Lines changed: 22 additions & 22 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();

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
}

pallets/subtensor/src/tests/epoch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2835,7 +2835,7 @@ fn test_blocks_since_last_step() {
28352835
// println!("]");
28362836
// }
28372837

2838-
/// Helpers
2838+
// Helpers
28392839

28402840
/// Asserts that two I32F32 values are approximately equal within a given epsilon.
28412841
///

runtime/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1867,7 +1867,10 @@ impl_runtime_apis! {
18671867
use frame_system_benchmarking::Pallet as SystemBench;
18681868
use baseline::Pallet as BaselineBench;
18691869

1870+
#[allow(non_local_definitions)]
18701871
impl frame_system_benchmarking::Config for Runtime {}
1872+
1873+
#[allow(non_local_definitions)]
18711874
impl baseline::Config for Runtime {}
18721875

18731876
use frame_support::traits::WhitelistedStorageKeys;

0 commit comments

Comments
 (0)