[][src]Enum pallet_collective::Call

pub enum Call<T: Trait<I>, I: Instance = DefaultInstance> {
    set_members(Vec<T::AccountId>, Option<T::AccountId>, MemberCount),
    execute(Box<<T as Trait<I>>::Proposal>, u32),
    propose(MemberCountBox<<T as Trait<I>>::Proposal>, u32),
    vote(T::HashProposalIndexbool),
    close(T::HashProposalIndexWeightu32),
    disapprove_proposal(T::Hash),
    // some variants omitted
}

Dispatchable calls.

Each variant of this enum maps to a dispatchable function from the associated module.

Variants

set_members(Vec<T::AccountId>, Option<T::AccountId>, MemberCount)

Set the collective's membership.

  • new_members: The new member list. Be nice to the chain and provide it sorted.
  • prime: The prime member whose vote sets the default.
  • old_count: The upper bound for the previous number of members in storage. Used for weight estimation.

Requires root origin.

NOTE: Does not enforce the expected MAX_MEMBERS limit on the amount of members, but the weight estimations rely on it to estimate dispatchable weight.

Weight

  • O(MP + N) where:
    • M old-members-count (code- and governance-bounded)
    • N new-members-count (code- and governance-bounded)
    • P proposals-count (code-bounded)
  • DB:
    • 1 storage mutation (codec O(M) read, O(N) write) for reading and writing the members
    • 1 storage read (codec O(P)) for reading the proposals
    • P storage mutations (codec O(M)) for updating the votes for each proposal
    • 1 storage write (codec O(1)) for deleting the old prime and setting the new one

execute(Box<<T as Trait<I>>::Proposal>, u32)

Dispatch a proposal from a member using the Member origin.

Origin must be a member of the collective.

Weight

  • O(M + P) where M members-count (code-bounded) and P complexity of dispatching proposal
  • DB: 1 read (codec O(M)) + DB access of proposal
  • 1 event

propose(MemberCountBox<<T as Trait<I>>::Proposal>, u32)

Add a new proposal to either be voted on or executed directly.

Requires the sender to be member.

threshold determines whether proposal is executed directly (threshold < 2) or put up for voting.

Weight

  • O(B + M + P1) or O(B + M + P2) where:
    • B is proposal size in bytes (length-fee-bounded)
    • M is members-count (code- and governance-bounded)
    • branching is influenced by threshold where:
      • P1 is proposal execution complexity (threshold < 2)
      • P2 is proposals-count (code-bounded) (threshold >= 2)
  • DB:
    • 1 storage read is_member (codec O(M))
    • 1 storage read ProposalOf::contains_key (codec O(1))
    • DB accesses influenced by threshold:
      • EITHER storage accesses done by proposal (threshold < 2)
      • OR proposal insertion (threshold <= 2)
        • 1 storage mutation Proposals (codec O(P2))
        • 1 storage mutation ProposalCount (codec O(1))
        • 1 storage write ProposalOf (codec O(B))
        • 1 storage write Voting (codec O(M))
    • 1 event

vote(T::HashProposalIndexbool)

Add an aye or nay vote for the sender to the given proposal.

Requires the sender to be a member.

Weight

  • O(M) where M is members-count (code- and governance-bounded)
  • DB:
    • 1 storage read Members (codec O(M))
    • 1 storage mutation Voting (codec O(M))
  • 1 event

close(T::HashProposalIndexWeightu32)

Close a vote that is either approved, disapproved or whose voting period has ended.

May be called by any signed account in order to finish voting and close the proposal.

If called before the end of the voting period it will only close the vote if it is has enough votes to be approved or disapproved.

If called after the end of the voting period abstentions are counted as rejections unless there is a prime member set and the prime member cast an approval.

  • proposal_weight_bound: The maximum amount of weight consumed by executing the closed proposal.
  • length_bound: The upper bound for the length of the proposal in storage. Checked via storage::read so it is size_of::<u32>() == 4 larger than the pure length.

