pub enum Call<T: Config<I>, I: 'static = ()> {
    set_members {
        new_members: Vec<T::AccountId>,
        prime: Option<T::AccountId>,
        old_count: MemberCount,
    },
    execute {
        proposal: Box<<T as Config<I>>::Proposal>,
        length_bound: u32,
    },
    propose {
        threshold: MemberCount,
        proposal: Box<<T as Config<I>>::Proposal>,
        length_bound: u32,
    },
    vote {
        proposal: T::Hash,
        index: ProposalIndex,
        approve: bool,
    },
    close {
        proposal_hash: T::Hash,
        index: ProposalIndex,
        proposal_weight_bound: Weight,
        length_bound: u32,
    },
    disapprove_proposal {
        proposal_hash: T::Hash,
    },
    // some variants omitted
}
Expand description

Contains one variant per dispatchable that can be called by an extrinsic.

Variants§

§

set_members

Fields

§new_members: Vec<T::AccountId>
§prime: Option<T::AccountId>
§old_count: 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 MaxMembers limit on the amount of members, but the weight estimations rely on it to estimate dispatchable weight.

WARNING:

The pallet-collective can also be managed by logic outside of the pallet through the implementation of the trait ChangeMembers. Any call to set_members must be careful that the member set doesn’t get out of sync with other logic managing the member set.

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

Fields

§proposal: Box<<T as Config<I>>::Proposal>
§length_bound: 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

Fields

§threshold: MemberCount
§proposal: Box<<T as Config<I>>::Proposal>
§length_bound: 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

Fields

§proposal: T::Hash
§approve: bool

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

Requires the sender to be a member.

Transaction fees will be waived if the member is voting on any particular proposal for the first time and the call is successful. Subsequent vote changes will charge a fee.

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

Fields

§proposal_hash: T::Hash
§proposal_weight_bound: Weight
§length_bound: u32

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.

If the close operation completes successfully with disapproval, the transaction fee will be waived. Otherwise execution of the approved operation will be charged to the caller.

  • 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

Fields

§proposal_hash: 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 DB Weight:

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

Implementations§

Create a call with the variant set_members.

Create a call with the variant execute.

Create a call with the variant propose.

Create a call with the variant vote.

Create a call with the variant close.

Create a call with the variant disapprove_proposal.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Attempt to deserialise the value from input.
Attempt to skip the encoded value from input. Read more
Returns the fixed encoded size of the type. Read more
Convert self to a slice and append it to the destination.
If possible give a hint of expected size of the encoding. Read more
Convert self to an owned vector.
Convert self to a slice and then invoke the given closure with it.
Calculates the encoded size. Read more
Return the function name of the Call.
Return all function names.
Return a DispatchInfo, containing relevant information of this dispatch. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
The type identifying for which type info is provided. Read more
Returns the static type identifier for Self.
The origin type of the runtime, (i.e. frame_system::Config::Origin).
Dispatch this call but do not check the filter in origin.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Convert from a value of T into an equivalent instance of Option<Self>. Read more
Consume self to return Some equivalent value of Option<T>. Read more
Converts self into T using Into<T>. Read more
Decode Self and consume all of the given input data. Read more
Decode Self and consume all of the given input data. Read more
Decode Self with the given maximum recursion depth and advance input by the number of bytes consumed. Read more
Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more
Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more
Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more
Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more
Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more
Compare self to key and return true if they are equal.
Causes self to use its Binary implementation when Debug-formatted. Read more
Causes self to use its Display implementation when Debug-formatted. Read more
Causes self to use its LowerExp implementation when Debug-formatted. Read more
Causes self to use its LowerHex implementation when Debug-formatted. Read more
Causes self to use its Octal implementation when Debug-formatted. Read more
Causes self to use its Pointer implementation when Debug-formatted. Read more
Causes self to use its UpperExp implementation when Debug-formatted. Read more
Causes self to use its UpperHex implementation when Debug-formatted. Read more
Formats each item in a sequence. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Cast reference.
Cast reference.
Cast mutable reference.
Cast mutable reference.

Get a reference to the inner from the outer.

Get a mutable reference to the inner from the outer.

Return an encoding of Self prepended by given slice.
Pipes by value. This is generally the method you want to use. Read more
Borrows self and passes that borrow into the pipe function. Read more
Mutably borrows self and passes that borrow into the pipe function. Read more
Borrows self, then passes self.borrow() into the pipe function. Read more
Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Borrows self, then passes self.as_ref() into the pipe function.
Mutably borrows self, then passes self.as_mut() into the pipe function. Read more
Borrows self, then passes self.deref() into the pipe function.
Mutably borrows self, then passes self.deref_mut() into the pipe function. Read more
The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
Convert from a value of T into an equivalent instance of Self. Read more
Consume self to return an equivalent value of T. Read more
The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Checks if self is actually part of its subset T (and can be converted to it).
Use with care! Same as self.to_subset but without any property checks. Always succeeds.
The inclusion map: converts self to the equivalent element of its superset.
Immutable access to a value. Read more
Mutable access to a value. Read more
Immutable access to the Borrow<B> of a value. Read more
Mutable access to the BorrowMut<B> of a value. Read more
Immutable access to the AsRef<R> view of a value. Read more
Mutable access to the AsMut<R> view of a value. Read more
Immutable access to the Deref::Target of a value. Read more
Mutable access to the Deref::Target of a value. Read more
Calls .tap() only in debug builds, and is erased in release builds.
Calls .tap_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_borrow() only in debug builds, and is erased in release builds. Read more
Calls .tap_borrow_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_ref() only in debug builds, and is erased in release builds. Read more
Calls .tap_ref_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_deref() only in debug builds, and is erased in release builds. Read more
Calls .tap_deref_mut() only in debug builds, and is erased in release builds. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Attempts to convert self into T using TryInto<T>. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The counterpart to unchecked_from.
Consume self to return an equivalent value of T.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more