Skip to content

Commit 788d7f6

Browse files
committed
chore: improve start/end row proof validation
1 parent 2ffec2f commit 788d7f6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

types/row_proof.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ func (rp RowProof) Validate(root []byte) error {
3434
if len(rp.Proofs) != len(rp.RowRoots) {
3535
return fmt.Errorf("the number of proofs %d must equal the number of row roots %d", len(rp.Proofs), len(rp.RowRoots))
3636
}
37+
if len(rp.Proofs) != 0 &&
38+
(int64(rp.StartRow) != rp.Proofs[0].Index ||
39+
int64(rp.StartRow) != rp.Proofs[len(rp.Proofs)-1].Index) {
40+
return fmt.Errorf("invalid start/end row")
41+
}
3742
if !rp.VerifyProof(root) {
3843
return errors.New("row proof failed to verify")
3944
}

0 commit comments

Comments
 (0)