Weight

  • O(B + M + P1 + P2) where:
    • B is proposal size in bytes (length-fee-bounded)
    • M is members-count (code- and governance-bounded)
    • P1 is the complexity of proposal preimage.
    • P2 is proposal-count (code-bounded)
  • DB:
  • 2 storage reads (Members: codec O(M), Prime: codec O(1))
  • 3 mutations (Voting: codec O(M), ProposalOf: codec O(B), Proposals: codec O(P2))
  • any mutations done while executing proposal (P1)
  • up to 3 events

disapprove_proposal(T::Hash)

Disapprove a proposal, close, and remove it from the system, regardless of its current state.

Must be called by the Root origin.

Parameters:

  • proposal_hash: The hash of the proposal that should be disapproved.

Complexity: O(P) where P is the number of max proposals Base Weight: .49 * P DB Weight:

  • Reads: Proposals
  • Writes: Voting, Proposals, ProposalOf

Trait Implementations

impl<T: Trait<I>, I: Instance> Clone for Call<T, I>[src]

impl<T: Trait<I>, I: Instance> Debug for Call<T, I>[src]

impl<T: Trait<I>, I: Instance> Decode for Call<T, I> where
    Vec<T::AccountId>: Decode,
    Vec<T::AccountId>: Decode,
    Option<T::AccountId>: Decode,
    Option<T::AccountId>: Decode,
    Box<<T as Trait<I>>::Proposal>: Decode,
    Box<<T as Trait<I>>::Proposal>: Decode,
    Box<<T as Trait<I>>::Proposal>: Decode,
    Box<<T as Trait<I>>::Proposal>: Decode,
    T::Hash: Decode,
    T::Hash: Decode,
    T::Hash: Decode,
    T::Hash: Decode,
    T::Hash: Decode,
    T::Hash: Decode
[src]

impl<T: Trait<I>, I: Instance> Dispatchable for Call<T, I>[src]

type Trait = T

...

type Origin = <T as Trait>::Origin

Every function call from your runtime has an origin, which specifies where the extrinsic was generated from. In the case of a signed extrinsic (transaction), the origin contains an identifier for the caller. The origin can be empty in the case of an inherent extrinsic. Read more

type Info = DispatchInfo

An opaque set of information attached to the transaction. This could be constructed anywhere down the line in a runtime. The current Substrate runtime uses a struct with the same name to represent the dispatch class and weight. Read more

type PostInfo = PostDispatchInfo

Additional information that is returned by dispatch. Can be used to supply the caller with information about a Dispatchable that is ownly known post dispatch. Read more

impl<T: Trait<I>, I: Instance> Encode for Call<T, I> where
    Vec<T::AccountId>: Encode,
    Vec<T::AccountId>: Encode,
    Option<T::AccountId>: Encode,
    Option<T::AccountId>: Encode,
    Box<<T as Trait<I>>::Proposal>: Encode,
    Box<<T as Trait<I>>::Proposal>: Encode,
    Box<<T as Trait<I>>::Proposal>: Encode,
    Box<<T as Trait<I>>::Proposal>: Encode,
    T::Hash: Encode,
    T::Hash: Encode,
    T::Hash: Encode,
    T::Hash: Encode,
    T::Hash: Encode,
    T::Hash: Encode
[src]

impl<T: Trait<I>, I: Instance> EncodeLike<Call<T, I>> for Call<T, I> where
    Vec<T::AccountId>: Encode,
    Vec<T::AccountId>: Encode,
    Option<T::AccountId>: Encode,
    Option<T::AccountId>: Encode,
    Box<<T as Trait<I>>::Proposal>: Encode,
    Box<<T as Trait<I>>::Proposal>: Encode,
    Box<<T as Trait<I>>::Proposal>: Encode,
    Box<<T as Trait<I>>::Proposal>: Encode,
    T::Hash: Encode,
    T::Hash: Encode,
    T::Hash: Encode,
    T::Hash: Encode,
    T::Hash: Encode,
    T::Hash: Encode
[src]

impl<T: Trait<I>, I: Instance> Eq for Call<T, I>[src]

