mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 12:11:02 +00:00
Introduce XCM Weight Traits (#3802)
* introduce xcm weight traits * patch some low hanging fruit * add weightinfobound * use checked math rather than saturating * Update xcm/xcm-builder/src/weight.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Revert "Update xcm/xcm-builder/src/weight.rs" This reverts commit 6331b874f3dccf7f01a051ca6d4ee4d14a23a82d. Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
use core::result;
|
||||
use parity_scale_codec::{Decode, Encode};
|
||||
|
||||
use super::{MultiLocation, Xcm};
|
||||
use super::*;
|
||||
|
||||
#[derive(Copy, Clone, Encode, Decode, Eq, PartialEq, Debug)]
|
||||
pub enum Error {
|
||||
@@ -313,3 +313,63 @@ impl SendXcm for Tuple {
|
||||
Err(SendError::CannotReachDestination(destination, message))
|
||||
}
|
||||
}
|
||||
|
||||
/// The info needed to weight an XCM.
|
||||
// TODO: Automate Generation
|
||||
pub trait XcmWeightInfo<Call> {
|
||||
fn withdraw_asset(assets: &MultiAssets) -> Weight;
|
||||
fn reserve_asset_deposited(assets: &MultiAssets) -> Weight;
|
||||
fn receive_teleported_asset(assets: &MultiAssets) -> Weight;
|
||||
fn query_response(query_id: &u64, response: &Response, max_weight: &u64) -> Weight;
|
||||
fn transfer_asset(assets: &MultiAssets, beneficiary: &MultiLocation) -> Weight;
|
||||
fn transfer_reserve_asset(assets: &MultiAssets, dest: &MultiLocation, xcm: &Xcm<()>) -> Weight;
|
||||
fn transact(
|
||||
origin_type: &OriginKind,
|
||||
require_weight_at_most: &u64,
|
||||
call: &DoubleEncoded<Call>,
|
||||
) -> Weight;
|
||||
fn hrmp_new_channel_open_request(
|
||||
sender: &u32,
|
||||
max_message_size: &u32,
|
||||
max_capacity: &u32,
|
||||
) -> Weight;
|
||||
fn hrmp_channel_accepted(recipient: &u32) -> Weight;
|
||||
fn hrmp_channel_closing(initiator: &u32, sender: &u32, recipient: &u32) -> Weight;
|
||||
fn clear_origin() -> Weight;
|
||||
fn descend_origin(who: &InteriorMultiLocation) -> Weight;
|
||||
fn report_error(query_id: &QueryId, dest: &MultiLocation, max_response_weight: &u64) -> Weight;
|
||||
fn relayed_from(who: &Junctions, message: &alloc::boxed::Box<Xcm<Call>>) -> Weight;
|
||||
fn deposit_asset(
|
||||
assets: &MultiAssetFilter,
|
||||
max_assets: &u32,
|
||||
beneficiary: &MultiLocation,
|
||||
) -> Weight;
|
||||
fn deposit_reserve_asset(
|
||||
assets: &MultiAssetFilter,
|
||||
max_assets: &u32,
|
||||
dest: &MultiLocation,
|
||||
xcm: &Xcm<()>,
|
||||
) -> Weight;
|
||||
fn exchange_asset(give: &MultiAssetFilter, receive: &MultiAssets) -> Weight;
|
||||
fn initiate_reserve_withdraw(
|
||||
assets: &MultiAssetFilter,
|
||||
reserve: &MultiLocation,
|
||||
xcm: &Xcm<()>,
|
||||
) -> Weight;
|
||||
fn initiate_teleport(assets: &MultiAssetFilter, dest: &MultiLocation, xcm: &Xcm<()>) -> Weight;
|
||||
fn query_holding(
|
||||
query_id: &u64,
|
||||
dest: &MultiLocation,
|
||||
assets: &MultiAssetFilter,
|
||||
max_response_weight: &u64,
|
||||
) -> Weight;
|
||||
fn buy_execution(fees: &MultiAsset, weight_limit: &WeightLimit) -> Weight;
|
||||
fn refund_surplus() -> Weight;
|
||||
fn set_error_handler(xcm: &Xcm<Call>) -> Weight;
|
||||
fn set_appendix(xcm: &Xcm<Call>) -> Weight;
|
||||
fn clear_error() -> Weight;
|
||||
fn claim_asset(assets: &MultiAssets, ticket: &MultiLocation) -> Weight;
|
||||
fn trap(code: &u64) -> Weight;
|
||||
fn subscribe_version(query_id: &QueryId, max_response_weight: &u64) -> Weight;
|
||||
fn unsubscribe_version() -> Weight;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user