Skip to content

Commit

Permalink
chore(xcm): remove unused frame-support dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscoaguirre committed Nov 26, 2024
1 parent d9e409e commit 19c923c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

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

2 changes: 0 additions & 2 deletions polkadot/xcm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ schemars = { default-features = true, optional = true, workspace = true }
xcm-procedural = { workspace = true, default-features = true }
environmental = { workspace = true }
hex-literal = { workspace = true, default-features = true }
frame-support = { workspace = true }

[dev-dependencies]
sp-io = { workspace = true, default-features = true }
Expand All @@ -37,7 +36,6 @@ std = [
"bounded-collections/std",
"codec/std",
"environmental/std",
"frame-support/std",
"log/std",
"scale-info/std",
"serde/std",
Expand Down
17 changes: 8 additions & 9 deletions polkadot/xcm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ extern crate alloc;

use codec::{Decode, DecodeLimit, Encode, Error as CodecError, Input, MaxEncodedLen};
use derivative::Derivative;
use frame_support::dispatch::GetDispatchInfo;
use scale_info::TypeInfo;

pub mod v3;
Expand Down Expand Up @@ -326,7 +325,7 @@ pub enum VersionedXcm<RuntimeCall> {
V5(v5::Xcm<RuntimeCall>),
}

impl<C: Decode + GetDispatchInfo> IntoVersion for VersionedXcm<C> {
impl<C> IntoVersion for VersionedXcm<C> {
fn into_version(self, n: Version) -> Result<Self, ()> {
Ok(match n {
3 => Self::V3(self.try_into()?),
Expand Down Expand Up @@ -382,7 +381,7 @@ impl<RuntimeCall> From<v5::Xcm<RuntimeCall>> for VersionedXcm<RuntimeCall> {
}
}

impl<Call: Decode + GetDispatchInfo> TryFrom<VersionedXcm<Call>> for v3::Xcm<Call> {
impl<Call> TryFrom<VersionedXcm<Call>> for v3::Xcm<Call> {
type Error = ();
fn try_from(x: VersionedXcm<Call>) -> Result<Self, ()> {
use VersionedXcm::*;
Expand All @@ -397,7 +396,7 @@ impl<Call: Decode + GetDispatchInfo> TryFrom<VersionedXcm<Call>> for v3::Xcm<Cal
}
}

impl<Call: Decode + GetDispatchInfo> TryFrom<VersionedXcm<Call>> for v4::Xcm<Call> {
impl<Call> TryFrom<VersionedXcm<Call>> for v4::Xcm<Call> {
type Error = ();
fn try_from(x: VersionedXcm<Call>) -> Result<Self, ()> {
use VersionedXcm::*;
Expand All @@ -409,7 +408,7 @@ impl<Call: Decode + GetDispatchInfo> TryFrom<VersionedXcm<Call>> for v4::Xcm<Cal
}
}

impl<Call: Decode + GetDispatchInfo> TryFrom<VersionedXcm<Call>> for v5::Xcm<Call> {
impl<Call> TryFrom<VersionedXcm<Call>> for v5::Xcm<Call> {
type Error = ();
fn try_from(x: VersionedXcm<Call>) -> Result<Self, ()> {
use VersionedXcm::*;
Expand All @@ -427,7 +426,7 @@ impl<Call: Decode + GetDispatchInfo> TryFrom<VersionedXcm<Call>> for v5::Xcm<Cal
/// Convert an `Xcm` datum into a `VersionedXcm`, based on a destination `Location` which will
/// interpret it.
pub trait WrapVersion {
fn wrap_version<RuntimeCall: Decode + GetDispatchInfo>(
fn wrap_version<RuntimeCall>(
dest: &latest::Location,
xcm: impl Into<VersionedXcm<RuntimeCall>>,
) -> Result<VersionedXcm<RuntimeCall>, ()>;
Expand Down Expand Up @@ -460,7 +459,7 @@ impl WrapVersion for () {
/// wrapping it.
pub struct AlwaysV3;
impl WrapVersion for AlwaysV3 {
fn wrap_version<Call: Decode + GetDispatchInfo>(
fn wrap_version<Call>(
_: &latest::Location,
xcm: impl Into<VersionedXcm<Call>>,
) -> Result<VersionedXcm<Call>, ()> {
Expand All @@ -477,7 +476,7 @@ impl GetVersion for AlwaysV3 {
/// wrapping it.
pub struct AlwaysV4;
impl WrapVersion for AlwaysV4 {
fn wrap_version<Call: Decode + GetDispatchInfo>(
fn wrap_version<Call>(
_: &latest::Location,
xcm: impl Into<VersionedXcm<Call>>,
) -> Result<VersionedXcm<Call>, ()> {
Expand All @@ -494,7 +493,7 @@ impl GetVersion for AlwaysV4 {
/// wrapping it.
pub struct AlwaysV5;
impl WrapVersion for AlwaysV5 {
fn wrap_version<Call: Decode + GetDispatchInfo>(
fn wrap_version<Call>(
_: &latest::Location,
xcm: impl Into<VersionedXcm<Call>>,
) -> Result<VersionedXcm<Call>, ()> {
Expand Down

0 comments on commit 19c923c

Please sign in to comment.