diff --git a/Cargo.lock b/Cargo.lock index 4b5bb405..5c055b5a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -84,7 +84,7 @@ dependencies = [ [[package]] name = "alphanet-runtime" -version = "1.2.5" +version = "1.2.6" dependencies = [ "alphanet-runtime-constants", "frame-benchmarking", @@ -3663,7 +3663,7 @@ dependencies = [ [[package]] name = "mainnet-runtime" -version = "1.2.5" +version = "1.2.6" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -8416,7 +8416,7 @@ dependencies = [ [[package]] name = "ternoa-runtime-common" -version = "1.2.5" +version = "1.2.6" dependencies = [ "frame-election-provider-support", "frame-support", diff --git a/runtime/alphanet/Cargo.toml b/runtime/alphanet/Cargo.toml index 9b658657..b75514ca 100644 --- a/runtime/alphanet/Cargo.toml +++ b/runtime/alphanet/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "alphanet-runtime" authors = [ "Ternoa" ] -version = "1.2.5" +version = "1.2.6" edition = "2021" build = "build.rs" diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 6a606670..3a064bca 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "ternoa-runtime-common" authors = [ "Ternoa" ] -version = "1.2.5" +version = "1.2.6" edition = "2021" [dependencies] diff --git a/runtime/mainnet/Cargo.toml b/runtime/mainnet/Cargo.toml index dcfcc2f3..8b68843a 100644 --- a/runtime/mainnet/Cargo.toml +++ b/runtime/mainnet/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "mainnet-runtime" authors = [ "Ternoa" ] -version = "1.2.5" +version = "1.2.6" edition = "2021" build = "build.rs" diff --git a/runtime/mainnet/src/lib.rs b/runtime/mainnet/src/lib.rs index 3b6d9df0..2f11cf08 100644 --- a/runtime/mainnet/src/lib.rs +++ b/runtime/mainnet/src/lib.rs @@ -187,7 +187,7 @@ mod custom_migration { use super::*; use frame_election_provider_support::SortedListProvider; use frame_support::{traits::OnRuntimeUpgrade, weights::Weight}; - use pallet_staking::{Nominators, Pallet}; + use pallet_staking::{Pallet, Validators}; pub struct Upgrade; impl OnRuntimeUpgrade for Upgrade { @@ -198,9 +198,21 @@ mod custom_migration { } fn on_runtime_upgrade() -> Weight { - ::VoterList::unsafe_regenerate( - Nominators::::iter().map(|(id, _)| id), - Pallet::::weight_of_fn(), + let prev_count = ::VoterList::count(); + let weight_of_cached = Pallet::::weight_of_fn(); + for (v, _) in Validators::::iter() { + let weight = weight_of_cached(&v); + let _ = + ::VoterList::on_insert(v.clone(), weight) + .map_err(|err| { + log::info!("failed to insert {:?} into VoterList: {:?}", v, err); + }); + } + log::info!( + "injected a total of {} new voters, prev count: {} next count: {}, updating.", + Validators::::count(), + prev_count, + ::VoterList::count(), ); debug_assert_eq!(::VoterList::try_state(), Ok(())); Weight::MAX diff --git a/runtime/mainnet/src/version.rs b/runtime/mainnet/src/version.rs index 30565872..d1460ca7 100644 --- a/runtime/mainnet/src/version.rs +++ b/runtime/mainnet/src/version.rs @@ -44,7 +44,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { /// Version of the runtime specification. A full-node will not attempt to use its native /// runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, /// `spec_version` and `authoring_version` are the same between Wasm and native. - spec_version: 12, + spec_version: 13, /// Version of the implementation of the specification. Nodes are free to ignore this; it /// serves only as an indication that the code is different; as long as the other two versions