diff --git a/polkadot/parachain/src/primitives.rs b/polkadot/parachain/src/primitives.rs index e3222b6cde..94bc2c9437 100644 --- a/polkadot/parachain/src/primitives.rs +++ b/polkadot/parachain/src/primitives.rs @@ -113,8 +113,8 @@ impl sp_std::fmt::LowerHex for ValidationCodeHash { /// Parachain block data. /// /// Contains everything required to validate para-block, may contain block and witness data. -#[derive(PartialEq, Eq, Clone, Encode, Decode, derive_more::From, TypeInfo)] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug, MallocSizeOf))] +#[derive(PartialEq, Eq, Clone, Encode, Decode, derive_more::From, TypeInfo, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize, MallocSizeOf))] pub struct BlockData(#[cfg_attr(feature = "std", serde(with = "bytes"))] pub Vec); /// Unique identifier of a parachain. diff --git a/polkadot/primitives/src/v0.rs b/polkadot/primitives/src/v0.rs index c10de3b9a5..76f9230aaa 100644 --- a/polkadot/primitives/src/v0.rs +++ b/polkadot/primitives/src/v0.rs @@ -107,8 +107,8 @@ impl MallocSizeOf for ValidatorId { } /// Index of the validator is used as a lightweight replacement of the `ValidatorId` when appropriate. -#[derive(Eq, Ord, PartialEq, PartialOrd, Copy, Clone, Encode, Decode, TypeInfo)] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Hash, MallocSizeOf, Debug))] +#[derive(Eq, Ord, PartialEq, PartialOrd, Copy, Clone, Encode, Decode, TypeInfo, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Hash, MallocSizeOf))] pub struct ValidatorIndex(pub u32); // We should really get https://github.com/paritytech/polkadot/issues/2403 going .. @@ -206,8 +206,7 @@ impl SwapAux for () { } /// Identifier for a chain, either one of a number of parachains or the relay chain. -#[derive(Copy, Clone, PartialEq, Encode, Decode, TypeInfo)] -#[cfg_attr(feature = "std", derive(Debug))] +#[derive(Copy, Clone, PartialEq, Encode, Decode, TypeInfo, RuntimeDebug)] pub enum Chain { /// The relay chain. Relay, @@ -216,8 +215,8 @@ pub enum Chain { } /// The duty roster specifying what jobs each validator must do. -#[derive(Clone, PartialEq, Encode, Decode, TypeInfo)] -#[cfg_attr(feature = "std", derive(Default, Debug))] +#[derive(Clone, PartialEq, Encode, Decode, TypeInfo, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(Default))] pub struct DutyRoster { /// Lookup from validator index to chain on which that validator has a duty to validate. pub validator_duty: Vec, @@ -227,8 +226,8 @@ pub struct DutyRoster { /// to fully validate the candidate. /// /// These are global parameters that apply to all parachain candidates in a block. -#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo)] -#[cfg_attr(feature = "std", derive(Debug, Default))] +#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(Default))] pub struct GlobalValidationData { /// The maximum code size permitted, in bytes. pub max_code_size: u32, @@ -240,8 +239,8 @@ pub struct GlobalValidationData { /// Extra data that is needed along with the other fields in a `CandidateReceipt` /// to fully validate the candidate. These fields are parachain-specific. -#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo)] -#[cfg_attr(feature = "std", derive(Debug, Default))] +#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(Default))] pub struct LocalValidationData { /// The parent head-data. pub parent_head: HeadData, @@ -262,8 +261,8 @@ pub struct LocalValidationData { } /// Commitments made in a `CandidateReceipt`. Many of these are outputs of validation. -#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo)] -#[cfg_attr(feature = "std", derive(Debug, Default))] +#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(Default))] pub struct CandidateCommitments { /// Fees paid from the chain to the relay chain validators. pub fees: Balance, @@ -311,8 +310,7 @@ fn check_collator_signature>( } /// All data pertaining to the execution of a parachain candidate. -#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo)] -#[cfg_attr(feature = "std", derive(Debug))] +#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, RuntimeDebug)] pub struct CandidateReceipt { /// The ID of the parachain this is a candidate for. pub parachain_index: Id, @@ -396,8 +394,8 @@ impl Ord for CandidateReceipt { /// All the data which is omitted in an `AbridgedCandidateReceipt`, but that /// is necessary for validation of the parachain candidate. -#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo)] -#[cfg_attr(feature = "std", derive(Debug, Default))] +#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(Default))] pub struct OmittedValidationData { /// The global validation schedule. pub global_validation: GlobalValidationData, @@ -410,8 +408,7 @@ pub struct OmittedValidationData { /// Much info in a candidate-receipt is duplicated from the relay-chain state. /// When submitting to the relay-chain, this data should be omitted as it can /// be re-generated from relay-chain state. -#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo)] -#[cfg_attr(feature = "std", derive(Debug))] +#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, RuntimeDebug)] pub struct AbridgedCandidateReceipt { /// The ID of the parachain this is a candidate for. pub parachain_index: Id, @@ -545,8 +542,7 @@ impl Ord for AbridgedCandidateReceipt { } /// A unique descriptor of the candidate receipt, in a lightweight format. -#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo)] -#[cfg_attr(feature = "std", derive(Debug))] +#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, RuntimeDebug)] pub struct CandidateDescriptor { /// The ID of the para this is a candidate for. pub para_id: Id, @@ -565,8 +561,7 @@ pub struct CandidateDescriptor { } /// A collation sent by a collator. -#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo)] -#[cfg_attr(feature = "std", derive(Debug))] +#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, RuntimeDebug)] pub struct CollationInfo { /// The ID of the parachain this is a candidate for. pub parachain_index: Id, @@ -619,8 +614,8 @@ impl CollationInfo { } /// A full collation. -#[derive(PartialEq, Eq, Clone)] -#[cfg_attr(feature = "std", derive(Debug, Encode, Decode, TypeInfo))] +#[derive(PartialEq, Eq, Clone, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(Encode, Decode, TypeInfo))] pub struct Collation { /// Candidate receipt itself. pub info: CollationInfo, @@ -629,8 +624,8 @@ pub struct Collation { } /// A Proof-of-Validation block. -#[derive(PartialEq, Eq, Clone)] -#[cfg_attr(feature = "std", derive(Debug, Encode, Decode, TypeInfo))] +#[derive(PartialEq, Eq, Clone, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(Encode, Decode, TypeInfo))] pub struct PoVBlock { /// Block data. pub block_data: BlockData, @@ -645,8 +640,8 @@ impl PoVBlock { } /// The data that is kept available about a particular parachain block. -#[derive(PartialEq, Eq, Clone)] -#[cfg_attr(feature = "std", derive(Debug, Encode, Decode, TypeInfo))] +#[derive(PartialEq, Eq, Clone, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(Encode, Decode, TypeInfo))] pub struct AvailableData { /// The PoV block. pub pov_block: PoVBlock, @@ -660,8 +655,8 @@ const BACKING_STATEMENT_MAGIC: [u8; 4] = *b"BKNG"; /// Statements that can be made about parachain candidates. These are the /// actual values that are signed. -#[derive(Clone, PartialEq, Eq)] -#[cfg_attr(feature = "std", derive(Debug, Hash))] +#[derive(Clone, PartialEq, Eq, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(Hash))] pub enum CompactStatement { /// Proposal of a parachain candidate. Seconded(CandidateHash), @@ -818,8 +813,10 @@ impl AttestedCandidate { } /// A fee schedule for messages. This is a linear function in the number of bytes of a message. -#[derive(PartialEq, Eq, PartialOrd, Hash, Default, Clone, Copy, Encode, Decode, TypeInfo)] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))] +#[derive( + PartialEq, Eq, PartialOrd, Hash, Default, Clone, Copy, Encode, Decode, TypeInfo, RuntimeDebug, +)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] pub struct FeeSchedule { /// The base fee charged for all messages. pub base: Balance, diff --git a/polkadot/primitives/src/v1/mod.rs b/polkadot/primitives/src/v1/mod.rs index e4c3d30f36..a36d317ede 100644 --- a/polkadot/primitives/src/v1/mod.rs +++ b/polkadot/primitives/src/v1/mod.rs @@ -336,8 +336,8 @@ fn check_collator_signature>( } /// A unique descriptor of the candidate receipt. -#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo)] -#[cfg_attr(feature = "std", derive(Debug, Hash, MallocSizeOf))] +#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(Hash, MallocSizeOf))] pub struct CandidateDescriptor { /// The ID of the para this is a candidate for. pub para_id: Id, @@ -378,8 +378,8 @@ impl> CandidateDescriptor { } /// A candidate-receipt. -#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo)] -#[cfg_attr(feature = "std", derive(Debug, MallocSizeOf))] +#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(MallocSizeOf))] pub struct CandidateReceipt { /// The descriptor of the candidate. pub descriptor: CandidateDescriptor, @@ -403,8 +403,7 @@ impl CandidateReceipt { } /// All data pertaining to the execution of a para candidate. -#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo)] -#[cfg_attr(feature = "std", derive(Debug))] +#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, RuntimeDebug)] pub struct FullCandidateReceipt { /// The inner candidate receipt. pub inner: CandidateReceipt, @@ -416,8 +415,8 @@ pub struct FullCandidateReceipt { } /// A candidate-receipt with commitments directly included. -#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo)] -#[cfg_attr(feature = "std", derive(Debug, Hash, MallocSizeOf))] +#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(Hash, MallocSizeOf))] pub struct CommittedCandidateReceipt { /// The descriptor of the candidate. pub descriptor: CandidateDescriptor, @@ -497,8 +496,8 @@ impl Ord for CommittedCandidateReceipt { /// /// The `PersistedValidationData` should be relatively lightweight primarily because it is constructed /// during inclusion for each candidate and therefore lies on the critical path of inclusion. -#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo)] -#[cfg_attr(feature = "std", derive(Debug, Default, MallocSizeOf))] +#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(Default, MallocSizeOf))] pub struct PersistedValidationData { /// The parent head-data. pub parent_head: HeadData, @@ -518,8 +517,8 @@ impl PersistedValidationData { } /// Commitments made in a `CandidateReceipt`. Many of these are outputs of validation. -#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo)] -#[cfg_attr(feature = "std", derive(Debug, Hash, MallocSizeOf, Default))] +#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(Hash, MallocSizeOf, Default))] pub struct CandidateCommitments { /// Messages destined to be interpreted by the Relay chain itself. pub upward_messages: Vec, @@ -655,8 +654,10 @@ pub fn check_candidate_backing + Clone + Encode>( } /// The unique (during session) index of a core. -#[derive(Encode, Decode, Default, PartialOrd, Ord, Eq, PartialEq, Clone, Copy, TypeInfo)] -#[cfg_attr(feature = "std", derive(Debug, Hash, MallocSizeOf))] +#[derive( + Encode, Decode, Default, PartialOrd, Ord, Eq, PartialEq, Clone, Copy, TypeInfo, RuntimeDebug, +)] +#[cfg_attr(feature = "std", derive(Hash, MallocSizeOf))] pub struct CoreIndex(pub u32); impl From for CoreIndex { @@ -677,13 +678,13 @@ impl From for GroupIndex { } /// A claim on authoring the next block for a given parathread. -#[derive(Clone, Encode, Decode, TypeInfo)] -#[cfg_attr(feature = "std", derive(PartialEq, Debug))] +#[derive(Clone, Encode, Decode, TypeInfo, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(PartialEq))] pub struct ParathreadClaim(pub Id, pub CollatorId); /// An entry tracking a claim to ensure it does not pass the maximum number of retries. -#[derive(Clone, Encode, Decode, TypeInfo)] -#[cfg_attr(feature = "std", derive(PartialEq, Debug))] +#[derive(Clone, Encode, Decode, TypeInfo, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(PartialEq))] pub struct ParathreadEntry { /// The claim. pub claim: ParathreadClaim, @@ -692,8 +693,8 @@ pub struct ParathreadEntry { } /// What is occupying a specific availability core. -#[derive(Clone, Encode, Decode, TypeInfo)] -#[cfg_attr(feature = "std", derive(PartialEq, Debug))] +#[derive(Clone, Encode, Decode, TypeInfo, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(PartialEq))] pub enum CoreOccupied { /// A parathread. Parathread(ParathreadEntry), @@ -702,8 +703,8 @@ pub enum CoreOccupied { } /// A helper data-type for tracking validator-group rotations. -#[derive(Clone, Encode, Decode, TypeInfo)] -#[cfg_attr(feature = "std", derive(PartialEq, Debug, MallocSizeOf))] +#[derive(Clone, Encode, Decode, TypeInfo, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(PartialEq, MallocSizeOf))] pub struct GroupRotationInfo { /// The block number where the session started. pub session_start_block: N, @@ -790,8 +791,8 @@ impl GroupRotationInfo { } /// Information about a core which is currently occupied. -#[derive(Clone, Encode, Decode, TypeInfo)] -#[cfg_attr(feature = "std", derive(Debug, PartialEq, MallocSizeOf))] +#[derive(Clone, Encode, Decode, TypeInfo, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(PartialEq, MallocSizeOf))] pub struct OccupiedCore { // NOTE: this has no ParaId as it can be deduced from the candidate descriptor. /// If this core is freed by availability, this is the assignment that is next up on this @@ -826,8 +827,8 @@ impl OccupiedCore { } /// Information about a core which is currently occupied. -#[derive(Clone, Encode, Decode, TypeInfo)] -#[cfg_attr(feature = "std", derive(Debug, PartialEq, MallocSizeOf))] +#[derive(Clone, Encode, Decode, TypeInfo, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(PartialEq, MallocSizeOf))] pub struct ScheduledCore { /// The ID of a para scheduled. pub para_id: Id, @@ -836,8 +837,8 @@ pub struct ScheduledCore { } /// The state of a particular availability core. -#[derive(Clone, Encode, Decode, TypeInfo)] -#[cfg_attr(feature = "std", derive(Debug, PartialEq, MallocSizeOf))] +#[derive(Clone, Encode, Decode, TypeInfo, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(PartialEq, MallocSizeOf))] pub enum CoreState { /// The core is currently occupied. #[codec(index = 0)] @@ -872,8 +873,8 @@ impl CoreState { } /// An assumption being made about the state of an occupied core. -#[derive(Clone, Copy, Encode, Decode, TypeInfo)] -#[cfg_attr(feature = "std", derive(PartialEq, Eq, Hash, Debug))] +#[derive(Clone, Copy, Encode, Decode, TypeInfo, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(PartialEq, Eq, Hash))] pub enum OccupiedCoreAssumption { /// The candidate occupying the core was made available and included to free the core. #[codec(index = 0)] @@ -887,8 +888,8 @@ pub enum OccupiedCoreAssumption { } /// An even concerning a candidate. -#[derive(Clone, Encode, Decode, TypeInfo)] -#[cfg_attr(feature = "std", derive(PartialEq, Debug, MallocSizeOf))] +#[derive(Clone, Encode, Decode, TypeInfo, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(PartialEq, MallocSizeOf))] pub enum CandidateEvent { /// This candidate receipt was backed in the most recent block. /// This includes the core index the candidate is now occupying.