Fix attestation worker critical path #1238
Merged
+29
−36
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.
Refactor
pkg/payerreportattestation verification by changingpayerreport.getMinuteFromEnvelopeto return only anint32minute and updatingpayerreport.PayerReportVerifier.IsValidReportto returntruefor empty reports to fix the attestation worker critical pathThis pull request adjusts minute extraction utilities and report verification flow in
pkg/payerreportto streamline attestation verification. It changespayerreport.getMinuteFromEnvelopeto return only anint32minute value and updatespayerreport.getMinuteFromSequenceIDaccordingly. It refactorspayerreport.PayerReportVerifier.IsValidReportto immediately returntruefor empty reports and to propagate the boolean fromverifyMerkleRootwith any error. It modifiespayerreport.PayerReportVerifier.verifyMerkleRootto treat invalid-report conditions as(false, nil)and to reserve error returns for system failures. It lowers the log level inpayerreport.PayerReportVerifier.isAtMinuteEndfor non-terminal sequence IDs.payerreport.PayerReportVerifier.verifyMerkleRootto return(false, nil)for invalid-report states and keep errors for system failures in verifier.gopayerreport.getMinuteFromEnvelopeto return only anint32minute and updatepayerreport.getMinuteFromSequenceIDin utils.gopayerreport.PayerReportVerifier.IsValidReportto returntruefor empty reports and propagateverifyMerkleRootresults in verifier.gopayerreport.PayerReportVerifier.isAtMinuteEndin verifier.go📍Where to Start
Start with the
payerreport.PayerReportVerifier.IsValidReportmethod in verifier.go, then follow intopayerreport.PayerReportVerifier.verifyMerkleRootand the updatedpayerreport.getMinuteFromEnvelopein utils.go.Changes since #1238 opened
📊 Macroscope summarized f57212d. 2 files reviewed, 3 issues evaluated, 2 issues filtered, 1 comment posted
🗂️ Filtered Issues
pkg/payerreport/utils.go — 0 comments posted, 1 evaluated, 1 filtered
getMinuteFromEnvelopereturnsint32minutes by callingutils.MinutesSinceEpoch, which casts toint32. If the envelope time is far enough from the epoch, the minute count can overflow/truncate, yielding incorrect values without error. These minutes are then used in database queries (BuildPayerReportandGetLastSequenceIDForOriginatorMinute), potentially causing incorrect lookups and validation outcomes. [ Previously rejected ]pkg/payerreport/verifier.go — 1 comment posted, 2 evaluated, 1 filtered
verifyMerkleRoot: several conditions that previously returned specific errors (e.g.,ErrInvalidReportStart,ErrMessageNotAtMinuteEnd,ErrMerkleRootMismatch) now return(false, nil), classifying them as invalid reports rather than errors. Additionally, the overflow case forOriginatorNodeIDnow returns the raw error fromutils.Uint32ToInt32instead of the prior sentinelErrInvalidOriginatorID. These changes alter the externally visible contract—callers relying on specific errors to differentiate invalid-input vs. system-error cases will observe different behavior. [ Low confidence ]