From f9c202190ad9ef059bd9d25a44ee37a26621bc3f Mon Sep 17 00:00:00 2001 From: kasey <489222+kasey@users.noreply.github.com> Date: Fri, 31 Jan 2025 15:30:27 -0600 Subject: [PATCH] warnings for flags due for deprecation (#14856) Co-authored-by: Kasey Kirkham --- changelog/kasey_warn-hist-state-rep.md | 2 ++ config/features/config.go | 17 +++++++++++++++++ config/features/deprecated_flags.go | 4 ++++ config/features/flags.go | 16 +++++++++++++--- 4 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 changelog/kasey_warn-hist-state-rep.md diff --git a/changelog/kasey_warn-hist-state-rep.md b/changelog/kasey_warn-hist-state-rep.md new file mode 100644 index 0000000000..7131aa2e65 --- /dev/null +++ b/changelog/kasey_warn-hist-state-rep.md @@ -0,0 +1,2 @@ +### Added +- WARN log message on node startup advising of the upcoming deprecation of the --enable-historical-state-representation feature flag. diff --git a/config/features/config.go b/config/features/config.go index d324ec21b0..1ceb28edf7 100644 --- a/config/features/config.go +++ b/config/features/config.go @@ -166,6 +166,7 @@ func applyHoleskyFeatureFlags(ctx *cli.Context) { // ConfigureBeaconChain sets the global config based // on what flags are enabled for the beacon-chain client. func ConfigureBeaconChain(ctx *cli.Context) error { + warnDeprecationUpcoming(ctx) complainOnDeprecatedFlags(ctx) cfg := &Flags{} if ctx.Bool(devModeFlag.Name) { @@ -336,6 +337,22 @@ func complainOnDeprecatedFlags(ctx *cli.Context) { } } +var upcomingDeprecationExtra = map[string]string{ + enableHistoricalSpaceRepresentation.Name: "The node needs to be resynced after flag removal.", +} + +func warnDeprecationUpcoming(ctx *cli.Context) { + for _, f := range upcomingDeprecation { + if ctx.IsSet(f.Names()[0]) { + extra := "Please remove this flag from your configuration." + if special, ok := upcomingDeprecationExtra[f.Names()[0]]; ok { + extra += " " + special + } + log.Warnf("--%s is pending deprecation and will be removed in the next release. %s", f.Names()[0], extra) + } + } +} + func logEnabled(flag cli.DocGenerationFlag) { var name string if names := flag.Names(); len(names) > 0 { diff --git a/config/features/deprecated_flags.go b/config/features/deprecated_flags.go index 8d5317e2cd..cecbadebef 100644 --- a/config/features/deprecated_flags.go +++ b/config/features/deprecated_flags.go @@ -120,6 +120,10 @@ var deprecatedFlags = []cli.Flag{ deprecatedEnableQuic, } +var upcomingDeprecation = []cli.Flag{ + enableHistoricalSpaceRepresentation, +} + // deprecatedBeaconFlags contains flags that are still used by other components // and therefore cannot be added to deprecatedFlags var deprecatedBeaconFlags = []cli.Flag{ diff --git a/config/features/flags.go b/config/features/flags.go index 8e245c7604..bf4e57cd11 100644 --- a/config/features/flags.go +++ b/config/features/flags.go @@ -205,7 +205,7 @@ var E2EValidatorFlags = []string{ } // BeaconChainFlags contains a list of all the feature flags that apply to the beacon-chain client. -var BeaconChainFlags = append(deprecatedBeaconFlags, append(deprecatedFlags, []cli.Flag{ +var BeaconChainFlags = combinedFlags([]cli.Flag{ devModeFlag, disableExperimentalState, writeSSZStateTransitionsFlag, @@ -218,7 +218,6 @@ var BeaconChainFlags = append(deprecatedBeaconFlags, append(deprecatedFlags, []c disablePeerScorer, disableBroadcastSlashingFlag, enableSlasherFlag, - enableHistoricalSpaceRepresentation, disableStakinContractCheck, SaveFullExecutionPayloads, enableStartupOptimistic, @@ -236,7 +235,18 @@ var BeaconChainFlags = append(deprecatedBeaconFlags, append(deprecatedFlags, []c DisableCommitteeAwarePacking, EnableDiscoveryReboot, enableExperimentalAttestationPool, -}...)...) +}, deprecatedBeaconFlags, deprecatedFlags, upcomingDeprecation) + +func combinedFlags(flags ...[]cli.Flag) []cli.Flag { + if len(flags) == 0 { + return []cli.Flag{} + } + collected := flags[0] + for _, f := range flags[1:] { + collected = append(collected, f...) + } + return collected +} // E2EBeaconChainFlags contains a list of the beacon chain feature flags to be tested in E2E. var E2EBeaconChainFlags = []string{