@@ -13,6 +13,7 @@ import (
1313
1414 coreappmgr "cosmossdk.io/core/app"
1515 "cosmossdk.io/core/comet"
16+ corecontext "cosmossdk.io/core/context"
1617 "cosmossdk.io/core/event"
1718 "cosmossdk.io/core/store"
1819 "cosmossdk.io/core/transaction"
@@ -152,10 +153,23 @@ func (c *Consensus[T]) Info(ctx context.Context, _ *abciproto.InfoRequest) (*abc
152153 return nil , err
153154 }
154155
155- // cp, err := c.GetConsensusParams(ctx)
156- // if err != nil {
157- // return nil, err
158- // }
156+ // if height is 0, we dont know the consensus params
157+ var appVersion uint64 = 0
158+ if version > 0 {
159+ cp , err := c .GetConsensusParams (ctx )
160+ // if the consensus params are not found, we set the app version to 0
161+ // in the case that the start version is > 0
162+ if cp == nil || errors .Is (err , errors .New ("collections: not found" )) {
163+ appVersion = 0
164+ } else if err != nil {
165+ return nil , err
166+ } else {
167+ appVersion = cp .Version .GetApp ()
168+ }
169+ if err != nil {
170+ return nil , err
171+ }
172+ }
159173
160174 cid , err := c .store .LastCommitID ()
161175 if err != nil {
@@ -165,7 +179,7 @@ func (c *Consensus[T]) Info(ctx context.Context, _ *abciproto.InfoRequest) (*abc
165179 return & abciproto.InfoResponse {
166180 Data : c .appName ,
167181 Version : c .version ,
168- AppVersion : 0 , // TODO fetch consensus params?
182+ AppVersion : appVersion ,
169183 LastBlockHeight : int64 (version ),
170184 LastBlockAppHash : cid .Hash ,
171185 }, nil
@@ -234,14 +248,15 @@ func (c *Consensus[T]) InitChain(ctx context.Context, req *abciproto.InitChainRe
234248 c .initialHeight = 1
235249 }
236250
237- var consMessages []transaction.Msg
238251 if req .ConsensusParams != nil {
239- consMessages = append ( consMessages , & consensustypes.MsgUpdateParams {
252+ ctx = context . WithValue ( ctx , corecontext . InitInfoKey , & consensustypes.MsgUpdateParams {
240253 Authority : c .consensusAuthority ,
241254 Block : req .ConsensusParams .Block ,
242255 Evidence : req .ConsensusParams .Evidence ,
243256 Validator : req .ConsensusParams .Validator ,
244257 Abci : req .ConsensusParams .Abci ,
258+ Synchrony : req .ConsensusParams .Synchrony ,
259+ Feature : req .ConsensusParams .Feature ,
245260 })
246261 }
247262
@@ -254,13 +269,12 @@ func (c *Consensus[T]) InitChain(ctx context.Context, req *abciproto.InitChainRe
254269 bz := sha256 .Sum256 ([]byte {})
255270
256271 br := & coreappmgr.BlockRequest [T ]{
257- Height : uint64 (req .InitialHeight - 1 ),
258- Time : req .Time ,
259- Hash : bz [:],
260- AppHash : ci .Hash ,
261- ChainId : req .ChainId ,
262- ConsensusMessages : consMessages ,
263- IsGenesis : true ,
272+ Height : uint64 (req .InitialHeight - 1 ),
273+ Time : req .Time ,
274+ Hash : bz [:],
275+ AppHash : ci .Hash ,
276+ ChainId : req .ChainId ,
277+ IsGenesis : true ,
264278 }
265279
266280 blockresponse , genesisState , err := c .app .InitGenesis (
0 commit comments