Skip to content

Commit

Permalink
fix(baseapp): fulfil all header.Info fields in test helpers context (#…
Browse files Browse the repository at this point in the history
…23014)

(cherry picked from commit 2c16372)
  • Loading branch information
damiannolan authored and mergify[bot] committed Dec 19, 2024
1 parent 4abcefc commit 4151d0f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions baseapp/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
})
}

Expand Down

0 comments on commit 4151d0f

Please sign in to comment.