Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix remaining escapes in hotfix pr bot message #1040

Merged
merged 3 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/hotfixes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
COMMENT_BODY=$(cat <<EOF
## 🚨🚨🚨 HOTFIX DETECTED 🚨🚨🚨

It looks like you are trying to merge a hotfix PR into `main`. If this isn't what you wanted to do, and you just wanted to make a regular PR, please close this PR, base your changes off the `devnet-ready` branch and open a new PR into `devnet ready`.
It looks like you are trying to merge a hotfix PR into \`main\`. If this isn't what you wanted to do, and you just wanted to make a regular PR, please close this PR, base your changes off the \`devnet-ready\` branch and open a new PR into \`devnet ready\`.

If you _are_ trying to merge a hotfix PR, please complete the following essential steps:
1. [ ] go ahead and get this PR into \`main\` merged, so we can get the change in as quickly as possible!
Expand Down
44 changes: 22 additions & 22 deletions pallets/subtensor/src/coinbase/run_coinbase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@ use substrate_fixed::types::I96F32;
impl<T: Config> Pallet<T> {
/// The `coinbase` function performs a four-part emission distribution process involving
/// subnets, epochs, hotkeys, and nominators.
// It is divided into several steps, each handling a specific part of the distribution:

// Step 1: Compute the block-wise emission for each subnet.
// This involves calculating how much (TAO) should be emitted into each subnet using the
// root epoch function.

// Step 2: Accumulate the subnet block emission.
// After calculating the block-wise emission, these values are accumulated to keep track
// of how much each subnet should emit before the next distribution phase. This accumulation
// is a running total that gets updated each block.

// Step 3: Distribute the accumulated emissions through epochs.
// Subnets periodically distribute their accumulated emissions to hotkeys (active validators/miners)
// in the network on a `tempo` --- the time between epochs. This step runs Yuma consensus to
// determine how emissions are split among hotkeys based on their contributions and roles.
// The accumulation of hotkey emissions is done through the `accumulate_hotkey_emission` function.
// The function splits the rewards for a hotkey amongst itself and its `parents`. The parents are
// the hotkeys that are delegating their stake to the hotkey.

// Step 4: Further distribute emissions from hotkeys to nominators.
// Finally, the emissions received by hotkeys are further distributed to their nominators,
// who are stakeholders that support the hotkeys.
/// It is divided into several steps, each handling a specific part of the distribution:
///
/// Step 1: Compute the block-wise emission for each subnet.
/// This involves calculating how much (TAO) should be emitted into each subnet using the
/// root epoch function.
///
/// Step 2: Accumulate the subnet block emission.
/// After calculating the block-wise emission, these values are accumulated to keep track
/// of how much each subnet should emit before the next distribution phase. This accumulation
/// is a running total that gets updated each block.
///
/// Step 3: Distribute the accumulated emissions through epochs.
/// Subnets periodically distribute their accumulated emissions to hotkeys (active validators/miners)
/// in the network on a `tempo` --- the time between epochs. This step runs Yuma consensus to
/// determine how emissions are split among hotkeys based on their contributions and roles.
/// The accumulation of hotkey emissions is done through the `accumulate_hotkey_emission` function.
/// The function splits the rewards for a hotkey amongst itself and its `parents`. The parents are
/// the hotkeys that are delegating their stake to the hotkey.
///
/// Step 4: Further distribute emissions from hotkeys to nominators.
/// Finally, the emissions received by hotkeys are further distributed to their nominators,
/// who are stakeholders that support the hotkeys.
pub fn run_coinbase() {
// --- 0. Get current block.
let current_block: u64 = Self::get_current_block_as_u64();
Expand Down
12 changes: 5 additions & 7 deletions pallets/subtensor/src/epoch/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,26 +113,24 @@ pub fn vec_max_upscale_to_u16(vec: &[I32F32]) -> Vec<u16> {
})
.collect();
}
return vec
.iter()
vec.iter()
.map(|e: &I32F32| {
e.saturating_mul(u16_max)
.saturating_div(*val)
.round()
.to_num::<u16>()
})
.collect();
.collect()
}
None => {
let sum: I32F32 = vec.iter().sum();
return vec
.iter()
vec.iter()
.map(|e: &I32F32| {
e.saturating_mul(u16_max)
.saturating_div(sum)
.to_num::<u16>()
})
.collect();
.collect()
}
}
}
Expand Down Expand Up @@ -246,7 +244,7 @@ pub fn is_topk(vector: &[I32F32], k: usize) -> Vec<bool> {
pub fn normalize(x: &[I32F32]) -> Vec<I32F32> {
let x_sum: I32F32 = sum(x);
if x_sum != I32F32::from_num(0.0_f32) {
return x.iter().map(|xi| xi.saturating_div(x_sum)).collect();
x.iter().map(|xi| xi.saturating_div(x_sum)).collect()
} else {
x.to_vec()
}
Expand Down
2 changes: 1 addition & 1 deletion pallets/subtensor/src/tests/epoch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2835,7 +2835,7 @@ fn test_blocks_since_last_step() {
// println!("]");
// }

/// Helpers
// Helpers

/// Asserts that two I32F32 values are approximately equal within a given epsilon.
///
Expand Down
3 changes: 3 additions & 0 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1867,7 +1867,10 @@ impl_runtime_apis! {
use frame_system_benchmarking::Pallet as SystemBench;
use baseline::Pallet as BaselineBench;

#[allow(non_local_definitions)]
impl frame_system_benchmarking::Config for Runtime {}

#[allow(non_local_definitions)]
impl baseline::Config for Runtime {}

use frame_support::traits::WhitelistedStorageKeys;
Expand Down
Loading