Skip to content

Commit

Permalink
propagate events in x/group through sdk.Results
Browse files Browse the repository at this point in the history
  • Loading branch information
damiannolan committed Nov 9, 2022
1 parent bcdf81c commit 685c047
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion x/group/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}
}

Expand Down

0 comments on commit 685c047

Please sign in to comment.