impl<T: Trait<I>, I: Instance> GetCallName for Call<T, I>[src]

impl<T: Trait<I>, I: Instance> GetDispatchInfo for Call<T, I>[src]

impl<T: Trait<I>, I: Instance> PartialEq<Call<T, I>> for Call<T, I>[src]

Auto Trait Implementations

impl<T, I> RefUnwindSafe for Call<T, I> where
    I: RefUnwindSafe,
    T: RefUnwindSafe,
    <T as Trait>::AccountId: RefUnwindSafe,
    <T as Trait>::Hash: RefUnwindSafe,
    <T as Trait<I>>::Proposal: RefUnwindSafe

impl<T, I> Send for Call<T, I> where
    I: Send,
    T: Send,
    <T as Trait>::AccountId: Send,
    <T as Trait>::Hash: Send,
    <T as Trait<I>>::Proposal: Send

impl<T, I> Sync for Call<T, I> where
    I: Sync,
    T: Sync,
    <T as Trait>::AccountId: Sync,
    <T as Trait>::Hash: Sync,
    <T as Trait<I>>::Proposal: Sync

impl<T, I> Unpin for Call<T, I> where
    I: Unpin,
    T: Unpin,
    <T as Trait>::AccountId: Unpin,
    <T as Trait>::Hash: Unpin

impl<T, I> UnwindSafe for Call<T, I> where
    I: UnwindSafe,
    T: UnwindSafe,
    <T as Trait>::AccountId: UnwindSafe,
    <T as Trait>::Hash: UnwindSafe,
    <T as Trait<I>>::Proposal: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CheckedConversion for T[src]

impl<S> Codec for S where
    S: Encode + Decode
[src]

impl<T, X> Decode for X where
    T: Decode + Into<X>,
    X: WrapperTypeDecode<Wrapped = T>, 
[src]

impl<T> DecodeAll for T where
    T: Decode
[src]

impl<T, X> Encode for X where
    T: Encode + ?Sized,
    X: WrapperTypeEncode<Target = T>, 
[src]

impl<'_, '_, T> EncodeLike<&'_ &'_ T> for T where
    T: Encode
[src]

impl<'_, T> EncodeLike<&'_ T> for T where
    T: Encode
[src]

impl<'_, T> EncodeLike<&'_ mut T> for T where
    T: Encode
[src]

impl<T> EncodeLike<Arc<T>> for T where
    T: Encode
[src]

impl<T> EncodeLike<Box<T>> for T where
    T: Encode
[src]

impl<'a, T> EncodeLike<Cow<'a, T>> for T where
    T: Encode + ToOwned
[src]

impl<T> EncodeLike<Rc<T>> for T where
    T: Encode
[src]

impl<T> From<T> for T[src]

impl<S> FullCodec for S where
    S: Decode + FullEncode
[src]

impl<S> FullEncode for S where
    S: Encode + EncodeLike<S>, 
[src]

impl<T> Hashable for T where
    T: Codec
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, Outer> IsWrappedBy<Outer> for T where
    Outer: AsRef<T> + AsMut<T> + From<T>,
    T: From<Outer>, 
[src]

fn from_ref(outer: &Outer) -> &T[src]

Get a reference to the inner from the outer.

fn from_mut(outer: &mut Outer) -> &mut T[src]

Get a mutable reference to the inner from the outer.

impl<T> KeyedVec for T where
    T: Codec
[src]

impl<T> MaybeDebug for T where
    T: Debug

impl<T> MaybeDebug for T where
    T: Debug

impl<T> MaybeRefUnwindSafe for T where
    T: RefUnwindSafe

impl<T> Member for T where
    T: 'static + Clone + PartialEq<T> + Eq + Send + Sync + Debug
[src]

impl<T> Parameter for T where
    T: Codec + EncodeLike<T> + Clone + Eq + Debug
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> SaturatedConversion for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<S, T> UncheckedInto<T> for S where
    T: UncheckedFrom<S>, 
[src]

impl<T, S> UniqueSaturatedInto<T> for S where
    S: TryInto<T>,
    T: Bounded

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,