cosmos / cosmos-sdk

:chains: A Framework for Building High Value Public Blockchains :sparkles:
https://cosmos.network/
Apache License 2.0
6.07k stars 3.48k forks source link

[Bug]: server/v2/api/grpc: Server disregards Config's `Enable` field #20819

Open mark-rushakoff opened 2 days ago

mark-rushakoff commented 2 days ago

Is there an existing issue for this?

What happened?

I was writing some tests with simd/v2, and the start command was failing because the gRPC server component could not bind to port 9090. I did not need the gRPC server for my test, so I set the config to Enable=false, but it still tried to bind to 9090.

The (*GRPCServer).Start method is short enough that it is easy to see it does not respect the Enable setting: https://github.com/cosmos/cosmos-sdk/blob/d426a5db677506a981cb094249bb6eaaf6324d39/server/v2/api/grpc/server.go#L73-L94

For my purposes, setting Address=127.0.0.1:0 to bind to an anonymous port is a sufficient workaround, although Enabled=false would be preferable.

Cosmos SDK Version

main

How to reproduce?

No response