-
Notifications
You must be signed in to change notification settings - Fork 214
Feat/pending childkeys #1050
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
Merged
Merged
Feat/pending childkeys #1050
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
e33a580
Pending children, tests passing, no specific tests
gztensor 88bf635
Pending children, specific tests
gztensor 07cef6a
Merge branch 'devnet-ready' into feat/pending-childkeys
gztensor aad6f56
Add pending childkey cooldown test
gztensor 796ffdb
Bump spec version
gztensor 962bf82
Revert "Bump spec version"
gztensor 2c63c6c
Fix clippy issues
gztensor 19d175f
fmt
gztensor d001c99
Fix test for removing stake
gztensor b4d41d0
Add ChildkeysMinStake, fix clippy, fix tests
gztensor 91c0d4a
Use StakeThreshold instead of WeightsMinStake and ChildkeyMinStake
gztensor c596998
Set that migration has run for StakeThreshold migration
gztensor 7e03512
Merge branch 'devnet-ready' into feat/pending-childkeys
gztensor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
pallets/subtensor/src/migrations/migrate_stake_threshold.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
use super::*; | ||
use crate::HasMigrationRun; | ||
use frame_support::pallet_prelude::ValueQuery; | ||
use frame_support::storage_alias; | ||
use frame_support::{traits::Get, weights::Weight}; | ||
use scale_info::prelude::string::String; | ||
|
||
/// Module containing deprecated storage format for WeightsMinStake | ||
pub mod deprecated_weights_min_stake { | ||
use super::*; | ||
|
||
#[storage_alias] | ||
pub(super) type WeightsMinStake<T: Config> = StorageValue<Pallet<T>, u64, ValueQuery>; | ||
} | ||
|
||
pub fn migrate_stake_threshold<T: Config>() -> Weight { | ||
let migration_name = b"migrate_stake_threshold".to_vec(); | ||
let mut weight = T::DbWeight::get().reads(1); | ||
|
||
if HasMigrationRun::<T>::get(&migration_name) { | ||
log::info!( | ||
"Migration '{:?}' has already run. Skipping.", | ||
migration_name | ||
); | ||
return weight; | ||
} | ||
|
||
log::info!( | ||
"Running migration '{}'", | ||
String::from_utf8_lossy(&migration_name) | ||
); | ||
|
||
let min_stake = deprecated_weights_min_stake::WeightsMinStake::<T>::get(); | ||
StakeThreshold::<T>::set(min_stake); | ||
deprecated_weights_min_stake::WeightsMinStake::<T>::kill(); | ||
|
||
weight = weight.saturating_add(T::DbWeight::get().reads_writes(1, 1)); | ||
|
||
HasMigrationRun::<T>::insert(&migration_name, true); | ||
weight = weight.saturating_add(T::DbWeight::get().writes(1)); | ||
|
||
log::info!( | ||
"Migration '{:?}' completed successfully.", | ||
String::from_utf8_lossy(&migration_name) | ||
); | ||
|
||
weight | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.