Skip to content

Commit

Permalink
Put GetWeight where it belongs
Browse files Browse the repository at this point in the history
  • Loading branch information
gavofyork committed Aug 28, 2023
1 parent 4252e48 commit 2d9b54b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 0 additions & 5 deletions polkadot/xcm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,11 +447,6 @@ pub mod opaque {
pub type VersionedXcm = super::VersionedXcm<()>;
}

// A simple trait to get the weight of some object.
pub trait GetWeight<W> {
fn weight(&self) -> latest::Weight;
}

#[test]
fn conversion_works() {
use latest::prelude::*;
Expand Down
5 changes: 3 additions & 2 deletions polkadot/xcm/src/v3/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use super::v2::{
Instruction as OldInstruction, Response as OldResponse, WeightLimit as OldWeightLimit,
Xcm as OldXcm,
};
use crate::{DoubleEncoded, GetWeight};
use crate::DoubleEncoded;
use alloc::{vec, vec::Vec};
use bounded_collections::{parameter_types, BoundedVec};
use core::{
Expand Down Expand Up @@ -49,7 +49,7 @@ pub use multilocation::{
};
pub use traits::{
send_xcm, validate_send, Error, ExecuteXcm, Outcome, PreparedMessage, Result, SendError,
SendResult, SendXcm, Weight, XcmHash,
SendResult, SendXcm, Weight, XcmHash, GetWeight,
};
// These parts of XCM v2 are unchanged in XCM v3, and are re-imported here.
pub use super::v2::OriginKind;
Expand Down Expand Up @@ -185,6 +185,7 @@ pub mod prelude {
OriginKind, Outcome, PalletInfo, Parent, ParentThen, PreparedMessage, QueryId,
QueryResponseInfo, Response, Result as XcmResult, SendError, SendResult, SendXcm,
Weight,
GetWeight,
WeightLimit::{self, *},
WildFungibility::{self, Fungible as WildFungible, NonFungible as WildNonFungible},
WildMultiAsset::{self, *},
Expand Down
5 changes: 5 additions & 0 deletions polkadot/xcm/src/v3/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ pub use sp_weights::Weight;

use super::*;

// A simple trait to get the weight of some object.
pub trait GetWeight<W> {
fn weight(&self) -> Weight;
}

/// Error codes used in XCM. The first errors codes have explicit indices and are part of the XCM
/// format. Those trailing are merely part of the XCM implementation; there is no expectation that
/// they will retain the same index over time.
Expand Down

0 comments on commit 2d9b54b

Please sign in to comment.