Skip to content

Commit

Permalink
chunks.go: Avoid templating log messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
nalepae committed Feb 8, 2024
1 parent 40eccfc commit bd02048
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions beacon-chain/slasher/chunks.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
slashertypes "github.com/prysmaticlabs/prysm/v4/beacon-chain/slasher/types"
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
"github.com/sirupsen/logrus"
)

// A struct encapsulating input arguments to
Expand Down Expand Up @@ -213,10 +214,12 @@ func (m *MinSpanChunksSlice) CheckSlashable(
// recorded in our min/max DB an distance corresponding to an attestaiton, but WITHOUT
// recording the attestation itself. As a consequence, we say there is no surrounding vote,
// but we log an error.
log.Errorf("No existing attestation record found for validator %d at target %d, while a surrounding vote was detected.",
validatorIdx, minTarget,
)
fields := logrus.Fields{
"validatorIndex": validatorIdx,
"targetEpoch": minTarget,
}

log.WithFields(fields).Error("No existing attestation record found while a surrounding vote was detected.")
return nil, nil
}

Expand Down Expand Up @@ -279,9 +282,12 @@ func (m *MaxSpanChunksSlice) CheckSlashable(
// recorded in our min/max DB an distance corresponding to an attestaiton, but WITHOUT
// recording the attestation itself. As a consequence, we say there is no surrounded vote,
// but we log an error.
log.Errorf("No existing attestation record found for validator %d at target %d, while a surrounded vote was detected.",
validatorIdx, maxTarget,
)
fields := logrus.Fields{
"validatorIndex": validatorIdx,
"targetEpoch": maxTarget,
}

log.WithFields(fields).Error("No existing attestation record found while a surrounded vote was detected.")
return nil, nil
}

Expand Down

0 comments on commit bd02048

Please sign in to comment.