Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
29790dc
feat(xcm-v2): add deprecation warnings
franciscoaguirre Apr 15, 2024
25b1654
Merge branch 'master' into deprecate-xcm-v2
franciscoaguirre May 23, 2024
e9cac9f
feat: just deprecate whole v2 module
franciscoaguirre May 23, 2024
aa09756
doc: prdoc
franciscoaguirre May 23, 2024
adde6be
Merge branch 'master' into deprecate-xcm-v2
franciscoaguirre May 23, 2024
e95aa65
fix: fmt
franciscoaguirre May 23, 2024
120accf
fix: change tests that used v2 and v3 to use v3 and v4
franciscoaguirre May 23, 2024
0c1827c
Merge branch 'master' into deprecate-xcm-v2
franciscoaguirre May 23, 2024
7cd9352
fix: fmt
franciscoaguirre May 23, 2024
1bf5fa9
fix: change v2 to v3 in benchmarks
franciscoaguirre May 23, 2024
c6148db
doc: update prdoc with more crate bumps
franciscoaguirre May 23, 2024
8dbe0cb
Update cumulus/parachains/integration-tests/emulated/tests/bridges/br…
franciscoaguirre May 24, 2024
9ccc37f
Update cumulus/parachains/integration-tests/emulated/tests/bridges/br…
franciscoaguirre May 24, 2024
d049685
Update cumulus/parachains/integration-tests/emulated/tests/bridges/br…
franciscoaguirre May 24, 2024
7a4cd57
Update cumulus/parachains/integration-tests/emulated/tests/bridges/br…
franciscoaguirre May 24, 2024
3e01c8a
Update cumulus/parachains/integration-tests/emulated/tests/bridges/br…
franciscoaguirre May 24, 2024
cec84ae
Update cumulus/parachains/integration-tests/emulated/tests/bridges/br…
franciscoaguirre May 24, 2024
3f0414f
Update cumulus/parachains/integration-tests/emulated/tests/bridges/br…
franciscoaguirre May 24, 2024
b2f1291
Update cumulus/parachains/integration-tests/emulated/tests/bridges/br…
franciscoaguirre May 24, 2024
45a1a2e
Update cumulus/parachains/integration-tests/emulated/tests/bridges/br…
franciscoaguirre May 24, 2024
0c56171
Update cumulus/parachains/integration-tests/emulated/tests/bridges/br…
franciscoaguirre May 24, 2024
4ccedb5
Update polkadot/xcm/pallet-xcm/src/benchmarking.rs
franciscoaguirre May 24, 2024
2e1b596
Update polkadot/xcm/pallet-xcm/src/benchmarking.rs
franciscoaguirre May 24, 2024
29ed18c
Update polkadot/xcm/pallet-xcm/src/benchmarking.rs
franciscoaguirre May 24, 2024
21f60dd
chore(xcmp-queue): use latest and older instead of hardcoding versions
franciscoaguirre May 24, 2024
5e8501f
fix(pallet-xcm::benchmarking): go back to creating a bad location
franciscoaguirre May 24, 2024
fdbd578
Merge branch 'master' into deprecate-xcm-v2
franciscoaguirre May 24, 2024
8307f81
fix: fmt
franciscoaguirre May 24, 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
4 changes: 4 additions & 0 deletions polkadot/xcm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
// Hence, `no_std` rather than sp-runtime.
#![cfg_attr(not(feature = "std"), no_std)]

// Because of XCMv2.
#![allow(deprecated)]
Comment thread
franciscoaguirre marked this conversation as resolved.

extern crate alloc;

