docs: clarify what is available in ctx.BlockHeader() (#23394)

This commit is contained in:
Julien Robert 2025-01-15 18:19:03 +01:00 committed by GitHub
parent 69defb4011
commit bbf813ccda
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 0 deletions

View File

@ -92,6 +92,9 @@ func (c Context) CometInfo() comet.Info { return c.comet
func (c Context) HeaderInfo() header.Info { return c.headerInfo }
// BlockHeader returns the header by value.
// Note, only ChainID, Time and Height are always filled by baseapp.
// In finalize block, the proposer address, validator hash and app hash are also filled.
// Use CometInfo service and/or the Consensus Keeper for getting more information.
func (c Context) BlockHeader() cmtproto.Header {
return c.header
}

View File

@ -28,5 +28,6 @@ type FeegrantKeeper interface {
}
type ConsensusKeeper interface {
AppVersion(ctx context.Context) (uint64, error)
BlockParams(context.Context) (uint64, uint64, error)
}

View File

@ -202,6 +202,21 @@ func (m *MockConsensusKeeper) EXPECT() *MockConsensusKeeperMockRecorder {
return m.recorder
}
// AppVersion mocks base method.
func (m *MockConsensusKeeper) AppVersion(ctx context.Context) (uint64, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AppVersion", ctx)
ret0, _ := ret[0].(uint64)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// AppVersion indicates an expected call of AppVersion.
func (mr *MockConsensusKeeperMockRecorder) AppVersion(ctx any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppVersion", reflect.TypeOf((*MockConsensusKeeper)(nil).AppVersion), ctx)
}
// BlockParams mocks base method.
func (m *MockConsensusKeeper) BlockParams(arg0 context.Context) (uint64, uint64, error) {
m.ctrl.T.Helper()