diff --git a/Makefile b/Makefile index 4ece5732..616d3c38 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,12 @@ try-runtime-upgrade-testnet: try-runtime-upgrade-mainnet: cargo build --release --features try-runtime - RUST_BACKTRACE=1; RUST_LOG="${RUST_LOG}"; try-runtime --runtime target/release/wbuild/node-subspace-runtime/node_subspace_runtime.compact.compressed.wasm on-runtime-upgrade --blocktime 8000 live --uri wss://mainnet.api.communeai.net:443 + RUST_BACKTRACE=1; RUST_LOG="${RUST_LOG}"; try-runtime --runtime target/release/wbuild/node-subspace-runtime/node_subspace_runtime.compact.compressed.wasm on-runtime-upgrade --blocktime 8000 live --uri wss://api.communeai.net:443 + +try-runtime-upgrade-devnet: + cargo build --release --features try-runtime + RUST_BACKTRACE=1; RUST_LOG="${RUST_LOG}"; try-runtime --runtime target/release/wbuild/node-subspace-runtime/node_subspace_runtime.compact.compressed.wasm on-runtime-upgrade --blocktime 8000 live --uri wss://devnet-commune-api-node-0.communeai.net:443 + run-benchmarking: cargo build -r --features runtime-benchmarks diff --git a/pallets/subnet_emission/src/migrations.rs b/pallets/subnet_emission/src/migrations.rs index 62c5188c..55224bdf 100644 --- a/pallets/subnet_emission/src/migrations.rs +++ b/pallets/subnet_emission/src/migrations.rs @@ -4,43 +4,7 @@ use frame_support::{ traits::{OnRuntimeUpgrade, StorageVersion}, }; -// pub mod v1 { -// use super::*; - -// pub struct MigrateToV1(sp_std::marker::PhantomData); - -// impl OnRuntimeUpgrade for MigrateToV1 { -// fn on_runtime_upgrade() -> frame_support::weights::Weight { -// let on_chain_version = StorageVersion::get::>(); -// if on_chain_version != 0 { -// log::info!("Storage v1 already updated"); -// return Weight::zero(); -// } - -// StorageVersion::new(1).put::>(); - -// pallet_subspace::migrations::v15::old_storage::Weights::::iter().for_each( -// |(netuid, uid, values)| { -// log::info!("migrating weights for netuid: {}, uid: {}", netuid, uid); -// Weights::::insert(netuid, uid, values); -// }, -// ); - -// // Just for clarity, (although not explicitly needed) -// let _ = -// pallet_subspace::migrations::v15::old_storage::Weights::::clear(u32::MAX, -// None); - -// log::info!("Migrated to v1"); - -// Weight::zero() -// } -// } -// } - pub mod v1 { - use core::u32; - use super::*; pub struct MigrateToV1(sp_std::marker::PhantomData); @@ -48,17 +12,24 @@ pub mod v1 { impl OnRuntimeUpgrade for MigrateToV1 { fn on_runtime_upgrade() -> frame_support::weights::Weight { let on_chain_version = StorageVersion::get::>(); - if on_chain_version != 15 { + if on_chain_version != 0 { log::info!("Storage v1 already updated"); return Weight::zero(); } - StorageVersion::new(16).put::>(); + StorageVersion::new(1).put::>(); - let _ = BannedDecryptionNodes::::clear(u32::MAX, None); - let _ = DecryptionNodeBanQueue::::clear(u32::MAX, None); + pallet_subspace::migrations::v15::old_storage::Weights::::iter().for_each( + |(netuid, uid, values)| { + log::info!("migrating weights for netuid: {}, uid: {}", netuid, uid); + Weights::::insert(netuid, uid, values); + }, + ); // Just for clarity, (although not explicitly needed) + let _ = + pallet_subspace::migrations::v15::old_storage::Weights::::clear(u32::MAX, None); + log::info!("Migrated to v1"); Weight::zero()