From f0c92c21f0dc111ce0e90f4a1d81053fcc760217 Mon Sep 17 00:00:00 2001 From: Julian Compagni Portis Date: Thu, 19 Dec 2024 20:42:26 -0800 Subject: [PATCH 1/2] keep dex message events --- x/wasm/keeper/msg_dispatcher.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/x/wasm/keeper/msg_dispatcher.go b/x/wasm/keeper/msg_dispatcher.go index 19f6687a84..32cea0f98a 100644 --- a/x/wasm/keeper/msg_dispatcher.go +++ b/x/wasm/keeper/msg_dispatcher.go @@ -237,12 +237,23 @@ func isIBCEvent(event sdk.Event) bool { return false } +func isDexEvent(event sdk.Event) bool { + for _, attr := range event.Attributes { + // Indexing of dex events requires that all dev events are emitted + if attr.Key == sdk.AttributeKeyModule && attr.Value == "dex" { + return true + } + } + return false +} + func filterEvents(events []sdk.Event) []sdk.Event { // pre-allocate space for efficiency res := make([]sdk.Event, 0, len(events)) for _, ev := range events { // we filter out all 'message' type events but if they are ibc events we must keep them for the IBC relayer (hermes particularly) - if ev.Type != "message" || isIBCEvent(ev) { + // we also keep dex events, this is required for proper indexing of dex messages + if ev.Type != "message" || isIBCEvent(ev) || isDexEvent(ev) { res = append(res, ev) } } From 5435721d79091f2ff5e6a25867050ea032cf28ec Mon Sep 17 00:00:00 2001 From: Julian Compagni Portis Date: Thu, 19 Dec 2024 20:57:32 -0800 Subject: [PATCH 2/2] add test case --- x/wasm/keeper/msg_dispatcher_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/x/wasm/keeper/msg_dispatcher_test.go b/x/wasm/keeper/msg_dispatcher_test.go index 73aa8d6b68..a76ae7aaa7 100644 --- a/x/wasm/keeper/msg_dispatcher_test.go +++ b/x/wasm/keeper/msg_dispatcher_test.go @@ -404,6 +404,7 @@ func TestDispatchSubmessages(t *testing.T) { // we still emit this to the client, but not the contract sdk.NewEvent("non-determinstic"), sdk.NewEvent("message", sdk.NewAttribute("module", "ibc_channel")), + sdk.NewEvent("message", sdk.NewAttribute("module", "dex")), } return events, [][]byte{[]byte("subData")}, [][]*codectypes.Any{}, nil }, @@ -413,6 +414,7 @@ func TestDispatchSubmessages(t *testing.T) { expEvents: []sdk.Event{ sdk.NewEvent("non-determinstic"), sdk.NewEvent("message", sdk.NewAttribute("module", "ibc_channel")), + sdk.NewEvent("message", sdk.NewAttribute("module", "dex")), // the event from reply is also exposed sdk.NewEvent("stargate-reply"), },