From 6c8614c4dbb2fdd8f5e911944c9ca71240ad4e1e Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 20 Sep 2022 10:40:42 +0200 Subject: [PATCH] fix: streaming listeners are not called for deliver tx event (backport #13334) (#13336) * fix: streaming listeners are not called for deliver tx event (#13334) * Problem: streaming listeners are not called for deliver tx event it was removed accidentally, add back. * Update CHANGELOG.md * try to fix e2e test by wait for one more block (cherry picked from commit 822900b69f4b62f118dc1ffd42b6a9e44054eef0) # Conflicts: # CHANGELOG.md # x/auth/tx/service_test.go * Update CHANGELOG.md * Update x/auth/tx/service_test.go * Update x/auth/tx/service_test.go Co-authored-by: yihuang --- CHANGELOG.md | 1 + baseapp/abci.go | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ee98b7f3d91..ce3e525f3cab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,6 +80,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/group) [#12888](https://github.com/cosmos/cosmos-sdk/pull/12888) Fix event propagation to the current context of `x/group` message execution `[]sdk.Result`. * (x/upgrade) [#12906](https://github.com/cosmos/cosmos-sdk/pull/12906) Fix upgrade failure by moving downgrade verification logic after store migration. +* (store) [#13336](https://github.com/cosmos/cosmos-sdk/pull/13336) Call streaming listeners for deliver tx event, it was removed accidentally, backport #13334. ## [v0.46.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.0) - 2022-07-26 diff --git a/baseapp/abci.go b/baseapp/abci.go index 6c6bd2f81ea3..b187ab49c2a2 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -278,10 +278,18 @@ func (app *BaseApp) CheckTx(req abci.RequestCheckTx) abci.ResponseCheckTx { // Otherwise, the ResponseDeliverTx will contain releveant error information. // Regardless of tx execution outcome, the ResponseDeliverTx will contain relevant // gas execution context. -func (app *BaseApp) DeliverTx(req abci.RequestDeliverTx) abci.ResponseDeliverTx { +func (app *BaseApp) DeliverTx(req abci.RequestDeliverTx) (res abci.ResponseDeliverTx) { gInfo := sdk.GasInfo{} resultStr := "successful" + defer func() { + for _, streamingListener := range app.abciListeners { + if err := streamingListener.ListenDeliverTx(app.deliverState.ctx, req, res); err != nil { + app.logger.Error("DeliverTx listening hook failed", "err", err) + } + } + }() + defer func() { telemetry.IncrCounter(1, "tx", "count") telemetry.IncrCounter(1, "tx", resultStr)