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

Commit a851930

Browse files
gavofyorknazar-pc
authored andcommitted
Session key should be settable at genesis even for non-endowed accounts (paritytech#8942)
* Session key should be settable at genesis even for non-endowed accounts * Docs
1 parent 9a80a5f commit a851930

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

frame/session/src/lib.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -442,11 +442,13 @@ decl_storage! {
442442
for (account, val, keys) in config.keys.iter().cloned() {
443443
<Module<T>>::inner_set_keys(&val, keys)
444444
.expect("genesis config must not contain duplicates; qed");
445-
assert!(
446-
frame_system::Pallet::<T>::inc_consumers(&account).is_ok(),
447-
"Account ({:?}) does not exist at genesis to set key. Account not endowed?",
448-
account,
449-
);
445+
if frame_system::Pallet::<T>::inc_consumers(&account).is_err() {
446+
// This will leak a provider reference, however it only happens once (at
447+
// genesis) so it's really not a big deal and we assume that the user wants to
448+
// do this since it's the only way a non-endowed account can contain a session
449+
// key.
450+
frame_system::Pallet::<T>::inc_providers(&account);
451+
}
450452
}
451453

452454
let initial_validators_0 = T::SessionManager::new_session(0)

0 commit comments

Comments
 (0)