Skip to content

Commit

Permalink
fix: max size for grpc calls in go
Browse files Browse the repository at this point in the history
  • Loading branch information
shifty11 committed Feb 27, 2024
1 parent c83274f commit 9f6da1c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
9 changes: 8 additions & 1 deletion tools/kystrap/grpcall/grpcall.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,14 @@ func (gc *GrpcCaller) dial() (*grpc.ClientConn, error) {
var creds credentials.TransportCredentials

grpcurlUA := "kystrap"
opts = append(opts, grpc.WithUserAgent(grpcurlUA))
maxMessageSize := 2 * 1024 * 1024 * 1024 // 2 GB
opts = append(
opts,
grpc.WithUserAgent(grpcurlUA),
grpc.WithDefaultCallOptions(
grpc.MaxCallRecvMsgSize(maxMessageSize),
grpc.MaxCallSendMsgSize(maxMessageSize)),
)

network := "tcp"

Expand Down
2 changes: 1 addition & 1 deletion tools/kystrap/templates/go/scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Variables #
#########################################
# Key, config, and expected values (CHANGE THESE TO MATCH YOUR RUNTIME!!!)
KEY=4943400
KEY="4943400"
API="https://rpc.kyve.network"
CONFIG='{"network":"kyve-1","rpc":"'$API'"}'
EXPECTED_SUMMARY="\"$KEY\""
Expand Down
3 changes: 2 additions & 1 deletion tools/kystrap/templates/go/server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
const (
host = "0.0.0.0"
port = "50051"
maxMessageSize = 2 * 1024 * 1024 * 1024 // 2 GB
)

func StartServer() {
Expand All @@ -21,7 +22,7 @@ func StartServer() {
}

// Create a new gRPC server instance
server := grpc.NewServer()
server := grpc.NewServer(grpc.MaxRecvMsgSize(maxMessageSize), grpc.MaxSendMsgSize(maxMessageSize))

// Register the Tendermint service with the gRPC server
pb.RegisterRuntimeServiceServer(server, &{{ .name | ToPascal }}Server{})
Expand Down

0 comments on commit 9f6da1c

Please sign in to comment.