From e09ae75c9fd02069278deaf15615f1e4f18050ad Mon Sep 17 00:00:00 2001 From: Manu NALEPA Date: Wed, 21 Feb 2024 16:20:44 +0100 Subject: [PATCH] Normalize checkpoint logs. (#13643) --- beacon-chain/sync/checkpoint/BUILD.bazel | 1 + beacon-chain/sync/checkpoint/api.go | 3 +-- beacon-chain/sync/checkpoint/file.go | 3 +-- beacon-chain/sync/checkpoint/log.go | 5 +++++ 4 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 beacon-chain/sync/checkpoint/log.go diff --git a/beacon-chain/sync/checkpoint/BUILD.bazel b/beacon-chain/sync/checkpoint/BUILD.bazel index 02fe674ac..1e5527253 100644 --- a/beacon-chain/sync/checkpoint/BUILD.bazel +++ b/beacon-chain/sync/checkpoint/BUILD.bazel @@ -5,6 +5,7 @@ go_library( srcs = [ "api.go", "file.go", + "log.go", ], importpath = "github.com/prysmaticlabs/prysm/v5/beacon-chain/sync/checkpoint", visibility = ["//visibility:public"], diff --git a/beacon-chain/sync/checkpoint/api.go b/beacon-chain/sync/checkpoint/api.go index 2699eb2d8..4ed9dc658 100644 --- a/beacon-chain/sync/checkpoint/api.go +++ b/beacon-chain/sync/checkpoint/api.go @@ -7,7 +7,6 @@ import ( "github.com/prysmaticlabs/prysm/v5/api/client/beacon" "github.com/prysmaticlabs/prysm/v5/beacon-chain/db" "github.com/prysmaticlabs/prysm/v5/config/params" - log "github.com/sirupsen/logrus" ) // APIInitializer manages initializing the beacon node using checkpoint sync, retrieving the checkpoint state and root @@ -31,7 +30,7 @@ func NewAPIInitializer(beaconNodeHost string) (*APIInitializer, error) { func (dl *APIInitializer) Initialize(ctx context.Context, d db.Database) error { origin, err := d.OriginCheckpointBlockRoot(ctx) if err == nil && origin != params.BeaconConfig().ZeroHash { - log.Warnf("origin checkpoint root %#x found in db, ignoring checkpoint sync flags", origin) + log.Warnf("Origin checkpoint root %#x found in db, ignoring checkpoint sync flags", origin) return nil } else { if !errors.Is(err, db.ErrNotFound) { diff --git a/beacon-chain/sync/checkpoint/file.go b/beacon-chain/sync/checkpoint/file.go index 38382f784..ba2ca1dc8 100644 --- a/beacon-chain/sync/checkpoint/file.go +++ b/beacon-chain/sync/checkpoint/file.go @@ -9,7 +9,6 @@ import ( "github.com/prysmaticlabs/prysm/v5/beacon-chain/db" "github.com/prysmaticlabs/prysm/v5/config/params" "github.com/prysmaticlabs/prysm/v5/io/file" - log "github.com/sirupsen/logrus" ) // Initializer describes a type that is able to obtain the checkpoint sync data (BeaconState and SignedBeaconBlock) @@ -45,7 +44,7 @@ type FileInitializer struct { func (fi *FileInitializer) Initialize(ctx context.Context, d db.Database) error { origin, err := d.OriginCheckpointBlockRoot(ctx) if err == nil && origin != params.BeaconConfig().ZeroHash { - log.Warnf("origin checkpoint root %#x found in db, ignoring checkpoint sync flags", origin) + log.Warnf("Origin checkpoint root %#x found in db, ignoring checkpoint sync flags", origin) return nil } else { if !errors.Is(err, db.ErrNotFound) { diff --git a/beacon-chain/sync/checkpoint/log.go b/beacon-chain/sync/checkpoint/log.go new file mode 100644 index 000000000..3cf5fad74 --- /dev/null +++ b/beacon-chain/sync/checkpoint/log.go @@ -0,0 +1,5 @@ +package checkpoint + +import "github.com/sirupsen/logrus" + +var log = logrus.WithField("prefix", "checkpoint-sync")