cmd/utils: fix formatting for beacon flag errors to fit Fatalf form (#32090)
Some checks are pending
/ Linux Build (arm) (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Docker Image (push) Waiting to run

Noticed that the errors for the blsync flags were not formatted
correctly for `Fatalf(..)`.
This commit is contained in:
lightclient 2025-06-25 04:42:45 +02:00 committed by GitHub
parent cafa5e6c12
commit 429e821fa2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1891,11 +1891,11 @@ func MakeBeaconLightConfig(ctx *cli.Context) bparams.ClientConfig {
if c, err := hexutil.Decode(ctx.String(BeaconGenesisRootFlag.Name)); err == nil && len(c) <= 32 {
copy(config.GenesisValidatorsRoot[:len(c)], c)
} else {
Fatalf("Invalid hex string", "beacon.genesis.gvroot", ctx.String(BeaconGenesisRootFlag.Name), "error", err)
Fatalf("Could not parse --%s: %v", BeaconGenesisRootFlag.Name, err)
}
configFile := ctx.String(BeaconConfigFlag.Name)
if err := config.ChainConfig.LoadForks(configFile); err != nil {
Fatalf("Could not load beacon chain config", "file", configFile, "error", err)
Fatalf("Could not load beacon chain config '%s': %v", configFile, err)
}
log.Info("Using custom beacon chain config", "file", configFile)
} else {
@ -1912,17 +1912,17 @@ func MakeBeaconLightConfig(ctx *cli.Context) bparams.ClientConfig {
// are saved to the specified file.
if ctx.IsSet(BeaconCheckpointFileFlag.Name) {
if _, err := config.SetCheckpointFile(ctx.String(BeaconCheckpointFileFlag.Name)); err != nil {
Fatalf("Could not load beacon checkpoint file", "beacon.checkpoint.file", ctx.String(BeaconCheckpointFileFlag.Name), "error", err)
Fatalf("Could not load beacon checkpoint file '%s': %v", ctx.String(BeaconCheckpointFileFlag.Name), err)
}
}
if ctx.IsSet(BeaconCheckpointFlag.Name) {
hex := ctx.String(BeaconCheckpointFlag.Name)
c, err := hexutil.Decode(hex)
if err != nil {
Fatalf("Invalid hex string", "beacon.checkpoint", hex, "error", err)
Fatalf("Could not parse --%s: %v", BeaconCheckpointFlag.Name, err)
}
if len(c) != 32 {
Fatalf("Invalid hex string length", "beacon.checkpoint", hex, "length", len(c))
Fatalf("Could not parse --%s: invalid length %d, want 32", BeaconCheckpointFlag.Name, len(c))
}
copy(config.Checkpoint[:len(c)], c)
}