Trait Config

Source
pub trait Config:
    Config
    + Config
    + Config
    + Config
    + Config
    + Config
    + CreateSignedTransaction<<Self as Config>::RuntimeCall> {
Show 21 associated items type RuntimeCall: From<Call<Self>> + Into<<Self as Config>::RuntimeCall>; type RuntimeEvent: From<Event<Self>> + IsType<<Self as Config>::RuntimeEvent>; type RoleAdapter: RoleManager<AuthorOf<Self>> + CompensateRoles<AuthorOf<Self>, Ratio = PenaltyRatio> + FundRoles<AuthorOf<Self>>; type ElectionAdapter: ElectionManager<AuthorOf<Self>> + InspectWeight<AuthorOf<Self>, ElectionVia<Self>>; type Asset: Inspect<AuthorOf<Self>, Balance = AssetOf<Self>> + Mutate<AuthorOf<Self>>; type PointsAdapter: AuthorPoints<AuthorOf<Self>, Self::Points>; type NextSessionRotation: EstimateNextSessionRotation<BlockNumberFor<Self>>; type AffidavitCrypto: AppCrypto<Self::Public, Self::Signature>; type Points: Countable; type InflationModel: PurePluginModel<AssetOf<Self>, <Self::InflationContext as ModelContext>::Context, AssetOf<Self>> + Default; type InflationContext: ModelContext; type RewardModel: PurePluginModel<(AssetOf<Self>, PayoutFor<Self>), <Self::RewardContext as ModelContext>::Context, PayeeList<Self>> + Default; type RewardContext: ModelContext; type PenaltyModel: PurePluginModel<PenaltyFor<Self>, <Self::PenaltyContext as ModelContext>::Context, PenaltyFor<Self>> + Default; type PenaltyContext: ModelContext; type WeightInfo: WeightInfo; type InflateViaSupply: Get<bool> + Clone + Debug; type MaxAffidavitWeights: Get<u32> + Clone + Debug; type EmitEvents: Get<bool> + Clone + Debug; const MAX_FORKS: u32; const MAX_FORK_RECOVERY_TRAVERSAL: u32;
}
Expand description

Configuration trait of this pallet.

The main purpose of this trait is to act as an interface between this pallet and the runtime in which it is embedded in. A type, function, or constant in this trait is essentially left to be configured by the runtime that includes this pallet.

Consequently, a runtime that wants to include this pallet must implement this trait. Configuration trait for the Chain Manager pallet.

This trait defines the types, constants, and dependencies that the runtime must provide for this pallet to function.

It extends several other FRAME pallets’ Config traits, ensuring tight integration with Substrate’s session, authorship, time-management and offence-handling subsystems.

§Dependencies

Dependencies other than [frame_system::Config]:

  • [pallet_authorship::Config]: Provides access to the current block author and authorship tracking, used to assign and record block production points.
  • [pallet_offences::Config]: Enables detection and handling of offences for misbehaving authors, required for penalty enforcement.
  • [pallet_session::Config]: Manages session rotation and validator/author sets; supports session-aware election and reward cycles.
  • [pallet_session::historical::Config]: Provides access to historical session data for offence handling.
  • [pallet_timestamp::Config] : Provides access to a monotonic deterministic onchain unix timestamp.
  • [frame_system::offchain::CreateSignedTransaction]: Enables offchain workers to sign and submit transactions. Required for unsigned extrinsics that rely on signed payload verification ([ValidateUnsigned]).

Required Associated Constants§

Required Associated Types§

Source

type RuntimeCall: From<Call<Self>> + Into<<Self as Config>::RuntimeCall>

Extrinsic calls aggregation type for the runtime.

Source

type RuntimeEvent: From<Event<Self>> + IsType<<Self as Config>::RuntimeEvent>

Events aggregation type for the runtime.

Source

type RoleAdapter: RoleManager<AuthorOf<Self>> + CompensateRoles<AuthorOf<Self>, Ratio = PenaltyRatio> + FundRoles<AuthorOf<Self>>

Adapter type for author role, and compensation management.

This associated type integrates multiple traits that together define how authors are managed, rewarded, and funded.

It acts as a unified interface between this pallet and the underlying role-management, and reward systems.

§Required Traits
  • RoleManager: Core author management - handles registration and membership.
  • CompensateRoles: Defines logic for author rewards and penalties.
  • FundRoles: Enables external funding or backing mechanisms for authors.
Source

type ElectionAdapter: ElectionManager<AuthorOf<Self>> + InspectWeight<AuthorOf<Self>, ElectionVia<Self>>

Adapter type for role author election management system.

This associated type integrates multiple traits that together define how authors are elected.

§Required Traits
Source

type Asset: Inspect<AuthorOf<Self>, Balance = AssetOf<Self>> + Mutate<AuthorOf<Self>>

The asset type used for distributing rewards and penalties.

This represents a fungible unit (e.g., a token balance) over which the pallet performs reward, penalty, and funding operations.

§Requirements
  • Must implement [Inspect], enabling the pallet to query and verify account balances or holdings of authors.
§Example
type Asset = pallet_assets::Pallet<T>;
Source

type PointsAdapter: AuthorPoints<AuthorOf<Self>, Self::Points>

Adapter for managing and querying author points.

Provides the implementation for tracking points (e.g., block production or performance metrics) associated with each author.

