Skip to content

Commit

Permalink
fix(server): don't hardcode grpc address to localhost (backport #18254)…
Browse files Browse the repository at this point in the history
… (#18259)

Co-authored-by: Julien Robert <[email protected]>
  • Loading branch information
mergify[bot] and julienrbrt authored Oct 25, 2023
1 parent af758d7 commit 8c9ab2c
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 @@ -48,6 +48,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.
* (server) [#18251](https://github.com/cosmos/cosmos-sdk/pull/18251) Call `baseapp.Close()` when app started as grpc only.
* (baseapp) [#17769](https://github.com/cosmos/cosmos-sdk/pull/17769) Ensure we respect block size constraints in the `DefaultProposalHandler`'s `PrepareProposal` handler when a nil or no-op mempool is used. We provide a `TxSelector` type to assist in making transaction selection generalized. We also fix a comparison bug in tx selection when `req.maxTxBytes` is reached.
* (config) [#17649](https://github.com/cosmos/cosmos-sdk/pull/17649) Fix `mempool.max-txs` configuration is invalid in `app.config`.
Expand Down
8 changes: 3 additions & 5 deletions server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ func startAPIserver(config serverconfig.Config, genDocProvider node.GenesisDocPr
clientCtx := clientCtx.WithHomeDir(home).WithChainID(genDoc.ChainID)

if config.GRPC.Enable {
_, port, err := net.SplitHostPort(config.GRPC.Address)
_, _, err := net.SplitHostPort(config.GRPC.Address)
if err != nil {
return nil, err
}
Expand All @@ -543,10 +543,8 @@ func startAPIserver(config serverconfig.Config, genDocProvider node.GenesisDocPr
maxRecvMsgSize = serverconfig.DefaultGRPCMaxRecvMsgSize
}

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

grpcClient, err := grpc.Dial(
grpcAddress,
config.GRPC.Address,
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithDefaultCallOptions(
grpc.ForceCodec(codec.NewProtoCodec(clientCtx.InterfaceRegistry).GRPCCodec()),
Expand All @@ -559,7 +557,7 @@ func startAPIserver(config serverconfig.Config, genDocProvider node.GenesisDocPr
}

clientCtx = clientCtx.WithGRPCClient(grpcClient)
ctx.Logger.Debug("grpc client assigned to client context", "target", grpcAddress)
ctx.Logger.Debug("grpc client assigned to client context", "target", config.GRPC.Address)
}

apiSrv = api.New(clientCtx, ctx.Logger.With("module", "api-server"))
Expand Down

0 comments on commit 8c9ab2c

Please sign in to comment.