git.delta.rocks / unique-network / refs/commits / 1a2b8d32f399

difftreelog

build update xcm to v1

Yaroslav Bolyukin2021-09-29parent: #f033297.patch.diff
in: master

1 file changed

modifiedruntime/src/lib.rsdiffbeforeafterboth
79// Polkadot imports79// Polkadot imports
80use pallet_xcm::XcmPassthrough;80use pallet_xcm::XcmPassthrough;
81use polkadot_parachain::primitives::Sibling;81use polkadot_parachain::primitives::Sibling;
82use xcm::v0::{BodyId, Junction::*, MultiLocation, MultiLocation::*, NetworkId};82use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};
83use xcm_builder::{83use xcm_builder::{
84 AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,84 AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,
85 EnsureXcmOrigin, FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset,85 EnsureXcmOrigin, FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset,
546impl cumulus_pallet_aura_ext::Config for Runtime {}546impl cumulus_pallet_aura_ext::Config for Runtime {}
547547
548parameter_types! {548parameter_types! {
549 pub const RelayLocation: MultiLocation = X1(Parent);549 pub const RelayLocation: MultiLocation = MultiLocation::parent();
550 pub const RelayNetwork: NetworkId = NetworkId::Polkadot;550 pub const RelayNetwork: NetworkId = NetworkId::Polkadot;
551 pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();551 pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();
552 pub Ancestry: MultiLocation = X1(Parachain(ParachainInfo::parachain_id().into()));552 pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();
553}553}
554554
555/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used555/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
606 // One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.606 // One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.
607 pub UnitWeightCost: Weight = 1_000_000;607 pub UnitWeightCost: Weight = 1_000_000;
608 // 1200 UNIQUEs buy 1 second of weight.608 // 1200 UNIQUEs buy 1 second of weight.
609 pub const WeightPrice: (MultiLocation, u128) = (X1(Parent), 1_200 * UNIQUE);609 pub const WeightPrice: (MultiLocation, u128) = (MultiLocation::parent(), 1_200 * UNIQUE);
610}610}
611611
612match_type! {612match_type! {
613 pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {613 pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {
614 X1(Parent) | X2(Parent, Plurality { id: BodyId::Unit, .. })614 MultiLocation { parents: 1, interior: Here } |
615 MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }
615 };616 };
616}617}
617618
636 type Weigher = FixedWeightBounds<UnitWeightCost, Call>;637 type Weigher = FixedWeightBounds<UnitWeightCost, Call>;
637 type Trader = UsingComponents<IdentityFee<Balance>, RelayLocation, AccountId, Balances, ()>;638 type Trader = UsingComponents<IdentityFee<Balance>, RelayLocation, AccountId, Balances, ()>;
638 type ResponseHandler = (); // Don't handle responses for now.639 type ResponseHandler = (); // Don't handle responses for now.
640 type SubscriptionService = PolkadotXcm;
639}641}
640642
641// parameter_types! {643// parameter_types! {
649/// queues.651/// queues.
650pub type XcmRouter = (652pub type XcmRouter = (
651 // Two routers - use UMP to communicate with the relay chain:653 // Two routers - use UMP to communicate with the relay chain:
652 cumulus_primitives_utility::ParentAsUmp<ParachainSystem>,654 cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,
653 // ..and XCMP to communicate with the sibling chains.655 // ..and XCMP to communicate with the sibling chains.
654 XcmpQueue,656 XcmpQueue,
655);657);
680 type Event = Event;682 type Event = Event;
681 type XcmExecutor = XcmExecutor<XcmConfig>;683 type XcmExecutor = XcmExecutor<XcmConfig>;
682 type ChannelInfo = ParachainSystem;684 type ChannelInfo = ParachainSystem;
685 type VersionWrapper = ();
683}686}
684687
685impl cumulus_pallet_dmp_queue::Config for Runtime {688impl cumulus_pallet_dmp_queue::Config for Runtime {