From 30387c6b1ca607a5942ae01264f2ab34b0eb6402 Mon Sep 17 00:00:00 2001 From: Facundo Date: Fri, 2 Feb 2024 18:31:50 +0100 Subject: [PATCH 1/2] fix: Set headerInfo in context on setState --- baseapp/baseapp.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index f4f4444299a1..879b7bffb45f 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -17,6 +17,7 @@ import ( "golang.org/x/exp/maps" protov2 "google.golang.org/protobuf/proto" + "cosmossdk.io/core/header" errorsmod "cosmossdk.io/errors" "cosmossdk.io/log" "cosmossdk.io/store" @@ -479,11 +480,20 @@ func (app *BaseApp) IsSealed() bool { return app.sealed } // setState sets the BaseApp's state for the corresponding mode with a branched // multi-store (i.e. a CacheMultiStore) and a new Context with the same // multi-store branch, and provided header. -func (app *BaseApp) setState(mode execMode, header cmtproto.Header) { +func (app *BaseApp) setState(mode execMode, h cmtproto.Header) { ms := app.cms.CacheMultiStore() + headerInfo := header.Info{ + Height: h.Height, + Time: h.Time, + ChainID: h.ChainID, + AppHash: h.AppHash, + } baseState := &state{ - ms: ms, - ctx: sdk.NewContext(ms, false, app.logger).WithStreamingManager(app.streamingManager).WithBlockHeader(header), + ms: ms, + ctx: sdk.NewContext(ms, false, app.logger). + WithStreamingManager(app.streamingManager). + WithBlockHeader(h). + WithHeaderInfo(headerInfo), } switch mode { From 29e46ced8fb9c97f8ff76596b9687d9b9bae761e Mon Sep 17 00:00:00 2001 From: Facundo Date: Sat, 3 Feb 2024 14:05:49 +0100 Subject: [PATCH 2/2] cl++ --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8edd28898dbe..a4df56b236cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -78,6 +78,7 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i ### Bug Fixes +* (baseapp) [#19338](https://github.com/cosmos/cosmos-sdk/pull/19338) Set HeaderInfo in context when calling `setState`. * (x/staking) [#19226](https://github.com/cosmos/cosmos-sdk/pull/19226) Ensure `GetLastValidators` in `x/staking` does not return an error when `MaxValidators` exceeds total number of bonded validators. * (baseapp) [#19198](https://github.com/cosmos/cosmos-sdk/pull/19198) Remove usage of pointers in logs in all OE goroutines. * (baseapp) [#19177](https://github.com/cosmos/cosmos-sdk/pull/19177) Fix baseapp DefaultProposalHandler same-sender non-sequential sequence