fix: propagate msg events correctly in x/gov (#13728)
This commit is contained in:
parent
61ed5d1d9f
commit
9b8e1a18b9
@ -175,6 +175,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
* (x/gov) [#13051](https://github.com/cosmos/cosmos-sdk/pull/13051) In SubmitPropsal, when a legacy msg fails it's handler call, wrap the error as ErrInvalidProposalContent (instead of ErrNoProposalHandlerExists).
|
||||
* (x/gov) [#13045](https://github.com/cosmos/cosmos-sdk/pull/13045) Fix gov migrations for v3(0.46).
|
||||
* (snapshot) [#13400](https://github.com/cosmos/cosmos-sdk/pull/13400) Fix snapshot checksum issue in golang 1.19.
|
||||
* (x/gov) [#13728](https://github.com/cosmos/cosmos-sdk/pull/13728) Fix propagation of message events to the current context in `EndBlocker`.
|
||||
|
||||
### Deprecated
|
||||
|
||||
|
||||
@ -58,8 +58,9 @@ func EndBlocker(ctx sdk.Context, keeper *keeper.Keeper) {
|
||||
|
||||
if passes {
|
||||
var (
|
||||
idx int
|
||||
msg sdk.Msg
|
||||
idx int
|
||||
events sdk.Events
|
||||
msg sdk.Msg
|
||||
)
|
||||
|
||||
// attempt to execute all messages within the passed proposal
|
||||
@ -71,10 +72,12 @@ func EndBlocker(ctx sdk.Context, keeper *keeper.Keeper) {
|
||||
if err == nil {
|
||||
for idx, msg = range messages {
|
||||
handler := keeper.Router().Handler(msg)
|
||||
_, err = handler(cacheCtx, msg)
|
||||
res, err := handler(cacheCtx, msg)
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
|
||||
events = append(events, res.GetEvents()...)
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,6 +90,9 @@ func EndBlocker(ctx sdk.Context, keeper *keeper.Keeper) {
|
||||
|
||||
// write state to the underlying multi-store
|
||||
writeCache()
|
||||
|
||||
// propagate the msg events to the current context
|
||||
ctx.EventManager().EmitEvents(events)
|
||||
} else {
|
||||
proposal.Status = v1.StatusFailed
|
||||
tagValue = types.AttributeValueProposalFailed
|
||||
|
||||
Loading…
Reference in New Issue
Block a user