Skip to content

Commit d8250c1

Browse files
authored
Merge branch 'dev' into e2e-log-node-uri
2 parents 4f1abab + c3e9c83 commit d8250c1

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

snow/engine/snowman/syncer/state_syncer.go

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,27 +233,43 @@ func (ss *stateSyncer) AcceptedStateSummary(ctx context.Context, nodeID ids.Node
233233
// Mark that we received a response from [nodeID]
234234
ss.pendingVoters.Remove(nodeID)
235235

236-
weight := ss.StateSyncBeacons.GetWeight(nodeID)
236+
nodeWeight := ss.StateSyncBeacons.GetWeight(nodeID)
237+
ss.Ctx.Log.Debug("adding weight to summaries",
238+
zap.Stringer("nodeID", nodeID),
239+
zap.Stringers("summaryIDs", summaryIDs),
240+
zap.Uint64("nodeWeight", nodeWeight),
241+
)
237242
for _, summaryID := range summaryIDs {
238243
ws, ok := ss.weightedSummaries[summaryID]
239244
if !ok {
240245
ss.Ctx.Log.Debug("skipping summary",
241-
zap.String("reason", "received a vote from validator for unknown summary"),
246+
zap.String("reason", "unknown summary"),
242247
zap.Stringer("nodeID", nodeID),
243248
zap.Stringer("summaryID", summaryID),
244249
)
245250
continue
246251
}
247252

248-
newWeight, err := math.Add64(weight, ws.weight)
253+
newWeight, err := math.Add64(nodeWeight, ws.weight)
249254
if err != nil {
250-
ss.Ctx.Log.Error("failed to calculate the Accepted votes",
251-
zap.Uint64("weight", weight),
255+
ss.Ctx.Log.Error("failed to calculate new summary weight",
256+
zap.Stringer("nodeID", nodeID),
257+
zap.Stringer("summaryID", summaryID),
258+
zap.Uint64("height", ws.summary.Height()),
259+
zap.Uint64("nodeWeight", nodeWeight),
252260
zap.Uint64("previousWeight", ws.weight),
253261
zap.Error(err),
254262
)
255263
newWeight = stdmath.MaxUint64
256264
}
265+
266+
ss.Ctx.Log.Verbo("updating summary weight",
267+
zap.Stringer("nodeID", nodeID),
268+
zap.Stringer("summaryID", summaryID),
269+
zap.Uint64("height", ws.summary.Height()),
270+
zap.Uint64("previousWeight", ws.weight),
271+
zap.Uint64("newWeight", newWeight),
272+
)
257273
ws.weight = newWeight
258274
}
259275

@@ -270,6 +286,8 @@ func (ss *stateSyncer) AcceptedStateSummary(ctx context.Context, nodeID ids.Node
270286
if ws.weight < ss.Alpha {
271287
ss.Ctx.Log.Debug("removing summary",
272288
zap.String("reason", "insufficient weight"),
289+
zap.Stringer("summaryID", summaryID),
290+
zap.Uint64("height", ws.summary.Height()),
273291
zap.Uint64("currentWeight", ws.weight),
274292
zap.Uint64("requiredWeight", ss.Alpha),
275293
)

0 commit comments

Comments
 (0)