Skip to content

Commit

Permalink
Remove ShouldAcceptFinalizedReport
Browse files Browse the repository at this point in the history
It is not used in OCR3
  • Loading branch information
samsondav committed Sep 29, 2023
1 parent 8550f24 commit 68b0f8e
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 87 deletions.
29 changes: 0 additions & 29 deletions pkg/reportingplugins/mercury/v1/mercury.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,35 +379,6 @@ func (rp *reportingPlugin) validateReport(rf ReportFields) error {
)
}

func (rp *reportingPlugin) ShouldAcceptFinalizedReport(ctx context.Context, repts types.ReportTimestamp, report types.Report) (bool, error) {
reportEpochRound := mercury.EpochRound{Epoch: repts.Epoch, Round: repts.Round}
if !rp.latestAcceptedEpochRound.Less(reportEpochRound) {
rp.logger.Debugw("ShouldAcceptFinalizedReport() = false, report is stale",
"latestAcceptedEpochRound", rp.latestAcceptedEpochRound,
"reportEpochRound", reportEpochRound,
)
return false, nil
}

if !(len(report) <= rp.maxReportLength) {
rp.logger.Warnw("report violates MaxReportLength limit set by ReportCodec",
"reportEpochRound", reportEpochRound,
"reportLength", len(report),
"maxReportLength", rp.maxReportLength,
)
return false, nil
}

rp.logger.Debugw("ShouldAcceptFinalizedReport() = true",
"reportEpochRound", reportEpochRound,
"latestAcceptedEpochRound", rp.latestAcceptedEpochRound,
)

rp.latestAcceptedEpochRound = reportEpochRound

return true, nil
}

func (rp *reportingPlugin) ShouldTransmitAcceptedReport(ctx context.Context, repts types.ReportTimestamp, report types.Report) (bool, error) {
return true, nil
}
Expand Down
29 changes: 0 additions & 29 deletions pkg/reportingplugins/mercury/v2/mercury.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,35 +379,6 @@ func (rp *reportingPlugin) validateReport(rf ReportFields) error {
)
}

func (rp *reportingPlugin) ShouldAcceptFinalizedReport(ctx context.Context, repts ocrtypes.ReportTimestamp, report ocrtypes.Report) (bool, error) {
reportEpochRound := mercury.EpochRound{Epoch: repts.Epoch, Round: repts.Round}
if !rp.latestAcceptedEpochRound.Less(reportEpochRound) {
rp.logger.Debugw("ShouldAcceptFinalizedReport() = false, report is stale",
"latestAcceptedEpochRound", rp.latestAcceptedEpochRound,
"reportEpochRound", reportEpochRound,
)
return false, nil
}

if !(len(report) <= rp.maxReportLength) {
rp.logger.Warnw("report violates MaxReportLength limit set by ReportCodec",
"reportEpochRound", reportEpochRound,
"reportLength", len(report),
"maxReportLength", rp.maxReportLength,
)
return false, nil
}

rp.logger.Debugw("ShouldAcceptFinalizedReport() = true",
"reportEpochRound", reportEpochRound,
"latestAcceptedEpochRound", rp.latestAcceptedEpochRound,
)

rp.latestAcceptedEpochRound = reportEpochRound

return true, nil
}

func (rp *reportingPlugin) ShouldTransmitAcceptedReport(ctx context.Context, repts ocrtypes.ReportTimestamp, report ocrtypes.Report) (bool, error) {
return true, nil
}
Expand Down
29 changes: 0 additions & 29 deletions pkg/reportingplugins/mercury/v3/mercury.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,35 +422,6 @@ func (rp *reportingPlugin) validateReport(rf ReportFields) error {
)
}

func (rp *reportingPlugin) ShouldAcceptFinalizedReport(ctx context.Context, repts ocrtypes.ReportTimestamp, report ocrtypes.Report) (bool, error) {
reportEpochRound := mercury.EpochRound{Epoch: repts.Epoch, Round: repts.Round}
if !rp.latestAcceptedEpochRound.Less(reportEpochRound) {
rp.logger.Debugw("ShouldAcceptFinalizedReport() = false, report is stale",
"latestAcceptedEpochRound", rp.latestAcceptedEpochRound,
"reportEpochRound", reportEpochRound,
)
return false, nil
}

if !(len(report) <= rp.maxReportLength) {
rp.logger.Warnw("report violates MaxReportLength limit set by ReportCodec",
"reportEpochRound", reportEpochRound,
"reportLength", len(report),
"maxReportLength", rp.maxReportLength,
)
return false, nil
}

rp.logger.Debugw("ShouldAcceptFinalizedReport() = true",
"reportEpochRound", reportEpochRound,
"latestAcceptedEpochRound", rp.latestAcceptedEpochRound,
)

rp.latestAcceptedEpochRound = reportEpochRound

return true, nil
}

func (rp *reportingPlugin) ShouldTransmitAcceptedReport(ctx context.Context, repts ocrtypes.ReportTimestamp, report ocrtypes.Report) (bool, error) {
return true, nil
}
Expand Down

0 comments on commit 68b0f8e

Please sign in to comment.