Trait pallet_nomination_pools::pallet::Config
source · pub trait Config: Config {
type RuntimeEvent: From<Event<Self>> + IsType<<Self as Config>::RuntimeEvent>;
type WeightInfo: WeightInfo;
type Currency: Currency<Self::AccountId>;
type RewardCounter: FixedPointNumber + MaxEncodedLen + TypeInfo + Default + FullCodec;
type PalletId: Get<PalletId>;
type MaxPointsToBalance: Get<u8>;
type BalanceToU256: Convert<BalanceOf<Self>, U256>;
type U256ToBalance: Convert<U256, BalanceOf<Self>>;
type Staking: StakingInterface<Balance = BalanceOf<Self>, AccountId = Self::AccountId>;
type PostUnbondingPoolsWindow: Get<u32>;
type MaxMetadataLen: Get<u32>;
type MaxUnbonding: Get<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.
Required Associated Types§
sourcetype RuntimeEvent: From<Event<Self>> + IsType<<Self as Config>::RuntimeEvent>
type RuntimeEvent: From<Event<Self>> + IsType<<Self as Config>::RuntimeEvent>
The overarching event type.
sourcetype WeightInfo: WeightInfo
type WeightInfo: WeightInfo
Weight information for extrinsics in this pallet.
sourcetype RewardCounter: FixedPointNumber + MaxEncodedLen + TypeInfo + Default + FullCodec
type RewardCounter: FixedPointNumber + MaxEncodedLen + TypeInfo + Default + FullCodec
The type that is used for reward counter.
The arithmetic of the reward counter might saturate based on the size of the
Currency::Balance
. If this happens, operations fails. Nonetheless, this type should be
chosen such that this failure almost never happens, as if it happens, the pool basically
needs to be dismantled (or all pools migrated to a larger RewardCounter
type, which is
a PITA to do).
See the inline code docs of Member::pending_rewards
and RewardPool::update_recorded
for example analysis. A sp_runtime::FixedU128
should be fine for chains with balance
types similar to that of Polkadot and Kusama, in the absence of severe slashing (or
prevented via a reasonable MaxPointsToBalance
), for many many years to come.
sourcetype MaxPointsToBalance: Get<u8>
type MaxPointsToBalance: Get<u8>
The maximum pool points-to-balance ratio that an open
pool can have.
This is important in the event slashing takes place and the pool’s points-to-balance ratio becomes disproportional.
Moreover, this relates to the RewardCounter
type as well, as the arithmetic operations
are a function of number of points, and by setting this value to e.g. 10, you ensure
that the total number of points in the system are at most 10 times the total_issuance of
the chain, in the absolute worse case.
For a value of 10, the threshold would be a pool points-to-balance ratio of 10:1. Such a scenario would also be the equivalent of the pool being 90% slashed.
sourcetype BalanceToU256: Convert<BalanceOf<Self>, U256>
type BalanceToU256: Convert<BalanceOf<Self>, U256>
Infallible method for converting Currency::Balance
to U256
.
sourcetype U256ToBalance: Convert<U256, BalanceOf<Self>>
type U256ToBalance: Convert<U256, BalanceOf<Self>>
Infallible method for converting U256
to Currency::Balance
.
sourcetype Staking: StakingInterface<Balance = BalanceOf<Self>, AccountId = Self::AccountId>
type Staking: StakingInterface<Balance = BalanceOf<Self>, AccountId = Self::AccountId>
The interface for nominating.
sourcetype PostUnbondingPoolsWindow: Get<u32>
type PostUnbondingPoolsWindow: Get<u32>
The amount of eras a SubPools::with_era
pool can exist before it gets merged into the
SubPools::no_era
pool. In other words, this is the amount of eras a member will be
able to withdraw from an unbonding pool which is guaranteed to have the correct ratio of
points to balance; once the with_era
pool is merged into the no_era
pool, the ratio
can become skewed due to some slashed ratio getting merged in at some point.
sourcetype MaxMetadataLen: Get<u32>
type MaxMetadataLen: Get<u32>
The maximum length, in bytes, that a pools metadata maybe.
sourcetype MaxUnbonding: Get<u32>
type MaxUnbonding: Get<u32>
The maximum number of simultaneous unbonding chunks that can exist per member.