Skip to content

fix broken subtensor pallet on_runtime_upgrade() #1660

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

Open
wants to merge 13 commits into
base: devnet-ready
Choose a base branch
from
Open
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
18 changes: 15 additions & 3 deletions pallets/subtensor/src/macros/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ mod hooks {
// Remove all entries in TotalHotkeyColdkeyStakesThisInterval
.saturating_add(migrations::migrate_remove_total_hotkey_coldkey_stakes_this_interval::migrate_remove_total_hotkey_coldkey_stakes_this_interval::<T>())
// Wipe the deprecated RateLimit storage item in the commitments pallet
.saturating_add(migrations::migrate_remove_commitments_rate_limit::migrate_remove_commitments_rate_limit::<T>());

weight
.saturating_add(migrations::migrate_remove_commitments_rate_limit::migrate_remove_commitments_rate_limit::<T>())
// Remove all entries in orphaned storage items
.saturating_add(
migrations::migrate_orphaned_storage_items::migrate_orphaned_storage_items::<T>(
Expand All @@ -116,6 +114,20 @@ mod hooks {
.saturating_add(migrations::migrate_reset_max_burn::migrate_reset_max_burn::<T>())
// Migrate ColdkeySwapScheduled structure to new format
.saturating_add(migrations::migrate_coldkey_swap_scheduled::migrate_coldkey_swap_scheduled::<T>());

// fix storage version for subtensor pallet
use frame_support::traits::{GetStorageVersion, StorageVersion};
let current_version = <Pallet<T> as GetStorageVersion>::on_chain_storage_version();
let v7 = StorageVersion::new(7);
if current_version == StorageVersion::new(6) {
v7.put::<Pallet<T>>();
} else if current_version < v7 {
panic!(
"Storage version mismatch: expected at least {:?}, found {:?}",
v7, current_version
);
}

weight
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// `spec_version`, and `authoring_version` are the same between Wasm and native.
// This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use
// the compatible custom types.
spec_version: 271,
spec_version: 272,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down
Loading