-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Chain behavior with less than minimum validator candidates #2494
Comments
Not sure if this is related. |
Based on this looks like it is related but it is the expected behavior. 3 candidates (assuming all have enough balance). 4 minimum. Nothing will happen. Correct? Though I am pretty sure even upon the resolve of this issue your scenario will not change. The chain will probably not do anything if your candidates are less than the minimum. |
Should we allow invalid chain specs? Why don't we do this instead? diff --git a/srml/staking/src/lib.rs b/srml/staking/src/lib.rs
index c1b42a8b..4a4b0ce0 100644
--- a/srml/staking/src/lib.rs
+++ b/srml/staking/src/lib.rs
@@ -275,8 +275,8 @@ use runtime_io::with_storage;
use rstd::{prelude::*, result, collections::btree_map::BTreeMap};
use parity_codec::{HasCompact, Encode, Decode};
use srml_support::{
- StorageValue, StorageMap, EnumerableStorageMap, decl_module, decl_event,
- decl_storage, ensure, traits::{
+ StorageValue, StorageMap, EnumerableStorageMap, assert_eq_uvec, decl_module,
+ decl_event, decl_storage, ensure, traits::{
Currency, OnFreeBalanceZero, OnDilution, LockIdentifier, LockableCurrency,
WithdrawReasons, OnUnbalanced, Imbalance, Get
}
@@ -585,9 +585,11 @@ decl_storage! {
};
}
- if let (_, Some(validators)) = <Module<T>>::select_validators() {
- <session::Validators<T>>::put(&validators);
- }
+ // Make sure the genesis state of the session module is consistent
+ // with the genesis state of the staking module.
+ let validators = <Module<T>>::select_validators().1
+ .expect("Genesis state of the staking module is valid.");
+ assert_eq_uvec!(validators, <session::Validators<T>>::get());
});
});
} |
We could maybe degrade to some "staking and governance only" chain state. It'd make moving staking and governance off the relay chain "interesting". :( |
as discussed offline it seems a good solution would be to not create a new era until there is a successful election of more than the minimum number of validator. |
It makes election censorship more risky, but that's likely better than our alternatives. |
Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions. |
The emergency phase is implemented, in the emergency phase the configured trusted origin (proportion of collective or root in kusama) can push the solution.
|
Yeah, this can be closed now. |
When this happens
candidates.len() < <MinimumValidators<T>>
,here should be an approach to make sure:
substrate/srml/staking/src/lib.rs
Lines 1028 to 1036 in f481c71
(not certain which milestone is this worth to be placed in)
The text was updated successfully, but these errors were encountered: