Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental RuntimeDebug -> Debug substitutions. #3107

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ pub struct PreDispatchData<AccountId> {
}

/// Type of the call that the extension recognizes.
#[derive(RuntimeDebugNoBound, PartialEq)]
#[derive(Debug, PartialEq)]
pub enum CallInfo {
/// Relay chain finality + parachain finality + message delivery/confirmation calls.
AllFinalityAndMsgs(
Expand Down Expand Up @@ -218,7 +218,7 @@ impl CallInfo {
}

/// The actions on relayer account that need to be performed because of his actions.
#[derive(RuntimeDebug, PartialEq)]
#[derive(Debug, PartialEq)]
pub enum RelayerAccountAction<AccountId, Reward> {
/// Do nothing with relayer account.
None,
Expand Down Expand Up @@ -419,14 +419,7 @@ pub trait RefundSignedExtension:
/// Adapter that allow implementing `sp_runtime::traits::SignedExtension` for any
/// `RefundSignedExtension`.
#[derive(
DefaultNoBound,
CloneNoBound,
Decode,
Encode,
EqNoBound,
PartialEqNoBound,
RuntimeDebugNoBound,
TypeInfo,
DefaultNoBound, CloneNoBound, Decode, Encode, EqNoBound, PartialEqNoBound, Debug, TypeInfo,
)]
pub struct RefundSignedExtensionAdapter<T: RefundSignedExtension>(T);

Expand Down Expand Up @@ -561,14 +554,7 @@ where
///
/// Extension does not refund transaction tip due to security reasons.
#[derive(
DefaultNoBound,
CloneNoBound,
Decode,
Encode,
EqNoBound,
PartialEqNoBound,
RuntimeDebugNoBound,
TypeInfo,
DefaultNoBound, CloneNoBound, Decode, Encode, EqNoBound, PartialEqNoBound, Debug, TypeInfo,
)]
#[scale_info(skip_type_params(Runtime, Para, Msgs, Refund, Priority, Id))]
pub struct RefundBridgedParachainMessages<Runtime, Para, Msgs, Refund, Priority, Id>(
Expand Down Expand Up @@ -723,14 +709,7 @@ where
///
/// Extension does not refund transaction tip due to security reasons.
#[derive(
DefaultNoBound,
CloneNoBound,
Decode,
Encode,
EqNoBound,
PartialEqNoBound,
RuntimeDebugNoBound,
TypeInfo,
DefaultNoBound, CloneNoBound, Decode, Encode, EqNoBound, PartialEqNoBound, Debug, TypeInfo,
)]
#[scale_info(skip_type_params(Runtime, GrandpaInstance, Msgs, Refund, Priority, Id))]
pub struct RefundBridgedGrandpaMessages<Runtime, GrandpaInstance, Msgs, Refund, Priority, Id>(
Expand Down Expand Up @@ -856,14 +835,7 @@ where
/// Transaction extension that refunds a relayer for standalone messages delivery and confirmation
/// transactions. Finality transactions are not refunded.
#[derive(
DefaultNoBound,
CloneNoBound,
Decode,
Encode,
EqNoBound,
PartialEqNoBound,
RuntimeDebugNoBound,
TypeInfo,
DefaultNoBound, CloneNoBound, Decode, Encode, EqNoBound, PartialEqNoBound, Debug, TypeInfo,
)]
#[scale_info(skip_type_params(Runtime, GrandpaInstance, Msgs, Refund, Priority, Id))]
pub struct RefundBridgedMessages<Runtime, Msgs, Refund, Priority, Id>(
Expand Down
10 changes: 5 additions & 5 deletions bridges/bin/runtime-common/src/messages_call_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use sp_runtime::{transaction_validity::TransactionValidity, RuntimeDebug};
use sp_std::ops::RangeInclusive;

/// Generic info about a messages delivery/confirmation proof.
#[derive(PartialEq, RuntimeDebug)]
#[derive(PartialEq, Debug)]
pub struct BaseMessagesProofInfo {
/// Message lane, used by the call.
pub lane_id: LaneId,
Expand All @@ -55,7 +55,7 @@ impl BaseMessagesProofInfo {
}

/// Occupation state of the unrewarded relayers vector.
#[derive(PartialEq, RuntimeDebug)]
#[derive(PartialEq, Debug)]
#[cfg_attr(test, derive(Default))]
pub struct UnrewardedRelayerOccupation {
/// The number of remaining unoccupied entries for new relayers.
Expand All @@ -65,7 +65,7 @@ pub struct UnrewardedRelayerOccupation {
}

/// Info about a `ReceiveMessagesProof` call which tries to update a single lane.
#[derive(PartialEq, RuntimeDebug)]
#[derive(PartialEq, Debug)]
pub struct ReceiveMessagesProofInfo {
/// Base messages proof info
pub base: BaseMessagesProofInfo,
Expand Down Expand Up @@ -105,7 +105,7 @@ impl ReceiveMessagesProofInfo {
}

/// Info about a `ReceiveMessagesDeliveryProof` call which tries to update a single lane.
#[derive(PartialEq, RuntimeDebug)]
#[derive(PartialEq, Debug)]
pub struct ReceiveMessagesDeliveryProofInfo(pub BaseMessagesProofInfo);

impl ReceiveMessagesDeliveryProofInfo {
Expand All @@ -117,7 +117,7 @@ impl ReceiveMessagesDeliveryProofInfo {

/// Info about a `ReceiveMessagesProof` or a `ReceiveMessagesDeliveryProof` call
/// which tries to update a single lane.
#[derive(PartialEq, RuntimeDebug)]
#[derive(PartialEq, Debug)]
pub enum CallInfo {
/// Messages delivery call info.
ReceiveMessagesProof(ReceiveMessagesProofInfo),
Expand Down
2 changes: 1 addition & 1 deletion bridges/chains/chain-bridge-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use frame_support::{
use sp_runtime::RuntimeDebug;

/// BridgeHubKusama parachain.
#[derive(RuntimeDebug)]
#[derive(Debug)]
pub struct BridgeHubKusama;

impl Chain for BridgeHubKusama {
Expand Down
2 changes: 1 addition & 1 deletion bridges/chains/chain-bridge-hub-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use frame_support::dispatch::DispatchClass;
use sp_runtime::RuntimeDebug;

/// BridgeHubPolkadot parachain.
#[derive(RuntimeDebug)]
#[derive(Debug)]
pub struct BridgeHubPolkadot;

impl Chain for BridgeHubPolkadot {
Expand Down
2 changes: 1 addition & 1 deletion bridges/chains/chain-bridge-hub-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use frame_support::dispatch::DispatchClass;
use sp_runtime::{MultiAddress, MultiSigner, RuntimeDebug};

/// BridgeHubRococo parachain.
#[derive(RuntimeDebug)]
#[derive(Debug)]
pub struct BridgeHubRococo;

impl Chain for BridgeHubRococo {
Expand Down
2 changes: 1 addition & 1 deletion bridges/chains/chain-bridge-hub-westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use frame_support::dispatch::DispatchClass;
use sp_runtime::RuntimeDebug;

/// BridgeHubWestend parachain.
#[derive(RuntimeDebug)]
#[derive(Debug)]
pub struct BridgeHubWestend;

impl Chain for BridgeHubWestend {
Expand Down
4 changes: 2 additions & 2 deletions bridges/modules/grandpa/src/call_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use sp_runtime::{
};

/// Info about a `SubmitParachainHeads` call which tries to update a single parachain.
#[derive(Copy, Clone, PartialEq, RuntimeDebug)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub struct SubmitFinalityProofInfo<N> {
/// Number of the finality target.
pub block_number: N,
Expand All @@ -64,7 +64,7 @@ pub struct SubmitFinalityProofInfo<N> {
}

/// Verified `SubmitFinalityProofInfo<N>`.
#[derive(Copy, Clone, PartialEq, RuntimeDebug)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub struct VerifiedSubmitFinalityProofInfo<N> {
/// Base call information.
pub base: SubmitFinalityProofInfo<N>,
Expand Down
2 changes: 1 addition & 1 deletion bridges/modules/grandpa/src/storage_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl<T: Config<I>, I: 'static> Get<u32> for StoredAuthorityListLimit<T, I> {
}

/// A bounded GRANDPA Authority List and ID.
#[derive(CloneNoBound, Decode, Encode, Eq, TypeInfo, MaxEncodedLen, RuntimeDebugNoBound)]
#[derive(CloneNoBound, Decode, Encode, Eq, TypeInfo, MaxEncodedLen, Debug)]
#[scale_info(skip_type_params(T, I))]
pub struct StoredAuthoritySet<T: Config<I>, I: 'static> {
/// List of GRANDPA authorities for the current round.
Expand Down
2 changes: 1 addition & 1 deletion bridges/modules/messages/src/inbound_lane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub trait InboundLaneStorage {
/// these generic bounds all over the code.
///
/// The encoding of this type matches encoding of the corresponding `MessageData`.
#[derive(Encode, Decode, Clone, RuntimeDebug, PartialEq, Eq)]
#[derive(Encode, Decode, Clone, Debug, PartialEq, Eq)]
pub struct StoredInboundLaneData<T: Config<I>, I: 'static>(pub InboundLaneData<T::InboundRelayer>);

impl<T: Config<I>, I: 'static> sp_std::ops::Deref for StoredInboundLaneData<T, I> {
Expand Down
2 changes: 1 addition & 1 deletion bridges/modules/messages/src/outbound_lane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub trait OutboundLaneStorage {
pub type StoredMessagePayload<T, I> = BoundedVec<u8, <T as Config<I>>::MaximalOutboundPayloadSize>;

/// Result of messages receival confirmation.
#[derive(Encode, Decode, RuntimeDebug, PartialEq, Eq, PalletError, TypeInfo)]
#[derive(Encode, Decode, Debug, PartialEq, Eq, PalletError, TypeInfo)]
pub enum ReceptionConfirmationError {
/// Bridged chain is trying to confirm more messages than we have generated. May be a result
/// of invalid bridged chain storage.
Expand Down
4 changes: 2 additions & 2 deletions bridges/modules/parachains/src/call_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use sp_runtime::{
};

/// Info about a `SubmitParachainHeads` call which tries to update a single parachain.
#[derive(PartialEq, RuntimeDebug)]
#[derive(PartialEq, Debug)]
pub struct SubmitParachainHeadsInfo {
/// Number and hash of the finalized relay block that has been used to prove parachain
/// finality.
Expand All @@ -46,7 +46,7 @@ pub struct SubmitParachainHeadsInfo {
}

/// Verified `SubmitParachainHeadsInfo`.
#[derive(PartialEq, RuntimeDebug)]
#[derive(PartialEq, Debug)]
pub struct VerifiedSubmitParachainHeadsInfo {
/// Base call information.
pub base: SubmitParachainHeadsInfo,
Expand Down
4 changes: 2 additions & 2 deletions bridges/primitives/beefy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ pub type BeefyMmrLeafOf<C> = sp_consensus_beefy::mmr::MmrLeaf<
///
/// Provides the initial context that the bridge needs in order to know
/// where to start the sync process from.
#[derive(Encode, Decode, RuntimeDebug, PartialEq, Clone, TypeInfo, Serialize, Deserialize)]
#[derive(Encode, Decode, Debug, PartialEq, Clone, TypeInfo, Serialize, Deserialize)]
pub struct InitializationData<BlockNumber, Hash> {
/// Pallet operating mode.
pub operating_mode: BasicOperatingMode,
Expand All @@ -142,7 +142,7 @@ pub struct InitializationData<BlockNumber, Hash> {
}

/// Basic data, stored by the pallet for every imported commitment.
#[derive(Encode, Decode, RuntimeDebug, PartialEq, TypeInfo)]
#[derive(Encode, Decode, Debug, PartialEq, TypeInfo)]
pub struct ImportedCommitment<BlockNumber, BlockHash, MmrHash> {
/// Block number and hash of the finalized block parent.
pub parent_number_and_hash: (BlockNumber, BlockHash),
Expand Down
4 changes: 2 additions & 2 deletions bridges/primitives/header-chain/src/justification/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ use sp_std::prelude::*;
///
/// 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, RuntimeDebugNoBound)]
#[derive(Encode, Decode, Clone, PartialEq, Eq, TypeInfo, Debug)]
pub struct GrandpaJustification<Header: HeaderT> {
/// The round (voting period) this justification is valid for.
pub round: u64,
Expand Down Expand Up @@ -108,7 +108,7 @@ impl<H: HeaderT> crate::FinalityProof<H::Hash, H::Number> for GrandpaJustificati
}

/// Justification verification error.
#[derive(Eq, RuntimeDebug, PartialEq)]
#[derive(Eq, Debug, PartialEq)]
pub enum Error {
/// Failed to decode justification.
JustificationDecode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type SignedPrecommit<Header> = finality_grandpa::SignedPrecommit<
>;

/// Votes ancestries with useful methods.
#[derive(RuntimeDebug)]
#[derive(Debug)]
pub struct AncestryChain<Header: HeaderT> {
/// We expect all forks in the ancestry chain to be descendants of base.
base: HeaderId<Header::Hash, Header::Number>,
Expand Down Expand Up @@ -134,7 +134,7 @@ impl<Header: HeaderT> AncestryChain<Header> {
}

/// Justification verification error.
#[derive(Eq, RuntimeDebug, PartialEq)]
#[derive(Eq, Debug, PartialEq)]
pub enum Error {
/// Could not convert `AuthorityList` to `VoterSet`.
InvalidAuthorityList,
Expand All @@ -152,7 +152,7 @@ pub enum Error {
}

/// Justification verification error.
#[derive(Eq, RuntimeDebug, PartialEq)]
#[derive(Eq, Debug, PartialEq)]
pub enum PrecommitError {
/// Justification contains redundant votes.
RedundantAuthorityVote,
Expand All @@ -168,7 +168,7 @@ pub enum PrecommitError {
}

/// The context needed for validating GRANDPA finality proofs.
#[derive(RuntimeDebug)]
#[derive(Debug)]
pub struct JustificationVerificationContext {
/// The authority set used to verify the justification.
pub voter_set: VoterSet<AuthorityId>,
Expand Down
6 changes: 3 additions & 3 deletions bridges/primitives/header-chain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub enum HeaderChainError {
///
/// Even though we may store full header, our applications (XCM) only use couple of header
/// fields. Extracting those values makes on-chain storage and PoV smaller, which is good.
#[derive(Clone, Decode, Encode, Eq, MaxEncodedLen, PartialEq, RuntimeDebug, TypeInfo)]
#[derive(Clone, Decode, Encode, Eq, MaxEncodedLen, PartialEq, Debug, TypeInfo)]
pub struct StoredHeaderData<Number, Hash> {
/// Header number.
pub number: Number,
Expand Down Expand Up @@ -96,7 +96,7 @@ pub trait Parameter: Codec + EncodeLike + Clone + Eq + Debug + TypeInfo {}
impl<T> Parameter for T where T: Codec + EncodeLike + Clone + Eq + Debug + TypeInfo {}

/// A GRANDPA Authority List and ID.
#[derive(Default, Encode, Eq, Decode, RuntimeDebug, PartialEq, Clone, TypeInfo)]
#[derive(Default, Encode, Eq, Decode, Debug, PartialEq, Clone, TypeInfo)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct AuthoritySet {
/// List of GRANDPA authorities for the current round.
Expand All @@ -116,7 +116,7 @@ impl AuthoritySet {
///
/// The bridge needs to know where to start its sync from, and this provides that initial context.
#[derive(
Default, Encode, Decode, RuntimeDebug, PartialEq, Eq, Clone, TypeInfo, Serialize, Deserialize,
Default, Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo, Serialize, Deserialize,
)]
pub struct InitializationData<H: HeaderT> {
/// The header from which we should start syncing.
Expand Down
Loading
Loading