Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ShouldAcceptFinalizedReport #184

Merged
merged 1 commit into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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