Skip to content

Commit

Permalink
safety check
Browse files Browse the repository at this point in the history
  • Loading branch information
rauljordan committed Sep 18, 2024
1 parent 2870567 commit 0c50978
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions state-commitments/optimized/inclusion_proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ func (h *HistoryCommitter) computeMerkleProof(leafIndex uint64, leaves []common.
if len(leaves) == 0 {
return nil, nil
}
ok, err := isPowTwo(virtual)
if err != nil {
return nil, err
}
if !ok {
return nil, errors.New("virtual size must be a power of 2")
}
if leafIndex >= uint64(len(leaves)) {
return nil, errors.New("leaf index out of bounds")
}
Expand Down

0 comments on commit 0c50978

Please sign in to comment.