diff --git a/pallets/subtensor/src/macros/hooks.rs b/pallets/subtensor/src/macros/hooks.rs index 22c741465..f2556d506 100644 --- a/pallets/subtensor/src/macros/hooks.rs +++ b/pallets/subtensor/src/macros/hooks.rs @@ -68,7 +68,9 @@ mod hooks { .saturating_add(migrations::migrate_populate_staking_hotkeys::migrate_populate_staking_hotkeys::()) // Fix total coldkey stake. // Storage version v8 -> v9 - .saturating_add(migrations::migrate_fix_total_coldkey_stake::migrate_fix_total_coldkey_stake::()); + .saturating_add(migrations::migrate_fix_total_coldkey_stake::migrate_fix_total_coldkey_stake::()) + // Migrate Delegate Ids on chain + .saturating_add(migrations::migrate_chain_identity::migrate_set_hotkey_identities::()); weight } diff --git a/pallets/subtensor/src/migrations/migrate_chain_identity.rs b/pallets/subtensor/src/migrations/migrate_chain_identity.rs index efb656cb3..06ee5dd3f 100644 --- a/pallets/subtensor/src/migrations/migrate_chain_identity.rs +++ b/pallets/subtensor/src/migrations/migrate_chain_identity.rs @@ -31,7 +31,7 @@ fn string_to_bounded_vec(input: &str) -> Result>, } pub fn migrate_set_hotkey_identities() -> Weight { - let migration_name = b"fix_total_coldkey_stake_v7".to_vec(); + let migration_name = b"migrate_identities".to_vec(); // Initialize the weight with one read operation. let mut weight = T::DbWeight::get().reads(1); @@ -140,17 +140,22 @@ pub fn migrate_set_hotkey_identities() -> Weight { && identity.description.len() <= 1024 && identity.additional.len() <= 1024; if !is_valid { + log::info!("Bytes not correct"); continue; } // Get the owning coldkey. let coldkey = Owner::::get(decoded_hotkey.clone()); + log::info!("ColdKey: {:?}", decoded_hotkey); + weight = weight.saturating_add(T::DbWeight::get().reads(1)); // Sink into the map. Identities::::insert(coldkey.clone(), identity.clone()); weight = weight.saturating_add(T::DbWeight::get().writes(1)); } + } else { + log::info!("Failed to decode JSON"); } // Mark the migration as completed HasMigrationRun::::insert(&migration_name, true);