mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 15:51:12 +00:00
Check that validator set is not empty at genesis (#3083)
* Check that the returned validator set is not empty * Move assert to session module * Clean up
This commit is contained in:
committed by
Gavin Wood
parent
df93867620
commit
0366f7b35c
@@ -411,8 +411,8 @@ construct_runtime!(
|
|||||||
Authorship: authorship::{Module, Call, Storage},
|
Authorship: authorship::{Module, Call, Storage},
|
||||||
Indices: indices,
|
Indices: indices,
|
||||||
Balances: balances,
|
Balances: balances,
|
||||||
Session: session::{Module, Call, Storage, Event, Config<T>},
|
|
||||||
Staking: staking::{default, OfflineWorker},
|
Staking: staking::{default, OfflineWorker},
|
||||||
|
Session: session::{Module, Call, Storage, Event, Config<T>},
|
||||||
Democracy: democracy::{Module, Call, Storage, Config, Event<T>},
|
Democracy: democracy::{Module, Call, Storage, Config, Event<T>},
|
||||||
Council: collective::<Instance1>::{Module, Call, Storage, Origin<T>, Event<T>, Config<T>},
|
Council: collective::<Instance1>::{Module, Call, Storage, Origin<T>, Event<T>, Config<T>},
|
||||||
TechnicalCommittee: collective::<Instance2>::{Module, Call, Storage, Origin<T>, Event<T>, Config<T>},
|
TechnicalCommittee: collective::<Instance2>::{Module, Call, Storage, Origin<T>, Event<T>, Config<T>},
|
||||||
|
|||||||
@@ -316,6 +316,8 @@ decl_storage! {
|
|||||||
let initial_validators = T::SelectInitialValidators::select_initial_validators()
|
let initial_validators = T::SelectInitialValidators::select_initial_validators()
|
||||||
.unwrap_or_else(|| config.keys.iter().map(|(ref v, _)| v.clone()).collect());
|
.unwrap_or_else(|| config.keys.iter().map(|(ref v, _)| v.clone()).collect());
|
||||||
|
|
||||||
|
assert!(!initial_validators.is_empty(), "Empty validator set in genesis block!");
|
||||||
|
|
||||||
let queued_keys: Vec<_> = initial_validators
|
let queued_keys: Vec<_> = initial_validators
|
||||||
.iter()
|
.iter()
|
||||||
.cloned()
|
.cloned()
|
||||||
|
|||||||
@@ -599,7 +599,10 @@ decl_storage! {
|
|||||||
| {
|
| {
|
||||||
with_storage(storage, || {
|
with_storage(storage, || {
|
||||||
for &(ref stash, ref controller, balance, ref status) in &config.stakers {
|
for &(ref stash, ref controller, balance, ref status) in &config.stakers {
|
||||||
assert!(T::Currency::free_balance(&stash) >= balance);
|
assert!(
|
||||||
|
T::Currency::free_balance(&stash) >= balance,
|
||||||
|
"Stash does not have enough balance to bond."
|
||||||
|
);
|
||||||
let _ = <Module<T>>::bond(
|
let _ = <Module<T>>::bond(
|
||||||
T::Origin::from(Some(stash.clone()).into()),
|
T::Origin::from(Some(stash.clone()).into()),
|
||||||
T::Lookup::unlookup(controller.clone()),
|
T::Lookup::unlookup(controller.clone()),
|
||||||
|
|||||||
Reference in New Issue
Block a user