use super::*; use crate::HasMigrationRun; use frame_support::{traits::Get, weights::Weight}; use scale_info::prelude::string::String; use sp_io::storage::clear; pub fn migrate_remove_unused_maps_and_values() -> Weight { let migration_name = b"migrate_remove_unused_maps_and_values".to_vec(); let mut weight = T::DbWeight::get().reads(1); if HasMigrationRun::::get(&migration_name) { log::info!( "Migration '{:?}' has already run. Skipping.", String::from_utf8_lossy(&migration_name) ); return weight; } log::info!( "Running migration '{}'", String::from_utf8_lossy(&migration_name) ); // Remove EmissionValues entries remove_prefix::("SubtensorModule", "EmissionValues", &mut weight); // Remove NetworkMaxStake remove_prefix::("SubtensorModule", "NetworkMaxStake", &mut weight); // Remove SubnetLimit clear(b"SubtensorModule::SubnetLimit"); // Mark Migration as Completed HasMigrationRun::::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 }