Add log capitalization analyzer and apply changes (#15452)

* Add log capitalization analyzer and apply fixes across codebase

Implements a new nogo analyzer to enforce proper log message capitalization and applies the fixes to all affected log statements throughout the beacon chain, validator, and supporting components.

Co-Authored-By: Claude <noreply@anthropic.com>

* Radek's feedback

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
terence
2025-07-10 06:43:38 -07:00
committed by GitHub
parent 5c1d827335
commit 16b567f6af
71 changed files with 616 additions and 159 deletions

View File

@@ -37,7 +37,7 @@ func (c *grpcNodeClient) Peers(ctx context.Context, in *empty.Empty) (*ethpb.Pee
func (c *grpcNodeClient) IsHealthy(ctx context.Context) bool {
_, err := c.nodeClient.GetHealth(ctx, &ethpb.HealthRequest{})
if err != nil {
log.WithError(err).Error("failed to get health of node")
log.WithError(err).Error("Failed to get health of node")
return false
}
return true

View File

@@ -33,7 +33,7 @@ func (c *grpcValidatorClient) Duties(ctx context.Context, in *ethpb.DutiesReques
dutiesResponse, err := c.beaconNodeValidatorClient.GetDutiesV2(ctx, in)
if err != nil {
if status.Code(err) == codes.Unimplemented {
log.Warn("beaconNodeValidatorClient.GetDutiesV2() returned status code unavailable, falling back to GetDuties")
log.Warn("GetDutiesV2 returned status code unavailable, falling back to GetDuties")
return c.getDuties(ctx, in)
}
return nil, errors.Wrap(

View File

@@ -275,7 +275,7 @@ func (*FakeValidator) HasProposerSettings() bool {
func (fv *FakeValidator) PushProposerSettings(ctx context.Context, _ primitives.Slot, _ bool) error {
time.Sleep(fv.ProposerSettingWait)
if errors.Is(ctx.Err(), context.DeadlineExceeded) {
log.Error("deadline exceeded")
log.Error("Deadline exceeded")
// can't return error as it will trigger a log.fatal
return nil
}

View File

@@ -565,7 +565,7 @@ func (v *validator) UpdateDuties(ctx context.Context) error {
v.dutiesLock.Lock()
v.duties = nil // Clear assignments so we know to retry the request.
v.dutiesLock.Unlock()
log.WithError(err).Error("error getting validator duties")
log.WithError(err).Error("Error getting validator duties")
return err
}
@@ -1141,7 +1141,7 @@ func (v *validator) PushProposerSettings(ctx context.Context, slot primitives.Sl
if len(signedRegReqs) > 0 {
go func() {
if err := SubmitValidatorRegistrations(ctx, v.validatorClient, signedRegReqs, v.validatorsRegBatchSize); err != nil {
log.WithError(errors.Wrap(ErrBuilderValidatorRegistration, err.Error())).Warn("failed to register validator on builder")
log.WithError(errors.Wrap(ErrBuilderValidatorRegistration, err.Error())).Warn("Failed to register validator on builder")
}
}()
}

View File

@@ -76,7 +76,7 @@ func (km *Keymanager) ImportKeystores(
}
}
if len(importedKeys) == 0 {
log.Warn("no keys were imported")
log.Warn("No keys were imported")
return statuses, nil
}
// 2) Update copied keystore with new keys,clear duplicates in existing set

View File

@@ -243,7 +243,7 @@ func TestLocalKeymanager_ImportKeystores(t *testing.T) {
fmt.Sprintf("incorrect password for key 0x%s", keystores[1].Pubkey),
statuses[1].Message,
)
require.LogsContain(t, hook, "no keys were imported")
require.LogsContain(t, hook, "No keys were imported")
})
t.Run("file write fails during import", func(t *testing.T) {
wallet.HasWriteFileError = true

View File

@@ -174,7 +174,7 @@ func (client *ApiClient) doRequest(ctx context.Context, httpMethod, fullPath str
"status": resp.StatusCode,
"request": string(requestDump),
"response": string(responseDump),
}).Error("web3signer request failed")
}).Error("Web3signer request failed")
}
if resp.StatusCode == http.StatusInternalServerError {
err = fmt.Errorf("internal Web3Signer server error, Signing Request URL: %v Status: %v", fullPath, resp.StatusCode)
@@ -217,6 +217,6 @@ func unmarshalSignatureResponse(responseBody io.ReadCloser) (bls.Signature, erro
// closeBody a utility method to wrap an error for closing
func closeBody(body io.Closer) {
if err := body.Close(); err != nil {
log.WithError(err).Error("could not close response body")
log.WithError(err).Error("Could not close response body")
}
}

View File

@@ -225,7 +225,7 @@ func (c *ValidatorClient) getLegacyDatabaseLocation(
func getWallet(cliCtx *cli.Context) (*wallet.Wallet, error) {
if cliCtx.IsSet(flags.InteropNumValidators.Name) {
log.Info("no wallet required for interop validation")
log.Info("No wallet required for interop validation")
return nil, nil
}
if cliCtx.IsSet(flags.Web3SignerURLFlag.Name) {