From 2eb307ff27f746d42ecf52d1ab57eab6d60a2cd3 Mon Sep 17 00:00:00 2001 From: MSalopek Date: Thu, 16 Nov 2023 14:01:13 +0100 Subject: [PATCH 1/5] fix: pass FinalizeBlock request and response to ABCIListener --- baseapp/abci.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/baseapp/abci.go b/baseapp/abci.go index ca13c03a13d3..41917aaffb4e 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -891,6 +891,14 @@ func (app *BaseApp) FinalizeBlock(req *abci.RequestFinalizeBlock) (*abci.Respons if res != nil { res.AppHash = app.workingHash() } + + // call the streaming service hooks with the FinalizeBlock messages + for _, streamingListener := range app.streamingManager.ABCIListeners { + if err := streamingListener.ListenFinalizeBlock(app.finalizeBlockState.ctx, *req, *res); err != nil { + panic(fmt.Errorf("ListenFinalizeBlock listening hook failed, height: %d, err: %w", req.Height, err)) + } + } + return res, err } From fccfed1faace752c860e023407f0cc3b0c8ef6ec Mon Sep 17 00:00:00 2001 From: MSalopek Date: Thu, 16 Nov 2023 14:08:06 +0100 Subject: [PATCH 2/5] chore: add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 223ac3e93e70..352362c6545c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,6 +66,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes +* (baseapp) [#18486](https://github.com/cosmos/cosmos-sdk/pull/18486) Fixed FinalizeBlock calls not being passed to ABCIListeners * (baseapp) [#18383](https://github.com/cosmos/cosmos-sdk/pull/18383) Fixed a data race inside BaseApp.getContext, found by end-to-end (e2e) tests. * (client/server) [#18345](https://github.com/cosmos/cosmos-sdk/pull/18345) Consistently set viper prefix in client and server. It defaults for the binary name for both client and server. * (simulation) [#17911](https://github.com/cosmos/cosmos-sdk/pull/17911) Fix all problems with executing command `make test-sim-custom-genesis-fast` for simulation test. From 9f820c4bfd4d04f888072fff2f735135d635c134 Mon Sep 17 00:00:00 2001 From: MSalopek Date: Thu, 16 Nov 2023 15:45:43 +0100 Subject: [PATCH 3/5] fix: log errors in FinalizeBlock ABCIListeners instead of panicking --- baseapp/abci.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/baseapp/abci.go b/baseapp/abci.go index 41917aaffb4e..eea42b4f5afb 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -895,7 +895,7 @@ func (app *BaseApp) FinalizeBlock(req *abci.RequestFinalizeBlock) (*abci.Respons // call the streaming service hooks with the FinalizeBlock messages for _, streamingListener := range app.streamingManager.ABCIListeners { if err := streamingListener.ListenFinalizeBlock(app.finalizeBlockState.ctx, *req, *res); err != nil { - panic(fmt.Errorf("ListenFinalizeBlock listening hook failed, height: %d, err: %w", req.Height, err)) + app.logger.Error("ListenFinalizeBlock listening hook failed, height: %d, err: %w", req.Height, err) } } From 9ba0740467ca05fd3e2edb7a001b70b9572dcfd6 Mon Sep 17 00:00:00 2001 From: MSalopek Date: Thu, 16 Nov 2023 17:16:08 +0100 Subject: [PATCH 4/5] Update baseapp/abci.go Co-authored-by: Aleksandr Bezobchuk --- baseapp/abci.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/baseapp/abci.go b/baseapp/abci.go index eea42b4f5afb..eed8f869ade0 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -895,7 +895,7 @@ func (app *BaseApp) FinalizeBlock(req *abci.RequestFinalizeBlock) (*abci.Respons // call the streaming service hooks with the FinalizeBlock messages for _, streamingListener := range app.streamingManager.ABCIListeners { if err := streamingListener.ListenFinalizeBlock(app.finalizeBlockState.ctx, *req, *res); err != nil { - app.logger.Error("ListenFinalizeBlock listening hook failed, height: %d, err: %w", req.Height, err) + app.logger.Error("ListenFinalizeBlock listening hook failed", "height", req.Height, "err", err) } } From caa228bc9edb9f13382ba86d151c6892a1c65f18 Mon Sep 17 00:00:00 2001 From: MSalopek Date: Thu, 16 Nov 2023 18:33:05 +0100 Subject: [PATCH 5/5] chore: appease lint rules --- baseapp/abci.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/baseapp/abci.go b/baseapp/abci.go index eed8f869ade0..39e915e7ac2b 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -895,7 +895,7 @@ func (app *BaseApp) FinalizeBlock(req *abci.RequestFinalizeBlock) (*abci.Respons // call the streaming service hooks with the FinalizeBlock messages for _, streamingListener := range app.streamingManager.ABCIListeners { if err := streamingListener.ListenFinalizeBlock(app.finalizeBlockState.ctx, *req, *res); err != nil { - app.logger.Error("ListenFinalizeBlock listening hook failed", "height", req.Height, "err", err) + app.logger.Error("ListenFinalizeBlock listening hook failed", "height", req.Height, "err", err) } }