diff --git a/ibctesting/utils_test.go b/ibctesting/utils_test.go index 58eb34dc7..18c93ce94 100644 --- a/ibctesting/utils_test.go +++ b/ibctesting/utils_test.go @@ -236,7 +236,8 @@ func (s *utilSuite) finalizeRollappState(index uint64, endHeight uint64) (sdk.Ev stateInfoIdx := rollapptypes.StateInfoIndex{RollappId: rollappChainID(), Index: index} stateInfo, found := rollappKeeper.GetStateInfo(ctx, rollappChainID(), stateInfoIdx.Index) s.Require().True(found) - stateInfo.BDs.BD = stateInfo.BDs.BD[:endHeight-stateInfo.StartHeight+2] + // this is a hack to increase the finalized height by modifying the last state info instead of submitting a new one + stateInfo = stateInfo.WithNumBlocks(endHeight - stateInfo.StartHeight + 1) stateInfo.Status = common.Status_FINALIZED // update the status of the stateInfo rollappKeeper.SetStateInfo(ctx, stateInfo) diff --git a/x/rollapp/keeper/grpc_query_get_state_info_by_height_test.go b/x/rollapp/keeper/grpc_query_get_state_info_by_height_test.go index c68abf92a..6f093759e 100644 --- a/x/rollapp/keeper/grpc_query_get_state_info_by_height_test.go +++ b/x/rollapp/keeper/grpc_query_get_state_info_by_height_test.go @@ -37,8 +37,7 @@ func createNStateInfoAndIndex(keeper *keeper.Keeper, ctx sdk.Context, n int, rol Index: uint64(i + 1), }, StartHeight: StartHeight, - BDs: types.BlockDescriptors{BD: make([]types.BlockDescriptor, numBlocks)}, - } + }.WithNumBlocks(numBlocks) StartHeight += stateInfo.NumBlocks() keeper.SetStateInfo(ctx, stateInfo) diff --git a/x/rollapp/types/state_info.go b/x/rollapp/types/state_info.go index bea07e33f..f71ffcb7b 100644 --- a/x/rollapp/types/state_info.go +++ b/x/rollapp/types/state_info.go @@ -47,7 +47,7 @@ func (s *StateInfo) GetIndex() StateInfoIndex { } func (s *StateInfo) GetLatestHeight() uint64 { - return s.StartHeight + uint64(s.NumBlocks()) - 1 + return s.StartHeight + s.NumBlocks() - 1 } func (s *StateInfo) ContainsHeight(height uint64) bool { @@ -66,7 +66,7 @@ func (s *StateInfo) GetLatestBlockDescriptor() BlockDescriptor { } func (s *StateInfo) LastHeight() uint64 { - return s.GetLatestBlockDescriptor().Height + return s.StartHeight + s.NumBlocks() - 1 } func (s *StateInfo) NumBlocks() uint64 {