referrerpolicy=no-referrer-when-downgrade

Trait pallet_xcm_benchmarks::generic::pallet::Config

source ·
pub trait Config<I: 'static = ()>: Config + Config {
    type RuntimeCall: Dispatchable<RuntimeOrigin = Self::RuntimeOrigin> + GetDispatchInfo + From<Call<Self>> + Encode;
    type TransactAsset: Mutate<Self::AccountId>;

    // Required methods
    fn worst_case_response() -> (u64, Response);
    fn worst_case_asset_exchange() -> Result<(Assets, Assets), BenchmarkError>;
    fn universal_alias() -> Result<(Location, Junction), BenchmarkError>;
    fn transact_origin_and_runtime_call(    ) -> Result<(Location, <Self as Config<I>>::RuntimeCall), BenchmarkError>;
    fn subscribe_origin() -> Result<Location, BenchmarkError>;
    fn claimable_asset() -> Result<(Location, Location, Assets), BenchmarkError>;
    fn fee_asset() -> Result<Asset, BenchmarkError>;
    fn unlockable_asset() -> Result<(Location, Location, Asset), BenchmarkError>;
    fn export_message_origin_and_destination(    ) -> Result<(Location, NetworkId, InteriorLocation), BenchmarkError>;
    fn alias_origin() -> Result<(Location, Location), BenchmarkError>;

    // Provided method
    fn valid_pallet() -> PalletInfoData { ... }
}
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 RuntimeCall: Dispatchable<RuntimeOrigin = Self::RuntimeOrigin> + GetDispatchInfo + From<Call<Self>> + Encode

source

type TransactAsset: Mutate<Self::AccountId>

The type of fungible that is being used under the hood.

This is useful for testing and checking.

Required Methods§

source

fn worst_case_response() -> (u64, Response)

The response which causes the most runtime weight.

source

fn worst_case_asset_exchange() -> Result<(Assets, Assets), BenchmarkError>

The pair of asset collections which causes the most runtime weight if demanded to be exchanged.

The first element in the returned tuple represents the assets that are being exchanged from, whereas the second element represents the assets that are being exchanged to.

If set to Err, benchmarks which rely on an exchange_asset will be skipped.

source

fn universal_alias() -> Result<(Location, Junction), BenchmarkError>

A (Location, Junction) that is one of the UniversalAliases configured by the XCM executor.

If set to Err, benchmarks which rely on a universal alias will be skipped.

source

fn transact_origin_and_runtime_call() -> Result<(Location, <Self as Config<I>>::RuntimeCall), BenchmarkError>

The Location and RuntimeCall used for successful transaction XCMs.

If set to Err, benchmarks which rely on a transact_origin_and_runtime_call will be skipped.

source

fn subscribe_origin() -> Result<Location, BenchmarkError>

A valid Location we can successfully subscribe to.

If set to Err, benchmarks which rely on a subscribe_origin will be skipped.

source

fn claimable_asset() -> Result<(Location, Location, Assets), BenchmarkError>

Return an origin, ticket, and assets that can be trapped and claimed.

source

fn fee_asset() -> Result<Asset, BenchmarkError>

Asset used to pay for fees. Used to buy weight in benchmarks, for example in refund_surplus.

source

fn unlockable_asset() -> Result<(Location, Location, Asset), BenchmarkError>

Return an unlocker, owner and assets that can be locked and unlocked.

source

fn export_message_origin_and_destination() -> Result<(Location, NetworkId, InteriorLocation), BenchmarkError>

A (Location, NetworkId, InteriorLocation) we can successfully export message to.

If set to Err, benchmarks which rely on export_message will be skipped.

source

fn alias_origin() -> Result<(Location, Location), BenchmarkError>

A (Location, Location) that is one of the Aliasers configured by the XCM executor.

If set to Err, benchmarks which rely on a universal alias will be skipped.

Provided Methods§

source

fn valid_pallet() -> PalletInfoData

Returns a valid pallet info for ExpectPallet or QueryPallet benchmark.

By default returns frame_system::Pallet info with expected pallet index 0.

Object Safety§

This trait is not object safe.

Implementors§