XCM: Introduce versioning to dispatchables' params (#3693)

* Introduce versioning to dispatchables' params

* Fixes

* Formatting

* Bump
This commit is contained in:
Gavin Wood
2021-08-23 19:53:59 +02:00
committed by GitHub
parent 4ac1e73535
commit e0244f9769
10 changed files with 222 additions and 57 deletions
+13 -13
View File
@@ -18,7 +18,7 @@ use crate::mock::*;
use frame_support::{assert_noop, assert_ok, traits::Currency};
use polkadot_parachain::primitives::{AccountIdConversion, Id as ParaId};
use std::convert::TryInto;
use xcm::v1::prelude::*;
use xcm::{v1::prelude::*, VersionedXcm};
const ALICE: AccountId = AccountId::new([0u8; 32]);
const BOB: AccountId = AccountId::new([1u8; 32]);
@@ -46,8 +46,8 @@ fn send_works() {
};
assert_ok!(XcmPallet::send(
Origin::signed(ALICE),
Box::new(RelayLocation::get()),
Box::new(message.clone())
Box::new(RelayLocation::get().into()),
Box::new(VersionedXcm::from(message.clone()))
));
assert_eq!(
sent_xcm(),
@@ -88,8 +88,8 @@ fn send_fails_when_xcm_router_blocks() {
assert_noop!(
XcmPallet::send(
Origin::signed(ALICE),
Box::new(MultiLocation::ancestor(8)),
Box::new(message.clone())
Box::new(MultiLocation::ancestor(8).into()),
Box::new(VersionedXcm::from(message.clone())),
),
crate::Error::<Test>::SendFailure
);
@@ -109,9 +109,9 @@ fn teleport_assets_works() {
assert_eq!(Balances::total_balance(&ALICE), INITIAL_BALANCE);
assert_ok!(XcmPallet::teleport_assets(
Origin::signed(ALICE),
Box::new(RelayLocation::get()),
Box::new(AccountId32 { network: Any, id: BOB.into() }.into()),
(Here, SEND_AMOUNT).into(),
Box::new(RelayLocation::get().into()),
Box::new(AccountId32 { network: Any, id: BOB.into() }.into().into()),
Box::new((Here, SEND_AMOUNT).into()),
0,
weight,
));
@@ -138,9 +138,9 @@ fn reserve_transfer_assets_works() {
assert_eq!(Balances::total_balance(&ALICE), INITIAL_BALANCE);
assert_ok!(XcmPallet::reserve_transfer_assets(
Origin::signed(ALICE),
Box::new(Parachain(PARA_ID).into()),
Box::new(dest.clone()),
(Here, SEND_AMOUNT).into(),
Box::new(Parachain(PARA_ID).into().into()),
Box::new(dest.clone().into()),
Box::new((Here, SEND_AMOUNT).into()),
0,
weight
));
@@ -184,13 +184,13 @@ fn execute_withdraw_to_deposit_works() {
assert_eq!(Balances::total_balance(&ALICE), INITIAL_BALANCE);
assert_ok!(XcmPallet::execute(
Origin::signed(ALICE),
Box::new(Xcm::WithdrawAsset {
Box::new(VersionedXcm::from(Xcm::WithdrawAsset {
assets: (Here, SEND_AMOUNT).into(),
effects: vec![
buy_execution((Here, SEND_AMOUNT), weight),
DepositAsset { assets: All.into(), max_assets: 1, beneficiary: dest }
],
}),
})),
weight
));
assert_eq!(Balances::total_balance(&ALICE), INITIAL_BALANCE - SEND_AMOUNT);