Skip to content

Commit

Permalink
Merge pull request #286 from neutron-org/fix/cache-ctx-emit-events
Browse files Browse the repository at this point in the history
Fix: emitting events from cached context
  • Loading branch information
pr0n00gler authored Jul 18, 2023
2 parents 0dc37b4 + d34f3df commit 7804860
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions x/interchaintxs/keeper/ibc_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ func (k *Keeper) HandleAcknowledgement(ctx sdk.Context, packet channeltypes.Pack
k.contractManagerKeeper.AddContractFailure(ctx, packet.SourceChannel, icaOwner.GetContract().String(), packet.GetSequence(), "ack")
k.Logger(ctx).Debug("HandleAcknowledgement: failed to Sudo contract on packet acknowledgement", "error", err)
} else {
ctx.EventManager().EmitEvents(cacheCtx.EventManager().Events())
writeFn()
}

Expand Down Expand Up @@ -142,6 +143,7 @@ func (k *Keeper) HandleTimeout(ctx sdk.Context, packet channeltypes.Packet, rela
k.contractManagerKeeper.AddContractFailure(ctx, packet.SourceChannel, icaOwner.GetContract().String(), packet.GetSequence(), "timeout")
k.Logger(ctx).Error("HandleTimeout: failed to Sudo contract on packet timeout", "error", err)
} else {
ctx.EventManager().EmitEvents(cacheCtx.EventManager().Events())
writeFn()
}

Expand Down
2 changes: 2 additions & 0 deletions x/transfer/ibc_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ func (im IBCModule) HandleAcknowledgement(ctx sdk.Context, packet channeltypes.P
im.ContractManagerKeeper.AddContractFailure(ctx, packet.SourceChannel, senderAddress.String(), packet.GetSequence(), "ack")
im.keeper.Logger(ctx).Debug("failed to Sudo contract on packet acknowledgement", err)
} else {
ctx.EventManager().EmitEvents(cacheCtx.EventManager().Events())
writeFn()
}

Expand Down Expand Up @@ -144,6 +145,7 @@ func (im IBCModule) HandleTimeout(ctx sdk.Context, packet channeltypes.Packet, r
im.ContractManagerKeeper.AddContractFailure(ctx, packet.SourceChannel, senderAddress.String(), packet.GetSequence(), "timeout")
im.keeper.Logger(ctx).Debug("failed to Sudo contract on packet timeout", err)
} else {
ctx.EventManager().EmitEvents(cacheCtx.EventManager().Events())
writeFn()
}

Expand Down

0 comments on commit 7804860

Please sign in to comment.