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

@@ -177,7 +177,7 @@ func (m *Miner) initAttempt(ctx context.Context, attempt int) (*os.File, error)
if err = helpers.WaitForTextInFile(minerLog, "Started P2P networking"); err != nil {
kerr := runCmd.Process.Kill()
if kerr != nil {
log.WithError(kerr).Error("error sending kill to failed miner command process")
log.WithError(kerr).Error("Error sending kill to failed miner command process")
}
return nil, fmt.Errorf("P2P log not found, this means the eth1 chain had issues starting: %w", err)
}
@@ -194,7 +194,7 @@ func (m *Miner) Start(ctx context.Context) error {
for attempt := 0; attempt < 3; attempt++ {
minerLog, retryErr = m.initAttempt(ctx, attempt)
if retryErr == nil {
log.Infof("miner started after %d retries", attempt)
log.Infof("Miner started after %d retries", attempt)
break
}
}
@@ -236,7 +236,7 @@ func (m *Miner) Start(ctx context.Context) error {
}
dCount, err := depositContractCaller.GetDepositCount(&bind.CallOpts{})
if err != nil {
log.Error("failed to call get_deposit_count method of deposit contract")
log.Error("Failed to call get_deposit_count method of deposit contract")
return err
}
log.Infof("deposit contract count=%d", dCount)

View File

@@ -135,13 +135,13 @@ func (node *Node) Start(ctx context.Context) error {
if err = helpers.WaitForTextInFile(errLog, "Node revalidated"); err != nil {
kerr := runCmd.Process.Kill()
if kerr != nil {
log.WithError(kerr).Error("error sending kill to failed node command process")
log.WithError(kerr).Error("Error sending kill to failed node command process")
}
retryErr = fmt.Errorf("the first node revalidated log not found, this means the eth1 chain had issues starting: %w", err)
continue
}
node.cmd = runCmd
log.Infof("eth1 node started after %d retries", retries)
log.Infof("Eth1 node started after %d retries", retries)
break
}
if retryErr != nil {

View File

@@ -210,6 +210,6 @@ func doSSZPOSTRequest(template, requestPath string, beaconNodeIdx int, postObj i
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

@@ -107,7 +107,7 @@ func feeRecipientIsPresent(_ *types.EvaluationContext, conns ...*grpc.ClientConn
continue
}
if len(payload.FeeRecipient) == 0 || hexutil.Encode(payload.FeeRecipient) == params.BeaconConfig().EthBurnAddressHex {
log.WithField("proposerIndex", bb.ProposerIndex).WithField("slot", bb.Slot).Error("fee recipient eval bug")
log.WithField("proposerIndex", bb.ProposerIndex).WithField("slot", bb.Slot).Error("Fee recipient eval bug")
return errors.New("fee recipient is not set")
}
@@ -138,7 +138,7 @@ func feeRecipientIsPresent(_ *types.EvaluationContext, conns ...*grpc.ClientConn
WithField("slot", bb.Slot).
WithField("proposerIndex", bb.ProposerIndex).
WithField("feeRecipient", fr.Hex()).
Warn("unknown key observed, not a deterministically generated key")
Warn("Unknown key observed, not a deterministically generated key")
return errors.New("unknown key observed, not a deterministically generated key")
}