pub trait Config: Config + Config {
type DeliveryHelper: EnsureDelivery;
// Required method
fn get_asset() -> Asset;
// Provided methods
fn reachable_dest() -> Option<Location> { ... }
fn teleportable_asset_and_dest() -> Option<(Asset, Location)> { ... }
fn reserve_transferable_asset_and_dest() -> Option<(Asset, Location)> { ... }
fn set_up_complex_asset_transfer( ) -> Option<(Assets, u32, Location, Box<dyn FnOnce()>)> { ... }
fn get_assets(_n: u32) -> Assets { ... }
fn batch_call(
_calls: Vec<<Self as Config>::RuntimeCall>,
) -> Option<<Self as Config>::RuntimeCall> { ... }
fn wrap_call(
call: <Self as Config>::RuntimeCall,
) -> Option<<Self as Config>::RuntimeCall> { ... }
}Expand description
Trait that must be implemented by runtime to be able to benchmark pallet properly.
Required Associated Types§
Sourcetype DeliveryHelper: EnsureDelivery
type DeliveryHelper: EnsureDelivery
Helper that ensures successful delivery for extrinsics/benchmarks which need SendXcm.
Required Methods§
Provided Methods§
Sourcefn reachable_dest() -> Option<Location>
fn reachable_dest() -> Option<Location>
A Location that can be reached via XcmRouter. Used only in benchmarks.
If None, the benchmarks that depend on a reachable destination will be skipped.
Sourcefn teleportable_asset_and_dest() -> Option<(Asset, Location)>
fn teleportable_asset_and_dest() -> Option<(Asset, Location)>
A (Asset, Location) pair representing asset and the destination it can be
teleported to. Used only in benchmarks.
Implementation should also make sure dest is reachable/connected.
If None, the benchmarks that depend on this will default to Weight::MAX.
Sourcefn reserve_transferable_asset_and_dest() -> Option<(Asset, Location)>
fn reserve_transferable_asset_and_dest() -> Option<(Asset, Location)>
A (Asset, Location) pair representing asset and the destination it can be
reserve-transferred to. Used only in benchmarks.
Implementation should also make sure dest is reachable/connected.
If None, the benchmarks that depend on this will default to Weight::MAX.
Sourcefn set_up_complex_asset_transfer() -> Option<(Assets, u32, Location, Box<dyn FnOnce()>)>
fn set_up_complex_asset_transfer() -> Option<(Assets, u32, Location, Box<dyn FnOnce()>)>
Sets up a complex transfer (usually consisting of a teleport and reserve-based transfer), so
that runtime can properly benchmark transfer_assets() extrinsic. Should return a tuple
(Asset, u32, Location, dyn FnOnce()) representing the assets to transfer, the
u32 index of the asset to be used for fees, the destination chain for the transfer, and a
verify() closure to verify the intended transfer side-effects.
Implementation should make sure the provided assets can be transacted by the runtime, there
are enough balances in the involved accounts, and that dest is reachable/connected.
Used only in benchmarks.
If None, the benchmarks that depend on this will default to Weight::MAX.
Sourcefn get_assets(_n: u32) -> Assets
fn get_assets(_n: u32) -> Assets
Gets n distinct fungible assets handled by the AssetTransactor, preferring the most
expensive-to-deposit kind the chain supports. Used only in benchmarks.
The default ignores n and returns a single asset, so it measures a ~zero per-asset
slope: that is sound only for chains whose AssetTransactor handles one asset kind.
Chains that can deposit several MUST override it, otherwise claim_assets is
under-weighted; there is no generic default, since which ids are depositable is
runtime-specific.
Sourcefn batch_call(
_calls: Vec<<Self as Config>::RuntimeCall>,
) -> Option<<Self as Config>::RuntimeCall>
fn batch_call( _calls: Vec<<Self as Config>::RuntimeCall>, ) -> Option<<Self as Config>::RuntimeCall>
Wraps calls into a single call that dispatches all of them, e.g. utility.batch. Used
only by helpers::worst_case_weighable_message.
If None, that worst case degrades to a single call and measures a far cheaper slope,
so chains with a batching pallet MUST implement this or the precompile that charges
weigh_message is under-charged.
Sourcefn wrap_call(
call: <Self as Config>::RuntimeCall,
) -> Option<<Self as Config>::RuntimeCall>
fn wrap_call( call: <Self as Config>::RuntimeCall, ) -> Option<<Self as Config>::RuntimeCall>
Wraps call into a single call that dispatches it. Used only in benchmarks.
Defaults to Self::batch_call with call as the only element.
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.