From bb0d6883115db96d9b54b67c6beadfc915957d47 Mon Sep 17 00:00:00 2001 From: Yorke Rhodes Date: Fri, 26 May 2023 14:19:14 -0400 Subject: [PATCH] Add origin filter to relayer msg processor (#2301) ### Description Ensures the relayer never attempts to process a message destined for it's own origin domain. ### Related issues - Fixes https://github.com/hyperlane-xyz/issues/issues/464 ### Backward compatibility Yes ### Testing E2E tests --- rust/agents/relayer/src/msg/processor.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rust/agents/relayer/src/msg/processor.rs b/rust/agents/relayer/src/msg/processor.rs index aecdaecc7..7f72c7dcf 100644 --- a/rust/agents/relayer/src/msg/processor.rs +++ b/rust/agents/relayer/src/msg/processor.rs @@ -129,6 +129,13 @@ impl MessageProcessor { return Ok(()); } + // Skip if the message is intended for this origin + if destination == self.domain().id() { + debug!(?msg, "Message destined for self, skipping"); + self.message_nonce += 1; + return Ok(()); + } + // Skip if the message is intended for a destination we do not service if !self.send_channels.contains_key(&destination) { debug!(?msg, "Message destined for unknown domain, skipping");