This can be set to Pallet<Self> if using the chain-manager pallet’s internal implementation, or provided externally via another pallet or adapter.

Source

type NextSessionRotation: EstimateNextSessionRotation<BlockNumberFor<Self>>

Provides the logic to estimate the length of the next session.

Used to compute

  • affidavit submission windows,
  • election start blocks, and
  • session timing.
Source

type AffidavitCrypto: AppCrypto<Self::Public, Self::Signature>

Custom application crypto for affidavit submission and rotation.

Defines the cryptographic scheme used by offchain workers when submitting and rotating affidavits. This associated type creates a dedicated KeyId namespace for affidavit-related operations.

§Supported Cryptography

Either scheme may be used depending on the desired security and performance characteristics.

Source

type Points: Countable

Type representing good-behaviour points accumulated by an author.

This is an abstract point type used to measure good behaviour (e.g. block production) within a session.

§Design Notes
  • Points are session-scoped and non-transferable.
  • This is not an economic asset.
  • Points are interpreted later by reward and penalty logic and may be transformed into actual asset movements.
Source

type InflationModel: PurePluginModel<AssetOf<Self>, <Self::InflationContext as ModelContext>::Context, AssetOf<Self>> + Default

Inflation adjustment plugin model.

This model defines the logic used to transform the raw total asset (AssetOf) into an inflation-adjusted payout before distribution to authors.

Conceptually similar to PayoutModel in RewardAuthors, but focused specifically on inflation-based adjustments in a more layman-friendly abstraction.

§Input
  • AssetOf: The raw total asset for the current cycle.
§Output
  • AssetOf: The total asset after applying inflation rules.

Designed to be runtime-configurable via Self::InflationContext.

Designed to be selectable using template plugin models in frame_plugins::rewards::payout or custom model defining macros via frame_suite::plugins.

Source

type InflationContext: ModelContext

Runtime context for the inflation adjustment plugin model.

Provides configurable parameters that influence how the Self::InflationModel behaves at runtime.

§Examples
  • Inflation rates
  • Upper or lower payout caps
  • Scaling coefficients or dampening factors

This allows the inflation logic to be tuned without changing the model implementation itself.

Source

type RewardModel: PurePluginModel<(AssetOf<Self>, PayoutFor<Self>), <Self::RewardContext as ModelContext>::Context, PayeeList<Self>> + Default

Per-author reward distribution plugin model.

Responsible for mapping each author’s contribution to a concrete payout. Conceptually performs:

(Author, Points) -> (Author, AssetOf)

§Input
  • (AssetOf, PayoutFor): The total payout for the cycle and the per-author points allocation.
§Output
  • PayeeList: The finalized list of authors and their respective rewards.
§Notes
  • Maps each author’s points to their final reward share.
  • Designed to be runtime-configurable via Self::RewardContext.

Designed to be selectable using template plugin models in frame_plugins::rewards::payee or custom model defining macros via frame_suite::plugins.

Source

type RewardContext: ModelContext

Runtime context for configuring reward plugin computation.

Supplies parameters that influence how rewards are calculated and distributed by the Self::RewardModel.

§Examples
  • Multipliers or weights
  • Per-author or global caps
  • Curves, thresholds, or smoothing factors

This separation allows payout logic to evolve independently from runtime tuning and governance decisions.

Source

type PenaltyModel: PurePluginModel<PenaltyFor<Self>, <Self::PenaltyContext as ModelContext>::Context, PenaltyFor<Self>> + Default

Penalty transformation plugin model.

Defines how author penalties are adjusted before being applied. Conceptually performs:

(Author, Penalty) -> (Author, Penalty)

§Input
  • PenaltyFor: The raw per-author penalties for the current cycle.
§Output
  • PenaltyFor: The penalties after applying transformation rules.
§Notes
  • Supports caps, scaling, or other penalty transformation logic.
  • Runtime behavior is influenced by Self::PenaltyContext.

Designed to be selectable using template plugin models in frame_plugins::penalty or custom model defining macros via frame_suite::plugins.

Source

type PenaltyContext: ModelContext

Runtime context for penalty plugin transformation.

Supplies parameters that configure how the Self::PenaltyModel operates at runtime.

§Examples
  • Multipliers or dampening factors
  • Upper or lower penalty caps
  • Thresholds or step functions

This allows penalty policy changes without modifying the model implementation.

Source

type WeightInfo: WeightInfo

Weight information for extrinsics in this pallet.

Source

type InflateViaSupply: Get<bool> + Clone + Debug

Flag for reward inflation model.

Determines how the total reward pool is computed:

  • true: total asset supply is used to calculate inflation/rewards.
  • false: total locked stake of authors is used instead.

This allows flexible reward strategies depending on economic design.

Source

type MaxAffidavitWeights: Get<u32> + Clone + Debug

Maximum number of weights an author can submit in an affidavit.

Weight represents backers or collateral information essential for conducting elections.

Limits storage and ensures predictable handling of submitted affidavits. If an author submits more than this number, the weights may be truncated.

Each weight must remain sortable (Ord) for ensuring priority ordering during truncation to this upper bound.

Source

type EmitEvents: Get<bool> + Clone + Debug

Controls emission of Event via deposit_event.

Recommended:

  • false for production runtimes (to reduce overhead)
  • true for development and mock runtimes (for testing and observability)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§