From 92c521695f6f87bb9914c9f2140b58e19b6da1ea Mon Sep 17 00:00:00 2001 From: Bolek <1416262+bolekk@users.noreply.github.com> Date: Tue, 28 May 2024 07:16:39 -0700 Subject: [PATCH] [Keystone] Minor logging improvements (#535) --- pkg/capabilities/consensus/ocr3/capability.go | 1 + .../consensus/ocr3/datafeeds/feeds_aggregator.go | 6 ++++-- pkg/capabilities/consensus/ocr3/reporting_plugin.go | 3 ++- pkg/capabilities/consensus/ocr3/transmitter.go | 1 + 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pkg/capabilities/consensus/ocr3/capability.go b/pkg/capabilities/consensus/ocr3/capability.go index b2100e21c..fb1e4f0fc 100644 --- a/pkg/capabilities/consensus/ocr3/capability.go +++ b/pkg/capabilities/consensus/ocr3/capability.go @@ -182,6 +182,7 @@ func (o *capability) Execute(ctx context.Context, r capabilities.CapabilityReque if err != nil { return nil, fmt.Errorf("failed to create map for response inputs: %w", err) } + o.lggr.Debugw("Execute - sending response", "workflowExecutionID", r.Metadata.WorkflowExecutionID, "inputs", inputs) out := &outputs{ WorkflowExecutionID: r.Metadata.WorkflowExecutionID, CapabilityResponse: capabilities.CapabilityResponse{ diff --git a/pkg/capabilities/consensus/ocr3/datafeeds/feeds_aggregator.go b/pkg/capabilities/consensus/ocr3/datafeeds/feeds_aggregator.go index 9571ba483..cf5217a35 100644 --- a/pkg/capabilities/consensus/ocr3/datafeeds/feeds_aggregator.go +++ b/pkg/capabilities/consensus/ocr3/datafeeds/feeds_aggregator.go @@ -103,8 +103,8 @@ func (a *dataFeedsAggregator) Aggregate(previousOutcome *types.AggregationOutcom for feedID := range currentState.FeedInfo { if _, ok := a.config.Feeds[datastreams.FeedID(feedID)]; !ok { delete(currentState.FeedInfo, feedID) + a.lggr.Debugw("removed obsolete feedID from state", "feedID", feedID) } - a.lggr.Debugw("removed obsolete feedID from state", "feedID", feedID) } reportsNeedingUpdate := []datastreams.FeedReport{} @@ -129,8 +129,10 @@ func (a *dataFeedsAggregator) Aggregate(previousOutcome *types.AggregationOutcom config := a.config.Feeds[feedID] oldPrice := big.NewInt(0).SetBytes(previousReportInfo.BenchmarkPrice) newPrice := big.NewInt(0).SetBytes(latestReport.BenchmarkPrice) + currDeviation := deviation(oldPrice, newPrice) + a.lggr.Debugw("checking deviation and heartbeat", "feedID", feedID, "currentTs", latestReport.ObservationTimestamp, "oldTs", previousReportInfo.ObservationTimestamp, "oldPrice", oldPrice, "newPrice", newPrice, "deviation", currDeviation) if latestReport.ObservationTimestamp-previousReportInfo.ObservationTimestamp > int64(config.Heartbeat) || - deviation(oldPrice, newPrice) > config.Deviation.InexactFloat64() { + currDeviation > config.Deviation.InexactFloat64() { previousReportInfo.ObservationTimestamp = latestReport.ObservationTimestamp previousReportInfo.BenchmarkPrice = latestReport.BenchmarkPrice reportsNeedingUpdate = append(reportsNeedingUpdate, latestReport) diff --git a/pkg/capabilities/consensus/ocr3/reporting_plugin.go b/pkg/capabilities/consensus/ocr3/reporting_plugin.go index fc375a09f..72049289f 100644 --- a/pkg/capabilities/consensus/ocr3/reporting_plugin.go +++ b/pkg/capabilities/consensus/ocr3/reporting_plugin.go @@ -207,7 +207,7 @@ func (r *reportingPlugin) Outcome(outctx ocr3types.OutcomeContext, query types.Q h := sha256.New() h.Write(rawOutcome) outcomeHash := h.Sum(nil) - r.lggr.Debugw("Outcome complete", "len", len(o.Outcomes), "nCurrentReports", len(o.CurrentReports), "outcomeHash", hex.EncodeToString(outcomeHash), "err", err) + r.lggr.Debugw("Outcome complete", "len", len(o.Outcomes), "nAggregatedWorkflowExecutions", len(o.CurrentReports), "outcomeHash", hex.EncodeToString(outcomeHash), "err", err) return rawOutcome, err } @@ -256,6 +256,7 @@ func (r *reportingPlugin) Reports(seqNr uint64, outcome ocr3types.Outcome) ([]oc continue } + // Append every report, even if shouldReport = false, to let the transmitter mark the step as complete. reports = append(reports, ocr3types.ReportWithInfo[[]byte]{ Report: report, Info: p, diff --git a/pkg/capabilities/consensus/ocr3/transmitter.go b/pkg/capabilities/consensus/ocr3/transmitter.go index 7df684498..a133b344d 100644 --- a/pkg/capabilities/consensus/ocr3/transmitter.go +++ b/pkg/capabilities/consensus/ocr3/transmitter.go @@ -46,6 +46,7 @@ func (c *ContractTransmitter) Transmit(ctx context.Context, configDigest types.C for _, s := range signatures { sigs = append(sigs, s.Signature) } + c.lggr.Debugw("ContractTransmitter added signatures", "nSignatures", len(sigs)) resp["signatures"] = sigs } else { resp["report"] = nil