From 26dffe1e9a0608f8a77e77efa9c3521454ee6379 Mon Sep 17 00:00:00 2001 From: yjh Date: Tue, 7 Mar 2023 16:59:04 +0800 Subject: [PATCH] remove serde derive for BlockId (#13457) --- primitives/runtime/src/generic/block.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/primitives/runtime/src/generic/block.rs b/primitives/runtime/src/generic/block.rs index 85d0b7ca1fd2d..1df747a16c839 100644 --- a/primitives/runtime/src/generic/block.rs +++ b/primitives/runtime/src/generic/block.rs @@ -33,9 +33,6 @@ use sp_std::prelude::*; /// Something to identify a block. #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug)] -#[cfg_attr(feature = "std", derive(Serialize))] -#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))] -#[cfg_attr(feature = "std", serde(deny_unknown_fields))] pub enum BlockId { /// Identify by block header hash. Hash(Block::Hash), @@ -45,12 +42,12 @@ pub enum BlockId { impl BlockId { /// Create a block ID from a hash. - pub fn hash(hash: Block::Hash) -> Self { + pub const fn hash(hash: Block::Hash) -> Self { BlockId::Hash(hash) } /// Create a block ID from a number. - pub fn number(number: NumberFor) -> Self { + pub const fn number(number: NumberFor) -> Self { BlockId::Number(number) }