gRPC Gateway Removal (#14089)

* wip passing e2e

* reverting temp comment

* remove unneeded comments

* fixing merge errors

* fixing more bugs from merge

* fixing test

* WIP moving code around and fixing tests

* unused linting

* gaz

* temp removing these tests as we need placeholder/wrapper APIs for them with the removal of the gateway

* attempting to remove dependencies to gRPC gateway , 1 mroe left in deps.bzl

* renaming flags and other gateway services to http

* goimport

* fixing deepsource

* git mv

* Update validator/package/validator.yaml

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

* Update validator/package/validator.yaml

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

* Update cmd/beacon-chain/flags/base.go

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

* Update cmd/beacon-chain/flags/base.go

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

* Update cmd/beacon-chain/flags/base.go

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

* addressing feedback

* missed lint

* renaming import

* reversal based on feedback

* fixing web ui registration

* don't require mux handler

* gaz

* removing gRPC service from validator completely, merged with http service, renames are a work in progress

* updating go.sum

* linting

* trailing white space

* realized there was more cleanup i could do with code reuse

* adding wrapper for routes

* reverting version

* fixing dependencies from merging develop

* gaz

* fixing unit test

* fixing dependencies

* reverting unit test

* fixing conflict

* updating change log

* Update log.go

Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>

* gaz

* Update api/server/httprest/server.go

Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>

* addressing some feedback

* forgot to remove deprecated flag in usage

* gofmt

* fixing test

* fixing deepsource issue

* moving deprecated flag and adding timeout handler

* missed removal of a flag

* fixing test:

* Update CHANGELOG.md

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

* addressing feedback

* updating comments based on feedback

* removing unused field for now, we can add it back in if we need to use the option

* removing unused struct

* changing api-timeout flag based on feedback

---------

Co-authored-by: Radosław Kapka <rkapka@wp.pl>
Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
This commit is contained in:
james-prysm
2024-09-04 10:40:31 -05:00
committed by GitHub
parent 963a1b4cb7
commit 45fd3eb1bf
94 changed files with 494 additions and 7751 deletions

View File

@@ -3,11 +3,24 @@
package flags
import (
"strings"
"github.com/prysmaticlabs/prysm/v5/cmd"
"github.com/prysmaticlabs/prysm/v5/config/params"
"github.com/urfave/cli/v2"
)
var (
DefaultWebDomains = []string{"http://localhost:4200", "http://127.0.0.1:4200", "http://0.0.0.0:4200"}
DefaultHTTPServerDomains = []string{"http://localhost:7500", "http://127.0.0.1:7500", "http://0.0.0.0:7500"}
DefaultHTTPCorsDomains = func() []string {
s := []string{"http://localhost:3000", "http://0.0.0.0:3000", "http://127.0.0.1:3000"}
s = append(s, DefaultWebDomains...)
s = append(s, DefaultHTTPServerDomains...)
return s
}()
)
var (
// MevRelayEndpoint provides an HTTP access endpoint to a MEV builder network.
MevRelayEndpoint = &cli.StringFlag{
@@ -118,30 +131,29 @@ var (
Usage: "Comma-separated list of API module names. Possible values: `" + PrysmAPIModule + `,` + EthAPIModule + "`.",
Value: PrysmAPIModule + `,` + EthAPIModule,
}
// DisableGRPCGateway for JSON-HTTP requests to the beacon node.
DisableGRPCGateway = &cli.BoolFlag{
Name: "disable-grpc-gateway",
Usage: "Disable the gRPC gateway for JSON-HTTP requests",
// HTTPServerHost specifies a HTTP server host for the validator client.
HTTPServerHost = &cli.StringFlag{
Name: "http-host",
Usage: "Host on which the HTTP server runs on.",
Value: "127.0.0.1",
Aliases: []string{"grpc-gateway-host"},
}
// GRPCGatewayHost specifies a gRPC gateway host for Prysm.
GRPCGatewayHost = &cli.StringFlag{
Name: "grpc-gateway-host",
Usage: "The host on which the gateway server runs on",
Value: "127.0.0.1",
// HTTPServerPort enables a REST server port to be exposed for the validator client.
HTTPServerPort = &cli.IntFlag{
Name: "http-port",
Usage: "Port on which the HTTP server runs on.",
Value: 3500,
Aliases: []string{"grpc-gateway-port"},
}
// GRPCGatewayPort specifies a gRPC gateway port for Prysm.
GRPCGatewayPort = &cli.IntFlag{
Name: "grpc-gateway-port",
Usage: "The port on which the gateway server runs on",
Value: 3500,
}
// GPRCGatewayCorsDomain serves preflight requests when serving gRPC JSON gateway.
GPRCGatewayCorsDomain = &cli.StringFlag{
Name: "grpc-gateway-corsdomain",
Usage: "Comma separated list of domains from which to accept cross origin requests " +
"(browser enforced). This flag has no effect if not used with --grpc-gateway-port.",
Value: "http://localhost:4200,http://localhost:7500,http://127.0.0.1:4200,http://127.0.0.1:7500,http://0.0.0.0:4200,http://0.0.0.0:7500,http://localhost:3000,http://0.0.0.0:3000,http://127.0.0.1:3000",
// HTTPServerCorsDomain serves preflight requests when serving HTTP.
HTTPServerCorsDomain = &cli.StringFlag{
Name: "http-cors-domain",
Usage: "Comma separated list of domains from which to accept cross origin requests.",
Value: strings.Join(DefaultHTTPCorsDomains, ", "),
Aliases: []string{"grpc-gateway-corsdomain"},
}
// MinSyncPeers specifies the required number of successful peer handshakes in order
// to start syncing with external peers.
MinSyncPeers = &cli.IntFlag{