Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Add missing #[pallet::constant] annotations to pallets (#9367)
Browse files Browse the repository at this point in the history
fixing #9306
  • Loading branch information
hirschenberger authored Jul 18, 2021
1 parent 5f992bd commit 0803f7d
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 0 deletions.
5 changes: 5 additions & 0 deletions frame/assets/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,19 +189,24 @@ pub mod pallet {
type ForceOrigin: EnsureOrigin<Self::Origin>;

/// The basic amount of funds that must be reserved for an asset.
#[pallet::constant]
type AssetDeposit: Get<DepositBalanceOf<Self, I>>;

/// The basic amount of funds that must be reserved when adding metadata to your asset.
#[pallet::constant]
type MetadataDepositBase: Get<DepositBalanceOf<Self, I>>;

/// The additional funds that must be reserved for the number of bytes you store in your
/// metadata.
#[pallet::constant]
type MetadataDepositPerByte: Get<DepositBalanceOf<Self, I>>;

/// The amount of funds that must be reserved when creating a new approval.
#[pallet::constant]
type ApprovalDeposit: Get<DepositBalanceOf<Self, I>>;

/// The maximum length of a name or symbol stored on-chain.
#[pallet::constant]
type StringLimit: Get<u32>;

/// A hook to allow a per-asset, per-account minimum balance to be enforced. This must be
Expand Down
1 change: 1 addition & 0 deletions frame/atomic-swap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ pub mod pallet {
/// If B sees A is on a blockchain with larger proof length limit, then it should kindly refuse
/// to accept the atomic swap request if A generates the proof, and asks that B generates the
/// proof instead.
#[pallet::constant]
type ProofLimit: Get<u32>;
}

Expand Down
1 change: 1 addition & 0 deletions frame/authorship/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ pub mod pallet {
/// The number of blocks back we should accept uncles.
/// This means that we will deal with uncle-parents that are
/// `UncleGenerations + 1` before `now`.
#[pallet::constant]
type UncleGenerations: Get<Self::BlockNumber>;
/// A filter for uncles within a block. This is for implementing
/// further constraints on what uncles can be included, other than their ancestry.
Expand Down
2 changes: 2 additions & 0 deletions frame/balances/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,11 @@ pub mod pallet {

/// The maximum number of locks that should exist on an account.
/// Not strictly enforced, but used for weight estimation.
#[pallet::constant]
type MaxLocks: Get<u32>;

/// The maximum number of named reserves that can exist on an account.
#[pallet::constant]
type MaxReserves: Get<u32>;

/// The id type for named reserves.
Expand Down
2 changes: 2 additions & 0 deletions frame/democracy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ pub mod pallet {
/// 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>;

/// Minimum voting period allowed for a fast-track referendum.
Expand Down Expand Up @@ -355,6 +356,7 @@ pub mod pallet {
type WeightInfo: WeightInfo;

/// The maximum number of public proposals that can exist at any time.
#[pallet::constant]
type MaxProposals: Get<u32>;
}

Expand Down
4 changes: 4 additions & 0 deletions frame/election-provider-multi-phase/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -587,15 +587,18 @@ pub mod pallet {
type OffchainRepeat: Get<Self::BlockNumber>;

/// The priority of the unsigned transaction submitted in the unsigned-phase
#[pallet::constant]
type MinerTxPriority: Get<TransactionPriority>;
/// Maximum number of iteration of balancing that will be executed in the embedded miner of
/// the pallet.
#[pallet::constant]
type MinerMaxIterations: Get<u32>;

/// Maximum weight that the miner should consume.
///
/// The miner will ensure that the total weight of the unsigned solution will not exceed
/// this value, based on [`WeightInfo::submit_unsigned`].
#[pallet::constant]
type MinerMaxWeight: Get<Weight>;

/// Maximum number of signed submissions that can be queued.
Expand Down Expand Up @@ -640,6 +643,7 @@ pub mod pallet {
///
/// The miner will ensure that the total length of the unsigned solution will not exceed
/// this value.
#[pallet::constant]
type MinerMaxLength: Get<u32>;

/// Something that will provide the election data.
Expand Down
1 change: 1 addition & 0 deletions frame/gilt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ pub mod pallet {

/// The issuance to ignore. This is subtracted from the `Currency`'s `total_issuance` to get
/// the issuance by which we inflate or deflate the gilt.
#[pallet::constant]
type IgnoredIssuance: Get<BalanceOf<Self>>;

/// Number of duration queues in total. This sets the maximum duration supported, which is
Expand Down
1 change: 1 addition & 0 deletions frame/im-online/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ pub mod pallet {
///
/// This is exposed so that it can be tuned for particular runtime, when
/// multiple pallets send unsigned transactions.
#[pallet::constant]
type UnsignedPriority: Get<TransactionPriority>;

/// Weight information for extrinsics in this pallet.
Expand Down
1 change: 1 addition & 0 deletions frame/lottery/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ pub mod pallet {
/// Number of time we should try to generate a random number that has no modulo bias.
/// The larger this number, the more potential computation is used for picking the winner,
/// but also the more likely that the chosen winner is done fairly.
#[pallet::constant]
type MaxGenerateRandom: Get<u32>;

/// Weight information for extrinsics in this pallet.
Expand Down
2 changes: 2 additions & 0 deletions frame/scheduler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,15 @@ pub mod pallet {

/// The maximum weight that may be scheduled per block for any dispatchables of less priority
/// than `schedule::HARD_DEADLINE`.
#[pallet::constant]
type MaximumWeight: Get<Weight>;

/// Required origin to schedule or cancel calls.
type ScheduleOrigin: EnsureOrigin<<Self as system::Config>::Origin>;

/// The maximum number of scheduled calls in the queue for a single block.
/// Not strictly enforced, but used for weight estimation.
#[pallet::constant]
type MaxScheduledPerBlock: Get<u32>;

/// Weight information for extrinsics in this pallet.
Expand Down
2 changes: 2 additions & 0 deletions frame/scored-pool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,12 @@ pub mod pallet {
// The deposit which is reserved from candidates if they want to
// start a candidacy. The deposit gets returned when the candidacy is
// withdrawn or when the candidate is kicked.
#[pallet::constant]
type CandidateDeposit: Get<BalanceOf<Self, I>>;

/// Every `Period` blocks the `Members` are filled with the highest scoring
/// members in the `Pool`.
#[pallet::constant]
type Period: Get<Self::BlockNumber>;

/// The receiver of the signal for when the membership has been initialized.
Expand Down
1 change: 1 addition & 0 deletions frame/treasury/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ pub mod pallet {
type SpendFunds: SpendFunds<Self, I>;

/// The maximum number of approvals that can wait in the spending queue.
#[pallet::constant]
type MaxApprovals: Get<u32>;
}

Expand Down
8 changes: 8 additions & 0 deletions frame/uniques/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,28 +79,36 @@ pub mod pallet {
type ForceOrigin: EnsureOrigin<Self::Origin>;

/// The basic amount of funds that must be reserved for an asset class.
#[pallet::constant]
type ClassDeposit: Get<DepositBalanceOf<Self, I>>;

/// The basic amount of funds that must be reserved for an asset instance.
#[pallet::constant]
type InstanceDeposit: Get<DepositBalanceOf<Self, I>>;

/// The basic amount of funds that must be reserved when adding metadata to your asset.
#[pallet::constant]
type MetadataDepositBase: Get<DepositBalanceOf<Self, I>>;

/// The basic amount of funds that must be reserved when adding an attribute to an asset.
#[pallet::constant]
type AttributeDepositBase: Get<DepositBalanceOf<Self, I>>;

/// The additional funds that must be reserved for the number of bytes store in metadata,
/// either "normal" metadata or attribute metadata.
#[pallet::constant]
type DepositPerByte: Get<DepositBalanceOf<Self, I>>;

/// The maximum length of data stored on-chain.
#[pallet::constant]
type StringLimit: Get<u32>;

/// The maximum length of an attribute key.
#[pallet::constant]
type KeyLimit: Get<u32>;

/// The maximum length of an attribute value.
#[pallet::constant]
type ValueLimit: Get<u32>;

/// Weight information for extrinsics in this pallet.
Expand Down

0 comments on commit 0803f7d

Please sign in to comment.