From e0374917565c91ed26db68c6f4160cb535424bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Kapka?= Date: Wed, 5 Jun 2024 14:04:21 +0200 Subject: [PATCH] Deprectate `EnableDebugRPCEndpoints` flag (#14015) * Deprectate `EnableDebugRPCEndpoints` flag * test fix * add flag to deprecated list * disable by default * test fixes --- beacon-chain/node/node.go | 6 ++---- beacon-chain/rpc/service.go | 3 +-- cmd/beacon-chain/flags/base.go | 8 ++++---- cmd/beacon-chain/main.go | 2 +- cmd/beacon-chain/usage.go | 2 +- config/features/deprecated_flags.go | 6 ++++++ testing/endtoend/components/beacon_node.go | 1 - 7 files changed, 15 insertions(+), 13 deletions(-) diff --git a/beacon-chain/node/node.go b/beacon-chain/node/node.go index 6e126a8509..8c2edff3d0 100644 --- a/beacon-chain/node/node.go +++ b/beacon-chain/node/node.go @@ -965,9 +965,8 @@ func (b *BeaconNode) registerRPCService(router *mux.Router) error { cert := b.cliCtx.String(flags.CertFlag.Name) key := b.cliCtx.String(flags.KeyFlag.Name) mockEth1DataVotes := b.cliCtx.Bool(flags.InteropMockEth1DataVotesFlag.Name) - maxMsgSize := b.cliCtx.Int(cmd.GrpcMaxCallRecvMsgSizeFlag.Name) - enableDebugRPCEndpoints := b.cliCtx.Bool(flags.EnableDebugRPCEndpoints.Name) + enableDebugRPCEndpoints := !b.cliCtx.Bool(flags.DisableDebugRPCEndpoints.Name) p2pService := b.fetchP2P() rpcService := rpc.NewService(b.ctx, &rpc.Config{ @@ -1056,11 +1055,10 @@ func (b *BeaconNode) registerGRPCGateway(router *mux.Router) error { gatewayPort := b.cliCtx.Int(flags.GRPCGatewayPort.Name) rpcHost := b.cliCtx.String(flags.RPCHost.Name) rpcPort := b.cliCtx.Int(flags.RPCPort.Name) - + enableDebugRPCEndpoints := !b.cliCtx.Bool(flags.DisableDebugRPCEndpoints.Name) selfAddress := net.JoinHostPort(rpcHost, strconv.Itoa(rpcPort)) gatewayAddress := net.JoinHostPort(gatewayHost, strconv.Itoa(gatewayPort)) allowedOrigins := strings.Split(b.cliCtx.String(flags.GPRCGatewayCorsDomain.Name), ",") - enableDebugRPCEndpoints := b.cliCtx.Bool(flags.EnableDebugRPCEndpoints.Name) selfCert := b.cliCtx.String(flags.CertFlag.Name) maxCallSize := b.cliCtx.Uint64(cmd.GrpcMaxCallRecvMsgSizeFlag.Name) httpModules := b.cliCtx.String(flags.HTTPModules.Name) diff --git a/beacon-chain/rpc/service.go b/beacon-chain/rpc/service.go index e30fb09aef..bb7104bd8f 100644 --- a/beacon-chain/rpc/service.go +++ b/beacon-chain/rpc/service.go @@ -113,8 +113,8 @@ type Config struct { ExecutionChainInfoFetcher execution.ChainInfoFetcher GenesisTimeFetcher blockchain.TimeFetcher GenesisFetcher blockchain.GenesisFetcher - EnableDebugRPCEndpoints bool MockEth1Votes bool + EnableDebugRPCEndpoints bool AttestationsPool attestations.Pool ExitPool voluntaryexits.PoolManager SlashingsPool slashings.PoolManager @@ -318,7 +318,6 @@ func NewService(ctx context.Context, cfg *Config) *Service { ethpbv1alpha1.RegisterHealthServer(s.grpcServer, nodeServer) ethpbv1alpha1.RegisterBeaconChainServer(s.grpcServer, beaconChainServer) if s.cfg.EnableDebugRPCEndpoints { - log.Info("Enabled debug gRPC endpoints") debugServer := &debugv1alpha1.Server{ GenesisTimeFetcher: s.cfg.GenesisTimeFetcher, BeaconDB: s.cfg.BeaconDB, diff --git a/cmd/beacon-chain/flags/base.go b/cmd/beacon-chain/flags/base.go index d119c427f2..4e8c948820 100644 --- a/cmd/beacon-chain/flags/base.go +++ b/cmd/beacon-chain/flags/base.go @@ -174,10 +174,10 @@ var ( Usage: "The factor by which blob batch limit may increase on burst.", Value: 2, } - // EnableDebugRPCEndpoints as /v1/beacon/state. - EnableDebugRPCEndpoints = &cli.BoolFlag{ - Name: "enable-debug-rpc-endpoints", - Usage: "Enables the debug rpc service, containing utility endpoints such as /eth/v1alpha1/beacon/state.", + // DisableDebugRPCEndpoints disables the debug Beacon API namespace. + DisableDebugRPCEndpoints = &cli.BoolFlag{ + Name: "disable-debug-rpc-endpoints", + Usage: "Disables the debug Beacon API namespace.", } // SubscribeToAllSubnets defines a flag to specify whether to subscribe to all possible attestation/sync subnets or not. SubscribeToAllSubnets = &cli.BoolFlag{ diff --git a/cmd/beacon-chain/main.go b/cmd/beacon-chain/main.go index 97092232d3..b74f9d5236 100644 --- a/cmd/beacon-chain/main.go +++ b/cmd/beacon-chain/main.go @@ -64,7 +64,7 @@ var appFlags = []cli.Flag{ flags.InteropNumValidatorsFlag, flags.InteropGenesisTimeFlag, flags.SlotsPerArchivedPoint, - flags.EnableDebugRPCEndpoints, + flags.DisableDebugRPCEndpoints, flags.SubscribeToAllSubnets, flags.HistoricalSlasherNode, flags.ChainID, diff --git a/cmd/beacon-chain/usage.go b/cmd/beacon-chain/usage.go index 747533c0f0..6d0f39cc25 100644 --- a/cmd/beacon-chain/usage.go +++ b/cmd/beacon-chain/usage.go @@ -116,7 +116,7 @@ var appHelpFlagGroups = []flagGroup{ flags.BlockBatchLimitBurstFactor, flags.BlobBatchLimit, flags.BlobBatchLimitBurstFactor, - flags.EnableDebugRPCEndpoints, + flags.DisableDebugRPCEndpoints, flags.SubscribeToAllSubnets, flags.HistoricalSlasherNode, flags.ChainID, diff --git a/config/features/deprecated_flags.go b/config/features/deprecated_flags.go index 1f31876dcf..ce04f877cf 100644 --- a/config/features/deprecated_flags.go +++ b/config/features/deprecated_flags.go @@ -52,6 +52,11 @@ var ( Usage: deprecatedUsage, Hidden: true, } + deprecatedEnableDebugRPCEndpoints = &cli.BoolFlag{ + Name: "enable-debug-rpc-endpoints", + Usage: deprecatedUsage, + Hidden: true, + } ) // Deprecated flags for both the beacon node and validator client. @@ -65,6 +70,7 @@ var deprecatedFlags = []cli.Flag{ deprecatedEnableEIP4881, deprecatedDisableEIP4881, deprecatedVerboseSigVerification, + deprecatedEnableDebugRPCEndpoints, } // deprecatedBeaconFlags contains flags that are still used by other components diff --git a/testing/endtoend/components/beacon_node.go b/testing/endtoend/components/beacon_node.go index 580fdccec1..a42da708bf 100644 --- a/testing/endtoend/components/beacon_node.go +++ b/testing/endtoend/components/beacon_node.go @@ -275,7 +275,6 @@ func (node *BeaconNode) Start(ctx context.Context) error { "--" + cmdshared.ValidatorMonitorIndicesFlag.Name + "=2", "--" + cmdshared.ForceClearDB.Name, "--" + cmdshared.AcceptTosFlag.Name, - "--" + flags.EnableDebugRPCEndpoints.Name, "--" + features.EnableQUIC.Name, } if config.UsePprof {