mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-06 20:13:59 -05:00
Downgrade log level for all validator indices. (#15998)
* Update logging behaviour for updated fee recipient. * Updated changelog. * Display validator indices only on TRACE * Fix tests --------- Co-authored-by: Manu NALEPA <enalepa@offchainlabs.com>
This commit is contained in:
@@ -99,6 +99,7 @@ go_test(
|
||||
"@com_github_ethereum_go_ethereum//common/hexutil:go_default_library",
|
||||
"@com_github_pkg_errors//:go_default_library",
|
||||
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@com_github_sirupsen_logrus//hooks/test:go_default_library",
|
||||
"@org_uber_go_mock//gomock:go_default_library",
|
||||
],
|
||||
|
||||
@@ -835,12 +835,17 @@ func (s *Server) PrepareBeaconProposer(w http.ResponseWriter, r *http.Request) {
|
||||
s.TrackedValidatorsCache.Set(val)
|
||||
validatorIndices = append(validatorIndices, primitives.ValidatorIndex(validatorIndex))
|
||||
}
|
||||
|
||||
if len(validatorIndices) == 0 {
|
||||
return
|
||||
}
|
||||
log.WithFields(logrus.Fields{
|
||||
"validatorIndices": validatorIndices,
|
||||
}).Info("Updated fee recipient addresses")
|
||||
|
||||
log := log.WithField("validatorCount", len(validatorIndices))
|
||||
if logrus.GetLevel() >= logrus.TraceLevel {
|
||||
log = log.WithField("validatorIndices", validatorIndices)
|
||||
}
|
||||
|
||||
log.Debug("Updated fee recipient addresses")
|
||||
}
|
||||
|
||||
// GetAttesterDuties requests the beacon node to provide a set of attestation duties,
|
||||
|
||||
@@ -44,6 +44,7 @@ import (
|
||||
"github.com/OffchainLabs/prysm/v7/time/slots"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
logTest "github.com/sirupsen/logrus/hooks/test"
|
||||
)
|
||||
|
||||
@@ -2854,6 +2855,8 @@ func TestPrepareBeaconProposer(t *testing.T) {
|
||||
|
||||
func TestProposer_PrepareBeaconProposerOverlapping(t *testing.T) {
|
||||
hook := logTest.NewGlobal()
|
||||
logrus.SetLevel(logrus.DebugLevel)
|
||||
|
||||
db := dbutil.SetupDB(t)
|
||||
|
||||
// New validator
|
||||
|
||||
@@ -547,11 +547,19 @@ func (vs *Server) PrepareBeaconProposer(
|
||||
vs.TrackedValidatorsCache.Set(val)
|
||||
validatorIndices = append(validatorIndices, r.ValidatorIndex)
|
||||
}
|
||||
if len(validatorIndices) != 0 {
|
||||
log.WithFields(logrus.Fields{
|
||||
"validatorCount": len(validatorIndices),
|
||||
}).Debug("Updated fee recipient addresses for validator indices")
|
||||
|
||||
if len(validatorIndices) == 0 {
|
||||
return &emptypb.Empty{}, nil
|
||||
|
||||
}
|
||||
|
||||
log := log.WithField("validatorCount", len(validatorIndices))
|
||||
if logrus.GetLevel() >= logrus.TraceLevel {
|
||||
log = log.WithField("validatorIndices", validatorIndices)
|
||||
}
|
||||
|
||||
log.Debug("Updated fee recipient addresses")
|
||||
|
||||
return &emptypb.Empty{}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ import (
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
logTest "github.com/sirupsen/logrus/hooks/test"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
@@ -3162,6 +3163,8 @@ func TestProposer_PrepareBeaconProposer(t *testing.T) {
|
||||
|
||||
func TestProposer_PrepareBeaconProposerOverlapping(t *testing.T) {
|
||||
hook := logTest.NewGlobal()
|
||||
logrus.SetLevel(logrus.DebugLevel)
|
||||
|
||||
db := dbutil.SetupDB(t)
|
||||
ctx := t.Context()
|
||||
proposerServer := &Server{
|
||||
@@ -3178,13 +3181,13 @@ func TestProposer_PrepareBeaconProposerOverlapping(t *testing.T) {
|
||||
}
|
||||
_, err := proposerServer.PrepareBeaconProposer(ctx, req)
|
||||
require.NoError(t, err)
|
||||
require.LogsContain(t, hook, "Updated fee recipient addresses for validator indices")
|
||||
require.LogsContain(t, hook, "Updated fee recipient addresses")
|
||||
|
||||
// Same validator
|
||||
hook.Reset()
|
||||
_, err = proposerServer.PrepareBeaconProposer(ctx, req)
|
||||
require.NoError(t, err)
|
||||
require.LogsContain(t, hook, "Updated fee recipient addresses for validator indices")
|
||||
require.LogsContain(t, hook, "Updated fee recipient addresses")
|
||||
|
||||
// Same validator with different fee recipient
|
||||
hook.Reset()
|
||||
@@ -3196,7 +3199,7 @@ func TestProposer_PrepareBeaconProposerOverlapping(t *testing.T) {
|
||||
}
|
||||
_, err = proposerServer.PrepareBeaconProposer(ctx, req)
|
||||
require.NoError(t, err)
|
||||
require.LogsContain(t, hook, "Updated fee recipient addresses for validator indices")
|
||||
require.LogsContain(t, hook, "Updated fee recipient addresses")
|
||||
|
||||
// More than one validator
|
||||
hook.Reset()
|
||||
@@ -3209,13 +3212,13 @@ func TestProposer_PrepareBeaconProposerOverlapping(t *testing.T) {
|
||||
}
|
||||
_, err = proposerServer.PrepareBeaconProposer(ctx, req)
|
||||
require.NoError(t, err)
|
||||
require.LogsContain(t, hook, "Updated fee recipient addresses for validator indices")
|
||||
require.LogsContain(t, hook, "Updated fee recipient addresses")
|
||||
|
||||
// Same validators
|
||||
hook.Reset()
|
||||
_, err = proposerServer.PrepareBeaconProposer(ctx, req)
|
||||
require.NoError(t, err)
|
||||
require.LogsContain(t, hook, "Updated fee recipient addresses for validator indices")
|
||||
require.LogsContain(t, hook, "Updated fee recipient addresses")
|
||||
}
|
||||
|
||||
func BenchmarkServer_PrepareBeaconProposer(b *testing.B) {
|
||||
|
||||
4
changelog/chris-downgrade-log-level.md
Normal file
4
changelog/chris-downgrade-log-level.md
Normal file
@@ -0,0 +1,4 @@
|
||||
### Changed
|
||||
|
||||
- Downgraded log level from INFO to DEBUG on PrepareBeaconProposer updated fee recipients.
|
||||
- Change the logging behaviour of Updated fee recipients to only log count of validators at Debug level and all validator indices at Trace level.
|
||||
Reference in New Issue
Block a user