Compare commits

...

1 Commits

Author SHA1 Message Date
james-prysm
23167cc1c2 adding in debug flag 2025-06-24 11:05:50 -05:00
4 changed files with 18 additions and 1 deletions

View File

@@ -0,0 +1,3 @@
### Added
- Added `json-only` debugging feature flag on validator client that forces use of json requests on api endpoints that support both json and ssz.

View File

@@ -53,6 +53,7 @@ type Flags struct {
EnableDutiesV2 bool // EnableDutiesV2 sets validator client to use the get Duties V2 endpoint
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)
JSONOnly bool // JSONOnly forces the validator client to use JSON for communication with the beacon node when REST mode is enabled (useful for debugging)
// Logging related toggles.
DisableGRPCConnectionLogs bool // Disables logging when a new grpc client has connected.
EnableFullSSZDataLogging bool // Enables logging for full ssz data on rejected gossip messages
@@ -349,6 +350,10 @@ func ConfigureValidator(ctx *cli.Context) error {
logEnabled(SSZOnly)
cfg.SSZOnly = true
}
if ctx.Bool(JSONOnly.Name) {
logEnabled(JSONOnly)
cfg.JSONOnly = true
}
cfg.KeystoreImportDebounceInterval = ctx.Duration(dynamicKeyReloadDebounceInterval.Name)
Init(cfg)

View File

@@ -207,6 +207,12 @@ var (
Name: "ssz-only",
Usage: "(debug): Forces the validator client to use SSZ for communication with the beacon node when REST mode is enabled",
}
// JSONOnly forces the validator client to use JSON for communication with the beacon node when REST mode is enabled
JSONOnly = &cli.BoolFlag{
Name: "json-only",
Usage: "(debug): Forces the validator client to use JSON for communication with the beacon node when REST mode is enabled",
}
)
// devModeFlags holds list of flags that are set when development mode is on.

View File

@@ -82,6 +82,9 @@ func (c *BeaconApiRestHandler) GetSSZ(ctx context.Context, endpoint string) ([]b
if features.Get().SSZOnly {
acceptHeaderString = api.OctetStreamMediaType
}
if features.Get().JSONOnly {
acceptHeaderString = api.JsonMediaType
}
req.Header.Set("Accept", acceptHeaderString)
httpResp, err := c.client.Do(req)
if err != nil {
@@ -115,7 +118,7 @@ func (c *BeaconApiRestHandler) GetSSZ(ctx context.Context, endpoint string) ([]b
return nil, nil, errorJson
}
if features.Get().SSZOnly && contentType != api.OctetStreamMediaType {
if (features.Get().SSZOnly && contentType != api.OctetStreamMediaType) || (features.Get().JSONOnly && contentType != api.JsonMediaType) {
return nil, nil, errors.Errorf("server responded with non primary accept type %s", contentType)
}