Skip to content

Commit

Permalink
fix(server): don't hardcode grpc address to localhost (#18254)
Browse files Browse the repository at this point in the history
Co-authored-by: Aleksandr Bezobchuk <[email protected]>
  • Loading branch information
julienrbrt and alexanderbez authored Oct 25, 2023
1 parent 86eaeed commit 894bebc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Bug Fixes

* (server) [#18254](https://github.com/cosmos/cosmos-sdk/pull/18254) Don't hardcode gRPC address to localhost.
* (x/slashing) [#18016](https://github.com/cosmos/cosmos-sdk/pull/18016) Fixed builder function for missed blocks key (`validatorMissedBlockBitArrayPrefixKey`) in slashing/migration/v4
* (x/gov) [#17873](https://github.com/cosmos/cosmos-sdk/pull/17873) Fail any inactive and active proposals whose messages cannot be decoded.
* (simulation) [#17911](https://github.com/cosmos/cosmos-sdk/pull/17911) Fix all problems with executing command `make test-sim-custom-genesis-fast` for simulation test.
Expand Down
8 changes: 3 additions & 5 deletions server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ func startGrpcServer(
// return grpcServer as nil if gRPC is disabled
return nil, clientCtx, nil
}
_, port, err := net.SplitHostPort(config.Address)
_, _, err := net.SplitHostPort(config.Address)
if err != nil {
return nil, clientCtx, err
}
Expand All @@ -498,11 +498,9 @@ func startGrpcServer(
maxRecvMsgSize = serverconfig.DefaultGRPCMaxRecvMsgSize
}

grpcAddress := fmt.Sprintf("127.0.0.1:%s", port)

// if gRPC is enabled, configure gRPC client for gRPC gateway
grpcClient, err := grpc.Dial(
grpcAddress,
config.Address,
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithDefaultCallOptions(
grpc.ForceCodec(codec.NewProtoCodec(clientCtx.InterfaceRegistry).GRPCCodec()),
Expand All @@ -515,7 +513,7 @@ func startGrpcServer(
}

clientCtx = clientCtx.WithGRPCClient(grpcClient)
svrCtx.Logger.Debug("gRPC client assigned to client context", "target", grpcAddress)
svrCtx.Logger.Debug("gRPC client assigned to client context", "target", config.Address)

grpcSrv, err := servergrpc.NewGRPCServer(clientCtx, app, config)
if err != nil {
Expand Down

0 comments on commit 894bebc

Please sign in to comment.