diff --git a/runtime/common/src/entities.rs b/runtime/common/src/entities.rs index 9300b95cdc74edfc9b013974251a7f25bb190854..a6224aa17a025008d9cc022f6da92ffb6f8a0151 100644 --- a/runtime/common/src/entities.rs +++ b/runtime/common/src/entities.rs @@ -21,10 +21,45 @@ use scale_info::TypeInfo; #[cfg(feature = "std")] use serde::{Deserialize, Serialize}; +#[macro_export] +macro_rules! declare_session_keys { + {} => { + pub mod opaque { + use super::*; + + impl_opaque_keys! { + pub struct SessionKeys { + pub grandpa: Grandpa, + pub babe: Babe, + pub im_online: ImOnline, + pub authority_discovery: AuthorityDiscovery, + } + } + + #[derive(Clone, codec::Decode, Debug, codec::Encode, Eq, PartialEq)] + pub struct SessionKeysWrapper(pub SessionKeys); + + impl From<SessionKeysWrapper> for SessionKeys { + fn from(keys_wrapper: SessionKeysWrapper) -> SessionKeys { + keys_wrapper.0 + } + } + + impl scale_info::TypeInfo for SessionKeysWrapper { + type Identity = [u8; 128]; + + fn type_info() -> scale_info::Type { + Self::Identity::type_info() + } + } + } + } +} + #[cfg_attr(feature = "std", derive(Deserialize, Serialize))] -#[derive(Clone, Encode, Decode, Default, Eq, PartialEq, RuntimeDebug, TypeInfo)] +#[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, TypeInfo)] pub struct SmithsMembershipMetaData<SessionKeysWrapper> { - pub peer_id: [u8; 32], + pub p2p_endpoint: sp_runtime::RuntimeString, pub session_keys: SessionKeysWrapper, } diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index fa5cd7912c5dd9db7fc3ab8cbcd7499e3ef175f0..88b16d498eddc453784d458938e1a0c3735bb060 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -88,38 +88,3 @@ impl< .map(|idty_value| idty_value.owner_key) } } - -#[macro_export] -macro_rules! declare_session_keys { - {} => { - pub mod opaque { - use super::*; - - impl_opaque_keys! { - pub struct SessionKeys { - pub grandpa: Grandpa, - pub babe: Babe, - pub im_online: ImOnline, - pub authority_discovery: AuthorityDiscovery, - } - } - - #[derive(Clone, codec::Decode, Debug, codec::Encode, Eq, PartialEq)] - pub struct SessionKeysWrapper(pub SessionKeys); - - impl From<SessionKeysWrapper> for SessionKeys { - fn from(keys_wrapper: SessionKeysWrapper) -> SessionKeys { - keys_wrapper.0 - } - } - - impl scale_info::TypeInfo for SessionKeysWrapper { - type Identity = [u8; 128]; - - fn type_info() -> scale_info::Type { - Self::Identity::type_info() - } - } - } - } -}