Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Commit

Permalink
Session key should be settable at genesis even for non-endowed accoun…
Browse files Browse the repository at this point in the history
…ts (paritytech#8942)

* Session key should be settable at genesis even for non-endowed accounts

* Docs
  • Loading branch information
gavofyork authored and nazar-pc committed Aug 8, 2021
1 parent 9a80a5f commit a851930
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions frame/session/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,11 +442,13 @@ decl_storage! {
for (account, val, keys) in config.keys.iter().cloned() {
<Module<T>>::inner_set_keys(&val, keys)
.expect("genesis config must not contain duplicates; qed");
assert!(
frame_system::Pallet::<T>::inc_consumers(&account).is_ok(),
"Account ({:?}) does not exist at genesis to set key. Account not endowed?",
account,
);
if frame_system::Pallet::<T>::inc_consumers(&account).is_err() {
// This will leak a provider reference, however it only happens once (at
// genesis) so it's really not a big deal and we assume that the user wants to
// do this since it's the only way a non-endowed account can contain a session
// key.
frame_system::Pallet::<T>::inc_providers(&account);
}
}

let initial_validators_0 = T::SessionManager::new_session(0)
Expand Down

0 comments on commit a851930

Please sign in to comment.