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

Make Eth APIs flag name implementation agnostic #9112

Merged
merged 2 commits into from
Jun 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions beacon-chain/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -645,12 +645,12 @@ func (b *BeaconNode) registerGRPCGateway() error {
return nil
}
gatewayPort := b.cliCtx.Int(flags.GRPCGatewayPort.Name)
apiMiddlewarePort := b.cliCtx.Int(flags.ApiMiddlewarePort.Name)
ethApiPort := b.cliCtx.Int(flags.EthApiPort.Name)
gatewayHost := b.cliCtx.String(flags.GRPCGatewayHost.Name)
rpcHost := b.cliCtx.String(flags.RPCHost.Name)
selfAddress := fmt.Sprintf("%s:%d", rpcHost, b.cliCtx.Int(flags.RPCPort.Name))
gatewayAddress := fmt.Sprintf("%s:%d", gatewayHost, gatewayPort)
apiMiddlewareAddress := fmt.Sprintf("%s:%d", gatewayHost, apiMiddlewarePort)
apiMiddlewareAddress := fmt.Sprintf("%s:%d", gatewayHost, ethApiPort)
allowedOrigins := strings.Split(b.cliCtx.String(flags.GPRCGatewayCorsDomain.Name), ",")
enableDebugRPCEndpoints := b.cliCtx.Bool(flags.EnableDebugRPCEndpoints.Name)
selfCert := b.cliCtx.String(flags.CertFlag.Name)
Expand Down
4 changes: 2 additions & 2 deletions beacon-chain/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
var (
beaconRPC = flag.String("beacon-rpc", "localhost:4000", "Beacon chain gRPC endpoint")
port = flag.Int("port", 8000, "Port to serve on")
apiMiddlewarePort = flag.Int("port", 8001, "Port to serve API middleware on")
EthApiPort = flag.Int("port", 8001, "Port to serve Ethereum API on")
host = flag.String("host", "127.0.0.1", "Host to serve on")
debug = flag.Bool("debug", false, "Enable debug logging")
allowedOrigins = flag.String("corsdomain", "localhost:4242", "A comma separated list of CORS domains to allow")
Expand Down Expand Up @@ -48,7 +48,7 @@ func main() {
fmt.Sprintf("%s:%d", *host, *port),
).WithAllowedOrigins(strings.Split(*allowedOrigins, ",")).
WithMaxCallRecvMsgSize(uint64(*grpcMaxMsgSize)).
WithApiMiddleware(fmt.Sprintf("%s:%d", *host, *apiMiddlewarePort), &apimiddleware.BeaconEndpointFactory{})
WithApiMiddleware(fmt.Sprintf("%s:%d", *host, *EthApiPort), &apimiddleware.BeaconEndpointFactory{})

mux := http.NewServeMux()
mux.HandleFunc("/swagger/", gateway.SwaggerServer())
Expand Down
10 changes: 5 additions & 5 deletions cmd/beacon-chain/flags/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ var (
Usage: "The port on which the gateway server runs on",
Value: 3500,
}
// ApiMiddlewarePort specifies the port for an HTTP proxy server which acts as a middleware between Ethereum consensus API clients and Prysm's gRPC gateway.
// The middleware serves JSON values conforming to the specification: https://ethereum.github.io/eth2.0-APIs/
ApiMiddlewarePort = &cli.IntFlag{
Name: "api-middleware-port",
Usage: "The port on which the API middleware runs on",
// EthApiPort specifies the port which runs the official Ethereum REST API.
// Serves JSON values conforming to the specification: https://ethereum.github.io/eth2.0-APIs/
EthApiPort = &cli.IntFlag{
Name: "eth-api-port",
Usage: "The port which exposes a REST API conforming to the official Ethereum API specification.",
Value: 3501,
}
// GPRCGatewayCorsDomain serves preflight requests when serving gRPC JSON gateway.
Expand Down
2 changes: 1 addition & 1 deletion cmd/beacon-chain/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var appFlags = []cli.Flag{
flags.DisableGRPCGateway,
flags.GRPCGatewayHost,
flags.GRPCGatewayPort,
flags.ApiMiddlewarePort,
flags.EthApiPort,
flags.GPRCGatewayCorsDomain,
flags.MinSyncPeers,
flags.ContractDeploymentBlock,
Expand Down
2 changes: 1 addition & 1 deletion cmd/beacon-chain/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ var appHelpFlagGroups = []flagGroup{
flags.DisableGRPCGateway,
flags.GRPCGatewayHost,
flags.GRPCGatewayPort,
flags.ApiMiddlewarePort,
flags.EthApiPort,
flags.GPRCGatewayCorsDomain,
flags.HTTPWeb3ProviderFlag,
flags.FallbackWeb3ProviderFlag,
Expand Down
2 changes: 1 addition & 1 deletion endtoend/components/beacon_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (node *BeaconNode) Start(ctx context.Context) error {
fmt.Sprintf("--%s=%d", cmdshared.P2PTCPPort.Name, e2e.TestParams.BeaconNodeRPCPort+index+20),
fmt.Sprintf("--%s=%d", flags.MonitoringPortFlag.Name, e2e.TestParams.BeaconNodeMetricsPort+index),
fmt.Sprintf("--%s=%d", flags.GRPCGatewayPort.Name, e2e.TestParams.BeaconNodeRPCPort+index+40),
fmt.Sprintf("--%s=%d", flags.ApiMiddlewarePort.Name, e2e.TestParams.BeaconNodeRPCPort+index+30),
fmt.Sprintf("--%s=%d", flags.EthApiPort.Name, e2e.TestParams.BeaconNodeRPCPort+index+30),
fmt.Sprintf("--%s=%d", flags.ContractDeploymentBlock.Name, 0),
fmt.Sprintf("--%s=%d", cmdshared.RPCMaxPageSizeFlag.Name, params.BeaconConfig().MinGenesisActiveValidatorCount),
fmt.Sprintf("--%s=%s", cmdshared.BootstrapNode.Name, enr),
Expand Down