mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 23:21:06 +00:00
Rewrap all comments to 100 line width (#9490)
* reformat everything again * manual formatting * last manual fix * Fix build
This commit is contained in:
@@ -46,12 +46,12 @@
|
||||
//! - **Conviction:** An indication of a voter's strength of belief in their vote. An increase
|
||||
//! of one in conviction indicates that a token holder is willing to lock their tokens for twice
|
||||
//! as many lock periods after enactment.
|
||||
//! - **Vote:** A value that can either be in approval ("Aye") or rejection ("Nay")
|
||||
//! of a particular referendum.
|
||||
//! - **Vote:** A value that can either be in approval ("Aye") or rejection ("Nay") of a particular
|
||||
//! referendum.
|
||||
//! - **Proposal:** A submission to the chain that represents an action that a proposer (either an
|
||||
//! account or an external origin) suggests that the system adopt.
|
||||
//! - **Referendum:** A proposal that is in the process of being voted on for
|
||||
//! either acceptance or rejection as a change to the system.
|
||||
//! - **Referendum:** A proposal that is in the process of being voted on for either acceptance or
|
||||
//! rejection as a change to the system.
|
||||
//! - **Delegation:** The act of granting your voting power to the decisions of another account for
|
||||
//! up to a certain conviction.
|
||||
//!
|
||||
@@ -92,50 +92,50 @@
|
||||
//! - `unlock` - Redetermine the account's balance lock, potentially making tokens available.
|
||||
//!
|
||||
//! Preimage actions:
|
||||
//! - `note_preimage` - Registers the preimage for an upcoming proposal, requires
|
||||
//! a deposit that is returned once the proposal is enacted.
|
||||
//! - `note_preimage` - Registers the preimage for an upcoming proposal, requires a deposit that is
|
||||
//! returned once the proposal is enacted.
|
||||
//! - `note_preimage_operational` - same but provided by `T::OperationalPreimageOrigin`.
|
||||
//! - `note_imminent_preimage` - Registers the preimage for an upcoming proposal.
|
||||
//! Does not require a deposit, but the proposal must be in the dispatch queue.
|
||||
//! - `note_imminent_preimage` - Registers the preimage for an upcoming proposal. Does not require a
|
||||
//! deposit, but the proposal must be in the dispatch queue.
|
||||
//! - `note_imminent_preimage_operational` - same but provided by `T::OperationalPreimageOrigin`.
|
||||
//! - `reap_preimage` - Removes the preimage for an expired proposal. Will only
|
||||
//! work under the condition that it's the same account that noted it and
|
||||
//! after the voting period, OR it's a different account after the enactment period.
|
||||
//! - `reap_preimage` - Removes the preimage for an expired proposal. Will only work under the
|
||||
//! condition that it's the same account that noted it and after the voting period, OR it's a
|
||||
//! different account after the enactment period.
|
||||
//!
|
||||
//! #### Cancellation Origin
|
||||
//!
|
||||
//! This call can only be made by the `CancellationOrigin`.
|
||||
//!
|
||||
//! - `emergency_cancel` - Schedules an emergency cancellation of a referendum.
|
||||
//! Can only happen once to a specific referendum.
|
||||
//! - `emergency_cancel` - Schedules an emergency cancellation of a referendum. Can only happen once
|
||||
//! to a specific referendum.
|
||||
//!
|
||||
//! #### ExternalOrigin
|
||||
//!
|
||||
//! This call can only be made by the `ExternalOrigin`.
|
||||
//!
|
||||
//! - `external_propose` - Schedules a proposal to become a referendum once it is is legal
|
||||
//! for an externally proposed referendum.
|
||||
//! - `external_propose` - Schedules a proposal to become a referendum once it is is legal for an
|
||||
//! externally proposed referendum.
|
||||
//!
|
||||
//! #### External Majority Origin
|
||||
//!
|
||||
//! This call can only be made by the `ExternalMajorityOrigin`.
|
||||
//!
|
||||
//! - `external_propose_majority` - Schedules a proposal to become a majority-carries
|
||||
//! referendum once it is legal for an externally proposed referendum.
|
||||
//! - `external_propose_majority` - Schedules a proposal to become a majority-carries referendum
|
||||
//! once it is legal for an externally proposed referendum.
|
||||
//!
|
||||
//! #### External Default Origin
|
||||
//!
|
||||
//! This call can only be made by the `ExternalDefaultOrigin`.
|
||||
//!
|
||||
//! - `external_propose_default` - Schedules a proposal to become a negative-turnout-bias
|
||||
//! referendum once it is legal for an externally proposed referendum.
|
||||
//! - `external_propose_default` - Schedules a proposal to become a negative-turnout-bias referendum
|
||||
//! once it is legal for an externally proposed referendum.
|
||||
//!
|
||||
//! #### Fast Track Origin
|
||||
//!
|
||||
//! This call can only be made by the `FastTrackOrigin`.
|
||||
//!
|
||||
//! - `fast_track` - Schedules the current externally proposed proposal that
|
||||
//! is "majority-carries" to become a referendum immediately.
|
||||
//! - `fast_track` - Schedules the current externally proposed proposal that is "majority-carries"
|
||||
//! to become a referendum immediately.
|
||||
//!
|
||||
//! #### Veto Origin
|
||||
//!
|
||||
@@ -263,11 +263,12 @@ pub mod pallet {
|
||||
type Currency: ReservableCurrency<Self::AccountId>
|
||||
+ LockableCurrency<Self::AccountId, Moment = Self::BlockNumber>;
|
||||
|
||||
/// The minimum period of locking and the period between a proposal being approved and enacted.
|
||||
/// The minimum period of locking and the period between a proposal being approved and
|
||||
/// enacted.
|
||||
///
|
||||
/// It should generally be a little more than the unstake period to ensure that
|
||||
/// voting stakers have an opportunity to remove themselves from the system in the case where
|
||||
/// they are on the losing side of a vote.
|
||||
/// voting stakers have an opportunity to remove themselves from the system in the case
|
||||
/// where they are on the losing side of a vote.
|
||||
#[pallet::constant]
|
||||
type EnactmentPeriod: Get<Self::BlockNumber>;
|
||||
|
||||
@@ -287,27 +288,27 @@ pub mod pallet {
|
||||
/// "super-majority-required" referendum.
|
||||
type ExternalOrigin: EnsureOrigin<Self::Origin>;
|
||||
|
||||
/// Origin from which the next tabled referendum may be forced; this allows for the tabling of
|
||||
/// a majority-carries referendum.
|
||||
/// Origin from which the next tabled referendum may be forced; this allows for the tabling
|
||||
/// of a majority-carries referendum.
|
||||
type ExternalMajorityOrigin: EnsureOrigin<Self::Origin>;
|
||||
|
||||
/// Origin from which the next tabled referendum may be forced; this allows for the tabling of
|
||||
/// a negative-turnout-bias (default-carries) referendum.
|
||||
/// Origin from which the next tabled referendum may be forced; this allows for the tabling
|
||||
/// of a negative-turnout-bias (default-carries) referendum.
|
||||
type ExternalDefaultOrigin: EnsureOrigin<Self::Origin>;
|
||||
|
||||
/// Origin from which the next majority-carries (or more permissive) referendum may be tabled to
|
||||
/// vote according to the `FastTrackVotingPeriod` asynchronously in a similar manner to the
|
||||
/// emergency origin. It retains its threshold method.
|
||||
/// Origin from which the next majority-carries (or more permissive) referendum may be
|
||||
/// tabled to vote according to the `FastTrackVotingPeriod` asynchronously in a similar
|
||||
/// manner to the emergency origin. It retains its threshold method.
|
||||
type FastTrackOrigin: EnsureOrigin<Self::Origin>;
|
||||
|
||||
/// Origin from which the next majority-carries (or more permissive) referendum may be tabled to
|
||||
/// vote immediately and asynchronously in a similar manner to the emergency origin. It retains
|
||||
/// its threshold method.
|
||||
/// Origin from which the next majority-carries (or more permissive) referendum may be
|
||||
/// tabled to vote immediately and asynchronously in a similar manner to the emergency
|
||||
/// origin. It retains its threshold method.
|
||||
type InstantOrigin: EnsureOrigin<Self::Origin>;
|
||||
|
||||
/// Indicator for whether an emergency origin is even allowed to happen. Some chains may want
|
||||
/// to set this permanently to `false`, others may want to condition it on things such as
|
||||
/// an upgrade having happened recently.
|
||||
/// Indicator for whether an emergency origin is even allowed to happen. Some chains may
|
||||
/// want to set this permanently to `false`, others may want to condition it on things such
|
||||
/// as an upgrade having happened recently.
|
||||
#[pallet::constant]
|
||||
type InstantAllowed: Get<bool>;
|
||||
|
||||
@@ -446,8 +447,8 @@ pub mod pallet {
|
||||
|
||||
/// True if the last referendum tabled was submitted externally. False if it was a public
|
||||
/// proposal.
|
||||
// TODO: There should be any number of tabling origins, not just public and "external" (council).
|
||||
// https://github.com/paritytech/substrate/issues/5322
|
||||
// TODO: There should be any number of tabling origins, not just public and "external"
|
||||
// (council). https://github.com/paritytech/substrate/issues/5322
|
||||
#[pallet::storage]
|
||||
pub type LastTabledWasExternal<T> = StorageValue<_, bool, ValueQuery>;
|
||||
|
||||
@@ -508,7 +509,8 @@ pub mod pallet {
|
||||
pub enum Event<T: Config> {
|
||||
/// A motion has been proposed by a public account. \[proposal_index, deposit\]
|
||||
Proposed(PropIndex, BalanceOf<T>),
|
||||
/// A public proposal has been tabled for referendum vote. \[proposal_index, deposit, depositors\]
|
||||
/// A public proposal has been tabled for referendum vote. \[proposal_index, deposit,
|
||||
/// depositors\]
|
||||
Tabled(PropIndex, BalanceOf<T>, Vec<T::AccountId>),
|
||||
/// An external proposal has been tabled.
|
||||
ExternalTabled,
|
||||
@@ -824,7 +826,8 @@ pub mod pallet {
|
||||
delay: T::BlockNumber,
|
||||
) -> DispatchResult {
|
||||
// Rather complicated bit of code to ensure that either:
|
||||
// - `voting_period` is at least `FastTrackVotingPeriod` and `origin` is `FastTrackOrigin`; or
|
||||
// - `voting_period` is at least `FastTrackVotingPeriod` and `origin` is
|
||||
// `FastTrackOrigin`; or
|
||||
// - `InstantAllowed` is `true` and `origin` is `InstantOrigin`.
|
||||
let maybe_ensure_instant = if voting_period < T::FastTrackVotingPeriod::get() {
|
||||
Some(origin)
|
||||
@@ -932,8 +935,8 @@ pub mod pallet {
|
||||
/// - `to`: The account whose voting the `target` account's voting power will follow.
|
||||
/// - `conviction`: The conviction that will be attached to the delegated votes. When the
|
||||
/// account is undelegated, the funds will be locked for the corresponding period.
|
||||
/// - `balance`: The amount of the account's balance to be used in delegating. This must
|
||||
/// not be more than the account's current balance.
|
||||
/// - `balance`: The amount of the account's balance to be used in delegating. This must not
|
||||
/// be more than the account's current balance.
|
||||
///
|
||||
/// Emits `Delegated`.
|
||||
///
|
||||
@@ -1035,8 +1038,9 @@ pub mod pallet {
|
||||
encoded_proposal: Vec<u8>,
|
||||
) -> DispatchResultWithPostInfo {
|
||||
Self::note_imminent_preimage_inner(ensure_signed(origin)?, encoded_proposal)?;
|
||||
// We check that this preimage was not uploaded before in `note_imminent_preimage_inner`,
|
||||
// thus this call can only be successful once. If successful, user does not pay a fee.
|
||||
// We check that this preimage was not uploaded before in
|
||||
// `note_imminent_preimage_inner`, thus this call can only be successful once. If
|
||||
// successful, user does not pay a fee.
|
||||
Ok(Pays::No.into())
|
||||
}
|
||||
|
||||
@@ -1051,8 +1055,9 @@ pub mod pallet {
|
||||
) -> DispatchResultWithPostInfo {
|
||||
let who = T::OperationalPreimageOrigin::ensure_origin(origin)?;
|
||||
Self::note_imminent_preimage_inner(who, encoded_proposal)?;
|
||||
// We check that this preimage was not uploaded before in `note_imminent_preimage_inner`,
|
||||
// thus this call can only be successful once. If successful, user does not pay a fee.
|
||||
// We check that this preimage was not uploaded before in
|
||||
// `note_imminent_preimage_inner`, thus this call can only be successful once. If
|
||||
// successful, user does not pay a fee.
|
||||
Ok(Pays::No.into())
|
||||
}
|
||||
|
||||
@@ -1061,8 +1066,8 @@ pub mod pallet {
|
||||
/// The dispatch origin of this call must be _Signed_.
|
||||
///
|
||||
/// - `proposal_hash`: The preimage hash of a proposal.
|
||||
/// - `proposal_length_upper_bound`: an upper bound on length of the proposal.
|
||||
/// Extrinsic is weighted according to this value with no refund.
|
||||
/// - `proposal_length_upper_bound`: an upper bound on length of the proposal. Extrinsic is
|
||||
/// weighted according to this value with no refund.
|
||||
///
|
||||
/// This will only work after `VotingPeriod` blocks from the time that the preimage was
|
||||
/// noted, if it's the same account doing it. If it's a different account, then it'll only
|
||||
@@ -1620,11 +1625,10 @@ impl<T: Config> Pallet<T> {
|
||||
/// Table the waiting public proposal with the highest backing for a vote.
|
||||
fn launch_public(now: T::BlockNumber) -> DispatchResult {
|
||||
let mut public_props = Self::public_props();
|
||||
if let Some((winner_index, _)) = public_props.iter()
|
||||
.enumerate()
|
||||
.max_by_key(|x| Self::backing_for((x.1).0).unwrap_or_else(Zero::zero)
|
||||
/* ^^ defensive only: All current public proposals have an amount locked*/)
|
||||
{
|
||||
if let Some((winner_index, _)) = public_props.iter().enumerate().max_by_key(
|
||||
// defensive only: All current public proposals have an amount locked
|
||||
|x| Self::backing_for((x.1).0).unwrap_or_else(Zero::zero),
|
||||
) {
|
||||
let (prop_index, proposal, _) = public_props.swap_remove(winner_index);
|
||||
<PublicProps<T>>::put(public_props);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user