diff --git a/frame/session/src/lib.rs b/frame/session/src/lib.rs index cbe70598a91b3..8574979ef2fea 100644 --- a/frame/session/src/lib.rs +++ b/frame/session/src/lib.rs @@ -442,11 +442,13 @@ decl_storage! { for (account, val, keys) in config.keys.iter().cloned() { >::inner_set_keys(&val, keys) .expect("genesis config must not contain duplicates; qed"); - assert!( - frame_system::Pallet::::inc_consumers(&account).is_ok(), - "Account ({:?}) does not exist at genesis to set key. Account not endowed?", - account, - ); + if frame_system::Pallet::::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::::inc_providers(&account); + } } let initial_validators_0 = T::SessionManager::new_session(0)