From 28e18ba515eb0f084c8c4d9775c02c6933618f7b Mon Sep 17 00:00:00 2001 From: Jim McDonald Date: Thu, 28 Nov 2024 22:15:24 +0000 Subject: [PATCH 1/2] Use millisecond timestamp format by default. --- CHANGELOG.md | 1 + logging.go | 2 ++ main.go | 1 + 3 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9922e10..9ed074b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - enable gzip compression - disallow generation of distributed accounts without passphrases - allow use of keystore wallets + - use millisecond-precision timestamps in logs by default # Version 1.2.0 - add Amazon Secrets Manager (ASM) confidant diff --git a/logging.go b/logging.go index e6d8de6..da216fe 100644 --- a/logging.go +++ b/logging.go @@ -32,6 +32,8 @@ func initLogging() error { // local log level the local level is ignored. It is then overridden for each module. zerolog.SetGlobalLevel(zerolog.TraceLevel) + zerolog.TimeFieldFormat = viper.GetString("logging.timestamp.format") + // Change the output file. if viper.GetString("log-file") != "" { f, err := os.OpenFile(util.ResolvePath(viper.GetString("log-file")), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0o600) diff --git a/main.go b/main.go index 5f20b9a..cce3369 100644 --- a/main.go +++ b/main.go @@ -193,6 +193,7 @@ func fetchConfig() error { viper.AutomaticEnv() // Defaults. + viper.SetDefault("logging.timestamp.format", "2006-01-02T15:04:05.000Z07:00") viper.SetDefault("storage-path", "storage") viper.SetDefault("process.generation-timeout", 70*time.Second) From fb5c0fcd9ec76a2a6424ebaa720ee5d24fa41115 Mon Sep 17 00:00:00 2001 From: Jim McDonald Date: Thu, 28 Nov 2024 22:17:44 +0000 Subject: [PATCH 2/2] Linting. --- .golangci.yml | 2 -- rules/standard/signbeaconattestations.go | 2 -- rules/standard/signbeaconproposal.go | 1 - 3 files changed, 5 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index d7aeec5..d9704de 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -153,7 +153,6 @@ linters: - depguard - dupl - err113 - - execinquery - exhaustive - exhaustruct - exportloopref @@ -163,7 +162,6 @@ linters: - gochecknoglobals - gocognit - goconst - - gomnd - ireturn - inamedparam - lll diff --git a/rules/standard/signbeaconattestations.go b/rules/standard/signbeaconattestations.go index cd2bc91..7a03d8c 100644 --- a/rules/standard/signbeaconattestations.go +++ b/rules/standard/signbeaconattestations.go @@ -150,7 +150,6 @@ func (s *Service) runSignBeaconAttestationChecks(_ context.Context, metadata *ru if state.TargetEpoch >= 0 { // The request target epoch must be greater than the previous request target epoch. - //nolint:gosec if targetEpoch <= uint64(state.TargetEpoch) { log.Warn(). Int64("previousTargetEpoch", state.TargetEpoch). @@ -163,7 +162,6 @@ func (s *Service) runSignBeaconAttestationChecks(_ context.Context, metadata *ru if state.SourceEpoch >= 0 { // The request source epoch must be greater than or equal to the previous request source epoch. - //nolint:gosec if sourceEpoch < uint64(state.SourceEpoch) { log.Warn(). Int64("previousSourceEpoch", state.SourceEpoch). diff --git a/rules/standard/signbeaconproposal.go b/rules/standard/signbeaconproposal.go index 55830af..c333271 100644 --- a/rules/standard/signbeaconproposal.go +++ b/rules/standard/signbeaconproposal.go @@ -89,7 +89,6 @@ func (s *Service) OnSignBeaconProposal(ctx context.Context, metadata *rules.ReqM if state.Slot >= 0 { // The request slot must be greater than the previous request slot. - //nolint:gosec if slot <= uint64(state.Slot) { log.Warn(). Int64("previousSlot", state.Slot).