Trait Config

Source
pub trait Config: Config {
Show 14 associated items type RuntimeEvent: From<Event<Self>> + IsType<<Self as Config>::RuntimeEvent>; type AssetFreeze: From<FreezeReason> + RuntimeEnum + Delimited + Copy + VariantCount; type Influence: Balance + From<AuthorAsset<Self>>; type Asset: Inspect<Author<Self>, Balance = <Self::CommitmentAdapter as InspectAsset<Author<Self>>>::Asset> + Mutate<Author<Self>> + UnbalancedHold<Author<Self>>; type CommitmentAdapter: Commitment<Author<Self>, Reason = Self::AssetFreeze, DigestSource = Author<Self>, Digest: Ord> + CommitIndex<Author<Self>> + CommitPool<Author<Self>> + InspectAsset<Author<Self>>; type ActivityProvider: RoleActivity<Author<Self>, BlockNumberFor<Self>>; type InfluenceModel: PurePluginModel<AuthorAsset<Self>, <Self::InfluenceContext as ModelContext>::Context, Self::Influence> + Default; type InfluenceContext: ModelContext; type FlatElectionModel: PurePluginModel<ElectViaInfluence<Self>, <Self::FlatElectionContext as ModelContext>::Context, ElectedAuthors<Self>> + Default; type FlatElectionContext: ModelContext; type FairElectionModel: PurePluginModel<ElectViaBacking<Self>, <Self::FairElectionContext as ModelContext>::Context, ElectedAuthors<Self>> + Default; type FairElectionContext: ModelContext; type WeightInfo: WeightInfo; type EmitEvents: Get<bool> + Clone + Debug;
}
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 Authors pallet.

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

Required Associated Types§

Source

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

The overarching event type for this pallet.

Allows the Authors pallet to emit events into the runtime event system, e.g., when authors are rewarded, penalized, or change status.

Source

type AssetFreeze: From<FreezeReason> + RuntimeEnum + Delimited + Copy + VariantCount

Type representing reason for freezing assets.

Converts from the pallet-level FreezeReason enum and is used by the CommitmentAdapter to distinguish between different frozen asset categories.

Source

type Influence: Balance + From<AuthorAsset<Self>>

Represents the computed influence of an entity (author, account, etc.).

Influence is derived from a raw backing asset (stake, tokens, or other measure) and is used as the primary metric for calculating an author’s influence over others.

Must implement a unsigned numeric type and support conversion from the raw fungible asset.

Source

type Asset: Inspect<Author<Self>, Balance = <Self::CommitmentAdapter as InspectAsset<Author<Self>>>::Asset> + Mutate<Author<Self>> + UnbalancedHold<Author<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_balances::Pallet<T>;
Source

type CommitmentAdapter: Commitment<Author<Self>, Reason = Self::AssetFreeze, DigestSource = Author<Self>, Digest: Ord> + CommitIndex<Author<Self>> + CommitPool<Author<Self>> + InspectAsset<Author<Self>>

Commitment trait adapter for managing authors’ external fundings, assets and digests.

This type implements multiple traits:

Provides the core mechanism for holding and tracking author funds.

Source

type ActivityProvider: RoleActivity<Author<Self>, BlockNumberFor<Self>>

Activity provider for authors, defining hooks or queries related to an author’s participation and behavior within the runtime.

This type allows the Authors pallet to expose author activity to other pallets that rely on author role participation.

In essence, it provides a standardized, pluggable interface for cross-pallet activity tracking.

Source

type InfluenceModel: PurePluginModel<AuthorAsset<Self>, <Self::InfluenceContext as ModelContext>::Context, Self::Influence> + Default

Influence computation plugin model.

Influence is a derived, comparable value used in influence-based systems such as elections, ranking, scoring, or governance decisions.

Encapsulates the logic that transforms a raw asset value into an influence metric.

Conceptually performs:

AuthorAsset -> Influence

The specific transformation semantics are entirely defined by the selected model.

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

Source

type InfluenceContext: ModelContext

Plugin model context for influence computation.

Supplies parameters that configure how the Self::InfluenceModel behaves at runtime.

This context enables dynamic tuning of influence policies via governance or configuration, without modifying the model implementation or pallet logic.

Must match the context type expected by the selected Self::InfluenceModel.

Source

type FlatElectionModel: PurePluginModel<ElectViaInfluence<Self>, <Self::FlatElectionContext as ModelContext>::Context, ElectedAuthors<Self>> + Default

Flat election plugin model.

Encapsulates the election logic that operates on influence values to determine the final set of elected candidates.

Conceptually performs:

[(Author, Influence)] -> [Author]

The model is expected to return elected candidates in priority order, as the runtime may truncate the result using MaxElected or ForceMaxElected.

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

Source

type FlatElectionContext: ModelContext

Plugin model context for flat election computation.

Supplies parameters that configure how the Self::FlatElectionModel behaves at runtime.

Enables dynamic tuning of election policies without modifying the model implementation or pallet logic.

Must match the context type expected by the selected Self::FlatElectionModel.

Source

type FairElectionModel: PurePluginModel<ElectViaBacking<Self>, <Self::FairElectionContext as ModelContext>::Context, ElectedAuthors<Self>> + Default

Fair election plugin model.

Encapsulates the election logic that operates on individual backing contributions to determine the final set of elected candidates.

Conceptually performs:

[(Author, [(Backer, Weight)])] -> [Author]

The model is expected to return elected candidates in priority order, as the runtime may truncate the result using MaxElected or ForceMaxElected.

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

Source

type FairElectionContext: ModelContext

Plugin model context for fair election computation.

Supplies parameters that configure how the Self::FairElectionModel behaves at runtime.

Enables dynamic tuning of election policies without modifying the model implementation or pallet logic.

Must match the context type expected by the selected Self::FairElectionModel.

Source

type WeightInfo: WeightInfo

Weight information for extrinsics in this pallet.

Source

type EmitEvents: Get<bool> + Clone + Debug

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§