Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Implement a blocking barrier for XCMv3 #5035

Closed
wants to merge 154 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
154 commits
Select commit Hold shift + click to select a range
eb3e8b1
XCM v3: Expectations, BurnAsset
gavofyork Oct 17, 2021
c448fda
Add files
gavofyork Oct 17, 2021
3caf55a
Formatting
gavofyork Oct 17, 2021
0a536b1
Safe dispatches
gavofyork Oct 18, 2021
8740a35
Update xcm/src/v3/mod.rs
gavofyork Oct 18, 2021
ebafb3d
Fixes
gavofyork Oct 19, 2021
157ca93
Merge branch 'gav-xcm-v3' of github.com:paritytech/polkadot into gav-…
gavofyork Oct 19, 2021
4b363d3
Latest Substrate naming
gavofyork Oct 19, 2021
9041340
Formatting
gavofyork Oct 19, 2021
d4866a1
Introduce into runtimes
gavofyork Oct 20, 2021
451a588
Back to nesting
gavofyork Oct 20, 2021
c9e3d7f
Formatting
gavofyork Oct 20, 2021
4b47b2b
Bump Substrate
gavofyork Oct 21, 2021
b6cb336
Fixes
gavofyork Oct 21, 2021
e7e90f8
Docs
gavofyork Oct 21, 2021
a7869c8
Ditch Dispatch in favor of composition
gavofyork Oct 21, 2021
5666b58
Ditch Dispatch in favor of composition
gavofyork Oct 21, 2021
8766961
Fixes
gavofyork Oct 21, 2021
6c69d8b
Remove max_assets 🎉
gavofyork Oct 21, 2021
f9defc3
Formatting
gavofyork Oct 21, 2021
a350033
Formatting
gavofyork Oct 21, 2021
b9c7e14
Fixes
gavofyork Oct 21, 2021
756d05e
Fixes
gavofyork Oct 21, 2021
b6c63f8
Fixes
gavofyork Oct 21, 2021
25a69b7
Formatting
gavofyork Oct 21, 2021
37384ae
Missing file
gavofyork Oct 21, 2021
63e3c82
Fix tests
KiChjang Oct 22, 2021
50c9e89
Add Deposit(Reserve)?Asset roundtrip test
KiChjang Oct 22, 2021
31c4e68
Fixes
gavofyork Oct 22, 2021
722f157
Formatting
gavofyork Oct 22, 2021
9f2773b
Fixes
gavofyork Oct 22, 2021
7b620d4
Fixes
gavofyork Oct 22, 2021
2648507
Fixes
gavofyork Oct 22, 2021
5711b2c
Fixes
gavofyork Oct 22, 2021
5c25268
Fixes
gavofyork Oct 22, 2021
df32fb0
Fixes
gavofyork Oct 22, 2021
87d996a
Fixes and spelling
gavofyork Oct 22, 2021
7bc5b20
Tests for Assets
gavofyork Oct 22, 2021
8358bb0
Formatting
gavofyork Oct 22, 2021
d866acf
Spellimg
gavofyork Oct 22, 2021
510a4c4
Merge branch 'master' into gav-xcm-v3
KiChjang Oct 23, 2021
73c8fd9
Tests for ExpectPallet and QueryPallet
gavofyork Oct 24, 2021
50ac5b2
Docs
gavofyork Oct 25, 2021
f58f603
Tests
gavofyork Oct 25, 2021
49220a9
Formatting
gavofyork Oct 25, 2021
3d38f58
Return a Result in invert_location (#3730)
gavofyork Oct 27, 2021
3b6dcbb
Fixes
gavofyork Oct 27, 2021
03a1678
Fixes
gavofyork Oct 27, 2021
94c1b36
Fixes
gavofyork Oct 27, 2021
8b3f3ff
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
gavofyork Oct 30, 2021
53ef334
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Nov 25, 2021
a213a64
Add missing associated types for XCM executor config in polkadot runtime
KiChjang Nov 25, 2021
3a284ea
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Dec 15, 2021
2e49223
cargo fmt
KiChjang Dec 15, 2021
b5b89e1
Fix compilation errors
KiChjang Dec 15, 2021
eed4d6e
Resolve warnings
KiChjang Dec 15, 2021
7bbb50d
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Dec 16, 2021
258f473
Use AllPalletsWithSystem
KiChjang Dec 16, 2021
d9030ea
Use AllPalletsWithSystem
KiChjang Dec 16, 2021
d0037cd
Use AllPalletsWithSystem
KiChjang Dec 16, 2021
20735f1
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Dec 29, 2021
85e0baf
Merge branch 'master' into gav-xcm-v3
gavofyork Jan 10, 2022
6ed5bd6
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Jan 13, 2022
cd5df6d
cargo fmt
KiChjang Jan 13, 2022
22b4332
Create benchmarks for XCM instructions introduced in v3 (#4564)
KiChjang Jan 20, 2022
c0d4800
XCM v3: Introduce querier field into `QueryReponse` (#4732)
gavofyork Jan 21, 2022
79c6d55
Fixes
KiChjang Jan 21, 2022
a837427
Merge branch 'master' into gav-xcm-v3
gavofyork Jan 22, 2022
87e5815
Fixes
KiChjang Jan 23, 2022
2ccb1f4
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
gavofyork Jan 31, 2022
0dcdf44
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Feb 2, 2022
e640d82
Add `starts_with` function to `MultiLocation` and `Junctions` (#4835)
apopiak Feb 10, 2022
fdf6352
Merge branch 'master' into gav-xcm-v3
gavofyork Feb 14, 2022
6185cf3
XCM v3: Bridge infrastructure (#4681)
gavofyork Feb 14, 2022
93382d9
Merge branch 'gav-xcm-v3' of github.com:paritytech/polkadot into gav-…
gavofyork Feb 15, 2022
841bdb9
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Feb 19, 2022
8e8e7b2
Merge branch 'gav-xcm-v3' of github.com:paritytech/polkadot into gav-…
gavofyork Feb 19, 2022
2578af8
Bump Substrate
gavofyork Feb 19, 2022
768535f
XCM v3: `ExchangeAsset` and Remote-locking (#4945)
gavofyork Feb 20, 2022
ba20a96
Merge branch 'gav-xcm-v3' of github.com:paritytech/polkadot into gav-…
gavofyork Feb 20, 2022
bc866e2
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
gavofyork Feb 25, 2022
42b12db
Add simulator test for remote locking
KiChjang Mar 3, 2022
0fbf0c7
Fix tests
KiChjang Mar 4, 2022
7442f7c
Implement a blocking barrier for XCMv3
KiChjang Mar 5, 2022
adb6862
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
gavofyork Mar 7, 2022
6fda480
Bump
gavofyork Mar 7, 2022
3d5ab32
XCM v3: Support for non-fungibles (#4950)
gavofyork Mar 8, 2022
c117f99
XCM v3: Context & ID hash (#4756)
gavofyork Mar 8, 2022
76cad39
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Mar 9, 2022
3026e89
Fixes
KiChjang Mar 9, 2022
4c8ed73
Fixes
KiChjang Mar 9, 2022
16b9de8
Fixes
KiChjang Mar 9, 2022
ab723e4
Merge branch 'gav-xcm-v3' into kckyeung/xcm-v3-blocking-barrier
KiChjang Mar 10, 2022
abdccdd
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Mar 11, 2022
38fb089
Fixes
KiChjang Mar 11, 2022
ac9662c
Formatting
gavofyork Mar 11, 2022
0f3c3ed
Fixes
gavofyork Mar 11, 2022
59d3e17
Formatting
gavofyork Mar 11, 2022
70c32d6
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
gavofyork Mar 11, 2022
7a1bc07
Fixes
gavofyork Mar 11, 2022
df62f3c
Fixes
gavofyork Mar 11, 2022
5a916ca
Formatting
gavofyork Mar 11, 2022
9cf0ff5
Formatting
gavofyork Mar 11, 2022
d236b2f
Remove horrible names
KiChjang Mar 11, 2022
edd992e
Bump
gavofyork Mar 11, 2022
4421714
Remove InvertLocation trait (#5092)
gavofyork Mar 12, 2022
cb12467
Fixes
gavofyork Mar 12, 2022
41e7c47
Remove XCMv1 (#5094)
gavofyork Mar 13, 2022
2f214f2
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
gavofyork Mar 13, 2022
069c75f
derive serialize/deserialize for xcm primitives (#5036)
stanly-johnson Mar 14, 2022
8723e31
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Mar 14, 2022
55d09a5
Merge branch 'master' into gav-xcm-v3
gavofyork Mar 15, 2022
9cca36a
Update lock
gavofyork Mar 15, 2022
bedb342
Fixes
gavofyork Mar 15, 2022
a261384
Add benchmarks for the ExchangeAsset instruction
KiChjang Mar 20, 2022
39283ce
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Mar 20, 2022
92a0d76
`AliasOrigin` instruction stub (#5122)
gavofyork Mar 20, 2022
9de612c
Fixes
gavofyork Mar 21, 2022
07cdc71
Merge branch 'master' into gav-xcm-v3
KiChjang Mar 21, 2022
5e0d072
Update substrate
KiChjang Mar 21, 2022
6d92833
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
gavofyork Mar 22, 2022
f567ef4
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
gavofyork Mar 24, 2022
7f94156
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Mar 25, 2022
0e27b18
Fixes
KiChjang Mar 25, 2022
e0ff9d4
Merge branch 'gav-xcm-v3' into kckyeung/xcm-v3-blocking-barrier
KiChjang Mar 25, 2022
e2fbea1
Fixes
KiChjang Mar 25, 2022
5c02901
Ensure same array length before using copy_from_slice
KiChjang Apr 8, 2022
f64a0b8
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Apr 8, 2022
990a5d1
Fixes
KiChjang Apr 8, 2022
a1828ac
Add benchmarks for the UniversalOrigin instruction
KiChjang Apr 8, 2022
7d05afd
Remove unused import
KiChjang Apr 8, 2022
e5052da
Remove unused import
KiChjang Apr 11, 2022
70723a4
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Apr 12, 2022
6632bff
Add benchmarks for SetFeesMode instruction
KiChjang Apr 12, 2022
54e3eb6
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Apr 14, 2022
865ee38
Add benchmarks for asset (un)locking instructions
KiChjang Apr 15, 2022
774945c
Leave AliasOrigin unbenchmarked
KiChjang Apr 15, 2022
aca38aa
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Apr 15, 2022
3425324
Fixes after merge
KiChjang Apr 15, 2022
c4a8da5
cargo fmt
KiChjang Apr 15, 2022
81ec7d2
Fixes
KiChjang Apr 15, 2022
325d469
Fixes
KiChjang Apr 15, 2022
41a4b79
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
KiChjang Apr 15, 2022
a8b2f7f
Set TrustedReserves to None on both Kusama and Westend
KiChjang Apr 15, 2022
5a409eb
Remove extraneous reserve_asset_deposited benchmark
KiChjang Apr 16, 2022
49cb4d7
Fix universal_origin benchmark
KiChjang Apr 17, 2022
0f4fb16
Merge branch 'master' of https://github.com/paritytech/polkadot into …
Apr 17, 2022
784941b
cargo run --quiet --profile=production --features=runtime-benchmarks…
Apr 17, 2022
923acc8
Don't rely on skipped benchmark functions
KiChjang Apr 17, 2022
5e53cf5
Fixes
KiChjang Apr 18, 2022
94c76ce
cargo run --quiet --profile=production --features=runtime-benchmarks…
Apr 18, 2022
ae53f58
Fix unused variables
KiChjang Apr 18, 2022
154c657
Merge branch 'gav-xcm-v3' into kckyeung/xcm-v3-blocking-barrier
KiChjang Apr 22, 2022
349d589
Add RejectReason::NoRulesMatched
KiChjang Apr 22, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
788 changes: 401 additions & 387 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions bridges/bin/rialto-parachain/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ use polkadot_parachain::primitives::Sibling;
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,
EnsureXcmOrigin, FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset,
EnsureXcmOrigin, FixedWeightBounds, IsConcrete, NativeAsset,
ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative,
SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,
Expand Down Expand Up @@ -289,7 +289,7 @@ parameter_types! {
pub const RelayLocation: MultiLocation = MultiLocation::parent();
pub const RelayNetwork: NetworkId = NetworkId::Polkadot;
pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();
pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();
pub UniversalLocation: InteriorMultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();
}

/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
Expand Down Expand Up @@ -374,12 +374,14 @@ impl Config for XcmConfig {
type OriginConverter = XcmOriginToTransactDispatchOrigin;
type IsReserve = NativeAsset;
type IsTeleporter = NativeAsset; // <- should be enough to allow teleportation of UNIT
type LocationInverter = LocationInverter<Ancestry>;
type UniversalLocation = UniversalLocation;
type Barrier = Barrier;
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
type Trader = UsingComponents<IdentityFee<Balance>, RelayLocation, AccountId, Balances, ()>;
type ResponseHandler = PolkadotXcm;
type AssetTrap = PolkadotXcm;
type AssetLocker = ();
type AssetExchanger = ();
type AssetClaims = PolkadotXcm;
type SubscriptionService = PolkadotXcm;
}
Expand All @@ -406,7 +408,7 @@ impl pallet_xcm::Config for Runtime {
type XcmTeleportFilter = Everything;
type XcmReserveTransferFilter = Everything;
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
type LocationInverter = LocationInverter<Ancestry>;
type UniversalLocation = UniversalLocation;
type Origin = Origin;
type Call = Call;
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
Expand Down
2 changes: 1 addition & 1 deletion bridges/primitives/chain-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: sp_version::create_runtime_str!("rococo"),
impl_name: sp_version::create_runtime_str!("parity-rococo-v2.0"),
authoring_version: 0,
spec_version: 9180,
spec_version: 9190,
impl_version: 0,
apis: sp_version::create_apis_vec![[]],
transaction_version: 0,
Expand Down
2 changes: 1 addition & 1 deletion node/core/pvf/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ async fn run(
futures::select_biased! {
() = cleanup_pulse.select_next_some() => {
// `select_next_some` because we don't expect this to fail, but if it does, we
// still don't fail. The tradeoff is that the compiled cache will start growing
// still don't fail. The trade-off is that the compiled cache will start growing
// in size. That is, however, rather a slow process and hopefully the operator
// will notice it.

Expand Down
2 changes: 1 addition & 1 deletion node/network/protocol/src/request_response/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const STATEMENTS_TIMEOUT: Duration = Duration::from_secs(1);

/// We don't want a slow peer to slow down all the others, at the same time we want to get out the
/// data quickly in full to at least some peers (as this will reduce load on us as they then can
/// start serving the data). So this value is a tradeoff. 3 seems to be sensible. So we would need
/// start serving the data). So this value is a trade-off. 3 seems to be sensible. So we would need
/// to have 3 slow nodes connected, to delay transfer for others by `STATEMENTS_TIMEOUT`.
pub const MAX_PARALLEL_STATEMENT_REQUESTS: u32 = 3;

Expand Down
85 changes: 61 additions & 24 deletions runtime/common/src/xcm_sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,71 @@

//! XCM sender for relay chain.

use frame_support::traits::Get;
use parity_scale_codec::Encode;
use runtime_parachains::{configuration, dmp};
use sp_std::marker::PhantomData;
use xcm::latest::prelude::*;
use primitives::v2::Id as ParaId;
use runtime_parachains::{
configuration::{self, HostConfiguration},
dmp,
};
use sp_std::{marker::PhantomData, prelude::*};
use xcm::prelude::*;
use SendError::*;

pub trait PriceForParachainDelivery {
fn price_for_parachain_delivery(para: ParaId, message: &Xcm<()>) -> MultiAssets;
}
impl PriceForParachainDelivery for () {
fn price_for_parachain_delivery(_: ParaId, _: &Xcm<()>) -> MultiAssets {
MultiAssets::new()
}
}

pub struct ConstantPrice<T>(sp_std::marker::PhantomData<T>);
impl<T: Get<MultiAssets>> PriceForParachainDelivery for ConstantPrice<T> {
fn price_for_parachain_delivery(_: ParaId, _: &Xcm<()>) -> MultiAssets {
T::get()
}
}

/// XCM sender for relay chain. It only sends downward message.
pub struct ChildParachainRouter<T, W>(PhantomData<(T, W)>);
pub struct ChildParachainRouter<T, W, P>(PhantomData<(T, W, P)>);

impl<T: configuration::Config + dmp::Config, W: xcm::WrapVersion> SendXcm
for ChildParachainRouter<T, W>
impl<T: configuration::Config + dmp::Config, W: xcm::WrapVersion, P: PriceForParachainDelivery>
SendXcm for ChildParachainRouter<T, W, P>
{
fn send_xcm(dest: impl Into<MultiLocation>, msg: Xcm<()>) -> SendResult {
let dest = dest.into();
match dest {
MultiLocation { parents: 0, interior: X1(Parachain(id)) } => {
// Downward message passing.
let versioned_xcm =
W::wrap_version(&dest, msg).map_err(|()| SendError::DestinationUnsupported)?;
let config = <configuration::Pallet<T>>::config();
<dmp::Pallet<T>>::queue_downward_message(
&config,
id.into(),
versioned_xcm.encode(),
)
.map_err(Into::<SendError>::into)?;
Ok(())
},
dest => Err(SendError::CannotReachDestination(dest, msg)),
}
type Ticket = (HostConfiguration<T::BlockNumber>, ParaId, Vec<u8>);

fn validate(
dest: &mut Option<MultiLocation>,
msg: &mut Option<Xcm<()>>,
) -> SendResult<(HostConfiguration<T::BlockNumber>, ParaId, Vec<u8>)> {
let d = dest.take().ok_or(MissingArgument)?;
let id = if let MultiLocation { parents: 0, interior: X1(Parachain(id)) } = &d {
*id
} else {
*dest = Some(d);
return Err(NotApplicable)
};

// Downward message passing.
let xcm = msg.take().ok_or(MissingArgument)?;
let config = <configuration::Pallet<T>>::config();
let para = id.into();
let price = P::price_for_parachain_delivery(para, &xcm);
let blob = W::wrap_version(&d, xcm).map_err(|()| DestinationUnsupported)?.encode();
<dmp::Pallet<T>>::can_queue_downward_message(&config, &para, &blob)
.map_err(Into::<SendError>::into)?;

Ok(((config, para, blob), price))
}

fn deliver(
(config, para, blob): (HostConfiguration<T::BlockNumber>, ParaId, Vec<u8>),
) -> Result<XcmHash, SendError> {
let hash = sp_io::hashing::blake2_256(&blob[..]);
<dmp::Pallet<T>>::queue_downward_message(&config, para, blob)
.map(|()| hash)
.map_err(|_| SendError::Transport(&"Error placing into DMP queue"))
}
}
32 changes: 21 additions & 11 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1988,7 +1988,7 @@ sp_api::impl_runtime_apis! {
use frame_system_benchmarking::Pallet as SystemBench;
use frame_benchmarking::baseline::Pallet as Baseline;
use xcm::latest::prelude::*;
use xcm_config::{CheckAccount, KsmLocation, SovereignAccountOf, Statemine, XcmConfig};
use xcm_config::{CheckAccount, SovereignAccountOf, Statemine, TokenLocation, XcmConfig};

impl pallet_session_benchmarking::Config for Runtime {}
impl pallet_offences_benchmarking::Config for Runtime {}
Expand All @@ -2002,10 +2002,10 @@ sp_api::impl_runtime_apis! {
fn valid_destination() -> Result<MultiLocation, BenchmarkError> {
Ok(Statemine::get())
}
fn worst_case_holding() -> MultiAssets {
fn worst_case_holding(_depositable_count: u32) -> MultiAssets {
// Kusama only knows about KSM.
vec![MultiAsset{
id: Concrete(KsmLocation::get()),
id: Concrete(TokenLocation::get()),
fun: Fungible(1_000_000 * UNITS),
}].into()
}
Expand All @@ -2014,11 +2014,7 @@ sp_api::impl_runtime_apis! {
parameter_types! {
pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some((
Statemine::get(),
MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(KsmLocation::get()) },
));
pub const TrustedReserve: Option<(MultiLocation, MultiAsset)> = Some((
Statemine::get(),
MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(KsmLocation::get()) },
MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(TokenLocation::get()) },
));
}

Expand All @@ -2027,11 +2023,10 @@ sp_api::impl_runtime_apis! {

type CheckedAccount = CheckAccount;
type TrustedTeleporter = TrustedTeleporter;
type TrustedReserve = TrustedReserve;

fn get_multi_asset() -> MultiAsset {
MultiAsset {
id: Concrete(KsmLocation::get()),
id: Concrete(TokenLocation::get()),
fun: Fungible(1 * UNITS),
}
}
Expand All @@ -2044,6 +2039,16 @@ sp_api::impl_runtime_apis! {
(0u64, Response::Version(Default::default()))
}

fn worst_case_asset_exchange() -> Result<(MultiAssets, MultiAssets), BenchmarkError> {
// Kusama doesn't support asset exchanges
Err(BenchmarkError::Skip)
}

fn universal_alias() -> Result<Junction, BenchmarkError> {
// The XCM executor of Kusama doesn't have a configured `UniversalAliases`
Err(BenchmarkError::Skip)
}

fn transact_origin() -> Result<MultiLocation, BenchmarkError> {
Ok(Statemine::get())
}
Expand All @@ -2054,10 +2059,15 @@ sp_api::impl_runtime_apis! {

fn claimable_asset() -> Result<(MultiLocation, MultiLocation, MultiAssets), BenchmarkError> {
let origin = Statemine::get();
let assets: MultiAssets = (Concrete(KsmLocation::get()), 1_000 * UNITS).into();
let assets: MultiAssets = (Concrete(TokenLocation::get()), 1_000 * UNITS).into();
let ticket = MultiLocation { parents: 0, interior: Here };
Ok((origin, ticket, assets))
}

fn unlockable_asset() -> Result<(MultiLocation, MultiLocation, MultiAsset), BenchmarkError> {
// Kusama doesn't support asset locking
Err(BenchmarkError::Skip)
}
}

let whitelist: Vec<TrackedStorageKey> = vec![
Expand Down
100 changes: 79 additions & 21 deletions runtime/kusama/src/weights/xcm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ impl<Call> XcmWeightInfo<Call> for KusamaXcmWeight<Call> {
fn receive_teleported_asset(assets: &MultiAssets) -> Weight {
assets.weigh_multi_assets(XcmBalancesWeight::<Runtime>::receive_teleported_asset())
}
fn query_response(_query_id: &u64, _response: &Response, _max_weight: &u64) -> Weight {
fn query_response(
_query_id: &u64,
_response: &Response,
_max_weight: &u64,
_querier: &Option<MultiLocation>,
) -> Weight {
XcmGeneric::<Runtime>::query_response()
}
fn transfer_asset(assets: &MultiAssets, _dest: &MultiLocation) -> Weight {
Expand Down Expand Up @@ -117,31 +122,23 @@ impl<Call> XcmWeightInfo<Call> for KusamaXcmWeight<Call> {
fn descend_origin(_who: &InteriorMultiLocation) -> Weight {
XcmGeneric::<Runtime>::descend_origin()
}
fn report_error(
_query_id: &QueryId,
_dest: &MultiLocation,
_max_response_weight: &u64,
) -> Weight {
fn report_error(_query_response_info: &QueryResponseInfo) -> Weight {
XcmGeneric::<Runtime>::report_error()
}

fn deposit_asset(
assets: &MultiAssetFilter,
_max_assets: &u32, // TODO use max assets?
_dest: &MultiLocation,
) -> Weight {
fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight {
assets.weigh_multi_assets(XcmBalancesWeight::<Runtime>::deposit_asset())
}
fn deposit_reserve_asset(
assets: &MultiAssetFilter,
_max_assets: &u32, // TODO use max assets?
_dest: &MultiLocation,
_xcm: &Xcm<()>,
) -> Weight {
assets.weigh_multi_assets(XcmBalancesWeight::<Runtime>::deposit_reserve_asset())
}
fn exchange_asset(_give: &MultiAssetFilter, _receive: &MultiAssets) -> Weight {
Weight::MAX // todo fix
fn exchange_asset(_give: &MultiAssetFilter, _receive: &MultiAssets, _maximal: &bool) -> Weight {
// Kusama does not currently support exchange asset operations
Weight::MAX
}
fn initiate_reserve_withdraw(
assets: &MultiAssetFilter,
Expand All @@ -157,13 +154,8 @@ impl<Call> XcmWeightInfo<Call> for KusamaXcmWeight<Call> {
) -> Weight {
assets.weigh_multi_assets(XcmBalancesWeight::<Runtime>::initiate_teleport())
}
fn query_holding(
_query_id: &u64,
_dest: &MultiLocation,
_assets: &MultiAssetFilter,
_max_response_weight: &u64,
) -> Weight {
XcmGeneric::<Runtime>::query_holding()
fn report_holding(_response_info: &QueryResponseInfo, _assets: &MultiAssetFilter) -> Weight {
XcmGeneric::<Runtime>::report_holding()
}
fn buy_execution(_fees: &MultiAsset, _weight_limit: &WeightLimit) -> Weight {
XcmGeneric::<Runtime>::buy_execution()
Expand Down Expand Up @@ -192,4 +184,70 @@ impl<Call> XcmWeightInfo<Call> for KusamaXcmWeight<Call> {
fn unsubscribe_version() -> Weight {
XcmGeneric::<Runtime>::unsubscribe_version()
}
fn burn_asset(assets: &MultiAssets) -> Weight {
assets.weigh_multi_assets(XcmGeneric::<Runtime>::burn_asset())
}
fn expect_asset(assets: &MultiAssets) -> Weight {
assets.weigh_multi_assets(XcmGeneric::<Runtime>::expect_asset())
}
fn expect_origin(_origin: &Option<MultiLocation>) -> Weight {
XcmGeneric::<Runtime>::expect_origin()
}
fn expect_error(_error: &Option<(u32, XcmError)>) -> Weight {
XcmGeneric::<Runtime>::expect_error()
}
fn query_pallet(_module_name: &Vec<u8>, _response_info: &QueryResponseInfo) -> Weight {
XcmGeneric::<Runtime>::query_pallet()
}
fn expect_pallet(
_index: &u32,
_name: &Vec<u8>,
_module_name: &Vec<u8>,
_crate_major: &u32,
_min_crate_minor: &u32,
) -> Weight {
XcmGeneric::<Runtime>::expect_pallet()
}
fn report_transact_status(_response_info: &QueryResponseInfo) -> Weight {
XcmGeneric::<Runtime>::report_transact_status()
}
fn clear_transact_status() -> Weight {
XcmGeneric::<Runtime>::clear_transact_status()
}
fn universal_origin(_: &Junction) -> Weight {
// Kusama does not currently support universal origin operations
Weight::MAX
}
fn export_message(_: &NetworkId, _: &Junctions, _: &Xcm<()>) -> Weight {
Weight::MAX // todo fix
}
fn lock_asset(_: &MultiAsset, _: &MultiLocation) -> Weight {
// Kusama does not currently support asset locking operations
Weight::MAX
}
fn unlock_asset(_: &MultiAsset, _: &MultiLocation) -> Weight {
// Kusama does not currently support asset locking operations
Weight::MAX
}
fn note_unlockable(_: &MultiAsset, _: &MultiLocation) -> Weight {
// Kusama does not currently support asset locking operations
Weight::MAX
}
fn request_unlock(_: &MultiAsset, _: &MultiLocation) -> Weight {
// Kusama does not currently support asset locking operations
Weight::MAX
}
fn set_fees_mode(_: &bool) -> Weight {
XcmGeneric::<Runtime>::set_fees_mode()
}
fn set_topic(_topic: &[u8; 32]) -> Weight {
XcmGeneric::<Runtime>::set_topic()
}
fn clear_topic() -> Weight {
XcmGeneric::<Runtime>::clear_topic()
}
fn alias_origin(_: &MultiLocation) -> Weight {
// XCM Executor does not currently support alias origin operations
Weight::MAX
}
}
Loading