Skip to content

Commit

Permalink
chore: review feedback improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanchriswhite committed Jul 15, 2024
1 parent 47b84bd commit a2802a5
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions x/tokenomics/keeper/settle_pending_claims.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,24 +166,24 @@ func (k Keeper) getExpiringClaims(ctx sdk.Context) (expiringClaims []prooftypes.

// NB: This error can be safely ignored as on-chain SharedQueryClient implementation cannot return an error.
sharedParams, _ := k.sharedQuerier.GetParams(ctx)
claimWindowSizeBlocks := sharedParams.GetClaimWindowCloseOffsetBlocks()
proofWindowSizeBlocks := sharedParams.GetProofWindowCloseOffsetBlocks()
claimWindowSizeBlocks := sharedParams.GetClaimWindowOpenOffsetBlocks() + sharedParams.GetClaimWindowCloseOffsetBlocks()
proofWindowSizeBlocks := sharedParams.GetProofWindowOpenOffsetBlocks() + sharedParams.GetProofWindowCloseOffsetBlocks()

previousSessionEndHeight := blockHeight -
int64(sharedParams.GetGracePeriodEndOffsetBlocks()+
claimWindowSizeBlocks+
expiringSessionEndHeight := blockHeight -
int64(claimWindowSizeBlocks+
proofWindowSizeBlocks+1)

allClaims := k.proofKeeper.GetAllClaims(ctx)
_ = allClaims

var nextKey []byte
for {
claimsRes, err := k.proofKeeper.AllClaims(ctx, &prooftypes.QueryAllClaimsRequest{
Pagination: &query.PageRequest{
Offset: uint64(len(expiringClaims)),
Key: nextKey,
},
Filter: &prooftypes.QueryAllClaimsRequest_SessionEndHeight{
SessionEndHeight: uint64(previousSessionEndHeight),
SessionEndHeight: uint64(expiringSessionEndHeight),
},
})
if err != nil {
Expand All @@ -195,7 +195,8 @@ func (k Keeper) getExpiringClaims(ctx sdk.Context) (expiringClaims []prooftypes.
}

// Continue if there are more claims to fetch.
if claimsRes.Pagination.GetNextKey() != nil {
nextKey = claimsRes.Pagination.GetNextKey()
if nextKey != nil {
continue
}

Expand Down

0 comments on commit a2802a5

Please sign in to comment.