Skip to content

Commit

Permalink
fix: migration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Dare committed Jul 2, 2024
1 parent 52f96e0 commit 2da8c95
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions pallets/subtensor/tests/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -281,7 +281,7 @@ fn test_migration_delete_subnet_21() {
}

#[storage_alias]
type OldWeightCommits<T: Config> = StorageDoubleMap<
type OldWeightCommits = StorageDoubleMap<
SubtensorModule,
Twox64Concat,
u16,
Expand All @@ -293,7 +293,7 @@ type OldWeightCommits<T: Config> = StorageDoubleMap<

// Add this storage alias for the StorageVersion
// #[storage_alias]
type StorageVersion = StorageValue<SubtensorModule, u16>;
// type StorageVersion = StorageValue<SubtensorModule, u16>;

#[test]
fn test_migration_to_v7_weight_commits() {
Expand All @@ -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::<SubtensorModule>();

// Run the migration
pallet_subtensor::migration::migrate_to_v7_weight_commits::<Test>();

Expand Down
2 changes: 1 addition & 1 deletion pallets/subtensor/tests/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 2da8c95

Please sign in to comment.