use derivative::Derivative;
Expand Down Expand Up @@ -428,6 +431,7 @@ pub type VersionedMultiAssets = VersionedAssets;
#[scale_info(replace_segment("staging_xcm", "xcm"))]
pub enum VersionedXcm<RuntimeCall> {
#[codec(index = 2)]
#[deprecated]
Comment thread
bkontur marked this conversation as resolved.
V2(v2::Xcm<RuntimeCall>),
#[codec(index = 3)]
V3(v3::Xcm<RuntimeCall>),
Expand Down
7 changes: 7 additions & 0 deletions polkadot/xcm/src/v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.

//! # XCM Version 2
//!
//! WARNING: DEPRECATED, please use version 3 or 4.
//!
//! Version 2 of the Cross-Consensus Message format data structures. The comprehensive list of
//! changes can be found in
//! [this PR description](https://github.com/paritytech/polkadot/pull/3629#issue-968428279).
Expand Down Expand Up @@ -49,6 +52,8 @@
//! `DepositAsset` instructions. Failing that, dispatch calls to `teleport_assets` and
//! `reserve_transfer_assets` will fail with `UnweighableMessage`.

#![allow(deprecated)]

use super::{
v3::{
BodyId as NewBodyId, BodyPart as NewBodyPart, Instruction as NewInstruction,
Expand Down Expand Up @@ -262,6 +267,8 @@ pub const VERSION: super::Version = 2;
/// An identifier for a query.
pub type QueryId = u64;

/// DEPRECATED. Please use XCMv3 or XCMv4 instead.
#[deprecated(note = "XCMv2 will be removed after June 2024. Please use XCMv3 or XCMv4 instead.")]
Comment thread
bkontur marked this conversation as resolved.
Outdated
#[derive(Derivative, Default, Encode, Decode, TypeInfo)]
#[derivative(Clone(bound = ""), Eq(bound = ""), PartialEq(bound = ""), Debug(bound = ""))]
#[codec(encode_bound())]
Expand Down
130 changes: 9 additions & 121 deletions polkadot/xcm/src/v3/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@

//! Version 3 of the Cross-Consensus Message format data structures.

use super::{
v2::{
Instruction as OldInstruction, Response as OldResponse, WeightLimit as OldWeightLimit,
Xcm as OldXcm,
},
v4::{
Instruction as NewInstruction, PalletInfo as NewPalletInfo,
QueryResponseInfo as NewQueryResponseInfo, Response as NewResponse, Xcm as NewXcm,
},
#[allow(deprecated)]
use super::v2::{
Instruction as OldInstruction, Response as OldResponse, WeightLimit as OldWeightLimit,
Xcm as OldXcm,
};
use super::v4::{
Instruction as NewInstruction, PalletInfo as NewPalletInfo,
QueryResponseInfo as NewQueryResponseInfo, Response as NewResponse, Xcm as NewXcm,
};
use crate::DoubleEncoded;
use alloc::{vec, vec::Vec};
Expand Down Expand Up @@ -1314,6 +1313,7 @@ impl TryFrom<OldResponse> for Response {
}

// Convert from a v2 XCM to a v3 XCM.
#[allow(deprecated)]
impl<Call> TryFrom<OldXcm<Call>> for Xcm<Call> {
type Error = ();
fn try_from(old_xcm: OldXcm<Call>) -> result::Result<Self, ()> {
Expand Down Expand Up @@ -1576,118 +1576,6 @@ impl<Call> TryFrom<OldInstruction<Call>> for Instruction<Call> {
#[cfg(test)]
mod tests {
use super::{prelude::*, *};
use crate::v2::{
Comment thread
bkontur marked this conversation as resolved.
Junctions::Here as OldHere, MultiAssetFilter as OldMultiAssetFilter,
WildMultiAsset as OldWildMultiAsset,
};

#[test]
fn basic_roundtrip_works() {
let xcm = Xcm::<()>(vec![TransferAsset {
assets: (Here, 1u128).into(),
beneficiary: Here.into(),
}]);
let old_xcm = OldXcm::<()>(vec![OldInstruction::TransferAsset {
assets: (OldHere, 1).into(),
beneficiary: OldHere.into(),
}]);
assert_eq!(old_xcm, OldXcm::<()>::try_from(xcm.clone()).unwrap());
let new_xcm: Xcm<()> = old_xcm.try_into().unwrap();
assert_eq!(new_xcm, xcm);
}

#[test]
fn teleport_roundtrip_works() {
let xcm = Xcm::<()>(vec![
ReceiveTeleportedAsset((Here, 1u128).into()),
ClearOrigin,
DepositAsset { assets: Wild(AllCounted(1)), beneficiary: Here.into() },
]);
let old_xcm: OldXcm<()> = OldXcm::<()>(vec![
OldInstruction::ReceiveTeleportedAsset((OldHere, 1).into()),
OldInstruction::ClearOrigin,
OldInstruction::DepositAsset {
assets: crate::v2::MultiAssetFilter::Wild(crate::v2::WildMultiAsset::All),
max_assets: 1,
beneficiary: OldHere.into(),
},
]);
assert_eq!(old_xcm, OldXcm::<()>::try_from(xcm.clone()).unwrap());
let new_xcm: Xcm<()> = old_xcm.try_into().unwrap();
assert_eq!(new_xcm, xcm);
}

#[test]
fn reserve_deposit_roundtrip_works() {
let xcm = Xcm::<()>(vec![
ReserveAssetDeposited((Here, 1u128).into()),
ClearOrigin,
BuyExecution {
fees: (Here, 1u128).into(),
weight_limit: Some(Weight::from_parts(1, DEFAULT_PROOF_SIZE)).into(),
},
DepositAsset { assets: Wild(AllCounted(1)), beneficiary: Here.into() },
]);
let old_xcm = OldXcm::<()>(vec![
OldInstruction::ReserveAssetDeposited((OldHere, 1).into()),
OldInstruction::ClearOrigin,
OldInstruction::BuyExecution {
fees: (OldHere, 1).into(),
weight_limit: Some(1).into(),
},
OldInstruction::DepositAsset {
assets: crate::v2::MultiAssetFilter::Wild(crate::v2::WildMultiAsset::All),
max_assets: 1,
beneficiary: OldHere.into(),
},
]);
assert_eq!(old_xcm, OldXcm::<()>::try_from(xcm.clone()).unwrap());
let new_xcm: Xcm<()> = old_xcm.try_into().unwrap();
assert_eq!(new_xcm, xcm);
}

#[test]
fn deposit_asset_roundtrip_works() {
let xcm = Xcm::<()>(vec![
WithdrawAsset((Here, 1u128).into()),
DepositAsset { assets: Wild(AllCounted(1)), beneficiary: Here.into() },
]);
let old_xcm = OldXcm::<()>(vec![
OldInstruction::WithdrawAsset((OldHere, 1).into()),
OldInstruction::DepositAsset {
assets: OldMultiAssetFilter::Wild(OldWildMultiAsset::All),
max_assets: 1,
beneficiary: OldHere.into(),
},
]);
assert_eq!(old_xcm, OldXcm::<()>::try_from(xcm.clone()).unwrap());
let new_xcm: Xcm<()> = old_xcm.try_into().unwrap();
assert_eq!(new_xcm, xcm);
}

#[test]
fn deposit_reserve_asset_roundtrip_works() {
let xcm = Xcm::<()>(vec![
WithdrawAsset((Here, 1u128).into()),
DepositReserveAsset {
assets: Wild(AllCounted(1)),
dest: Here.into(),
xcm: Xcm::<()>(vec![]),
},
]);
let old_xcm = OldXcm::<()>(vec![
OldInstruction::WithdrawAsset((OldHere, 1).into()),
OldInstruction::DepositReserveAsset {
assets: OldMultiAssetFilter::Wild(OldWildMultiAsset::All),
max_assets: 1,
dest: OldHere.into(),
xcm: OldXcm::<()>(vec![]),
},
]);
assert_eq!(old_xcm, OldXcm::<()>::try_from(xcm.clone()).unwrap());
let new_xcm: Xcm<()> = old_xcm.try_into().unwrap();
assert_eq!(new_xcm, xcm);
}

#[test]
fn decoding_respects_limit() {
Expand Down