Bubble up payer report verifier results #1264
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Return structured
payerreport.VerifyReportResultfrompayerreport.Verifier.VerifyReportand update attestation worker logs to bubble up verifier reasonsRename
payerreport.Verifier.IsValidReporttopayerreport.Verifier.VerifyReportand change its return type topayerreport.VerifyReportResultwithIsValidandReason. Update attestation worker to logutils.ReasonFieldand act on the structured result; addutils.ReasonFieldand switch mint success logs toutils.AmountField. Adjust tests and mocks to the new interface and result type. Note: fix a Go variable shadowing issue inVerifyReportwhereerris redeclared.📍Where to Start
Start with the
VerifyReportimplementation in verifier.go, then review its callers in attestation.go and the updated tests in verifier_test.go.Changes since #1264 opened
📊 Macroscope summarized 9744de8. 5 files reviewed, 2 issues evaluated, 2 issues filtered, 0 comments posted
🗂️ Filtered Issues
pkg/payerreport/verifier.go — 0 comments posted, 2 evaluated, 2 filtered
VerifyReporttreats reports withStartSequenceID == EndSequenceIDas valid without verifying thatPayersMerkleRootequals the canonical hash of an empty set. The comment explicitly states the merkle root must always be the hash of an empty set, but the implementation returnsIsValid: trueunconditionally. This allows malformed empty reports with an incorrectPayersMerkleRootto be accepted as valid, leading to incorrect attestations and downstream state inconsistency. [ Low confidence ]verifyMerkleRootconvertsreport.EndSequenceIDfromuint64toint64using a direct castint64(report.EndSequenceID)when callingisAtMinuteEnd. IfEndSequenceIDexceedsmath.MaxInt64, this conversion will wrap to a negative value, causing incorrect validation (e.g., mismatching the last sequence ID) and potentially rejecting valid reports. The rest of the codebase usesutils.Uint64ToInt64to guard against overflow; the same check should be applied here to avoid silent overflow and logic errors. [ Low confidence ]