Expand description
§Origin restriction pallet and transaction extension
This pallet tracks certain origin and limits how much total “fee usage” they can accumulate. Usage gradually recovers as blocks pass.
First the entity is extracted from the restricted origin, the entity represents the granularity of usage tracking.
For example, an origin like DaoOrigin { name: [u8; 8], tally: Percent }
can have its usage tracked and restricted at the DAO level, so the tracked entity would be
DaoEntity { name: [u8; 8] }
. This ensures that usage restrictions apply to the DAO as a whole,
independent of any particular voter percentage.
Then when dispatching a transaction, if the entity’s new usage would exceed its max allowance,
the transaction is invalid, except if the call is in the set of calls permitted to exceed that
limit (see OperationAllowedOneTimeExcess
). In that case, as long as the entity’s usage prior
to dispatch was zero, the transaction is valid (with respect to usage). If the entity’s
usage is already above the limit, the transaction is always invalid. After dispatch, any call
flagged as Pays::No
fully restores the consumed usage.
To expand on OperationAllowedOneTimeExcess
, user have to wait for the usage to completely
recover to zero before being able to do an operation that exceed max allowance.
Re-exports§
pub use weights::WeightInfo;
pub use pallet::*;
Modules§
- pallet
- The
pallet
module in each FRAME pallet hosts the most important items needed to construct this pallet. - weights
Structs§
- Allowance
- The allowance for an entity, defining its usage limit and recovery rate.
- Restrict
Origin - This transaction extension restricts some origins and prevents them from dispatching calls, based on their usage and allowance.
Enums§
- Pre
- The info passed between the prepare and post-dispatch steps for the
RestrictOrigins
extension. - Val
- The info passed between the validate and prepare steps for the
RestrictOrigins
extension.
Traits§
- Restricted
Entity - The restriction of an entity.