Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Emit channel on Message Queue (#147)
Browse files Browse the repository at this point in the history
* add channel id to events

* fixed channel

* fix formatting
  • Loading branch information
alistair-singh authored May 30, 2024
1 parent c13f7c7 commit 5ca8277
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
10 changes: 9 additions & 1 deletion bridges/snowbridge/pallets/outbound-queue/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,16 @@ pub mod pallet {
pub enum Event<T: Config> {
/// Message has been queued and will be processed in the future
MessageQueued {
/// The message channel.
channel_id: ChannelId,
/// ID of the message. Usually the XCM message hash or a SetTopic.
id: H256,
},
/// Message will be committed at the end of current block. From now on, to track the
/// progress the message, use the `nonce` of `id`.
MessageAccepted {
/// The message channel.
channel_id: ChannelId,
/// ID of the message
id: H256,
/// The nonce assigned to this message
Expand Down Expand Up @@ -358,7 +362,11 @@ pub mod pallet {
Messages::<T>::append(Box::new(message));
MessageLeaves::<T>::append(message_abi_encoded_hash);

Self::deposit_event(Event::MessageAccepted { id: queued_message.id, nonce });
Self::deposit_event(Event::MessageAccepted {
channel_id: queued_message.channel_id,
id: queued_message.id,
nonce,
});

Ok(true)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ where
let message = ticket.message.as_bounded_slice();

T::MessageQueue::enqueue_message(message, origin);
Self::deposit_event(Event::MessageQueued { id: ticket.message_id });
Self::deposit_event(Event::MessageQueued {
channel_id: ticket.channel_id,
id: ticket.message_id,
});
Ok(ticket.message_id)
}
}
Expand Down

0 comments on commit 5ca8277

Please sign in to comment.