Skip to content

Commit

Permalink
add query bound for SeqToBlocknums
Browse files Browse the repository at this point in the history
  • Loading branch information
tkxkd0159 committed May 3, 2024
1 parent 530603a commit 384dbce
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions x/fbridge/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package keeper

import (
"context"
"fmt"

"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand Down Expand Up @@ -32,6 +33,12 @@ func (k Keeper) SeqToBlocknums(goCtx context.Context, req *types.QuerySeqToBlock
return nil, status.Error(codes.InvalidArgument, "empty request")
}

const lowerBound int = 1
const upperBound int = 1000
if len(req.Seqs) < lowerBound || len(req.Seqs) > upperBound {
return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("The number of seqs requested must be between %d and %d", lowerBound, upperBound))
}

ctx := sdk.UnwrapSDKContext(goCtx)
bhList := make([]uint64, len(req.Seqs))
for i, seq := range req.Seqs {
Expand Down

0 comments on commit 384dbce

Please sign in to comment.