From 2da8c95bbce72761eed5950dc21ec4acc06ae73c Mon Sep 17 00:00:00 2001 From: Samuel Dare Date: Tue, 2 Jul 2024 15:46:55 +0400 Subject: [PATCH] fix: migration tests --- pallets/subtensor/tests/migration.rs | 9 +++++---- pallets/subtensor/tests/weights.rs | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pallets/subtensor/tests/migration.rs b/pallets/subtensor/tests/migration.rs index d390a723a..ae48a870b 100644 --- a/pallets/subtensor/tests/migration.rs +++ b/pallets/subtensor/tests/migration.rs @@ -2,7 +2,7 @@ mod mock; use pallet_subtensor::*; use frame_support::assert_ok; -use frame_support::pallet_prelude::{OptionQuery, StorageVersion}; +use frame_support::pallet_prelude::OptionQuery; use frame_support::Twox64Concat; use frame_support::{storage_alias, traits::GetStorageVersion}; use frame_system::Config; @@ -281,7 +281,7 @@ fn test_migration_delete_subnet_21() { } #[storage_alias] -type OldWeightCommits = StorageDoubleMap< +type OldWeightCommits = StorageDoubleMap< SubtensorModule, Twox64Concat, u16, @@ -293,7 +293,7 @@ type OldWeightCommits = StorageDoubleMap< // Add this storage alias for the StorageVersion // #[storage_alias] -type StorageVersion = StorageValue; +// type StorageVersion = StorageValue; #[test] fn test_migration_to_v7_weight_commits() { @@ -311,7 +311,8 @@ fn test_migration_to_v7_weight_commits() { OldWeightCommits::insert(netuid, account2, (hash2, block_number2)); // Set the storage version to 6 - StorageVersion::put(6); + SubtensorModule::in_code_storage_version().put::(); + // Run the migration pallet_subtensor::migration::migrate_to_v7_weight_commits::(); diff --git a/pallets/subtensor/tests/weights.rs b/pallets/subtensor/tests/weights.rs index 80f9848c6..80f57a4ce 100644 --- a/pallets/subtensor/tests/weights.rs +++ b/pallets/subtensor/tests/weights.rs @@ -1492,7 +1492,7 @@ fn test_commit_reveal_interval() { ); // Move to the next interval again - System::set_block_number((interval * 2)); + System::set_block_number(interval * 2); // Reveal with the new nonce (should succeed) assert_ok!(SubtensorModule::reveal_weights(