Skip to content
Snippets Groups Projects
Commit 9d8c2e3f authored by Éloïs's avatar Éloïs
Browse files

feat(smith-membership):metadata: replace peer id by p2p endpoint

parent 053902ba
No related branches found
No related tags found
No related merge requests found
......@@ -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,
}
......
......@@ -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()
}
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment