Skip to content

Commit 833f069

Browse files
authored
fix: remove duplication of events in queued epoch msgs (#714)
1 parent 8109494 commit 833f069

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
3737

3838
## Unreleased
3939

40+
## v1.0.0-rc.6-hot-fix
41+
42+
### Bug fixes
43+
44+
- [#714](https://github.com/babylonlabs-io/babylon/pull/714) hot-fix: removed
45+
duplicated events `EventHandleQueuedMsg` at end of epoch for queued messages
46+
4047
## v1.0.0-rc6
4148

4249
### Improvements

x/epoching/abci.go

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,20 @@ func EndBlocker(ctx context.Context, k keeper.Keeper) ([]abci.ValidatorUpdate, e
8989
queuedMsgs := k.GetCurrentEpochMsgs(ctx)
9090
// forward each msg in the msg queue to the right keeper
9191
for _, msg := range queuedMsgs {
92-
res, err := k.HandleQueuedMsg(ctx, msg)
92+
_, errMsg := k.HandleQueuedMsg(ctx, msg)
9393
// skip this failed msg and emit and event signalling it
9494
// we do not panic here as some users may wrap an invalid message
9595
// (e.g., self-delegate coins more than its balance, wrong coding of addresses, ...)
9696
// honest validators will have consistent execution results on the queued messages
97-
if err != nil {
97+
if errMsg != nil {
9898
// emit an event signalling the failed execution
9999
err := sdkCtx.EventManager().EmitTypedEvent(
100100
&types.EventHandleQueuedMsg{
101101
EpochNumber: epoch.EpochNumber,
102102
Height: msg.BlockHeight,
103103
TxId: msg.TxId,
104104
MsgId: msg.MsgId,
105-
Error: err.Error(),
105+
Error: errMsg.Error(),
106106
},
107107
)
108108
if err != nil {
@@ -111,21 +111,6 @@ func EndBlocker(ctx context.Context, k keeper.Keeper) ([]abci.ValidatorUpdate, e
111111
// skip this failed msg
112112
continue
113113
}
114-
// for each event, emit an wrapped event EventTypeHandleQueuedMsg, which attaches the original attributes plus the original event type, the epoch number, txid and msgid to the event here
115-
for _, event := range res.Events {
116-
err := sdkCtx.EventManager().EmitTypedEvent(
117-
&types.EventHandleQueuedMsg{
118-
OriginalEventType: event.Type,
119-
EpochNumber: epoch.EpochNumber,
120-
TxId: msg.TxId,
121-
MsgId: msg.MsgId,
122-
OriginalAttributes: event.Attributes,
123-
},
124-
)
125-
if err != nil {
126-
return nil, err
127-
}
128-
}
129114
}
130115

131116
// update validator set

0 commit comments

Comments
 (0)