From 932b79a228d976218808c6be01cc191e13ffffde Mon Sep 17 00:00:00 2001 From: kalo <24719519+KaloyanTanev@users.noreply.github.com> Date: Wed, 21 Oct 2026 17:22:36 +0300 Subject: [PATCH] core/tracker: debug log sync selection proof inconsistency --- core/tracker/tracker.go | 6 +++--- core/tracker/tracker_internal_test.go | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/core/tracker/tracker.go b/core/tracker/tracker.go index 041b3f8ae..d28132735 100644 --- a/core/tracker/tracker.go +++ b/core/tracker/tracker.go @@ -1082,9 +1082,9 @@ func reportParSigs(ctx context.Context, duty core.Duty, parsigMsgs parsigsByMsg) entriesJSON = json.RawMessage(fmt.Sprintf("%q", err.Error())) } - // DutySyncMessage is handled earlier via reportSyncMessageCohorts. Sync contribution - // inconsistency is expected (per-validator, per-subcommittee) so log at debug. - if duty.Type == core.DutySyncContribution { + // DutySyncMessage is handled earlier via reportSyncMessageCohorts. Sync contribution and + // selection proof inconsistency is expected (per-validator, per-subcommittee) so log at debug. + if duty.Type == core.DutySyncContribution || duty.Type == core.DutyPrepareSyncContribution { log.Debug(ctx, "Inconsistent sync committee partial signed data", z.Any("pubkey", pubkey), z.Any("duty", duty), diff --git a/core/tracker/tracker_internal_test.go b/core/tracker/tracker_internal_test.go index 981d9c385..5b96d7a67 100644 --- a/core/tracker/tracker_internal_test.go +++ b/core/tracker/tracker_internal_test.go @@ -19,8 +19,10 @@ import ( eth2p0 "github.com/attestantio/go-eth2-client/spec/phase0" promtestutil "github.com/prometheus/client_golang/prometheus/testutil" "github.com/stretchr/testify/require" + "go.uber.org/zap/zaptest" "github.com/obolnetwork/charon/app/errors" + "github.com/obolnetwork/charon/app/log" "github.com/obolnetwork/charon/core" "github.com/obolnetwork/charon/p2p" "github.com/obolnetwork/charon/testutil" @@ -1767,6 +1769,22 @@ func TestReportParSigsBuilderPreferences(t *testing.T) { require.InDelta(t, before, inconsistentVal(), 0) } +// TestReportParSigsSyncSubcommittees verifies that a validator's sync contributions and selection proofs +// for different subcommittees aren't warned about as inconsistent, since their message roots differ. +func TestReportParSigsSyncSubcommittees(t *testing.T) { + for _, duty := range []core.Duty{core.NewSyncContributionDuty(123), core.NewPrepareSyncContributionDuty(123)} { + t.Run(duty.Type.String(), func(t *testing.T) { + var buf zaptest.Buffer + log.InitConsoleForT(t, &buf) + + reportParSigs(context.Background(), duty, parsigsByMsg{"pk": {rootFrom(0x0a): syncSigs(1, 2), rootFrom(0x0b): syncSigs(3)}}) + + require.Contains(t, buf.String(), "Inconsistent sync committee partial signed data") + require.NotContains(t, buf.String(), "Inconsistent partial signed data") + }) + } +} + func TestBuilderAuthReporter(t *testing.T) { const ( builderA = "builder-a.example.com"