Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
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
Next Next commit
Add event with XCM executor outcome, which includes weight fee
  • Loading branch information
girazoki committed May 23, 2022
commit f1b266b172a4db9d33ab7b773556e2a3b86c4669
12 changes: 11 additions & 1 deletion pallets/xcmp-queue/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ pub mod pallet {
OverweightEnqueued(ParaId, RelayBlockNumber, OverweightIndex, Weight),
/// An XCM from the overweight queue was executed with the given actual weight used.
OverweightServiced(OverweightIndex, Weight),
/// XCMP message executed with the given outcome.
ExecutedXcmp { message_id: Option<T::Hash>, outcome: Outcome },
}

#[pallet::error]
Expand Down Expand Up @@ -599,7 +601,15 @@ 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, xcm, max_weight) {
let outcome = T::XcmExecutor::execute_xcm(location, xcm, max_weight);
// Deposit new event
// Dont disrupt previous behavior
Self::deposit_event(Event::ExecutedXcmp {
message_id: Some(hash),
outcome: outcome.clone()
});

match outcome {
Outcome::Error(e) => (Err(e), 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
Expand Down