diff --git a/substrate/core/primitives/src/crypto.rs b/substrate/core/primitives/src/crypto.rs index 6e46793432..93f499b230 100644 --- a/substrate/core/primitives/src/crypto.rs +++ b/substrate/core/primitives/src/crypto.rs @@ -898,7 +898,6 @@ pub mod key_types { /// Key type for ImOnline module, built-in. pub const IM_ONLINE: KeyTypeId = KeyTypeId(*b"imon"); /// A key type ID useful for tests. - #[cfg(feature = "std")] pub const DUMMY: KeyTypeId = KeyTypeId(*b"dumy"); } diff --git a/substrate/srml/session/src/lib.rs b/substrate/srml/session/src/lib.rs index 7f66673483..42324d387f 100644 --- a/substrate/srml/session/src/lib.rs +++ b/substrate/srml/session/src/lib.rs @@ -259,7 +259,7 @@ pub trait OneSessionHandler: BoundToRuntimeAppPublic { fn on_disabled(_validator_index: usize); } -#[impl_trait_for_tuples::impl_for_tuples(30)] +#[impl_trait_for_tuples::impl_for_tuples(1, 30)] #[tuple_types_no_default_trait_bound] impl SessionHandler for Tuple { for_tuples!( where #( Tuple: OneSessionHandler )* ); @@ -307,6 +307,20 @@ impl SessionHandler for Tuple { } } +/// `SessionHandler` for tests that use `UintAuthorityId` as `Keys`. +pub struct TestSessionHandler; +impl SessionHandler for TestSessionHandler { + const KEY_TYPE_IDS: &'static [KeyTypeId] = &[sr_primitives::key_types::DUMMY]; + + fn on_genesis_session(_: &[(AId, Ks)]) {} + + fn on_new_session(_: bool, _: &[(AId, Ks)], _: &[(AId, Ks)]) {} + + fn on_before_session_ending() {} + + fn on_disabled(_: usize) {} +} + /// Handler for selecting the genesis validator set. pub trait SelectInitialValidators { /// Returns the initial validator set. If `None` is returned