referrerpolicy=no-referrer-when-downgrade

Trait pallet_bridge_grandpa::pallet::Config

source ·
pub trait Config<I: 'static = ()>: Config {
    type RuntimeEvent: From<Event<Self, I>> + IsType<<Self as Config>::RuntimeEvent>;
    type BridgedChain: ChainWithGrandpa;
    type MaxFreeHeadersPerBlock: Get<u32>;
    type FreeHeadersInterval: Get<Option<u32>>;
    type HeadersToKeep: Get<u32>;
    type WeightInfo: WeightInfoExt;
}
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§

source

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

The overarching event type.

source

type BridgedChain: ChainWithGrandpa

The chain we are bridging to here.

source

type MaxFreeHeadersPerBlock: Get<u32>

Maximal number of “free” header transactions per block.

To be able to track the bridged chain, the pallet requires all headers that are changing GRANDPA authorities set at the bridged chain (we call them mandatory). So it is a common good deed to submit mandatory headers to the pallet.

The pallet may be configured (see [Self::FreeHeadersInterval]) to import some non-mandatory headers for free as well. It also may be treated as a common good deed, because it may help to reduce bridge fees - this cost may be deducted from bridge fees, paid by message senders.

However, if the bridged chain gets compromised, its validators may generate as many “free” headers as they want. And they may fill the whole block (at this chain) for free. This constant limits number of calls that we may refund in a single block. All calls above this limit are accepted, but are not refunded.

source

type FreeHeadersInterval: Get<Option<u32>>

The distance between bridged chain headers, that may be submitted for free. The first free header is header number zero, the next one is header number FreeHeadersInterval::get() or any of its descendant if that header has not been submitted. In other words, interval between free headers should be at least FreeHeadersInterval.

source

type HeadersToKeep: Get<u32>

Maximal number of finalized headers to keep in the storage.

The setting is there to prevent growing the on-chain state indefinitely. Note the setting does not relate to block numbers - we will simply keep as much items in the storage, so it doesn’t guarantee any fixed timeframe for finality headers.

Incautious change of this constant may lead to orphan entries in the runtime storage.

source

type WeightInfo: WeightInfoExt

Weights gathered through benchmarking.

Object Safety§

This trait is not object safe.

Implementors§