switching enable to disable for duties (#15445)

This commit is contained in:
james-prysm
2025-07-10 13:57:36 -05:00
committed by GitHub
parent 02f8726e46
commit bc7e4f7751
4 changed files with 26 additions and 23 deletions

View File

@@ -0,0 +1,3 @@
### Changed
- Changed `enable-duties-v2` to `disable-duties-v2` to default to using duties v2.

View File

@@ -49,7 +49,7 @@ type Flags struct {
EnableHistoricalSpaceRepresentation bool // EnableHistoricalSpaceRepresentation enables the saving of registry validators in separate buckets to save space EnableHistoricalSpaceRepresentation bool // EnableHistoricalSpaceRepresentation enables the saving of registry validators in separate buckets to save space
EnableBeaconRESTApi bool // EnableBeaconRESTApi enables experimental usage of the beacon REST API by the validator when querying a beacon node EnableBeaconRESTApi bool // EnableBeaconRESTApi enables experimental usage of the beacon REST API by the validator when querying a beacon node
EnableExperimentalAttestationPool bool // EnableExperimentalAttestationPool enables an experimental attestation pool design. EnableExperimentalAttestationPool bool // EnableExperimentalAttestationPool enables an experimental attestation pool design.
EnableDutiesV2 bool // EnableDutiesV2 sets validator client to use the get Duties V2 endpoint DisableDutiesV2 bool // DisableDutiesV2 sets validator client to use the get Duties endpoint
EnableWeb bool // EnableWeb enables the webui on the validator client EnableWeb bool // EnableWeb enables the webui on the validator client
SSZOnly bool // SSZOnly forces the validator client to use SSZ for communication with the beacon node when REST mode is enabled (useful for debugging) SSZOnly bool // SSZOnly forces the validator client to use SSZ for communication with the beacon node when REST mode is enabled (useful for debugging)
// Logging related toggles. // Logging related toggles.
@@ -332,9 +332,9 @@ func ConfigureValidator(ctx *cli.Context) error {
logEnabled(EnableBeaconRESTApi) logEnabled(EnableBeaconRESTApi)
cfg.EnableBeaconRESTApi = true cfg.EnableBeaconRESTApi = true
} }
if ctx.Bool(EnableDutiesV2.Name) { if ctx.Bool(DisableDutiesV2.Name) {
logEnabled(EnableDutiesV2) logEnabled(DisableDutiesV2)
cfg.EnableDutiesV2 = true cfg.DisableDutiesV2 = true
} }
if ctx.Bool(EnableWebFlag.Name) { if ctx.Bool(EnableWebFlag.Name) {
logEnabled(EnableWebFlag) logEnabled(EnableWebFlag)

View File

@@ -185,10 +185,10 @@ var (
Usage: "A comma-separatted list of 0x-prefixed hexstrings. Declares blocks with the given blockroots to be invalid. It downscores peers that send these blocks.", Usage: "A comma-separatted list of 0x-prefixed hexstrings. Declares blocks with the given blockroots to be invalid. It downscores peers that send these blocks.",
} }
// EnableDutiesV2 sets the validator client to use the get duties v2 grpc endpoint // DisableDutiesV2 sets the validator client to use the get duties grpc endpoint
EnableDutiesV2 = &cli.BoolFlag{ DisableDutiesV2 = &cli.BoolFlag{
Name: "enable-duties-v2", Name: "disable-duties-v2",
Usage: "Forces use of get duties v2 endpoint.", Usage: "Forces use of get duties endpoint instead of v2.",
} }
// EnableWebFlag enables controlling the validator client via the Prysm web ui. This is a work in progress. // EnableWebFlag enables controlling the validator client via the Prysm web ui. This is a work in progress.
@@ -223,7 +223,7 @@ var ValidatorFlags = append(deprecatedFlags, []cli.Flag{
EnableMinimalSlashingProtection, EnableMinimalSlashingProtection,
enableDoppelGangerProtection, enableDoppelGangerProtection,
EnableBeaconRESTApi, EnableBeaconRESTApi,
EnableDutiesV2, DisableDutiesV2,
EnableWebFlag, EnableWebFlag,
SSZOnly, SSZOnly,
}...) }...)

View File

@@ -29,21 +29,21 @@ type grpcValidatorClient struct {
} }
func (c *grpcValidatorClient) Duties(ctx context.Context, in *ethpb.DutiesRequest) (*ethpb.ValidatorDutiesContainer, error) { func (c *grpcValidatorClient) Duties(ctx context.Context, in *ethpb.DutiesRequest) (*ethpb.ValidatorDutiesContainer, error) {
if features.Get().EnableDutiesV2 { if features.Get().DisableDutiesV2 {
dutiesResponse, err := c.beaconNodeValidatorClient.GetDutiesV2(ctx, in) return c.getDuties(ctx, in)
if err != nil {
if status.Code(err) == codes.Unimplemented {
log.Warn("GetDutiesV2 returned status code unavailable, falling back to GetDuties")
return c.getDuties(ctx, in)
}
return nil, errors.Wrap(
client.ErrConnectionIssue,
errors.Wrap(err, "getDutiesV2").Error(),
)
}
return toValidatorDutiesContainerV2(dutiesResponse)
} }
return c.getDuties(ctx, in) dutiesResponse, err := c.beaconNodeValidatorClient.GetDutiesV2(ctx, in)
if err != nil {
if status.Code(err) == codes.Unimplemented {
log.Warn("GetDutiesV2 returned status code unavailable, falling back to GetDuties")
return c.getDuties(ctx, in)
}
return nil, errors.Wrap(
client.ErrConnectionIssue,
errors.Wrap(err, "getDutiesV2").Error(),
)
}
return toValidatorDutiesContainerV2(dutiesResponse)
} }
// getDuties is calling the v1 of get duties // getDuties is calling the v1 of get duties