referrerpolicy=no-referrer-when-downgrade

Trait pallet_bridge_parachains::pallet::Config

source ·
pub trait Config<I: 'static = ()>: BoundedBridgeGrandpaConfig<Self::BridgesGrandpaPalletInstance> {
    type RuntimeEvent: From<Event<Self, I>> + IsType<<Self as Config>::RuntimeEvent>;
    type WeightInfo: WeightInfoExt;
    type BridgesGrandpaPalletInstance: 'static;
    type ParasPalletName: Get<&'static str>;
    type ParaStoredHeaderDataBuilder: ParaStoredHeaderDataBuilder;
    type HeadsToKeep: Get<u32>;
    type MaxParaHeadDataSize: 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§

source

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

The overarching event type.

source

type WeightInfo: WeightInfoExt

Benchmarks results from runtime we’re plugged into.

source

type BridgesGrandpaPalletInstance: 'static

Instance of bridges GRANDPA pallet (within this runtime) that this pallet is linked to.

The GRANDPA pallet instance must be configured to import headers of relay chain that we’re interested in.

The associated GRANDPA pallet is also used to configure free parachain heads submissions. The parachain head submission will be free if:

  1. the submission contains exactly one parachain head update that succeeds;

  2. the difference between relay chain block numbers, used to prove new parachain head and previous best parachain head is larger than the FreeHeadersInterval, configured at the associated GRANDPA pallet;

  3. there are slots for free submissions, remaining at the block. This is also configured at the associated GRANDPA pallet using MaxFreeHeadersPerBlock parameter.

First parachain head submission is also free for the submitted, if free submissions are yet accepted to this block.

source

type ParasPalletName: Get<&'static str>

Name of the original paras pallet in the construct_runtime!() call at the bridged chain.

Please keep in mind that this should be the name of the runtime_parachains::paras pallet from polkadot repository, not the pallet-bridge-parachains.

source

type ParaStoredHeaderDataBuilder: ParaStoredHeaderDataBuilder

Parachain head data builder.

We never store parachain heads here, since they may be too big (e.g. because of large digest items). Instead we’re using the same approach as pallet-bridge-grandpa pallet - we are only storing bp_messages::StoredHeaderData (number and state root), which is enough for our applications. However, we work with different parachains here and they can use different primitives (for block numbers and hash). So we can’t store it directly. Instead, we’re storing bp_messages::StoredHeaderData in SCALE-encoded form, wrapping it into bp_parachains::ParaStoredHeaderData.

This builder helps to convert from HeadData to bp_parachains::ParaStoredHeaderData.

source

type HeadsToKeep: Get<u32>

Maximal number of single parachain heads to keep in the storage.

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

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

source

type MaxParaHeadDataSize: Get<u32>

Maximal size (in bytes) of the SCALE-encoded parachain head data (bp_parachains::ParaStoredHeaderData).

Keep in mind that the size of any tracked parachain header data must not exceed this value. So if you’re going to track multiple parachains, one of which is using large hashes, you shall choose this maximal value.

There’s no mandatory headers in this pallet, so it can’t stall if there’s some header that exceeds this bound.

Object Safety§

This trait is not object safe.

Implementors§