From c5f24cb7613050ed2742dc365028c0e6a014fc50 Mon Sep 17 00:00:00 2001 From: Serban Iorga Date: Mon, 10 Jul 2023 15:31:48 +0300 Subject: [PATCH] Implement RuntimeDebug for GrandpaJustification (#2254) --- .../header-chain/src/justification.rs | 23 ++----------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/bridges/primitives/header-chain/src/justification.rs b/bridges/primitives/header-chain/src/justification.rs index 8433107fce20..a8f514825312 100644 --- a/bridges/primitives/header-chain/src/justification.rs +++ b/bridges/primitives/header-chain/src/justification.rs @@ -24,7 +24,7 @@ use crate::ChainWithGrandpa; use bp_runtime::{BlockNumberOf, Chain, HashOf}; use codec::{Decode, Encode, MaxEncodedLen}; use finality_grandpa::voter_set::VoterSet; -use frame_support::RuntimeDebug; +use frame_support::{RuntimeDebug, RuntimeDebugNoBound}; use scale_info::TypeInfo; use sp_consensus_grandpa::{AuthorityId, AuthoritySignature, SetId}; use sp_runtime::{traits::Header as HeaderT, SaturatedConversion}; @@ -38,7 +38,7 @@ use sp_std::{ /// /// This particular proof is used to prove that headers on a bridged chain /// (so not our chain) have been finalized correctly. -#[derive(Encode, Decode, Clone, PartialEq, Eq, TypeInfo)] +#[derive(Encode, Decode, Clone, PartialEq, Eq, TypeInfo, RuntimeDebugNoBound)] pub struct GrandpaJustification { /// The round (voting period) this justification is valid for. pub round: u64, @@ -49,25 +49,6 @@ pub struct GrandpaJustification { pub votes_ancestries: Vec
, } -// TODO: remove and use `RuntimeDebug` (https://github.com/paritytech/parity-bridges-common/issues/2136) -impl sp_std::fmt::Debug for GrandpaJustification
{ - fn fmt(&self, fmt: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { - #[cfg(feature = "std")] - { - fmt.debug_struct("GrandpaJustification") - .field("round", &self.round) - .field("commit", &self.commit) - .field("votes_ancestries", &self.votes_ancestries) - .finish() - } - - #[cfg(not(feature = "std"))] - { - fmt.write_str("") - } - } -} - impl GrandpaJustification { /// Returns reasonable size of justification using constants from the provided chain. ///