Skip to content

Commit

Permalink
Also change derive attributes of enums
Browse files Browse the repository at this point in the history
  • Loading branch information
hirschenberger committed Apr 29, 2024
1 parent b466976 commit 39b0d19
Show file tree
Hide file tree
Showing 103 changed files with 187 additions and 259 deletions.
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
2 changes: 1 addition & 1 deletion bridges/bin/runtime-common/src/messages_call_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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/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
2 changes: 1 addition & 1 deletion bridges/primitives/header-chain/src/justification/mod.rs
Original file line number Diff line number Diff line change
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 @@ -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 Down
6 changes: 3 additions & 3 deletions bridges/primitives/messages/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ where
Copy,
PartialEq,
Eq,
RuntimeDebug,
Debug,
TypeInfo,
MaxEncodedLen,
Serialize,
Expand Down Expand Up @@ -308,7 +308,7 @@ impl<DispatchLevelResult> ReceivedMessages<DispatchLevelResult> {
}

/// Result of single message receival.
#[derive(RuntimeDebug, Encode, Decode, PartialEq, Eq, Clone, TypeInfo)]
#[derive(Debug, Encode, Decode, PartialEq, Eq, Clone, TypeInfo)]
pub enum ReceptionResult<DispatchLevelResult> {
/// Message has been received and dispatched. Note that we don't care whether dispatch has
/// been successful or not - in both case message falls into this category.
Expand Down Expand Up @@ -474,7 +474,7 @@ pub enum BridgeMessagesCall<AccountId, MessagesProof, MessagesDeliveryProof> {
}

/// Error that happens during message verification.
#[derive(Encode, Decode, RuntimeDebug, PartialEq, Eq, PalletError, TypeInfo)]
#[derive(Encode, Decode, Debug, PartialEq, Eq, PalletError, TypeInfo)]
pub enum VerificationError {
/// The message proof is empty.
EmptyMessageProof,
Expand Down
4 changes: 2 additions & 2 deletions bridges/primitives/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ impl Size for PreComputedSize {
}

/// Era of specific transaction.
#[derive(RuntimeDebug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum TransactionEra<BlockNumber, BlockHash> {
/// Transaction is immortal.
Immortal,
Expand Down Expand Up @@ -333,7 +333,7 @@ pub trait OperatingMode: Send + Copy + Debug + FullCodec {
Copy,
PartialEq,
Eq,
RuntimeDebug,
Debug,
TypeInfo,
MaxEncodedLen,
Serialize,
Expand Down
2 changes: 1 addition & 1 deletion bridges/snowbridge/pallets/system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ where
}

/// Whether a fee should be withdrawn to an account for sending an outbound message
#[derive(Clone, PartialEq, RuntimeDebug)]
#[derive(Clone, PartialEq, Debug)]
pub enum PaysFee<T>
where
T: Config,
Expand Down
2 changes: 1 addition & 1 deletion bridges/snowbridge/primitives/beacon/src/bls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use sp_core::H256;
use sp_runtime::RuntimeDebug;
use sp_std::prelude::*;

#[derive(Copy, Clone, Encode, Decode, Eq, PartialEq, TypeInfo, RuntimeDebug, PalletError)]
#[derive(Copy, Clone, Encode, Decode, Eq, PartialEq, TypeInfo, Debug, PalletError)]
pub enum BlsError {
InvalidSignature,
InvalidPublicKey,
Expand Down
4 changes: 2 additions & 2 deletions bridges/snowbridge/primitives/beacon/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ pub struct CompactBeaconState {
}

/// VersionedExecutionPayloadHeader
#[derive(Encode, Decode, CloneNoBound, PartialEqNoBound, RuntimeDebugNoBound, TypeInfo)]
#[derive(Encode, Decode, CloneNoBound, PartialEqNoBound, Debug, TypeInfo)]
#[cfg_attr(
feature = "std",
derive(Serialize, Deserialize),
Expand Down Expand Up @@ -545,7 +545,7 @@ mod tests {
}

/// Operating modes for beacon client
#[derive(Encode, Decode, Copy, Clone, PartialEq, RuntimeDebug, TypeInfo)]
#[derive(Encode, Decode, Copy, Clone, PartialEq, Debug, TypeInfo)]
pub enum Mode {
Active,
Blocked,
Expand Down
4 changes: 2 additions & 2 deletions bridges/snowbridge/primitives/core/src/inbound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub trait Verifier {
fn verify(event: &Log, proof: &Proof) -> Result<(), VerificationError>;
}

#[derive(Clone, Encode, Decode, RuntimeDebug, PalletError, TypeInfo)]
#[derive(Clone, Encode, Decode, Debug, PalletError, TypeInfo)]
#[cfg_attr(feature = "std", derive(PartialEq))]
pub enum VerificationError {
/// Execution header is missing
Expand Down Expand Up @@ -43,7 +43,7 @@ pub struct Message {

const MAX_TOPICS: usize = 4;

#[derive(Clone, RuntimeDebug)]
#[derive(Clone, Debug)]
pub enum LogValidationError {
TooManyTopics,
}
Expand Down
2 changes: 1 addition & 1 deletion bridges/snowbridge/primitives/core/src/operating_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use scale_info::TypeInfo;
use sp_runtime::RuntimeDebug;

/// Basic operating modes for a bridges module (Normal/Halted).
#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug, TypeInfo, MaxEncodedLen)]
#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, Debug, TypeInfo, MaxEncodedLen)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum BasicOperatingMode {
/// Normal mode, when all operations are allowed.
Expand Down
4 changes: 2 additions & 2 deletions bridges/snowbridge/primitives/core/src/outbound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub use v1::{AgentExecuteCommand, Command, Initializer, Message, OperatingMode,

/// Enqueued outbound messages need to be versioned to prevent data corruption
/// or loss after forkless runtime upgrades
#[derive(Encode, Decode, TypeInfo, Clone, RuntimeDebug)]
#[derive(Encode, Decode, TypeInfo, Clone, Debug)]
#[cfg_attr(feature = "std", derive(PartialEq))]
pub enum VersionedQueuedMessage {
V1(QueuedMessage),
Expand Down Expand Up @@ -335,7 +335,7 @@ pub trait SendMessageFeeProvider {
}

/// Reasons why sending to Ethereum could not be initiated
#[derive(Copy, Clone, Encode, Decode, PartialEq, Eq, RuntimeDebug, PalletError, TypeInfo)]
#[derive(Copy, Clone, Encode, Decode, PartialEq, Eq, Debug, PalletError, TypeInfo)]
pub enum SendError {
/// Message is too large to be safely executed on Ethereum
MessageTooLarge,
Expand Down
8 changes: 4 additions & 4 deletions bridges/snowbridge/primitives/router/src/inbound/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const MINIMUM_DEPOSIT: u128 = 1;
/// Messages from Ethereum are versioned. This is because in future,
/// we may want to evolve the protocol so that the ethereum side sends XCM messages directly.
/// Instead having BridgeHub transcode the messages into XCM.
#[derive(Clone, Encode, Decode, RuntimeDebug)]
#[derive(Clone, Encode, Decode, Debug)]
pub enum VersionedMessage {
V1(MessageV1),
}
Expand All @@ -36,7 +36,7 @@ pub struct MessageV1 {
pub command: Command,
}

#[derive(Clone, Encode, Decode, RuntimeDebug)]
#[derive(Clone, Encode, Decode, Debug)]
pub enum Command {
/// Register a wrapped token on the AssetHub `ForeignAssets` pallet
RegisterToken {
Expand All @@ -59,7 +59,7 @@ pub enum Command {
}

/// Destination for bridged tokens
#[derive(Clone, Encode, Decode, RuntimeDebug)]
#[derive(Clone, Encode, Decode, Debug)]
pub enum Destination {
/// The funds will be deposited into account `id` on AssetHub
AccountId32 { id: [u8; 32] },
Expand Down Expand Up @@ -104,7 +104,7 @@ pub struct MessageToXcm<
}

/// Reason why a message conversion failed.
#[derive(Copy, Clone, TypeInfo, PalletError, Encode, Decode, RuntimeDebug)]
#[derive(Copy, Clone, TypeInfo, PalletError, Encode, Decode, Debug)]
pub enum ConvertMessageError {
/// The message version is not supported for conversion.
UnsupportedVersion,
Expand Down
2 changes: 1 addition & 1 deletion cumulus/pallets/parachain-system/src/unincluded_segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl OutboundBandwidthLimits {
}

/// The error type for updating bandwidth used by a segment.
#[derive(RuntimeDebug)]
#[derive(Debug)]
pub enum BandwidthUpdateError {
/// Too many messages submitted to HRMP channel.
HrmpMessagesOverflow {
Expand Down
2 changes: 1 addition & 1 deletion cumulus/pallets/xcmp-queue/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ pub mod pallet {
StorageMap<_, Twox64Concat, ParaId, FixedU128, ValueQuery, InitialFactor>;
}

#[derive(Copy, Clone, Eq, PartialEq, Encode, Decode, RuntimeDebug, TypeInfo)]
#[derive(Copy, Clone, Eq, PartialEq, Encode, Decode, Debug, TypeInfo)]
pub enum OutboundState {
Ok,
Suspended,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ parameter_types! {
PartialOrd,
Encode,
Decode,
RuntimeDebug,
Debug,
MaxEncodedLen,
scale_info::TypeInfo,
)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ parameter_types! {
PartialOrd,
Encode,
Decode,
RuntimeDebug,
Debug,
MaxEncodedLen,
scale_info::TypeInfo,
)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use sp_runtime::RuntimeDebug;
use {sp_std::vec::Vec, xcm::latest::Asset};

/// The possible errors that can happen querying the storage of assets.
#[derive(Eq, PartialEq, Encode, Decode, RuntimeDebug, scale_info::TypeInfo)]
#[derive(Eq, PartialEq, Encode, Decode, Debug, scale_info::TypeInfo)]
pub enum FungiblesAccessError {
/// `Location` to `AssetId`/`ClassId` conversion failed.
AssetIdConversionFailed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use sp_core::{RuntimeDebug, H256};
use sp_runtime::generic::DigestItem;

/// Custom header digest items, inserted as DigestItem::Other
#[derive(Encode, Decode, Copy, Clone, Eq, PartialEq, RuntimeDebug)]
#[derive(Encode, Decode, Copy, Clone, Eq, PartialEq, Debug)]
pub enum CustomDigestItem {
#[codec(index = 0)]
/// Merkle root of outbound Snowbridge messages.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ parameter_types! {
PartialOrd,
Encode,
Decode,
RuntimeDebug,
Debug,
MaxEncodedLen,
scale_info::TypeInfo,
)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl pallet_identity::Config for Runtime {
/// in the `IdentityInfo` struct.
#[bitflags]
#[repr(u64)]
#[derive(Clone, Copy, PartialEq, Eq, RuntimeDebug)]
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub enum IdentityField {
Display,
Legal,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl pallet_identity::Config for Runtime {
/// in the `IdentityInfo` struct.
#[bitflags]
#[repr(u64)]
#[derive(Clone, Copy, PartialEq, Eq, RuntimeDebug)]
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub enum IdentityField {
Display,
Legal,
Expand Down
6 changes: 3 additions & 3 deletions cumulus/primitives/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub type InboundHrmpMessage = polkadot_primitives::InboundHrmpMessage<relay_chai
pub type OutboundHrmpMessage = polkadot_primitives::OutboundHrmpMessage<ParaId>;

/// Error description of a message send failure.
#[derive(Eq, PartialEq, Copy, Clone, RuntimeDebug, Encode, Decode)]
#[derive(Eq, PartialEq, Copy, Clone, Debug, Encode, Decode)]
pub enum MessageSendError {
/// The dispatch queue is full.
QueueFull,
Expand Down Expand Up @@ -174,7 +174,7 @@ impl XcmpMessageSource for () {
}

/// The "quality of service" considerations for message sending.
#[derive(Eq, PartialEq, Clone, Copy, Encode, Decode, RuntimeDebug)]
#[derive(Eq, PartialEq, Clone, Copy, Encode, Decode, Debug)]
pub enum ServiceQuality {
/// Ensure that this message is dispatched in the same relative order as any other messages
/// that were also sent with `Ordered`. This only guarantees message ordering on the dispatch
Expand Down Expand Up @@ -244,7 +244,7 @@ impl<B: BlockT> ParachainBlockData<B> {
pub const CUMULUS_CONSENSUS_ID: ConsensusEngineId = *b"CMLS";

/// Consensus header digests for Cumulus parachains.
#[derive(Clone, RuntimeDebug, Decode, Encode, PartialEq)]
#[derive(Clone, Debug, Decode, Encode, PartialEq)]
pub enum CumulusDigestItem {
/// A digest item indicating the relay-parent a parachain block was built against.
#[codec(index = 0)]
Expand Down
2 changes: 1 addition & 1 deletion polkadot/parachain/src/primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ impl DmpMessageHandler for () {
}

/// The aggregate XCMP message format.
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, TypeInfo, RuntimeDebug)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, TypeInfo, Debug)]
pub enum XcmpMessageFormat {
/// Encoded `VersionedXcm` messages, all concatenated.
ConcatenatedVersionedXcm,
Expand Down
Loading

0 comments on commit 39b0d19

Please sign in to comment.