Make RelayedFrom typesafe (#3617)

* Corrent type

* Fix build

* Fixes

* Fixes

* Formatting
This commit is contained in:
Gavin Wood
2021-08-11 12:40:10 +02:00
committed by GitHub
parent c40f080394
commit 0bb5434e08
8 changed files with 94 additions and 84 deletions
+2 -5
View File
@@ -267,14 +267,11 @@ pub enum Xcm<Call> {
/// A message to indicate that the embedded XCM is actually arriving on behalf of some consensus
/// location within the origin.
///
/// Safety: `who` must be an interior location of the context. This basically means that no `Parent`
/// junctions are allowed in it. This should be verified at the time of XCM execution.
///
/// Kind: *Instruction*
///
/// Errors:
#[codec(index = 10)]
RelayedFrom { who: MultiLocation, message: alloc::boxed::Box<Xcm<Call>> },
RelayedFrom { who: Junctions, message: alloc::boxed::Box<Xcm<Call>> },
}
impl<Call> Xcm<Call> {
@@ -375,7 +372,7 @@ impl<Call> TryFrom<Xcm0<Call>> for Xcm<Call> {
Xcm0::Transact { origin_type, require_weight_at_most, call } =>
Transact { origin_type, require_weight_at_most, call: call.into() },
Xcm0::RelayedFrom { who, message } => RelayedFrom {
who: who.try_into()?,
who: MultiLocation::try_from(who)?.try_into()?,
message: alloc::boxed::Box::new((*message).try_into()?),
},
})