fix(baseapp): fulfil all header.Info fields in test helpers context (backport #23014) (#23016)

Co-authored-by: Damian Nolan <damiannolan@gmail.com>
This commit is contained in:
mergify[bot] 2024-12-19 21:59:32 +01:00 committed by GitHub
parent 4abcefc19d
commit 05b5a4eb71
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,6 +2,7 @@ package baseapp
import (
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1"
cmttypes "github.com/cometbft/cometbft/types"
coreheader "cosmossdk.io/core/header"
errorsmod "cosmossdk.io/errors"
@ -64,11 +65,15 @@ func (app *BaseApp) NewContext(isCheckTx bool) sdk.Context {
}
func (app *BaseApp) NewUncachedContext(isCheckTx bool, header cmtproto.Header) sdk.Context {
cmtHeader, _ := cmttypes.HeaderFromProto(&header)
return sdk.NewContext(app.cms, isCheckTx, app.logger).
WithBlockHeader(header).
WithHeaderInfo(coreheader.Info{
Height: header.Height,
Time: header.Time,
AppHash: cmtHeader.AppHash,
Hash: cmtHeader.Hash(),
ChainID: cmtHeader.ChainID,
Height: cmtHeader.Height,
Time: cmtHeader.Time,
})
}