mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 09:21:05 +00:00
Remove footgun around session keys/handlers (#3949)
* Remove footgun around session keys/handlers - `OpaqueKeys` now has an associated type `KeyTypeIdProviders`. This can be used in the runtime as input for `SessionHandler` from the session trait. - `impl_opaque_keys` now works with modules and extracts the `KeyTypeId` from the module directly. - Added some checks to the `session` storage initialization that checks that the `SessionHandler` and `Keys` use the same number of keys and that the order is equal. * Update core/sr-primitives/src/traits.rs
This commit is contained in:
@@ -117,10 +117,10 @@ impl app_crypto::RuntimeAppPublic for UintAuthorityId {
|
||||
}
|
||||
|
||||
impl OpaqueKeys for UintAuthorityId {
|
||||
type KeyTypeIds = std::iter::Cloned<std::slice::Iter<'static, KeyTypeId>>;
|
||||
type KeyTypeIdProviders = ();
|
||||
|
||||
fn key_ids() -> Self::KeyTypeIds {
|
||||
[key_types::DUMMY].iter().cloned()
|
||||
fn key_ids() -> &'static [KeyTypeId] {
|
||||
&[key_types::DUMMY]
|
||||
}
|
||||
|
||||
fn get_raw(&self, _: KeyTypeId) -> &[u8] {
|
||||
@@ -132,6 +132,10 @@ impl OpaqueKeys for UintAuthorityId {
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::BoundToRuntimeAppPublic for UintAuthorityId {
|
||||
type Public = Self;
|
||||
}
|
||||
|
||||
/// Digest item
|
||||
pub type DigestItem = generic::DigestItem<H256>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user