diff --git a/substrate/frame/election-provider-multi-phase/src/lib.rs b/substrate/frame/election-provider-multi-phase/src/lib.rs index 06cb2963d762..65cfde8ea6f4 100644 --- a/substrate/frame/election-provider-multi-phase/src/lib.rs +++ b/substrate/frame/election-provider-multi-phase/src/lib.rs @@ -232,7 +232,7 @@ extern crate alloc; use alloc::{boxed::Box, vec::Vec}; -use codec::{Decode, Encode}; +use codec::{Decode, Encode, MaxEncodedLen}; use frame_election_provider_support::{ bounds::{CountBound, ElectionBounds, ElectionBoundsBuilder, SizeBound}, BoundedSupportsOf, DataProviderBounds, ElectionDataProvider, ElectionProvider, @@ -317,7 +317,7 @@ pub trait BenchmarkingConfig { } /// Current phase of the pallet. -#[derive(PartialEq, Eq, Clone, Copy, Encode, Decode, Debug, TypeInfo)] +#[derive(PartialEq, Eq, Clone, Copy, Encode, Decode, Debug, TypeInfo, MaxEncodedLen)] pub enum Phase { /// Nothing, the election is not happening. Off, @@ -379,7 +379,7 @@ impl Phase { } /// The type of `Computation` that provided this election data. -#[derive(PartialEq, Eq, Clone, Copy, Encode, Decode, Debug, TypeInfo)] +#[derive(PartialEq, Eq, Clone, Copy, Encode, Decode, Debug, TypeInfo, MaxEncodedLen)] pub enum ElectionCompute { /// Election was computed on-chain. OnChain, @@ -405,7 +405,9 @@ impl Default for ElectionCompute { /// /// Such a solution should never become effective in anyway before being checked by the /// `Pallet::feasibility_check`. -#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, PartialOrd, Ord, TypeInfo)] +#[derive( + PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, PartialOrd, Ord, TypeInfo, MaxEncodedLen, +)] pub struct RawSolution { /// the solution itself. pub solution: S, @@ -432,6 +434,7 @@ impl Default for RawSolution { RuntimeDebug, DefaultNoBound, scale_info::TypeInfo, + MaxEncodedLen, )] #[scale_info(skip_type_params(AccountId, MaxWinners))] pub struct ReadySolution @@ -470,7 +473,7 @@ pub struct RoundSnapshot { /// This is stored automatically on-chain, and it contains the **size of the entire snapshot**. /// This is also used in dispatchables as weight witness data and should **only contain the size of /// the presented solution**, not the entire snapshot. -#[derive(PartialEq, Eq, Clone, Copy, Encode, Decode, Debug, Default, TypeInfo)] +#[derive(PartialEq, Eq, Clone, Copy, Encode, Decode, Debug, Default, TypeInfo, MaxEncodedLen)] pub struct SolutionOrSnapshotSize { /// The length of voters. #[codec(compact)]