Same procedure as not every day (#636)

* Same procedure as not every day

* Remove warning

* Update
This commit is contained in:
Bastian Köcher
2021-10-01 13:23:56 +02:00
committed by GitHub
parent 24f8cd72cf
commit a8d84dba8e
7 changed files with 448 additions and 430 deletions
+2 -2
View File
@@ -240,7 +240,7 @@ pub mod pallet {
Ok(0)
},
Ok(Ok(x)) => {
let outcome = T::XcmExecutor::execute_xcm(Parent.into(), x, limit);
let outcome = T::XcmExecutor::execute_xcm(Parent, x, limit);
match outcome {
Outcome::Error(XcmError::WeightLimitReached(required)) =>
Err((id, required)),
@@ -420,7 +420,7 @@ mod tests {
pub struct MockExec;
impl ExecuteXcm<Call> for MockExec {
fn execute_xcm_in_credit(
_origin: MultiLocation,
_origin: impl Into<MultiLocation>,
message: Xcm,
weight_limit: Weight,
_credit: Weight,
+2 -2
View File
@@ -124,7 +124,7 @@ impl<T: Config> DmpMessageHandler for UnlimitedDmpExecution<T> {
Err(_) => Pallet::<T>::deposit_event(Event::InvalidFormat(id)),
Ok(Err(())) => Pallet::<T>::deposit_event(Event::UnsupportedVersion(id)),
Ok(Ok(x)) => {
let outcome = T::XcmExecutor::execute_xcm(Parent.into(), x, limit);
let outcome = T::XcmExecutor::execute_xcm(Parent, x, limit);
used += outcome.weight_used();
Pallet::<T>::deposit_event(Event::ExecutedDownward(id, outcome));
},
@@ -158,7 +158,7 @@ impl<T: Config> DmpMessageHandler for LimitAndDropDmpExecution<T> {
Ok(Err(())) => Pallet::<T>::deposit_event(Event::UnsupportedVersion(id)),
Ok(Ok(x)) => {
let weight_limit = limit.saturating_sub(used);
let outcome = T::XcmExecutor::execute_xcm(Parent.into(), x, weight_limit);
let outcome = T::XcmExecutor::execute_xcm(Parent, x, weight_limit);
used += outcome.weight_used();
Pallet::<T>::deposit_event(Event::ExecutedDownward(id, outcome));
},
+4 -2
View File
@@ -348,7 +348,7 @@ impl<T: Config> Pallet<T> {
let (result, event) = match Xcm::<T::Call>::try_from(xcm) {
Ok(xcm) => {
let location = (1, Parachain(sender.into()));
match T::XcmExecutor::execute_xcm(location.into(), xcm, max_weight) {
match T::XcmExecutor::execute_xcm(location, xcm, max_weight) {
Outcome::Error(e) => (Err(e.clone()), Event::Fail(Some(hash), e)),
Outcome::Complete(w) => (Ok(w), Event::Success(Some(hash))),
// As far as the caller is concerned, this was dispatched without error, so
@@ -754,7 +754,9 @@ impl<T: Config> XcmpMessageSource for Pallet<T> {
/// Xcm sender for sending to a sibling parachain.
impl<T: Config> SendXcm for Pallet<T> {
fn send_xcm(dest: MultiLocation, msg: Xcm<()>) -> Result<(), SendError> {
fn send_xcm(dest: impl Into<MultiLocation>, msg: Xcm<()>) -> Result<(), SendError> {
let dest = dest.into();
match &dest {
// An HRMP message for a sibling parachain.
MultiLocation { parents: 1, interior: X1(Parachain(id)) } => {