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

chore!: improve start/end row proof validation #1476

Draft
wants to merge 4 commits into
base: v0.34.x-celestia
Choose a base branch
from
Draft
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions types/row_proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ func (rp RowProof) Validate(root []byte) error {
if len(rp.Proofs) != len(rp.RowRoots) {
return fmt.Errorf("the number of proofs %d must equal the number of row roots %d", len(rp.Proofs), len(rp.RowRoots))
}
if len(rp.Proofs) != 0 &&
staheri14 marked this conversation as resolved.
Show resolved Hide resolved
(int64(rp.StartRow) != rp.Proofs[0].Index ||
int64(rp.StartRow) != rp.Proofs[len(rp.Proofs)-1].Index) {
return fmt.Errorf("invalid start/end row")
}
Copy link
Collaborator

@rootulp rootulp Sep 11, 2024

Choose a reason for hiding this comment

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

I'm a bit lost on why this conditional is an invalid start or end row. EndRow isn't used in the conditional so how can it be deemed invalid?

Can this PR please include a unit test?

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch

Copy link
Member Author

Choose a reason for hiding this comment

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

if !rp.VerifyProof(root) {
return errors.New("row proof failed to verify")
}
Expand Down
Loading