Session keys buffered for a session. (#2946)

* Session keys buffered for the duration of a session.

* Add queued_keys getter.

* Make sure genesis state is consistent.

* Add validator_count validators.

* Compensate for session delay.

* Remove unused code.

* Add num_validators option.

* Fix session numbers.

* Fix merge.

* Reintroduce changed.

* Update runtime.

* Make NextKeyFor private.

* Move block initialization to function.

* Update lib.rs

* Add test for change propagation.

* Fix docstring.

* Use get instead of take.

* Initialize validators from keys.

* Next try.

* Fix build.

* Fix warning.

* Make initial validator selection more transparent.

* Make storage items private.

* Reorder genesis initialization.

* Update Cargo.lock

* Update runtime version.

* Update runtime version.

* Update Cargo.lock

* Update runtime version.

* Add docs.
This commit is contained in:
David Craven
2019-07-04 12:40:10 +02:00
committed by GitHub
parent fe08221479
commit 336053f7ae
8 changed files with 264 additions and 141 deletions
-2
View File
@@ -112,7 +112,6 @@ fn staging_testnet_config_genesis() -> GenesisConfig {
.collect::<Vec<_>>(),
}),
session: Some(SessionConfig {
validators: initial_authorities.iter().map(|x| x.1.clone()).collect(),
keys: initial_authorities.iter().map(|x| (x.1.clone(), SessionKeys(x.2.clone(),x.2.clone()))).collect::<Vec<_>>(),
}),
staking: Some(StakingConfig {
@@ -240,7 +239,6 @@ pub fn testnet_genesis(
vesting: vec![],
}),
session: Some(SessionConfig {
validators: initial_authorities.iter().map(|x| x.1.clone()).collect(),
keys: initial_authorities.iter().map(|x| (x.1.clone(), SessionKeys(x.2.clone(), x.2.clone()))).collect::<Vec<_>>(),
}),
staking: Some(StakingConfig {
-2
View File
@@ -294,7 +294,6 @@ mod tests {
}
fn new_test_ext(code: &[u8], support_changes_trie: bool) -> TestExternalities<Blake2Hasher> {
let three = AccountId::from_raw([3u8; 32]);
let mut ext = TestExternalities::new_with_code(code, GenesisConfig {
aura: Some(Default::default()),
system: Some(SystemConfig {
@@ -319,7 +318,6 @@ mod tests {
vesting: vec![],
}),
session: Some(SessionConfig {
validators: vec![AccountKeyring::One.into(), AccountKeyring::Two.into(), three],
keys: vec![
(alice(), to_session_keys(&AuthorityKeyring::Alice)),
(bob(), to_session_keys(&AuthorityKeyring::Bob)),
+3 -2
View File
@@ -71,8 +71,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// and set impl_version to equal spec_version. If only runtime
// implementation changes and behavior does not, then leave spec_version as
// is and increment impl_version.
spec_version: 103,
impl_version: 103,
spec_version: 104,
impl_version: 104,
apis: RUNTIME_API_VERSIONS,
};
@@ -197,6 +197,7 @@ impl session::Trait for Runtime {
type ShouldEndSession = session::PeriodicSessions<Period, Offset>;
type Event = Event;
type Keys = SessionKeys;
type SelectInitialValidators = Staking;
}
parameter_types! {