mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 22:11:02 +00:00
XCMv4 (#1230)
# Note for reviewer
Most changes are just syntax changes necessary for the new version.
Most important files should be the ones under the `xcm` folder.
# Description
Added XCMv4.
## Removed `Multi` prefix
The following types have been renamed:
- MultiLocation -> Location
- MultiAsset -> Asset
- MultiAssets -> Assets
- InteriorMultiLocation -> InteriorLocation
- MultiAssetFilter -> AssetFilter
- VersionedMultiAsset -> VersionedAsset
- WildMultiAsset -> WildAsset
- VersionedMultiLocation -> VersionedLocation
In order to fix a name conflict, the `Assets` in `xcm-executor` were
renamed to `HoldingAssets`, as they represent assets in holding.
## Removed `Abstract` asset id
It was not being used anywhere and this simplifies the code.
Now assets are just constructed as follows:
```rust
let asset: Asset = (AssetId(Location::new(1, Here)), 100u128).into();
```
No need for specifying `Concrete` anymore.
## Outcome is now a named fields struct
Instead of
```rust
pub enum Outcome {
Complete(Weight),
Incomplete(Weight, Error),
Error(Error),
}
```
we now have
```rust
pub enum Outcome {
Complete { used: Weight },
Incomplete { used: Weight, error: Error },
Error { error: Error },
}
```
## Added Reanchorable trait
Now both locations and assets implement this trait, making it easier to
reanchor both.
## New syntax for building locations and junctions
Now junctions are built using the following methods:
```rust
let location = Location {
parents: 1,
interior: [Parachain(1000), PalletInstance(50), GeneralIndex(1984)].into()
};
```
or
```rust
let location = Location::new(1, [Parachain(1000), PalletInstance(50), GeneralIndex(1984)]);
```
And they are matched like so:
```rust
match location.unpack() {
(1, [Parachain(id)]) => ...
(0, Here) => ...,
(1, [_]) => ...,
}
```
This syntax is mandatory in v4, and has been also implemented for v2 and
v3 for easier migration.
This was needed to make all sizes smaller.
# TODO
- [x] Scaffold v4
- [x] Port github.com/paritytech/polkadot/pull/7236
- [x] Remove `Multi` prefix
- [x] Remove `Abstract` asset id
---------
Co-authored-by: command-bot <>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
This commit is contained in:
committed by
GitHub
parent
ec7bfae00a
commit
8428f678fe
+16
-16
@@ -47,7 +47,7 @@ use frame_support::{
|
||||
use sp_runtime::RuntimeDebug;
|
||||
use xcm::{
|
||||
latest::prelude::*,
|
||||
prelude::{InteriorMultiLocation, NetworkId},
|
||||
prelude::{InteriorLocation, NetworkId},
|
||||
};
|
||||
use xcm_builder::BridgeBlobDispatcher;
|
||||
|
||||
@@ -63,12 +63,12 @@ parameter_types! {
|
||||
pub const MaxUnconfirmedMessagesAtInboundLane: bp_messages::MessageNonce =
|
||||
bp_bridge_hub_westend::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
|
||||
pub const BridgeHubRococoChainId: bp_runtime::ChainId = bp_runtime::BRIDGE_HUB_ROCOCO_CHAIN_ID;
|
||||
pub BridgeWestendToRococoMessagesPalletInstance: InteriorMultiLocation = X1(PalletInstance(<BridgeRococoMessages as PalletInfoAccess>::index() as u8));
|
||||
pub BridgeWestendToRococoMessagesPalletInstance: InteriorLocation = [PalletInstance(<BridgeRococoMessages as PalletInfoAccess>::index() as u8)].into();
|
||||
pub RococoGlobalConsensusNetwork: NetworkId = NetworkId::Rococo;
|
||||
pub RococoGlobalConsensusNetworkLocation: MultiLocation = MultiLocation {
|
||||
parents: 2,
|
||||
interior: X1(GlobalConsensus(RococoGlobalConsensusNetwork::get()))
|
||||
};
|
||||
pub RococoGlobalConsensusNetworkLocation: Location = Location::new(
|
||||
2,
|
||||
[GlobalConsensus(RococoGlobalConsensusNetwork::get())]
|
||||
);
|
||||
// see the `FEE_BOOST_PER_MESSAGE` constant to get the meaning of this value
|
||||
pub PriorityBoostPerMessage: u64 = 182_044_444_444_444;
|
||||
|
||||
@@ -79,26 +79,26 @@ parameter_types! {
|
||||
pub ActiveOutboundLanesToBridgeHubRococo: &'static [bp_messages::LaneId] = &[XCM_LANE_FOR_ASSET_HUB_WESTEND_TO_ASSET_HUB_ROCOCO];
|
||||
pub const AssetHubWestendToAssetHubRococoMessagesLane: bp_messages::LaneId = XCM_LANE_FOR_ASSET_HUB_WESTEND_TO_ASSET_HUB_ROCOCO;
|
||||
pub FromAssetHubWestendToAssetHubRococoRoute: SenderAndLane = SenderAndLane::new(
|
||||
ParentThen(X1(Parachain(AssetHubWestendParaId::get().into()))).into(),
|
||||
ParentThen([Parachain(AssetHubWestendParaId::get().into())].into()).into(),
|
||||
XCM_LANE_FOR_ASSET_HUB_WESTEND_TO_ASSET_HUB_ROCOCO,
|
||||
);
|
||||
pub ActiveLanes: sp_std::vec::Vec<(SenderAndLane, (NetworkId, InteriorMultiLocation))> = sp_std::vec![
|
||||
pub ActiveLanes: sp_std::vec::Vec<(SenderAndLane, (NetworkId, InteriorLocation))> = sp_std::vec![
|
||||
(
|
||||
FromAssetHubWestendToAssetHubRococoRoute::get(),
|
||||
(RococoGlobalConsensusNetwork::get(), X1(Parachain(AssetHubRococoParaId::get().into())))
|
||||
(RococoGlobalConsensusNetwork::get(), [Parachain(AssetHubRococoParaId::get().into())].into())
|
||||
)
|
||||
];
|
||||
|
||||
pub CongestedMessage: Xcm<()> = build_congestion_message(true).into();
|
||||
pub UncongestedMessage: Xcm<()> = build_congestion_message(false).into();
|
||||
|
||||
pub BridgeHubRococoLocation: MultiLocation = MultiLocation {
|
||||
parents: 2,
|
||||
interior: X2(
|
||||
pub BridgeHubRococoLocation: Location = Location::new(
|
||||
2,
|
||||
[
|
||||
GlobalConsensus(RococoGlobalConsensusNetwork::get()),
|
||||
Parachain(<bp_bridge_hub_rococo::BridgeHubRococo as bp_runtime::Parachain>::PARACHAIN_ID)
|
||||
)
|
||||
};
|
||||
]
|
||||
);
|
||||
}
|
||||
pub const XCM_LANE_FOR_ASSET_HUB_WESTEND_TO_ASSET_HUB_ROCOCO: LaneId = LaneId([0, 0, 0, 2]);
|
||||
|
||||
@@ -363,9 +363,9 @@ mod tests {
|
||||
|
||||
assert_eq!(
|
||||
BridgeWestendToRococoMessagesPalletInstance::get(),
|
||||
X1(PalletInstance(
|
||||
[PalletInstance(
|
||||
bp_bridge_hub_westend::WITH_BRIDGE_WESTEND_TO_ROCOCO_MESSAGES_PALLET_INDEX
|
||||
))
|
||||
)]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -352,7 +352,7 @@ impl cumulus_pallet_aura_ext::Config for Runtime {}
|
||||
|
||||
parameter_types! {
|
||||
/// The asset ID for the asset that we use to pay for message delivery fees.
|
||||
pub FeeAssetId: AssetId = Concrete(xcm_config::WestendLocation::get());
|
||||
pub FeeAssetId: AssetId = AssetId(xcm_config::WestendLocation::get());
|
||||
/// The base fee for the message delivery fees.
|
||||
pub const BaseDeliveryFee: u128 = CENTS.saturating_mul(3);
|
||||
}
|
||||
@@ -797,28 +797,28 @@ impl_runtime_apis! {
|
||||
|
||||
use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsicsBenchmark;
|
||||
impl pallet_xcm::benchmarking::Config for Runtime {
|
||||
fn reachable_dest() -> Option<MultiLocation> {
|
||||
fn reachable_dest() -> Option<Location> {
|
||||
Some(Parent.into())
|
||||
}
|
||||
|
||||
fn teleportable_asset_and_dest() -> Option<(MultiAsset, MultiLocation)> {
|
||||
fn teleportable_asset_and_dest() -> Option<(Asset, Location)> {
|
||||
// Relay/native token can be teleported between BH and Relay.
|
||||
Some((
|
||||
MultiAsset {
|
||||
Asset {
|
||||
fun: Fungible(EXISTENTIAL_DEPOSIT),
|
||||
id: Concrete(Parent.into())
|
||||
id: AssetId(Parent.into())
|
||||
},
|
||||
Parent.into(),
|
||||
))
|
||||
}
|
||||
|
||||
fn reserve_transferable_asset_and_dest() -> Option<(MultiAsset, MultiLocation)> {
|
||||
fn reserve_transferable_asset_and_dest() -> Option<(Asset, Location)> {
|
||||
// Reserve transfers are disabled on BH.
|
||||
None
|
||||
}
|
||||
|
||||
fn set_up_complex_asset_transfer(
|
||||
) -> Option<(MultiAssets, u32, MultiLocation, Box<dyn FnOnce()>)> {
|
||||
) -> Option<(Assets, u32, Location, Box<dyn FnOnce()>)> {
|
||||
// BH only supports teleports to system parachain.
|
||||
// Relay/native token can be teleported between BH and Relay.
|
||||
let native_location = Parent.into();
|
||||
@@ -834,7 +834,7 @@ impl_runtime_apis! {
|
||||
use xcm_config::WestendLocation;
|
||||
|
||||
parameter_types! {
|
||||
pub ExistentialDepositMultiAsset: Option<MultiAsset> = Some((
|
||||
pub ExistentialDepositAsset: Option<Asset> = Some((
|
||||
WestendLocation::get(),
|
||||
ExistentialDeposit::get()
|
||||
).into());
|
||||
@@ -845,17 +845,17 @@ impl_runtime_apis! {
|
||||
type AccountIdConverter = xcm_config::LocationToAccountId;
|
||||
type DeliveryHelper = cumulus_primitives_utility::ToParentDeliveryHelper<
|
||||
xcm_config::XcmConfig,
|
||||
ExistentialDepositMultiAsset,
|
||||
ExistentialDepositAsset,
|
||||
xcm_config::PriceForParentDelivery,
|
||||
>;
|
||||
fn valid_destination() -> Result<MultiLocation, BenchmarkError> {
|
||||
fn valid_destination() -> Result<Location, BenchmarkError> {
|
||||
Ok(WestendLocation::get())
|
||||
}
|
||||
fn worst_case_holding(_depositable_count: u32) -> MultiAssets {
|
||||
// just concrete assets according to relay chain.
|
||||
let assets: Vec<MultiAsset> = vec![
|
||||
MultiAsset {
|
||||
id: Concrete(WestendLocation::get()),
|
||||
fn worst_case_holding(_depositable_count: u32) -> Assets {
|
||||
// just assets according to relay chain.
|
||||
let assets: Vec<Asset> = vec![
|
||||
Asset {
|
||||
id: AssetId(WestendLocation::get()),
|
||||
fun: Fungible(1_000_000 * UNITS),
|
||||
}
|
||||
];
|
||||
@@ -864,12 +864,12 @@ impl_runtime_apis! {
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some((
|
||||
pub const TrustedTeleporter: Option<(Location, Asset)> = Some((
|
||||
WestendLocation::get(),
|
||||
MultiAsset { fun: Fungible(UNITS), id: Concrete(WestendLocation::get()) },
|
||||
Asset { fun: Fungible(UNITS), id: AssetId(WestendLocation::get()) },
|
||||
));
|
||||
pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None;
|
||||
pub const TrustedReserve: Option<(MultiLocation, MultiAsset)> = None;
|
||||
pub const TrustedReserve: Option<(Location, Asset)> = None;
|
||||
}
|
||||
|
||||
impl pallet_xcm_benchmarks::fungible::Config for Runtime {
|
||||
@@ -879,9 +879,9 @@ impl_runtime_apis! {
|
||||
type TrustedTeleporter = TrustedTeleporter;
|
||||
type TrustedReserve = TrustedReserve;
|
||||
|
||||
fn get_multi_asset() -> MultiAsset {
|
||||
MultiAsset {
|
||||
id: Concrete(WestendLocation::get()),
|
||||
fn get_asset() -> Asset {
|
||||
Asset {
|
||||
id: AssetId(WestendLocation::get()),
|
||||
fun: Fungible(UNITS),
|
||||
}
|
||||
}
|
||||
@@ -895,35 +895,35 @@ impl_runtime_apis! {
|
||||
(0u64, Response::Version(Default::default()))
|
||||
}
|
||||
|
||||
fn worst_case_asset_exchange() -> Result<(MultiAssets, MultiAssets), BenchmarkError> {
|
||||
fn worst_case_asset_exchange() -> Result<(Assets, Assets), BenchmarkError> {
|
||||
Err(BenchmarkError::Skip)
|
||||
}
|
||||
|
||||
fn universal_alias() -> Result<(MultiLocation, Junction), BenchmarkError> {
|
||||
fn universal_alias() -> Result<(Location, Junction), BenchmarkError> {
|
||||
Err(BenchmarkError::Skip)
|
||||
}
|
||||
|
||||
fn transact_origin_and_runtime_call() -> Result<(MultiLocation, RuntimeCall), BenchmarkError> {
|
||||
fn transact_origin_and_runtime_call() -> Result<(Location, RuntimeCall), BenchmarkError> {
|
||||
Ok((WestendLocation::get(), frame_system::Call::remark_with_event { remark: vec![] }.into()))
|
||||
}
|
||||
|
||||
fn subscribe_origin() -> Result<MultiLocation, BenchmarkError> {
|
||||
fn subscribe_origin() -> Result<Location, BenchmarkError> {
|
||||
Ok(WestendLocation::get())
|
||||
}
|
||||
|
||||
fn claimable_asset() -> Result<(MultiLocation, MultiLocation, MultiAssets), BenchmarkError> {
|
||||
fn claimable_asset() -> Result<(Location, Location, Assets), BenchmarkError> {
|
||||
let origin = WestendLocation::get();
|
||||
let assets: MultiAssets = (Concrete(WestendLocation::get()), 1_000 * UNITS).into();
|
||||
let ticket = MultiLocation { parents: 0, interior: Here };
|
||||
let assets: Assets = (AssetId(WestendLocation::get()), 1_000 * UNITS).into();
|
||||
let ticket = Location { parents: 0, interior: Here };
|
||||
Ok((origin, ticket, assets))
|
||||
}
|
||||
|
||||
fn unlockable_asset() -> Result<(MultiLocation, MultiLocation, MultiAsset), BenchmarkError> {
|
||||
fn unlockable_asset() -> Result<(Location, Location, Asset), BenchmarkError> {
|
||||
Err(BenchmarkError::Skip)
|
||||
}
|
||||
|
||||
fn export_message_origin_and_destination(
|
||||
) -> Result<(MultiLocation, NetworkId, InteriorMultiLocation), BenchmarkError> {
|
||||
) -> Result<(Location, NetworkId, InteriorLocation), BenchmarkError> {
|
||||
// save XCM version for remote bridge hub
|
||||
let _ = PolkadotXcm::force_xcm_version(
|
||||
RuntimeOrigin::root(),
|
||||
@@ -943,12 +943,12 @@ impl_runtime_apis! {
|
||||
(
|
||||
bridge_to_rococo_config::FromAssetHubWestendToAssetHubRococoRoute::get().location,
|
||||
NetworkId::Rococo,
|
||||
X1(Parachain(bridge_to_rococo_config::AssetHubRococoParaId::get().into()))
|
||||
[Parachain(bridge_to_rococo_config::AssetHubRococoParaId::get().into())].into()
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
fn alias_origin() -> Result<(MultiLocation, MultiLocation), BenchmarkError> {
|
||||
fn alias_origin() -> Result<(Location, Location), BenchmarkError> {
|
||||
Err(BenchmarkError::Skip)
|
||||
}
|
||||
}
|
||||
@@ -995,7 +995,7 @@ impl_runtime_apis! {
|
||||
Runtime,
|
||||
bridge_to_rococo_config::BridgeGrandpaRococoInstance,
|
||||
bridge_to_rococo_config::WithBridgeHubRococoMessageBridge,
|
||||
>(params, generate_xcm_builder_bridge_message_sample(X2(GlobalConsensus(Westend), Parachain(42))))
|
||||
>(params, generate_xcm_builder_bridge_message_sample([GlobalConsensus(Westend), Parachain(42)].into()))
|
||||
}
|
||||
|
||||
fn prepare_message_delivery_proof(
|
||||
|
||||
@@ -25,14 +25,14 @@ use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric;
|
||||
use sp_std::prelude::*;
|
||||
use xcm::{latest::prelude::*, DoubleEncoded};
|
||||
|
||||
trait WeighMultiAssets {
|
||||
fn weigh_multi_assets(&self, weight: Weight) -> Weight;
|
||||
trait WeighAssets {
|
||||
fn weigh_assets(&self, weight: Weight) -> Weight;
|
||||
}
|
||||
|
||||
const MAX_ASSETS: u64 = 100;
|
||||
|
||||
impl WeighMultiAssets for MultiAssetFilter {
|
||||
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
|
||||
impl WeighAssets for AssetFilter {
|
||||
fn weigh_assets(&self, weight: Weight) -> Weight {
|
||||
match self {
|
||||
Self::Definite(assets) => weight.saturating_mul(assets.inner().iter().count() as u64),
|
||||
Self::Wild(asset) => match asset {
|
||||
@@ -51,40 +51,36 @@ impl WeighMultiAssets for MultiAssetFilter {
|
||||
}
|
||||
}
|
||||
|
||||
impl WeighMultiAssets for MultiAssets {
|
||||
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
|
||||
impl WeighAssets for Assets {
|
||||
fn weigh_assets(&self, weight: Weight) -> Weight {
|
||||
weight.saturating_mul(self.inner().iter().count() as u64)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct BridgeHubWestendXcmWeight<Call>(core::marker::PhantomData<Call>);
|
||||
impl<Call> XcmWeightInfo<Call> for BridgeHubWestendXcmWeight<Call> {
|
||||
fn withdraw_asset(assets: &MultiAssets) -> Weight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::withdraw_asset())
|
||||
fn withdraw_asset(assets: &Assets) -> Weight {
|
||||
assets.weigh_assets(XcmFungibleWeight::<Runtime>::withdraw_asset())
|
||||
}
|
||||
fn reserve_asset_deposited(assets: &MultiAssets) -> Weight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::reserve_asset_deposited())
|
||||
fn reserve_asset_deposited(assets: &Assets) -> Weight {
|
||||
assets.weigh_assets(XcmFungibleWeight::<Runtime>::reserve_asset_deposited())
|
||||
}
|
||||
fn receive_teleported_asset(assets: &MultiAssets) -> Weight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::receive_teleported_asset())
|
||||
fn receive_teleported_asset(assets: &Assets) -> Weight {
|
||||
assets.weigh_assets(XcmFungibleWeight::<Runtime>::receive_teleported_asset())
|
||||
}
|
||||
fn query_response(
|
||||
_query_id: &u64,
|
||||
_response: &Response,
|
||||
_max_weight: &Weight,
|
||||
_querier: &Option<MultiLocation>,
|
||||
_querier: &Option<Location>,
|
||||
) -> Weight {
|
||||
XcmGeneric::<Runtime>::query_response()
|
||||
}
|
||||
fn transfer_asset(assets: &MultiAssets, _dest: &MultiLocation) -> Weight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::transfer_asset())
|
||||
fn transfer_asset(assets: &Assets, _dest: &Location) -> Weight {
|
||||
assets.weigh_assets(XcmFungibleWeight::<Runtime>::transfer_asset())
|
||||
}
|
||||
fn transfer_reserve_asset(
|
||||
assets: &MultiAssets,
|
||||
_dest: &MultiLocation,
|
||||
_xcm: &Xcm<()>,
|
||||
) -> Weight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::transfer_reserve_asset())
|
||||
fn transfer_reserve_asset(assets: &Assets, _dest: &Location, _xcm: &Xcm<()>) -> Weight {
|
||||
assets.weigh_assets(XcmFungibleWeight::<Runtime>::transfer_reserve_asset())
|
||||
}
|
||||
fn transact(
|
||||
_origin_type: &OriginKind,
|
||||
@@ -112,44 +108,36 @@ impl<Call> XcmWeightInfo<Call> for BridgeHubWestendXcmWeight<Call> {
|
||||
fn clear_origin() -> Weight {
|
||||
XcmGeneric::<Runtime>::clear_origin()
|
||||
}
|
||||
fn descend_origin(_who: &InteriorMultiLocation) -> Weight {
|
||||
fn descend_origin(_who: &InteriorLocation) -> Weight {
|
||||
XcmGeneric::<Runtime>::descend_origin()
|
||||
}
|
||||
fn report_error(_query_response_info: &QueryResponseInfo) -> Weight {
|
||||
XcmGeneric::<Runtime>::report_error()
|
||||
}
|
||||
|
||||
fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_asset())
|
||||
fn deposit_asset(assets: &AssetFilter, _dest: &Location) -> Weight {
|
||||
assets.weigh_assets(XcmFungibleWeight::<Runtime>::deposit_asset())
|
||||
}
|
||||
fn deposit_reserve_asset(
|
||||
assets: &MultiAssetFilter,
|
||||
_dest: &MultiLocation,
|
||||
_xcm: &Xcm<()>,
|
||||
) -> Weight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_reserve_asset())
|
||||
fn deposit_reserve_asset(assets: &AssetFilter, _dest: &Location, _xcm: &Xcm<()>) -> Weight {
|
||||
assets.weigh_assets(XcmFungibleWeight::<Runtime>::deposit_reserve_asset())
|
||||
}
|
||||
fn exchange_asset(_give: &MultiAssetFilter, _receive: &MultiAssets, _maximal: &bool) -> Weight {
|
||||
fn exchange_asset(_give: &AssetFilter, _receive: &Assets, _maximal: &bool) -> Weight {
|
||||
Weight::MAX
|
||||
}
|
||||
fn initiate_reserve_withdraw(
|
||||
assets: &MultiAssetFilter,
|
||||
_reserve: &MultiLocation,
|
||||
assets: &AssetFilter,
|
||||
_reserve: &Location,
|
||||
_xcm: &Xcm<()>,
|
||||
) -> Weight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::initiate_reserve_withdraw())
|
||||
assets.weigh_assets(XcmFungibleWeight::<Runtime>::initiate_reserve_withdraw())
|
||||
}
|
||||
fn initiate_teleport(
|
||||
assets: &MultiAssetFilter,
|
||||
_dest: &MultiLocation,
|
||||
_xcm: &Xcm<()>,
|
||||
) -> Weight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::initiate_teleport())
|
||||
fn initiate_teleport(assets: &AssetFilter, _dest: &Location, _xcm: &Xcm<()>) -> Weight {
|
||||
assets.weigh_assets(XcmFungibleWeight::<Runtime>::initiate_teleport())
|
||||
}
|
||||
fn report_holding(_response_info: &QueryResponseInfo, _assets: &MultiAssetFilter) -> Weight {
|
||||
fn report_holding(_response_info: &QueryResponseInfo, _assets: &AssetFilter) -> Weight {
|
||||
XcmGeneric::<Runtime>::report_holding()
|
||||
}
|
||||
fn buy_execution(_fees: &MultiAsset, _weight_limit: &WeightLimit) -> Weight {
|
||||
fn buy_execution(_fees: &Asset, _weight_limit: &WeightLimit) -> Weight {
|
||||
XcmGeneric::<Runtime>::buy_execution()
|
||||
}
|
||||
fn refund_surplus() -> Weight {
|
||||
@@ -164,7 +152,7 @@ impl<Call> XcmWeightInfo<Call> for BridgeHubWestendXcmWeight<Call> {
|
||||
fn clear_error() -> Weight {
|
||||
XcmGeneric::<Runtime>::clear_error()
|
||||
}
|
||||
fn claim_asset(_assets: &MultiAssets, _ticket: &MultiLocation) -> Weight {
|
||||
fn claim_asset(_assets: &Assets, _ticket: &Location) -> Weight {
|
||||
XcmGeneric::<Runtime>::claim_asset()
|
||||
}
|
||||
fn trap(_code: &u64) -> Weight {
|
||||
@@ -176,13 +164,13 @@ impl<Call> XcmWeightInfo<Call> for BridgeHubWestendXcmWeight<Call> {
|
||||
fn unsubscribe_version() -> Weight {
|
||||
XcmGeneric::<Runtime>::unsubscribe_version()
|
||||
}
|
||||
fn burn_asset(assets: &MultiAssets) -> Weight {
|
||||
assets.weigh_multi_assets(XcmGeneric::<Runtime>::burn_asset())
|
||||
fn burn_asset(assets: &Assets) -> Weight {
|
||||
assets.weigh_assets(XcmGeneric::<Runtime>::burn_asset())
|
||||
}
|
||||
fn expect_asset(assets: &MultiAssets) -> Weight {
|
||||
assets.weigh_multi_assets(XcmGeneric::<Runtime>::expect_asset())
|
||||
fn expect_asset(assets: &Assets) -> Weight {
|
||||
assets.weigh_assets(XcmGeneric::<Runtime>::expect_asset())
|
||||
}
|
||||
fn expect_origin(_origin: &Option<MultiLocation>) -> Weight {
|
||||
fn expect_origin(_origin: &Option<Location>) -> Weight {
|
||||
XcmGeneric::<Runtime>::expect_origin()
|
||||
}
|
||||
fn expect_error(_error: &Option<(u32, XcmError)>) -> Weight {
|
||||
@@ -216,16 +204,16 @@ impl<Call> XcmWeightInfo<Call> for BridgeHubWestendXcmWeight<Call> {
|
||||
let inner_encoded_len = inner.encode().len() as u32;
|
||||
XcmGeneric::<Runtime>::export_message(inner_encoded_len)
|
||||
}
|
||||
fn lock_asset(_: &MultiAsset, _: &MultiLocation) -> Weight {
|
||||
fn lock_asset(_: &Asset, _: &Location) -> Weight {
|
||||
Weight::MAX
|
||||
}
|
||||
fn unlock_asset(_: &MultiAsset, _: &MultiLocation) -> Weight {
|
||||
fn unlock_asset(_: &Asset, _: &Location) -> Weight {
|
||||
Weight::MAX
|
||||
}
|
||||
fn note_unlockable(_: &MultiAsset, _: &MultiLocation) -> Weight {
|
||||
fn note_unlockable(_: &Asset, _: &Location) -> Weight {
|
||||
Weight::MAX
|
||||
}
|
||||
fn request_unlock(_: &MultiAsset, _: &MultiLocation) -> Weight {
|
||||
fn request_unlock(_: &Asset, _: &Location) -> Weight {
|
||||
Weight::MAX
|
||||
}
|
||||
fn set_fees_mode(_: &bool) -> Weight {
|
||||
@@ -237,11 +225,11 @@ impl<Call> XcmWeightInfo<Call> for BridgeHubWestendXcmWeight<Call> {
|
||||
fn clear_topic() -> Weight {
|
||||
XcmGeneric::<Runtime>::clear_topic()
|
||||
}
|
||||
fn alias_origin(_: &MultiLocation) -> Weight {
|
||||
fn alias_origin(_: &Location) -> Weight {
|
||||
// XCM Executor does not currently support alias origin operations
|
||||
Weight::MAX
|
||||
}
|
||||
fn unpaid_execution(_: &WeightLimit, _: &Option<MultiLocation>) -> Weight {
|
||||
fn unpaid_execution(_: &WeightLimit, _: &Option<Location>) -> Weight {
|
||||
XcmGeneric::<Runtime>::unpaid_execution()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ use super::{
|
||||
};
|
||||
use crate::bridge_common_config::{DeliveryRewardInBalance, RequiredStakeForStakeAndSlash};
|
||||
use frame_support::{
|
||||
match_types, parameter_types,
|
||||
parameter_types,
|
||||
traits::{ConstU32, Contains, Equals, Everything, Nothing},
|
||||
};
|
||||
use frame_system::EnsureRoot;
|
||||
@@ -52,18 +52,18 @@ use xcm_builder::{
|
||||
use xcm_executor::{traits::WithOriginFilter, XcmExecutor};
|
||||
|
||||
parameter_types! {
|
||||
pub const WestendLocation: MultiLocation = MultiLocation::parent();
|
||||
pub const WestendLocation: Location = Location::parent();
|
||||
pub const RelayNetwork: NetworkId = NetworkId::Westend;
|
||||
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
|
||||
pub UniversalLocation: InteriorMultiLocation =
|
||||
X2(GlobalConsensus(RelayNetwork::get()), Parachain(ParachainInfo::parachain_id().into()));
|
||||
pub UniversalLocation: InteriorLocation =
|
||||
[GlobalConsensus(RelayNetwork::get()), Parachain(ParachainInfo::parachain_id().into())].into();
|
||||
pub const MaxInstructions: u32 = 100;
|
||||
pub const MaxAssetsIntoHolding: u32 = 64;
|
||||
pub TreasuryAccount: AccountId = TREASURY_PALLET_ID.into_account_truncating();
|
||||
pub RelayTreasuryLocation: MultiLocation = (Parent, PalletInstance(westend_runtime_constants::TREASURY_PALLET_ID)).into();
|
||||
pub RelayTreasuryLocation: Location = (Parent, PalletInstance(westend_runtime_constants::TREASURY_PALLET_ID)).into();
|
||||
}
|
||||
|
||||
/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
|
||||
/// Type for specifying how a `Location` can be converted into an `AccountId`. This is used
|
||||
/// when determining ownership of accounts for asset transacting and when attempting to use XCM
|
||||
/// `Transact` in order to determine the dispatch Origin.
|
||||
pub type LocationToAccountId = (
|
||||
@@ -82,7 +82,7 @@ pub type CurrencyTransactor = CurrencyAdapter<
|
||||
Balances,
|
||||
// Use this currency when it is a fungible asset matching the given location or name:
|
||||
IsConcrete<WestendLocation>,
|
||||
// Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:
|
||||
// Do a simple punn to convert an AccountId32 Location into a native chain account ID:
|
||||
LocationToAccountId,
|
||||
// Our chain's account ID type (we can't get away without mentioning it explicitly):
|
||||
AccountId,
|
||||
@@ -114,11 +114,11 @@ pub type XcmOriginToTransactDispatchOrigin = (
|
||||
XcmPassthrough<RuntimeOrigin>,
|
||||
);
|
||||
|
||||
match_types! {
|
||||
pub type ParentOrParentsPlurality: impl Contains<MultiLocation> = {
|
||||
MultiLocation { parents: 1, interior: Here } |
|
||||
MultiLocation { parents: 1, interior: X1(Plurality { .. }) }
|
||||
};
|
||||
pub struct ParentOrParentsPlurality;
|
||||
impl Contains<Location> for ParentOrParentsPlurality {
|
||||
fn contains(location: &Location) -> bool {
|
||||
matches!(location.unpack(), (1, []) | (1, [Plurality { .. }]))
|
||||
}
|
||||
}
|
||||
|
||||
/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly
|
||||
@@ -270,7 +270,7 @@ impl xcm_executor::Config for XcmConfig {
|
||||
pub type PriceForParentDelivery =
|
||||
ExponentialPrice<FeeAssetId, BaseDeliveryFee, TransactionByteFee, ParachainSystem>;
|
||||
|
||||
/// Converts a local signed origin into an XCM multilocation.
|
||||
/// Converts a local signed origin into an XCM location.
|
||||
/// Forms the basis for local origins sending/executing XCMs.
|
||||
pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;
|
||||
|
||||
|
||||
@@ -207,7 +207,7 @@ fn handle_export_message_from_system_parachain_add_to_outbound_queue_works() {
|
||||
_ => None,
|
||||
}
|
||||
}),
|
||||
|| ExportMessage { network: Rococo, destination: X1(Parachain(bridge_to_rococo_config::AssetHubRococoParaId::get().into())), xcm: Xcm(vec![]) },
|
||||
|| ExportMessage { network: Rococo, destination: [Parachain(bridge_to_rococo_config::AssetHubRococoParaId::get().into())].into(), xcm: Xcm(vec![]) },
|
||||
XCM_LANE_FOR_ASSET_HUB_WESTEND_TO_ASSET_HUB_ROCOCO,
|
||||
Some((WestendLocation::get(), ExistentialDeposit::get()).into()),
|
||||
// value should be >= than value generated by `can_calculate_weight_for_paid_export_message_with_reserve_transfer`
|
||||
|
||||
Reference in New Issue
Block a user