Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XCMv4 #1230

Merged
merged 201 commits into from
Jan 16, 2024
Merged

XCMv4 #1230

Show file tree
Hide file tree
Changes from 184 commits
Commits
Show all changes
201 commits
Select commit Hold shift + click to select a range
6d5beca
Copy XCM V3 to V4
franciscoaguirre Aug 28, 2023
bf114a0
Add v4 procedural
franciscoaguirre Aug 28, 2023
b33c516
".git/.scripts/commands/fmt/fmt.sh"
Aug 28, 2023
9dc896e
Fix all errors
franciscoaguirre Aug 29, 2023
b61f5dd
Fix all conversion tests
franciscoaguirre Aug 29, 2023
2b61dff
Ported over polkadot#7236
franciscoaguirre Aug 29, 2023
053efa6
Fix more conversion issues
franciscoaguirre Aug 30, 2023
1e73a45
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Aug 30, 2023
812df22
Fix more version things
franciscoaguirre Aug 31, 2023
8ec2a1d
Fix pallet-xcm tests
franciscoaguirre Sep 1, 2023
56512b9
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 1, 2023
b179a75
".git/.scripts/commands/fmt/fmt.sh"
Sep 1, 2023
f132002
Import GetWeight from v2
franciscoaguirre Sep 1, 2023
35e3b12
Fix clippy issues
franciscoaguirre Sep 1, 2023
fe8ab73
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 1, 2023
c4ea551
".git/.scripts/commands/fmt/fmt.sh"
Sep 1, 2023
bb7892c
Fix cumulus issues
franciscoaguirre Sep 2, 2023
a18be4c
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 2, 2023
6465d73
".git/.scripts/commands/fmt/fmt.sh"
Sep 2, 2023
e550269
Fix fuzzer compilation issue
franciscoaguirre Sep 2, 2023
df82a6f
Fix assets benchmarks
franciscoaguirre Sep 2, 2023
27b3f7a
Fix compilation issues
franciscoaguirre Sep 2, 2023
12e7768
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 2, 2023
3226676
".git/.scripts/commands/fmt/fmt.sh"
Sep 2, 2023
66227d3
Fix runtime-benchmarks compilation issues
franciscoaguirre Sep 3, 2023
e1a581d
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 3, 2023
d448008
Merge commit
franciscoaguirre Sep 4, 2023
3005d80
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 4, 2023
95db365
Fix limits test
franciscoaguirre Sep 4, 2023
8126d0a
Fix
franciscoaguirre Sep 4, 2023
85d9c22
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 5, 2023
e66e438
Remove the 'Multi' prefix from Locations and Assets
franciscoaguirre Sep 5, 2023
51f7b0c
Fixes
franciscoaguirre Sep 6, 2023
bf01267
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 6, 2023
16f63ce
Address feedback and fix some outstanding issues
franciscoaguirre Sep 6, 2023
9eadae5
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 7, 2023
09f8470
Fix small type confusion
franciscoaguirre Sep 7, 2023
36038eb
Fix small type confusion
franciscoaguirre Sep 7, 2023
50b4ae6
Fix small type confusion
franciscoaguirre Sep 7, 2023
3bacb50
Fix small type confusion
franciscoaguirre Sep 7, 2023
6f9306a
Fix small type confusion
franciscoaguirre Sep 7, 2023
1684d48
Fix small type confusion
franciscoaguirre Sep 7, 2023
10797bd
Fix conflicts
franciscoaguirre Sep 7, 2023
89998c3
Remove some remnants of Multi
franciscoaguirre Sep 7, 2023
3c653a2
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 7, 2023
f4c5483
".git/.scripts/commands/fmt/fmt.sh"
Sep 7, 2023
ae00c52
Remove Abstract AssetId
franciscoaguirre Sep 7, 2023
2fe9519
Remove more references to abstract assets
franciscoaguirre Sep 7, 2023
042c0cc
Remove more references to abstract assets
franciscoaguirre Sep 7, 2023
71a61b5
Remove more references to abstract assets
franciscoaguirre Sep 8, 2023
73694fa
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 8, 2023
7a3231a
Remove more references to abstract assets
franciscoaguirre Sep 8, 2023
a3a0124
".git/.scripts/commands/fmt/fmt.sh"
Sep 8, 2023
6ac7f6f
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 8, 2023
b9701bf
Update polkadot/xcm/src/lib.rs
franciscoaguirre Sep 9, 2023
f9bfab7
Update polkadot/xcm/src/lib.rs
franciscoaguirre Sep 9, 2023
8f82a46
Address feedback
franciscoaguirre Sep 9, 2023
3cf6607
Fix V3/V4 NetworkId issues
franciscoaguirre Sep 11, 2023
177c30e
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 11, 2023
b0a3c56
".git/.scripts/commands/fmt/fmt.sh"
Sep 11, 2023
efd0146
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 12, 2023
a054f7b
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 26, 2023
03dd1b8
Fix some conflicts
franciscoaguirre Sep 26, 2023
7ec0bd7
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 27, 2023
fd06d44
Fix pallet-xcm
franciscoaguirre Sep 27, 2023
2c6db72
Add deprecation warnings in executor
franciscoaguirre Sep 27, 2023
09a697f
Address feedback
franciscoaguirre Sep 27, 2023
953d6d4
Remove more old syntax
franciscoaguirre Sep 27, 2023
00fd94b
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 27, 2023
3b0a504
Fix universal exports
franciscoaguirre Sep 27, 2023
09ba7f2
Favor xcm executor's prepare_and_execute
franciscoaguirre Sep 27, 2023
1f15c8e
Fixes
franciscoaguirre Sep 27, 2023
31ab8e9
Fixing old runtime code
franciscoaguirre Sep 28, 2023
9dfc772
Replace more deprecated functions
franciscoaguirre Sep 28, 2023
bab9c85
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Oct 6, 2023
541d495
Rename more instances of multi-things
franciscoaguirre Oct 6, 2023
7129c5b
Moved some muts
franciscoaguirre Oct 9, 2023
056a427
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Oct 20, 2023
3709d36
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Oct 20, 2023
9d375b3
Fix a bunch of things
franciscoaguirre Oct 20, 2023
d81d176
Add TODO for LocatableAssetId to fix conflicts
franciscoaguirre Oct 23, 2023
16d8997
Fix conflicts
franciscoaguirre Oct 23, 2023
a1b9512
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Oct 25, 2023
2e2ade7
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Oct 25, 2023
1e9aeba
Address feedback
franciscoaguirre Oct 25, 2023
3408299
Fix more compiler issues
franciscoaguirre Oct 25, 2023
defc92f
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 1, 2023
223f70f
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 1, 2023
25e7fa2
Fix conflicts and add tests for xcm procedural
franciscoaguirre Nov 1, 2023
00f2c86
Add alias HERE for empty junctions when matching unpacked locations
franciscoaguirre Nov 1, 2023
e4e9ede
Fix unclosed delimiter
franciscoaguirre Nov 1, 2023
06b288a
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 2, 2023
17436b2
Remove unused import
franciscoaguirre Nov 2, 2023
b580ef2
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 3, 2023
d7ba541
Fix conflicts
franciscoaguirre Nov 7, 2023
dd156da
Remove unused stuff and fix conversion example
franciscoaguirre Nov 7, 2023
1136c1b
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 7, 2023
e9dc9ca
Make Outcome a named fields struct
franciscoaguirre Nov 7, 2023
dfe5863
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 7, 2023
b036638
Fixed conflicts, only missing the LocatableAssetId issue
franciscoaguirre Nov 7, 2023
2470925
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 9, 2023
08ccf4f
More HEREs
franciscoaguirre Nov 13, 2023
739dc98
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 13, 2023
e0b1da2
Fix conflicts
franciscoaguirre Nov 13, 2023
94f6f98
Fix conflicts
franciscoaguirre Nov 13, 2023
a0a4c1b
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 14, 2023
7bccc37
Fix a lot more conflicts
franciscoaguirre Nov 15, 2023
a97a1a6
Remove dbg
franciscoaguirre Nov 17, 2023
a14ca21
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 17, 2023
45c4f8a
Fix conflicts again
franciscoaguirre Nov 17, 2023
9ed6a56
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 17, 2023
7c5e528
Remove deprecated type
franciscoaguirre Nov 17, 2023
c701e97
Remove unused import
franciscoaguirre Nov 17, 2023
0218c21
Add import back but under feature flag
franciscoaguirre Nov 18, 2023
1650d96
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 18, 2023
8eb706d
".git/.scripts/commands/fmt/fmt.sh"
Nov 18, 2023
19d1e13
Add missing licensen
franciscoaguirre Nov 18, 2023
2ecc6f5
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 18, 2023
dd85e2c
Remove all HERE in favor of empty slice for consistency
franciscoaguirre Nov 21, 2023
af08d0a
Simplify an impl
franciscoaguirre Nov 21, 2023
6e905de
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 21, 2023
e9fff16
Fix duplicated dev dependency
franciscoaguirre Nov 21, 2023
4cf61b8
Fix builder pattern issues in v4
franciscoaguirre Nov 21, 2023
8f0beef
Remove leftover HERE
franciscoaguirre Nov 22, 2023
99f2053
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 22, 2023
22f4af5
".git/.scripts/commands/fmt/fmt.sh"
Nov 22, 2023
724037d
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 22, 2023
dca03dc
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 22, 2023
54e4c78
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 23, 2023
44e80cd
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 29, 2023
ab6a4bb
Add conversion for the new variant
franciscoaguirre Nov 29, 2023
6a20fa0
Pin v3::MultiLocation for some stored values
franciscoaguirre Nov 29, 2023
03f1b56
Fix conflicts
franciscoaguirre Nov 29, 2023
a97b454
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 29, 2023
a835e56
".git/.scripts/commands/fmt/fmt.sh"
Nov 29, 2023
d9536d7
Fix conflicts
franciscoaguirre Nov 29, 2023
f9f83cd
Fix conflicts
franciscoaguirre Nov 29, 2023
25b65a8
Fix conflict
franciscoaguirre Nov 29, 2023
a911050
Fix conflict
franciscoaguirre Nov 29, 2023
0622b80
Fix conflict
franciscoaguirre Nov 29, 2023
e6eeec1
Fix conflict
franciscoaguirre Nov 29, 2023
c4d7baa
Fix conflict
franciscoaguirre Nov 29, 2023
8c890d3
Fix conflict
franciscoaguirre Nov 29, 2023
8460c30
Fix conflict
franciscoaguirre Nov 29, 2023
8fefa03
Address feedback
franciscoaguirre Nov 30, 2023
735ad69
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Dec 6, 2023
fd26de9
Finally pin v3::Location for foreign assets in asset hubs
franciscoaguirre Dec 8, 2023
da99090
Fix conflicts
franciscoaguirre Dec 9, 2023
e5ddf8e
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Dec 9, 2023
f93576c
Add PRDoc
franciscoaguirre Dec 9, 2023
d89fa40
".git/.scripts/commands/fmt/fmt.sh"
Dec 9, 2023
3a767da
Remove unnecessary clone
franciscoaguirre Dec 9, 2023
e8a0cd0
Remove unnecessary Some and question mark
franciscoaguirre Dec 10, 2023
9100086
Remove some more Multis
franciscoaguirre Dec 10, 2023
e694ecc
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Dec 11, 2023
f9baa17
Fix conflicts
franciscoaguirre Dec 11, 2023
ee7e4c8
Remove unnecessary clone
franciscoaguirre Dec 11, 2023
09d8da7
Remove unnecessary clone
franciscoaguirre Dec 11, 2023
bcd62c2
Remove unused imports
franciscoaguirre Dec 11, 2023
6910bb4
Remove unnecessary clones
franciscoaguirre Dec 11, 2023
8cba5c6
Fix lints
franciscoaguirre Dec 11, 2023
1e08305
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Dec 12, 2023
6cc919d
".git/.scripts/commands/fmt/fmt.sh"
Dec 12, 2023
11afede
Merge commit
franciscoaguirre Dec 12, 2023
7d425c5
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Dec 12, 2023
28a8626
Fix conflicts
franciscoaguirre Dec 12, 2023
0230b55
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Dec 12, 2023
1cfcbd6
Fix
franciscoaguirre Dec 12, 2023
b66a928
Move import to another feature
franciscoaguirre Dec 12, 2023
5305a13
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Dec 13, 2023
676c9a3
Address feedback
franciscoaguirre Dec 13, 2023
b47501c
Fix
franciscoaguirre Dec 13, 2023
967414f
Fixes
franciscoaguirre Dec 13, 2023
fcb6cf5
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Dec 13, 2023
6d48112
Remove deprecated code
franciscoaguirre Dec 13, 2023
fb9a196
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Jan 11, 2024
113ffc2
Partly fix all conflicts
franciscoaguirre Jan 11, 2024
1749902
All conflicts fixed
franciscoaguirre Jan 12, 2024
2765259
Fix more conflicts
franciscoaguirre Jan 12, 2024
417d974
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Jan 12, 2024
5441996
".git/.scripts/commands/fmt/fmt.sh"
Jan 12, 2024
760fddc
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Jan 12, 2024
3a5f005
Remove another instance of MultiLocation
franciscoaguirre Jan 12, 2024
d45c283
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Jan 15, 2024
57698c7
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Jan 15, 2024
b8d045d
Fix issue with prepare_and_execute in snowbridge test
franciscoaguirre Jan 16, 2024
2a20325
Update message id in test
franciscoaguirre Jan 16, 2024
30023b5
Use zero credit for prepare_and_execute in test
franciscoaguirre Jan 16, 2024
97e85a4
Remove pallet-asset-tx-payment from asset-hub-westend
franciscoaguirre Jan 16, 2024
ef5a740
Remove file and set more credits to 0
franciscoaguirre Jan 16, 2024
7b6a9b8
Remove some extra things from conflict resolution
franciscoaguirre Jan 16, 2024
6aae8f6
Simplify version conversion pattern
franciscoaguirre Jan 16, 2024
8aa2425
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Jan 16, 2024
c51f0c2
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Jan 16, 2024
741ab96
Fix conflicts
franciscoaguirre Jan 16, 2024
9be601f
Fix some versions
franciscoaguirre Jan 16, 2024
f92c65d
Fix more conflicts
franciscoaguirre Jan 16, 2024
feebfc8
Fix more conflicts
franciscoaguirre Jan 16, 2024
1d318ce
Fix
franciscoaguirre Jan 16, 2024
b619d25
Tackle some feedback
franciscoaguirre Jan 16, 2024
c933a23
".git/.scripts/commands/fmt/fmt.sh"
Jan 16, 2024
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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions bridges/bin/runtime-common/src/messages_benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use frame_support::weights::Weight;
use pallet_bridge_messages::benchmarking::{MessageDeliveryProofParams, MessageProofParams};
use sp_runtime::traits::{Header, Zero};
use sp_std::prelude::*;
use xcm::v3::prelude::*;
use xcm::latest::prelude::*;

