mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-07 22:27:21 +00:00
MEL: Origin, Referenda, ConvictionVoting (#11631)
* Referenda & CV pallets ready * Fix build * Add mel_bound for Voting and Casting types * Add mel_bound on Tally * Add mel_bound on another Tally * Add mel_bound for pallet_collective::RawOrigin Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
//! Traits for dealing with dispatching calls and the origin from which they are dispatched.
|
||||
|
||||
use crate::dispatch::{DispatchResultWithPostInfo, Parameter, RawOrigin};
|
||||
use codec::MaxEncodedLen;
|
||||
use sp_runtime::{
|
||||
traits::{BadOrigin, Member, Morph, TryMorph},
|
||||
Either,
|
||||
@@ -258,7 +259,11 @@ pub trait OriginTrait: Sized {
|
||||
type Call;
|
||||
|
||||
/// The caller origin, overarching type of all pallets origins.
|
||||
type PalletsOrigin: Parameter + Member + Into<Self> + From<RawOrigin<Self::AccountId>>;
|
||||
type PalletsOrigin: Parameter
|
||||
+ Member
|
||||
+ Into<Self>
|
||||
+ From<RawOrigin<Self::AccountId>>
|
||||
+ MaxEncodedLen;
|
||||
|
||||
/// The AccountId used across the system.
|
||||
type AccountId;
|
||||
|
||||
@@ -134,7 +134,7 @@ pub mod v1 {
|
||||
/// A type that can be used as a scheduler.
|
||||
pub trait Anon<BlockNumber, Call, Origin> {
|
||||
/// An address which can be used for removing a scheduled task.
|
||||
type Address: Codec + Clone + Eq + EncodeLike + Debug + TypeInfo;
|
||||
type Address: Codec + Clone + Eq + EncodeLike + Debug + TypeInfo + MaxEncodedLen;
|
||||
|
||||
/// Schedule a dispatch to happen at the beginning of some block in the future.
|
||||
///
|
||||
@@ -179,7 +179,7 @@ pub mod v1 {
|
||||
/// A type that can be used as a scheduler.
|
||||
pub trait Named<BlockNumber, Call, Origin> {
|
||||
/// An address which can be used for removing a scheduled task.
|
||||
type Address: Codec + Clone + Eq + EncodeLike + sp_std::fmt::Debug;
|
||||
type Address: Codec + Clone + Eq + EncodeLike + sp_std::fmt::Debug + MaxEncodedLen;
|
||||
|
||||
/// Schedule a dispatch to happen at the beginning of some block in the future.
|
||||
///
|
||||
@@ -289,7 +289,7 @@ pub mod v2 {
|
||||
/// A type that can be used as a scheduler.
|
||||
pub trait Anon<BlockNumber, Call, Origin> {
|
||||
/// An address which can be used for removing a scheduled task.
|
||||
type Address: Codec + Clone + Eq + EncodeLike + Debug + TypeInfo;
|
||||
type Address: Codec + Clone + Eq + EncodeLike + Debug + TypeInfo + MaxEncodedLen;
|
||||
/// A means of expressing a call by the hash of its encoded data.
|
||||
type Hash;
|
||||
|
||||
@@ -336,7 +336,7 @@ pub mod v2 {
|
||||
/// A type that can be used as a scheduler.
|
||||
pub trait Named<BlockNumber, Call, Origin> {
|
||||
/// An address which can be used for removing a scheduled task.
|
||||
type Address: Codec + Clone + Eq + EncodeLike + sp_std::fmt::Debug;
|
||||
type Address: Codec + Clone + Eq + EncodeLike + sp_std::fmt::Debug + MaxEncodedLen;
|
||||
/// A means of expressing a call by the hash of its encoded data.
|
||||
type Hash;
|
||||
|
||||
|
||||
@@ -122,6 +122,13 @@ impl<Tally, Moment, Class> PollStatus<Tally, Moment, Class> {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ClassCountOf<P, T>(sp_std::marker::PhantomData<(P, T)>);
|
||||
impl<T, P: Polling<T>> sp_runtime::traits::Get<u32> for ClassCountOf<P, T> {
|
||||
fn get() -> u32 {
|
||||
P::classes().len() as u32
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Polling<Tally> {
|
||||
type Index: Parameter + Member + Ord + PartialOrd + Copy + HasCompact + MaxEncodedLen;
|
||||
type Votes: Parameter + Member + Ord + PartialOrd + Copy + HasCompact + MaxEncodedLen;
|
||||
|
||||
Reference in New Issue
Block a user