Skip to content

Commit

Permalink
fixes tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danwt committed Sep 23, 2024
1 parent 6317c39 commit f7f2a28
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
3 changes: 2 additions & 1 deletion ibctesting/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions x/rollapp/keeper/grpc_query_get_state_info_by_height_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions x/rollapp/types/state_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit f7f2a28

Please sign in to comment.