Skip to content

Commit

Permalink
Revert "add light client flag check to rpc handlers (prysmaticlabs#14736
Browse files Browse the repository at this point in the history
)"

This reverts commit 0b7c005.
rupam-04 authored Dec 19, 2024
1 parent 0b7c005 commit 9adfd14
Showing 4 changed files with 0 additions and 110 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -77,7 +77,6 @@ Notable features:
- Added a Prometheus error counter metric for SSE requests.
- Save light client updates and bootstraps in DB.
- Added more comprehensive tests for `BlockToLightClientHeader`. [PR](https://github.com/prysmaticlabs/prysm/pull/14699)
- Added light client feature flag check to RPC handlers. [PR](https://github.com/prysmaticlabs/prysm/pull/14736)

### Changed

2 changes: 0 additions & 2 deletions beacon-chain/rpc/eth/light-client/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@ go_library(
"//beacon-chain/rpc/eth/shared:go_default_library",
"//beacon-chain/rpc/lookup:go_default_library",
"//beacon-chain/state:go_default_library",
"//config/features:go_default_library",
"//config/params:go_default_library",
"//consensus-types/interfaces:go_default_library",
"//consensus-types/primitives:go_default_library",
@@ -46,7 +45,6 @@ go_test(
"//beacon-chain/db/testing:go_default_library",
"//beacon-chain/rpc/testutil:go_default_library",
"//beacon-chain/state:go_default_library",
"//config/features:go_default_library",
"//config/fieldparams:go_default_library",
"//config/params:go_default_library",
"//consensus-types/blocks:go_default_library",
21 changes: 0 additions & 21 deletions beacon-chain/rpc/eth/light-client/handlers.go
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@ import (
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
lightclient "github.com/prysmaticlabs/prysm/v5/beacon-chain/core/light-client"
"github.com/prysmaticlabs/prysm/v5/beacon-chain/rpc/eth/shared"
"github.com/prysmaticlabs/prysm/v5/config/features"
"github.com/prysmaticlabs/prysm/v5/config/params"
"github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces"
"github.com/prysmaticlabs/prysm/v5/monitoring/tracing/trace"
@@ -23,11 +22,6 @@ import (

// GetLightClientBootstrap - implements https://github.com/ethereum/beacon-APIs/blob/263f4ed6c263c967f13279c7a9f5629b51c5fc55/apis/beacon/light_client/bootstrap.yaml
func (s *Server) GetLightClientBootstrap(w http.ResponseWriter, req *http.Request) {
if !features.Get().EnableLightClient {
httputil.HandleError(w, "Light client feature flag is not enabled", http.StatusNotFound)
return
}

// Prepare
ctx, span := trace.StartSpan(req.Context(), "beacon.GetLightClientBootstrap")
defer span.End()
@@ -82,11 +76,6 @@ func (s *Server) GetLightClientBootstrap(w http.ResponseWriter, req *http.Reques

// GetLightClientUpdatesByRange - implements https://github.com/ethereum/beacon-APIs/blob/263f4ed6c263c967f13279c7a9f5629b51c5fc55/apis/beacon/light_client/updates.yaml
func (s *Server) GetLightClientUpdatesByRange(w http.ResponseWriter, req *http.Request) {
if !features.Get().EnableLightClient {
httputil.HandleError(w, "Light client feature flag is not enabled", http.StatusNotFound)
return
}

ctx, span := trace.StartSpan(req.Context(), "beacon.GetLightClientUpdatesByRange")
defer span.End()

@@ -143,11 +132,6 @@ func (s *Server) GetLightClientUpdatesByRange(w http.ResponseWriter, req *http.R

// GetLightClientFinalityUpdate - implements https://github.com/ethereum/beacon-APIs/blob/263f4ed6c263c967f13279c7a9f5629b51c5fc55/apis/beacon/light_client/finality_update.yaml
func (s *Server) GetLightClientFinalityUpdate(w http.ResponseWriter, req *http.Request) {
if !features.Get().EnableLightClient {
httputil.HandleError(w, "Light client feature flag is not enabled", http.StatusNotFound)
return
}

ctx, span := trace.StartSpan(req.Context(), "beacon.GetLightClientFinalityUpdate")
defer span.End()

@@ -206,11 +190,6 @@ func (s *Server) GetLightClientFinalityUpdate(w http.ResponseWriter, req *http.R

// GetLightClientOptimisticUpdate - implements https://github.com/ethereum/beacon-APIs/blob/263f4ed6c263c967f13279c7a9f5629b51c5fc55/apis/beacon/light_client/optimistic_update.yaml
func (s *Server) GetLightClientOptimisticUpdate(w http.ResponseWriter, req *http.Request) {
if !features.Get().EnableLightClient {
httputil.HandleError(w, "Light client feature flag is not enabled", http.StatusNotFound)
return
}

ctx, span := trace.StartSpan(req.Context(), "beacon.GetLightClientOptimisticUpdate")
defer span.End()

86 changes: 0 additions & 86 deletions beacon-chain/rpc/eth/light-client/handlers_test.go
Original file line number Diff line number Diff line change
@@ -19,7 +19,6 @@ import (
dbtesting "github.com/prysmaticlabs/prysm/v5/beacon-chain/db/testing"
"github.com/prysmaticlabs/prysm/v5/beacon-chain/rpc/testutil"
"github.com/prysmaticlabs/prysm/v5/beacon-chain/state"
"github.com/prysmaticlabs/prysm/v5/config/features"
fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams"
"github.com/prysmaticlabs/prysm/v5/config/params"
"github.com/prysmaticlabs/prysm/v5/consensus-types/blocks"
@@ -34,11 +33,6 @@ import (
)

func TestLightClientHandler_GetLightClientBootstrap(t *testing.T) {
resetFn := features.InitWithReset(&features.Flags{
EnableLightClient: true,
})
defer resetFn()

params.SetupTestConfigCleanup(t)
cfg := params.BeaconConfig()
cfg.AltairForkEpoch = 0
@@ -258,11 +252,6 @@ func TestLightClientHandler_GetLightClientBootstrap(t *testing.T) {
// GetLightClientByRange tests

func TestLightClientHandler_GetLightClientUpdatesByRangeAltair(t *testing.T) {
resetFn := features.InitWithReset(&features.Flags{
EnableLightClient: true,
})
defer resetFn()

helpers.ClearCache()
ctx := context.Background()

@@ -312,11 +301,6 @@ func TestLightClientHandler_GetLightClientUpdatesByRangeAltair(t *testing.T) {
}

func TestLightClientHandler_GetLightClientUpdatesByRangeCapella(t *testing.T) {
resetFn := features.InitWithReset(&features.Flags{
EnableLightClient: true,
})
defer resetFn()

helpers.ClearCache()
ctx := context.Background()
params.SetupTestConfigCleanup(t)
@@ -366,11 +350,6 @@ func TestLightClientHandler_GetLightClientUpdatesByRangeCapella(t *testing.T) {
}

func TestLightClientHandler_GetLightClientUpdatesByRangeDeneb(t *testing.T) {
resetFn := features.InitWithReset(&features.Flags{
EnableLightClient: true,
})
defer resetFn()

helpers.ClearCache()
ctx := context.Background()
params.SetupTestConfigCleanup(t)
@@ -420,11 +399,6 @@ func TestLightClientHandler_GetLightClientUpdatesByRangeDeneb(t *testing.T) {
}

func TestLightClientHandler_GetLightClientUpdatesByRangeMultipleAltair(t *testing.T) {
resetFn := features.InitWithReset(&features.Flags{
EnableLightClient: true,
})
defer resetFn()

helpers.ClearCache()
ctx := context.Background()
params.SetupTestConfigCleanup(t)
@@ -484,11 +458,6 @@ func TestLightClientHandler_GetLightClientUpdatesByRangeMultipleAltair(t *testin
}

func TestLightClientHandler_GetLightClientUpdatesByRangeMultipleCapella(t *testing.T) {
resetFn := features.InitWithReset(&features.Flags{
EnableLightClient: true,
})
defer resetFn()

helpers.ClearCache()
ctx := context.Background()
params.SetupTestConfigCleanup(t)
@@ -549,11 +518,6 @@ func TestLightClientHandler_GetLightClientUpdatesByRangeMultipleCapella(t *testi
}

func TestLightClientHandler_GetLightClientUpdatesByRangeMultipleDeneb(t *testing.T) {
resetFn := features.InitWithReset(&features.Flags{
EnableLightClient: true,
})
defer resetFn()

helpers.ClearCache()
ctx := context.Background()
params.SetupTestConfigCleanup(t)
@@ -614,11 +578,6 @@ func TestLightClientHandler_GetLightClientUpdatesByRangeMultipleDeneb(t *testing
}

func TestLightClientHandler_GetLightClientUpdatesByRangeMultipleForksAltairCapella(t *testing.T) {
resetFn := features.InitWithReset(&features.Flags{
EnableLightClient: true,
})
defer resetFn()

helpers.ClearCache()
ctx := context.Background()
params.SetupTestConfigCleanup(t)
@@ -687,11 +646,6 @@ func TestLightClientHandler_GetLightClientUpdatesByRangeMultipleForksAltairCapel
}

func TestLightClientHandler_GetLightClientUpdatesByRangeMultipleForksCapellaDeneb(t *testing.T) {
resetFn := features.InitWithReset(&features.Flags{
EnableLightClient: true,
})
defer resetFn()

helpers.ClearCache()
ctx := context.Background()
params.SetupTestConfigCleanup(t)
@@ -761,11 +715,6 @@ func TestLightClientHandler_GetLightClientUpdatesByRangeMultipleForksCapellaDene
}

func TestLightClientHandler_GetLightClientUpdatesByRangeCountBiggerThanLimit(t *testing.T) {
resetFn := features.InitWithReset(&features.Flags{
EnableLightClient: true,
})
defer resetFn()

helpers.ClearCache()
ctx := context.Background()
params.SetupTestConfigCleanup(t)
@@ -828,11 +777,6 @@ func TestLightClientHandler_GetLightClientUpdatesByRangeCountBiggerThanLimit(t *
}

func TestLightClientHandler_GetLightClientUpdatesByRangeCountBiggerThanMax(t *testing.T) {
resetFn := features.InitWithReset(&features.Flags{
EnableLightClient: true,
})
defer resetFn()

helpers.ClearCache()
ctx := context.Background()
params.SetupTestConfigCleanup(t)
@@ -894,11 +838,6 @@ func TestLightClientHandler_GetLightClientUpdatesByRangeCountBiggerThanMax(t *te
}

func TestLightClientHandler_GetLightClientUpdatesByRangeStartPeriodBeforeAltair(t *testing.T) {
resetFn := features.InitWithReset(&features.Flags{
EnableLightClient: true,
})
defer resetFn()

helpers.ClearCache()
params.SetupTestConfigCleanup(t)
config := params.BeaconConfig()
@@ -927,11 +866,6 @@ func TestLightClientHandler_GetLightClientUpdatesByRangeStartPeriodBeforeAltair(
}

func TestLightClientHandler_GetLightClientUpdatesByRangeMissingUpdates(t *testing.T) {
resetFn := features.InitWithReset(&features.Flags{
EnableLightClient: true,
})
defer resetFn()

helpers.ClearCache()
ctx := context.Background()
params.SetupTestConfigCleanup(t)
@@ -1038,11 +972,6 @@ func TestLightClientHandler_GetLightClientUpdatesByRangeMissingUpdates(t *testin
}

func TestLightClientHandler_GetLightClientFinalityUpdate(t *testing.T) {
resetFn := features.InitWithReset(&features.Flags{
EnableLightClient: true,
})
defer resetFn()

helpers.ClearCache()
ctx := context.Background()
config := params.BeaconConfig()
@@ -1155,11 +1084,6 @@ func TestLightClientHandler_GetLightClientFinalityUpdate(t *testing.T) {
}

func TestLightClientHandler_GetLightClientOptimisticUpdateAltair(t *testing.T) {
resetFn := features.InitWithReset(&features.Flags{
EnableLightClient: true,
})
defer resetFn()

helpers.ClearCache()
ctx := context.Background()
config := params.BeaconConfig()
@@ -1272,11 +1196,6 @@ func TestLightClientHandler_GetLightClientOptimisticUpdateAltair(t *testing.T) {
}

func TestLightClientHandler_GetLightClientOptimisticUpdateCapella(t *testing.T) {
resetFn := features.InitWithReset(&features.Flags{
EnableLightClient: true,
})
defer resetFn()

helpers.ClearCache()
ctx := context.Background()
config := params.BeaconConfig()
@@ -1389,11 +1308,6 @@ func TestLightClientHandler_GetLightClientOptimisticUpdateCapella(t *testing.T)
}

func TestLightClientHandler_GetLightClientOptimisticUpdateDeneb(t *testing.T) {
resetFn := features.InitWithReset(&features.Flags{
EnableLightClient: true,
})
defer resetFn()

helpers.ClearCache()
ctx := context.Background()
config := params.BeaconConfig()

0 comments on commit 9adfd14

Please sign in to comment.