diff --git a/Cargo.lock b/Cargo.lock index f341246ed..533b3d9b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11663,6 +11663,7 @@ dependencies = [ "nimbus-primitives", "parity-scale-codec", "scale-info", + "serde", "sp-application-crypto", "sp-consensus-aura", "sp-core", diff --git a/primitives/session-keys/Cargo.toml b/primitives/session-keys/Cargo.toml index 13db2a982..6d8d47192 100644 --- a/primitives/session-keys/Cargo.toml +++ b/primitives/session-keys/Cargo.toml @@ -12,6 +12,7 @@ manta-primitives = { path = "../manta", default-features = false } nimbus-primitives = { git = "https://github.com/manta-network/nimbus.git", tag = "v4.0.8", default-features = false } parity-scale-codec = { version = "3.4.0", default-features = false, features = ["derive"] } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } +serde = { version = "1.0.140", features = ['derive'], optional = true } sp-application-crypto = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.37", default-features = false } sp-consensus-aura = { git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v0.9.37" } sp-core = { git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v0.9.37" } @@ -26,6 +27,7 @@ std = [ "nimbus-primitives/std", "parity-scale-codec/std", "scale-info/std", + "serde", "sp-application-crypto/std", "sp-consensus-aura/std", "sp-core/std", diff --git a/primitives/session-keys/src/vrf.rs b/primitives/session-keys/src/vrf.rs index 278e5dd24..46bd95b0b 100644 --- a/primitives/session-keys/src/vrf.rs +++ b/primitives/session-keys/src/vrf.rs @@ -20,6 +20,7 @@ use sp_application_crypto::KeyTypeId; use sp_runtime::{BoundToRuntimeAppPublic, ConsensusEngineId}; /// Implementation of [`BoundToRuntimeAppPublic`] with the public key set to [`VrfId`] +#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct VrfSessionKey; diff --git a/runtime/calamari/src/nimbus_session_adapter.rs b/runtime/calamari/src/nimbus_session_adapter.rs index 0d7fb0f3a..ccaa6089b 100644 --- a/runtime/calamari/src/nimbus_session_adapter.rs +++ b/runtime/calamari/src/nimbus_session_adapter.rs @@ -51,6 +51,7 @@ impl OneSessionHandler for AuthorInherentWithNoOpSessio /// This adapts VrfSessionKey to be compatible with pallet session /// making it suitable as a SessionKey entry +#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] pub struct VrfWithNoOpSession(pub VrfSessionKey); impl BoundToRuntimeAppPublic for VrfWithNoOpSession { diff --git a/runtime/manta/src/nimbus_session_adapter.rs b/runtime/manta/src/nimbus_session_adapter.rs index 0d7fb0f3a..ccaa6089b 100644 --- a/runtime/manta/src/nimbus_session_adapter.rs +++ b/runtime/manta/src/nimbus_session_adapter.rs @@ -51,6 +51,7 @@ impl OneSessionHandler for AuthorInherentWithNoOpSessio /// This adapts VrfSessionKey to be compatible with pallet session /// making it suitable as a SessionKey entry +#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] pub struct VrfWithNoOpSession(pub VrfSessionKey); impl BoundToRuntimeAppPublic for VrfWithNoOpSession {