From 685c0475d1296ac162859040475ef6e5738d8b4f Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Wed, 9 Nov 2022 15:06:36 +0100 Subject: [PATCH] propagate events in x/group through sdk.Results --- x/group/keeper/msg_server.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/x/group/keeper/msg_server.go b/x/group/keeper/msg_server.go index 6f6cee539f93..fd144525cc34 100644 --- a/x/group/keeper/msg_server.go +++ b/x/group/keeper/msg_server.go @@ -754,13 +754,18 @@ func (k Keeper) Exec(goCtx context.Context, req *group.MsgExec) (*group.MsgExecR return nil, err } - if _, err := k.doExecuteMsgs(cacheCtx, k.router, proposal, addr); err != nil { + if results, err := k.doExecuteMsgs(cacheCtx, k.router, proposal, addr); err != nil { proposal.ExecutorResult = group.PROPOSAL_EXECUTOR_RESULT_FAILURE logs = fmt.Sprintf("proposal execution failed on proposal %d, because of error %s", id, err.Error()) k.Logger(ctx).Info("proposal execution failed", "cause", err, "proposalID", id) } else { proposal.ExecutorResult = group.PROPOSAL_EXECUTOR_RESULT_SUCCESS flush() + + for _, res := range results { + // NOTE: The sdk msg handler creates a new EventManager, so events must be correctly propagated back to the current context + ctx.EventManager().EmitEvents(res.GetEvents()) + } } }