mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 08:41:02 +00:00
Implement RuntimeDebug for GrandpaJustification (#2254)
This commit is contained in:
committed by
Bastian Köcher
parent
f6d374b69a
commit
c5f24cb761
@@ -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<Header: HeaderT> {
|
||||
/// The round (voting period) this justification is valid for.
|
||||
pub round: u64,
|
||||
@@ -49,25 +49,6 @@ pub struct GrandpaJustification<Header: HeaderT> {
|
||||
pub votes_ancestries: Vec<Header>,
|
||||
}
|
||||
|
||||
// TODO: remove and use `RuntimeDebug` (https://github.com/paritytech/parity-bridges-common/issues/2136)
|
||||
impl<Header: HeaderT> sp_std::fmt::Debug for GrandpaJustification<Header> {
|
||||
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("<stripped>")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<H: HeaderT> GrandpaJustification<H> {
|
||||
/// Returns reasonable size of justification using constants from the provided chain.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user