/// Prepare inbound bridge message according to given message proof parameters.
fn prepare_inbound_message(
Expand Down Expand Up @@ -266,19 +266,19 @@ where
/// Returns callback which generates `BridgeMessage` from Polkadot XCM builder based on
/// `expected_message_size` for benchmark.
pub fn generate_xcm_builder_bridge_message_sample(
destination: InteriorMultiLocation,
destination: InteriorLocation,
) -> impl Fn(usize) -> MessagePayload {
move |expected_message_size| -> MessagePayload {
// For XCM bridge hubs, it is the message that
// will be pushed further to some XCM queue (XCMP/UMP)
let location = xcm::VersionedInteriorMultiLocation::V3(destination);
let location = xcm::VersionedInteriorLocation::V4(destination.clone());
let location_encoded_size = location.encoded_size();

// we don't need to be super-precise with `expected_size` here
let xcm_size = expected_message_size.saturating_sub(location_encoded_size);
let xcm_data_size = xcm_size.saturating_sub(
// minus empty instruction size
xcm::v3::Instruction::<()>::ExpectPallet {
Instruction::<()>::ExpectPallet {
index: 0,
name: vec![],
module_name: vec![],
Expand All @@ -294,8 +294,8 @@ pub fn generate_xcm_builder_bridge_message_sample(
expected_message_size, location_encoded_size, xcm_size, xcm_data_size,
);

let xcm = xcm::VersionedXcm::<()>::V3(
vec![xcm::v3::Instruction::<()>::ExpectPallet {
let xcm = xcm::VersionedXcm::<()>::V4(
vec![Instruction::<()>::ExpectPallet {
index: 0,
name: vec![42; xcm_data_size],
module_name: vec![],
Expand Down
22 changes: 11 additions & 11 deletions bridges/bin/runtime-common/src/messages_xcm_extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@ impl<
#[cfg_attr(feature = "std", derive(Debug, Eq, PartialEq))]
pub struct SenderAndLane {
/// Sending chain relative location.
pub location: MultiLocation,
pub location: Location,
/// Message lane, used by the sending chain.
pub lane: LaneId,
}

impl SenderAndLane {
/// Create new object using provided location and lane.
pub fn new(location: MultiLocation, lane: LaneId) -> Self {
pub fn new(location: Location, lane: LaneId) -> Self {
SenderAndLane { location, lane }
}
}
Expand Down Expand Up @@ -168,7 +168,7 @@ pub struct XcmBlobHaulerAdapter<XcmBlobHauler, Lanes>(

impl<
H: XcmBlobHauler,
Lanes: Get<sp_std::vec::Vec<(SenderAndLane, (NetworkId, InteriorMultiLocation))>>,
Lanes: Get<sp_std::vec::Vec<(SenderAndLane, (NetworkId, InteriorLocation))>>,
> OnMessagesDelivered for XcmBlobHaulerAdapter<H, Lanes>
{
fn on_messages_delivered(lane: LaneId, enqueued_messages: MessageNonce) {
Expand Down Expand Up @@ -288,7 +288,7 @@ impl<H: XcmBlobHauler> LocalXcmQueueManager<H> {
/// Send congested signal to the `sending_chain_location`.
fn send_congested_signal(sender_and_lane: &SenderAndLane) -> Result<(), SendError> {
if let Some(msg) = H::CongestedMessage::get() {
send_xcm::<H::ToSourceChainSender>(sender_and_lane.location, msg)?;
send_xcm::<H::ToSourceChainSender>(sender_and_lane.location.clone(), msg)?;
OutboundLanesCongestedSignals::<H::Runtime, H::MessagesInstance>::insert(
sender_and_lane.lane,
true,
Expand All @@ -300,7 +300,7 @@ impl<H: XcmBlobHauler> LocalXcmQueueManager<H> {
/// Send `uncongested` signal to the `sending_chain_location`.
fn send_uncongested_signal(sender_and_lane: &SenderAndLane) -> Result<(), SendError> {
if let Some(msg) = H::UncongestedMessage::get() {
send_xcm::<H::ToSourceChainSender>(sender_and_lane.location, msg)?;
send_xcm::<H::ToSourceChainSender>(sender_and_lane.location.clone(), msg)?;
OutboundLanesCongestedSignals::<H::Runtime, H::MessagesInstance>::remove(
sender_and_lane.lane,
);
Expand All @@ -315,10 +315,10 @@ impl<H: XcmBlobHauler> LocalXcmQueueManager<H> {
pub struct XcmVersionOfDestAndRemoteBridge<Version, RemoteBridge>(
sp_std::marker::PhantomData<(Version, RemoteBridge)>,
);
impl<Version: GetVersion, RemoteBridge: Get<MultiLocation>> GetVersion
impl<Version: GetVersion, RemoteBridge: Get<Location>> GetVersion
for XcmVersionOfDestAndRemoteBridge<Version, RemoteBridge>
{
fn get_version_for(dest: &MultiLocation) -> Option<XcmVersion> {
fn get_version_for(dest: &Location) -> Option<XcmVersion> {
let dest_version = Version::get_version_for(dest);
let bridge_hub_version = Version::get_version_for(&RemoteBridge::get());

Expand All @@ -342,11 +342,11 @@ mod tests {

parameter_types! {
pub TestSenderAndLane: SenderAndLane = SenderAndLane {
location: MultiLocation::new(1, X1(Parachain(1000))),
location: Location::new(1, [Parachain(1000)]),
lane: TEST_LANE_ID,
};
pub TestLanes: sp_std::vec::Vec<(SenderAndLane, (NetworkId, InteriorMultiLocation))> = sp_std::vec![
(TestSenderAndLane::get(), (NetworkId::ByGenesis([0; 32]), InteriorMultiLocation::Here))
pub TestLanes: sp_std::vec::Vec<(SenderAndLane, (NetworkId, InteriorLocation))> = sp_std::vec![
(TestSenderAndLane::get(), (NetworkId::ByGenesis([0; 32]), InteriorLocation::Here))
];
pub DummyXcmMessage: Xcm<()> = Xcm::new();
}
Expand All @@ -363,7 +363,7 @@ mod tests {
type Ticket = ();

fn validate(
_destination: &mut Option<MultiLocation>,
_destination: &mut Option<Location>,
_message: &mut Option<Xcm<()>>,
) -> SendResult<Self::Ticket> {
Ok(((), Default::default()))
Expand Down
6 changes: 3 additions & 3 deletions bridges/modules/xcm-bridge-hub-router/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ pub trait Config<I: 'static>: crate::Config<I> {
/// Returns destination which is valid for this router instance.
/// (Needs to pass `T::Bridges`)
/// Make sure that `SendXcm` will pass.
fn ensure_bridged_target_destination() -> Result<MultiLocation, BenchmarkError> {
Ok(MultiLocation::new(
fn ensure_bridged_target_destination() -> Result<Location, BenchmarkError> {
Ok(Location::new(
Self::UniversalLocation::get().len() as u8,
X1(GlobalConsensus(Self::BridgedNetworkId::get().unwrap())),
[GlobalConsensus(Self::BridgedNetworkId::get().unwrap())],
))
}
}
Expand Down
33 changes: 12 additions & 21 deletions bridges/modules/xcm-bridge-hub-router/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pub mod pallet {
type WeightInfo: WeightInfo;

/// Universal location of this runtime.
type UniversalLocation: Get<InteriorMultiLocation>;
type UniversalLocation: Get<InteriorLocation>;
/// The bridged network that this config is for if specified.
/// Also used for filtering `Bridges` by `BridgedNetworkId`.
/// If not specified, allows all networks pass through.
Expand Down Expand Up @@ -235,9 +235,9 @@ type ViaBridgeHubExporter<T, I> = SovereignPaidRemoteExporter<
impl<T: Config<I>, I: 'static> ExporterFor for Pallet<T, I> {
fn exporter_for(
network: &NetworkId,
remote_location: &InteriorMultiLocation,
remote_location: &InteriorLocation,
message: &Xcm<()>,
) -> Option<(MultiLocation, Option<MultiAsset>)> {
) -> Option<(Location, Option<Asset>)> {
// ensure that the message is sent to the expected bridged network (if specified).
if let Some(bridged_network) = T::BridgedNetworkId::get() {
if *network != bridged_network {
Expand Down Expand Up @@ -268,7 +268,7 @@ impl<T: Config<I>, I: 'static> ExporterFor for Pallet<T, I> {
// take `base_fee` from `T::Brides`, but it has to be the same `T::FeeAsset`
let base_fee = match maybe_payment {
Some(payment) => match payment {
MultiAsset { fun: Fungible(amount), id } if id.eq(&T::FeeAsset::get()) => amount,
Asset { fun: Fungible(amount), id } if id.eq(&T::FeeAsset::get()) => amount,
invalid_asset => {
log::error!(
target: LOG_TARGET,
Expand Down Expand Up @@ -318,7 +318,7 @@ impl<T: Config<I>, I: 'static> SendXcm for Pallet<T, I> {
type Ticket = (u32, <T::ToBridgeHubSender as SendXcm>::Ticket);

fn validate(
dest: &mut Option<MultiLocation>,
dest: &mut Option<Location>,
xcm: &mut Option<Xcm<()>>,
) -> SendResult<Self::Ticket> {
// `dest` and `xcm` are required here
Expand Down Expand Up @@ -446,7 +446,7 @@ mod tests {
run_test(|| {
assert_eq!(
send_xcm::<XcmBridgeHubRouter>(
MultiLocation::new(2, X2(GlobalConsensus(Rococo), Parachain(1000))),
Location::new(2, [GlobalConsensus(Rococo), Parachain(1000)]),
vec![].into(),
),
Err(SendError::NotApplicable),
Expand All @@ -459,7 +459,7 @@ mod tests {
run_test(|| {
assert_eq!(
send_xcm::<XcmBridgeHubRouter>(
MultiLocation::new(2, X2(GlobalConsensus(Rococo), Parachain(1000))),
Location::new(2, [GlobalConsensus(Rococo), Parachain(1000)]),
vec![ClearOrigin; HARD_MESSAGE_SIZE_LIMIT as usize].into(),
),
Err(SendError::ExceedsMaxMessageSize),
Expand All @@ -483,14 +483,14 @@ mod tests {
#[test]
fn returns_proper_delivery_price() {
run_test(|| {
let dest = MultiLocation::new(2, X1(GlobalConsensus(BridgedNetworkId::get())));
let dest = Location::new(2, [GlobalConsensus(BridgedNetworkId::get())]);
let xcm: Xcm<()> = vec![ClearOrigin].into();
let msg_size = xcm.encoded_size();

// initially the base fee is used: `BASE_FEE + BYTE_FEE * msg_size + HRMP_FEE`
let expected_fee = BASE_FEE + BYTE_FEE * (msg_size as u128) + HRMP_FEE;
assert_eq!(
XcmBridgeHubRouter::validate(&mut Some(dest), &mut Some(xcm.clone()))
XcmBridgeHubRouter::validate(&mut Some(dest.clone()), &mut Some(xcm.clone()))
.unwrap()
.1
.get(0),
Expand Down Expand Up @@ -518,10 +518,7 @@ mod tests {
run_test(|| {
let old_bridge = XcmBridgeHubRouter::bridge();
assert_ok!(send_xcm::<XcmBridgeHubRouter>(
MultiLocation::new(
2,
X2(GlobalConsensus(BridgedNetworkId::get()), Parachain(1000))
),
Location::new(2, [GlobalConsensus(BridgedNetworkId::get()), Parachain(1000)]),
vec![ClearOrigin].into(),
)
.map(drop));
Expand All @@ -538,10 +535,7 @@ mod tests {

let old_bridge = XcmBridgeHubRouter::bridge();
assert_ok!(send_xcm::<XcmBridgeHubRouter>(
MultiLocation::new(
2,
X2(GlobalConsensus(BridgedNetworkId::get()), Parachain(1000))
),
Location::new(2, [GlobalConsensus(BridgedNetworkId::get()), Parachain(1000)]),
vec![ClearOrigin].into(),
)
.map(drop));
Expand All @@ -560,10 +554,7 @@ mod tests {

let old_bridge = XcmBridgeHubRouter::bridge();
assert_ok!(send_xcm::<XcmBridgeHubRouter>(
MultiLocation::new(
2,
X2(GlobalConsensus(BridgedNetworkId::get()), Parachain(1000))
),
Location::new(2, [GlobalConsensus(BridgedNetworkId::get()), Parachain(1000)]),
vec![ClearOrigin].into(),
)
.map(drop));
Expand Down
18 changes: 9 additions & 9 deletions bridges/modules/xcm-bridge-hub-router/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ construct_runtime! {
parameter_types! {
pub ThisNetworkId: NetworkId = Polkadot;
pub BridgedNetworkId: NetworkId = Kusama;
pub UniversalLocation: InteriorMultiLocation = X2(GlobalConsensus(ThisNetworkId::get()), Parachain(1000));
pub SiblingBridgeHubLocation: MultiLocation = ParentThen(X1(Parachain(1002))).into();
pub BridgeFeeAsset: AssetId = MultiLocation::parent().into();
pub UniversalLocation: InteriorLocation = [GlobalConsensus(ThisNetworkId::get()), Parachain(1000)].into();
pub SiblingBridgeHubLocation: Location = ParentThen([Parachain(1002)].into()).into();
pub BridgeFeeAsset: AssetId = Location::parent().into();
pub BridgeTable: Vec<NetworkExportTableItem>
= vec![
NetworkExportTableItem::new(
Expand All @@ -61,7 +61,7 @@ parameter_types! {
Some((BridgeFeeAsset::get(), BASE_FEE).into())
)
];
pub UnknownXcmVersionLocation: MultiLocation = MultiLocation::new(2, X2(GlobalConsensus(BridgedNetworkId::get()), Parachain(9999)));
pub UnknownXcmVersionLocation: Location = Location::new(2, [GlobalConsensus(BridgedNetworkId::get()), Parachain(9999)]);
}

#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
Expand All @@ -87,11 +87,11 @@ impl pallet_xcm_bridge_hub_router::Config<()> for TestRuntime {
}

pub struct LatestOrNoneForLocationVersionChecker<Location>(sp_std::marker::PhantomData<Location>);
impl<Location: Contains<MultiLocation>> GetVersion
for LatestOrNoneForLocationVersionChecker<Location>
impl<LocationValue: Contains<Location>> GetVersion
for LatestOrNoneForLocationVersionChecker<LocationValue>
{
fn get_version_for(dest: &MultiLocation) -> Option<XcmVersion> {
if Location::contains(dest) {
fn get_version_for(dest: &Location) -> Option<XcmVersion> {
if LocationValue::contains(dest) {
return None
}
Some(XCM_VERSION)
Expand All @@ -110,7 +110,7 @@ impl SendXcm for TestToBridgeHubSender {
type Ticket = ();

fn validate(
_destination: &mut Option<MultiLocation>,
_destination: &mut Option<Location>,
_message: &mut Option<Xcm<()>>,
) -> SendResult<Self::Ticket> {
Ok(((), (BridgeFeeAsset::get(), HRMP_FEE).into()))
Expand Down
12 changes: 6 additions & 6 deletions bridges/modules/xcm-bridge-hub/src/exporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ where
fn validate(
network: NetworkId,
channel: u32,
universal_source: &mut Option<InteriorMultiLocation>,
destination: &mut Option<InteriorMultiLocation>,
universal_source: &mut Option<InteriorLocation>,
destination: &mut Option<InteriorLocation>,
message: &mut Option<Xcm<()>>,
) -> Result<(Self::Ticket, MultiAssets), SendError> {
) -> Result<(Self::Ticket, Assets), SendError> {
// Find supported lane_id.
let sender_and_lane = Self::lane_for(
universal_source.as_ref().ok_or(SendError::MissingArgument)?,
Expand Down Expand Up @@ -137,11 +137,11 @@ mod tests {
use frame_support::assert_ok;
use xcm_executor::traits::export_xcm;

fn universal_source() -> InteriorMultiLocation {
X2(GlobalConsensus(RelayNetwork::get()), Parachain(SIBLING_ASSET_HUB_ID))
fn universal_source() -> InteriorLocation {
[GlobalConsensus(RelayNetwork::get()), Parachain(SIBLING_ASSET_HUB_ID)].into()
}

fn universal_destination() -> InteriorMultiLocation {
fn universal_destination() -> InteriorLocation {
BridgedDestination::get()
}

Expand Down
14 changes: 7 additions & 7 deletions bridges/modules/xcm-bridge-hub/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,25 @@ pub mod pallet {
BridgeMessagesConfig<Self::BridgeMessagesPalletInstance>
{
/// Runtime's universal location.
type UniversalLocation: Get<InteriorMultiLocation>;
type UniversalLocation: Get<InteriorLocation>;
// TODO: https://github.com/paritytech/parity-bridges-common/issues/1666 remove `ChainId` and
// replace it with the `NetworkId` - then we'll be able to use
// `T as pallet_bridge_messages::Config<T::BridgeMessagesPalletInstance>::BridgedChain::NetworkId`
/// Bridged network as relative location of bridged `GlobalConsensus`.
#[pallet::constant]
type BridgedNetwork: Get<MultiLocation>;
type BridgedNetwork: Get<Location>;
/// Associated messages pallet instance that bridges us with the
/// `BridgedNetworkId` consensus.
type BridgeMessagesPalletInstance: 'static;

/// Price of single message export to the bridged consensus (`Self::BridgedNetworkId`).
type MessageExportPrice: Get<MultiAssets>;
type MessageExportPrice: Get<Assets>;
/// Checks the XCM version for the destination.
type DestinationVersion: GetVersion;

/// Get point-to-point links with bridged consensus (`Self::BridgedNetworkId`).
/// (this will be replaced with dynamic on-chain bridges - `Bridges V2`)
type Lanes: Get<sp_std::vec::Vec<(SenderAndLane, (NetworkId, InteriorMultiLocation))>>;
type Lanes: Get<sp_std::vec::Vec<(SenderAndLane, (NetworkId, InteriorLocation))>>;
/// Support for point-to-point links
/// (this will be replaced with dynamic on-chain bridges - `Bridges V2`)
type LanesSupport: XcmBlobHauler;
Expand All @@ -86,10 +86,10 @@ pub mod pallet {
impl<T: Config<I>, I: 'static> Pallet<T, I> {
/// Returns dedicated/configured lane identifier.
pub(crate) fn lane_for(
source: &InteriorMultiLocation,
dest: (&NetworkId, &InteriorMultiLocation),
source: &InteriorLocation,
dest: (&NetworkId, &InteriorLocation),
) -> Option<SenderAndLane> {
let source = source.relative_to(&T::UniversalLocation::get());
let source = source.clone().relative_to(&T::UniversalLocation::get());

// Check that we have configured a point-to-point lane for 'source' and `dest`.
T::Lanes::get()
Expand Down
Loading
Loading