Follow-up on #1518 (#1546)

* Adjustments for the xcm messages sending logic

Signed-off-by: Serban Iorga <serban@parity.io>

* Deduplicate XCM destination

Signed-off-by: Serban Iorga <serban@parity.io>

* [send_message] small changes

Signed-off-by: Serban Iorga <serban@parity.io>

* Define CustomNetworkId

Right now we use some associations between Rialto, RialtoParachain and
Millau chains and chains defined in the NetworkId enum. But if we are
not carreful we might do mistakes like:
In Millau:
pub const ThisNetwork: NetworkId = Kusama;
pub const RialtoNetwork: NetworkId = Polkadot;
In Rialto:
pub const ThisNetwork: NetworkId = Kusama;
pub const MillauNetwork: NetworkId = Polkadot;

We're introducing CustomNetworkId to have a centralized mapping between
NetworkId chains and our custom chains.

Signed-off-by: Serban Iorga <serban@parity.io>

* Revert "Deduplicate XCM destination"

This reverts commit 3a0a950e1d7484e3ecac45f5c00b152f0485cd11.

Signed-off-by: Serban Iorga <serban@parity.io>
This commit is contained in:
Serban Iorga
2022-08-12 12:05:46 +03:00
committed by Bastian Köcher
parent 050b12f3aa
commit e0b42dfae7
11 changed files with 89 additions and 72 deletions
@@ -78,6 +78,7 @@ pub use pallet_bridge_messages::Call as MessagesCall;
pub use pallet_xcm::Call as XcmCall;
// Polkadot & XCM imports
use bridge_runtime_common::CustomNetworkId;
use pallet_xcm::XcmPassthrough;
use polkadot_parachain::primitives::Sibling;
use xcm::latest::prelude::*;
@@ -304,13 +305,13 @@ impl pallet_randomness_collective_flip::Config for Runtime {}
parameter_types! {
pub const RelayLocation: MultiLocation = MultiLocation::parent();
pub const RelayNetwork: NetworkId = NetworkId::Polkadot;
pub const RelayNetwork: NetworkId = CustomNetworkId::Rialto.as_network_id();
pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();
pub UniversalLocation: InteriorMultiLocation = X1(Parachain(ParachainInfo::parachain_id().into()));
/// The Millau network ID, associated with Kusama.
pub const MillauNetwork: NetworkId = Kusama;
/// The RialtoParachain network ID, associated with Westend.
pub const ThisNetwork: NetworkId = Westend;
/// The Millau network ID.
pub const MillauNetwork: NetworkId = CustomNetworkId::Millau.as_network_id();
/// The RialtoParachain network ID.
pub const ThisNetwork: NetworkId = CustomNetworkId::RialtoParachain.as_network_id();
}
/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used