mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 07:41:08 +00:00
Provide simple TestSessionHandler that works with UintAuthorityId (#3962)
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
@@ -259,7 +259,7 @@ pub trait OneSessionHandler<ValidatorId>: 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<AId> SessionHandler<AId> for Tuple {
|
||||
for_tuples!( where #( Tuple: OneSessionHandler<AId> )* );
|
||||
@@ -307,6 +307,20 @@ impl<AId> SessionHandler<AId> for Tuple {
|
||||
}
|
||||
}
|
||||
|
||||
/// `SessionHandler` for tests that use `UintAuthorityId` as `Keys`.
|
||||
pub struct TestSessionHandler;
|
||||
impl<AId> SessionHandler<AId> for TestSessionHandler {
|
||||
const KEY_TYPE_IDS: &'static [KeyTypeId] = &[sr_primitives::key_types::DUMMY];
|
||||
|
||||
fn on_genesis_session<Ks: OpaqueKeys>(_: &[(AId, Ks)]) {}
|
||||
|
||||
fn on_new_session<Ks: OpaqueKeys>(_: bool, _: &[(AId, Ks)], _: &[(AId, Ks)]) {}
|
||||
|
||||
fn on_before_session_ending() {}
|
||||
|
||||
fn on_disabled(_: usize) {}
|
||||
}
|
||||
|
||||
/// Handler for selecting the genesis validator set.
|
||||
pub trait SelectInitialValidators<ValidatorId> {
|
||||
/// Returns the initial validator set. If `None` is returned
|
||||
|
||||
Reference in New Issue
Block a user