From 5ca8277f2778cd42dcc3526688a2779dec4960ce Mon Sep 17 00:00:00 2001 From: Alistair Singh Date: Thu, 30 May 2024 23:16:13 +0200 Subject: [PATCH] Emit channel on Message Queue (#147) * add channel id to events * fixed channel * fix formatting --- bridges/snowbridge/pallets/outbound-queue/src/lib.rs | 10 +++++++++- .../pallets/outbound-queue/src/send_message_impl.rs | 5 ++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/bridges/snowbridge/pallets/outbound-queue/src/lib.rs b/bridges/snowbridge/pallets/outbound-queue/src/lib.rs index 9b9dbe854a5e..0037f537c480 100644 --- a/bridges/snowbridge/pallets/outbound-queue/src/lib.rs +++ b/bridges/snowbridge/pallets/outbound-queue/src/lib.rs @@ -180,12 +180,16 @@ pub mod pallet { pub enum Event { /// 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 @@ -358,7 +362,11 @@ pub mod pallet { Messages::::append(Box::new(message)); MessageLeaves::::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) } diff --git a/bridges/snowbridge/pallets/outbound-queue/src/send_message_impl.rs b/bridges/snowbridge/pallets/outbound-queue/src/send_message_impl.rs index 03be61819973..a4f064a24202 100644 --- a/bridges/snowbridge/pallets/outbound-queue/src/send_message_impl.rs +++ b/bridges/snowbridge/pallets/outbound-queue/src/send_message_impl.rs @@ -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) } }