Skip to content

Commit

Permalink
[Keystone] Minor logging improvements (#535)
Browse files Browse the repository at this point in the history
  • Loading branch information
bolekk authored May 28, 2024
1 parent 2839b40 commit 92c5216
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions pkg/capabilities/consensus/ocr3/capability.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
6 changes: 4 additions & 2 deletions pkg/capabilities/consensus/ocr3/datafeeds/feeds_aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand All @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion pkg/capabilities/consensus/ocr3/reporting_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions pkg/capabilities/consensus/ocr3/transmitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 92c5216

Please sign in to comment.