Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

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

Merged
merged 2 commits into from
May 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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