Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: check blockhash/txhash length whether it is 64 #699

Merged
merged 12 commits into from
Oct 12, 2022
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (refactor) [\#685](https://github.com/line/lbm-sdk/pull/685) remove x/foundation UpdateValidatorAuthsProposal
* (x/foundation) [\#686](https://github.com/line/lbm-sdk/pull/686) remove `Minthreshold` and `MinPercentage` from x/foundation config
* (x/foundation) [\#693](https://github.com/line/lbm-sdk/pull/693) add pool to the state of x/foundation
* (x/auth, client) [\#699](https://github.com/line/lbm-sdk/pull/699) Improvement on input validation of `req.Hash`
* (x/wasm,distribution) [\#696](https://github.com/line/lbm-sdk/pull/696) x/wasm,distribution - add checking a file size before reading it
* (x/foundation) [\#698](https://github.com/line/lbm-sdk/pull/698) update x/group relevant logic in x/foundation

Expand Down
9 changes: 4 additions & 5 deletions client/docs/statik/statik.go

Large diffs are not rendered by default.

1,492 changes: 746 additions & 746 deletions client/docs/swagger-ui/swagger.yaml

Large diffs are not rendered by default.

161 changes: 81 additions & 80 deletions client/grpc/tmservice/query.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/grpc/tmservice/query.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions client/grpc/tmservice/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package tmservice

import (
"context"
"crypto/sha256"

gogogrpc "github.com/gogo/protobuf/grpc"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
abci "github.com/line/ostracon/abci/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

abci "github.com/line/ostracon/abci/types"

"github.com/line/lbm-sdk/client"
"github.com/line/lbm-sdk/client/rpc"
codectypes "github.com/line/lbm-sdk/codec/types"
Expand Down Expand Up @@ -88,6 +88,13 @@ func (s queryServer) GetBlockByHeight(ctx context.Context, req *GetBlockByHeight

// GetBlockByHash implements ServiceServer.GetBlockByHash
func (s queryServer) GetBlockByHash(_ context.Context, req *GetBlockByHashRequest) (*GetBlockByHashResponse, error) {
if n := len(req.Hash); n != sha256.Size {
if n == 0 {
return nil, status.Error(codes.InvalidArgument, "block hash cannot be empty")
}
return nil, status.Error(codes.InvalidArgument, "The length of blcok hash must be 32")
tkxkd0159 marked this conversation as resolved.
Show resolved Hide resolved
}

res, err := getBlockByHash(s.clientCtx, req.Hash)
if err != nil {
return nil, err
Expand Down
Loading