From 3cc18c3790b86f6044d7d1fac2558b7f1c70873c Mon Sep 17 00:00:00 2001 From: Sam Johnson Date: Tue, 20 May 2025 14:19:32 -0400 Subject: [PATCH 1/5] fix a really bad typo! --- pallets/subtensor/src/macros/hooks.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/pallets/subtensor/src/macros/hooks.rs b/pallets/subtensor/src/macros/hooks.rs index a0e2fc6e7..2aa60c472 100644 --- a/pallets/subtensor/src/macros/hooks.rs +++ b/pallets/subtensor/src/macros/hooks.rs @@ -103,8 +103,6 @@ mod hooks { .saturating_add(migrations::migrate_remove_total_hotkey_coldkey_stakes_this_interval::migrate_remove_total_hotkey_coldkey_stakes_this_interval::()) // Wipe the deprecated RateLimit storage item in the commitments pallet .saturating_add(migrations::migrate_remove_commitments_rate_limit::migrate_remove_commitments_rate_limit::()); - - weight // Remove all entries in orphaned storage items .saturating_add( migrations::migrate_orphaned_storage_items::migrate_orphaned_storage_items::( From 941e7745281f23ea36cb031d21a0fc592be46cb3 Mon Sep 17 00:00:00 2001 From: Sam Johnson Date: Tue, 20 May 2025 15:00:49 -0400 Subject: [PATCH 2/5] fix subtensor pallet on_runtime_upgrade hook --- pallets/subtensor/src/macros/hooks.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pallets/subtensor/src/macros/hooks.rs b/pallets/subtensor/src/macros/hooks.rs index 2aa60c472..be4dec9ae 100644 --- a/pallets/subtensor/src/macros/hooks.rs +++ b/pallets/subtensor/src/macros/hooks.rs @@ -102,7 +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::()) // Wipe the deprecated RateLimit storage item in the commitments pallet - .saturating_add(migrations::migrate_remove_commitments_rate_limit::migrate_remove_commitments_rate_limit::()); + .saturating_add(migrations::migrate_remove_commitments_rate_limit::migrate_remove_commitments_rate_limit::()) // Remove all entries in orphaned storage items .saturating_add( migrations::migrate_orphaned_storage_items::migrate_orphaned_storage_items::( @@ -114,6 +114,20 @@ mod hooks { .saturating_add(migrations::migrate_reset_max_burn::migrate_reset_max_burn::()) // Migrate ColdkeySwapScheduled structure to new format .saturating_add(migrations::migrate_coldkey_swap_scheduled::migrate_coldkey_swap_scheduled::()); + + // fix storage version for subtensor pallet + use frame_support::traits::{GetStorageVersion, StorageVersion}; + let current_version = as GetStorageVersion>::on_chain_storage_version(); + let target_version = StorageVersion::new(7); + if current_version == target_version - 1 { + target_version.put::>(); + } else if current_version != target_version { + panic!( + "Storage version mismatch: expected {:?}, found {:?}", + target_version, current_version + ); + } + weight } From 602d25ed78819a201b349da79f04555f3c67867c Mon Sep 17 00:00:00 2001 From: Sam Johnson Date: Tue, 20 May 2025 15:12:55 -0400 Subject: [PATCH 3/5] fix --- pallets/subtensor/src/macros/hooks.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pallets/subtensor/src/macros/hooks.rs b/pallets/subtensor/src/macros/hooks.rs index be4dec9ae..ffc1c0c8b 100644 --- a/pallets/subtensor/src/macros/hooks.rs +++ b/pallets/subtensor/src/macros/hooks.rs @@ -118,13 +118,13 @@ mod hooks { // fix storage version for subtensor pallet use frame_support::traits::{GetStorageVersion, StorageVersion}; let current_version = as GetStorageVersion>::on_chain_storage_version(); - let target_version = StorageVersion::new(7); - if current_version == target_version - 1 { - target_version.put::>(); - } else if current_version != target_version { + let v7 = StorageVersion::new(7); + if current_version == StorageVersion::new(6) { + v7.put::>(); + } else if current_version != v7 { panic!( "Storage version mismatch: expected {:?}, found {:?}", - target_version, current_version + v7, current_version ); } From e2522f9fb3c89ab5ed9b4454bb7f3c2683afedeb Mon Sep 17 00:00:00 2001 From: Sam Johnson Date: Tue, 20 May 2025 15:19:11 -0400 Subject: [PATCH 4/5] bump spec version to 272 --- runtime/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 64937fd3b..219b1673e 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -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, From e3ac4f90f41ea5499019948fa8c21ed52c3882c8 Mon Sep 17 00:00:00 2001 From: Sam Johnson Date: Tue, 20 May 2025 15:21:48 -0400 Subject: [PATCH 5/5] fix again --- pallets/subtensor/src/macros/hooks.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pallets/subtensor/src/macros/hooks.rs b/pallets/subtensor/src/macros/hooks.rs index ffc1c0c8b..102507337 100644 --- a/pallets/subtensor/src/macros/hooks.rs +++ b/pallets/subtensor/src/macros/hooks.rs @@ -121,9 +121,9 @@ mod hooks { let v7 = StorageVersion::new(7); if current_version == StorageVersion::new(6) { v7.put::>(); - } else if current_version != v7 { + } else if current_version < v7 { panic!( - "Storage version mismatch: expected {:?}, found {:?}", + "Storage version mismatch: expected at least {:?}, found {:?}", v7, current_version ); }