Skip to content

Conversation

@mkysel
Copy link
Collaborator

@mkysel mkysel commented Oct 3, 2025

Fix report verification to avoid ErrMessageAtStartSequenceIDNotFound by treating StartSequenceID == 0 as the first report in payerreport.PayerReportVerifier

Update report verification to handle first reports without a start envelope and expose types required by tests.

  • Modify payerreport.PayerReportVerifier.getStartAndEndMessages to return a nil start envelope when startSequenceID == 0, avoiding a lookup and error in verifier.go
  • Adjust payerreport.PayerReportVerifier.verifyMerkleRoot to set startMinute = 0 when the start envelope is nil in verifier.go
  • Export payerreport.PayerMap and update call sites in generator.go and merkle.go
  • Add test-only bindings payerreport.GenerateMerkleTreeTestBinding, payerreport.ValidateReportTransitionTestBinding, and payerreport.ValidateReportStructureTestBinding in testbindings_test.go
  • Update tests to use the external package style and new exported types/functions across generator_test.go, merkle_test.go, report_test.go, store_test.go, and verifier_test.go

📍Where to Start

Start with payerreport.PayerReportVerifier.getStartAndEndMessages and payerreport.PayerReportVerifier.verifyMerkleRoot in verifier.go.


Macroscope summarized f1bc7dd.

@mkysel mkysel requested a review from a team as a code owner October 3, 2025 15:12
@graphite-app
Copy link

graphite-app bot commented Oct 3, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • Queue - adds this PR to the back of the merge queue
  • Hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

// If the start sequence ID is 0, it is the first report and we should start from minute 0 since there are no preceding reports
var startMinute int32
if startEnvelope.OriginatorSequenceID() == 0 {
if startEnvelope == nil {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change 1) here

if err != nil {
return nil, nil, ErrMessageAtStartSequenceIDNotFound
}
var startEnvelope *envelopes.OriginatorEnvelope
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change 2) here

@mkysel
Copy link
Collaborator Author

mkysel commented Oct 3, 2025

All relevant changes are in the verifier.go file. Others are just test changes and test plumbing.

Copy link
Contributor

@neekolas neekolas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change makes sense. Thanks for fixing my dumb bug

@mkysel mkysel merged commit 18d9ea8 into main Oct 3, 2025
11 checks passed
@mkysel mkysel deleted the mkysel/off-by-1 branch October 3, 2025 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants