diff --git a/x/compute/internal/keeper/msg_dispatcher.go b/x/compute/internal/keeper/msg_dispatcher.go index 80486471f..2117d5222 100644 --- a/x/compute/internal/keeper/msg_dispatcher.go +++ b/x/compute/internal/keeper/msg_dispatcher.go @@ -1,8 +1,10 @@ package keeper import ( + "bytes" "encoding/json" "fmt" + "sort" "strings" sdk "github.com/cosmos/cosmos-sdk/types" @@ -204,6 +206,17 @@ func (d MessageDispatcher) DispatchSubmessages(ctx sdk.Context, contractAddr sdk commit() filteredEvents = filterEvents(append(em.Events(), events...)) ctx.EventManager().EmitEvents(filteredEvents) + + if msg.Msg.Wasm == nil { + filteredEvents = []sdk.Event{} + } else { + for _, e := range filteredEvents { + attributes := e.Attributes + sort.SliceStable(attributes, func(i, j int) bool { + return bytes.Compare(attributes[i].Key, attributes[j].Key) < 0 + }) + } + } } // on failure, revert state from sandbox, and ignore events (just skip doing the above) // we only callback if requested. Short-circuit here the cases we don't want to