Skip to content

Commit

Permalink
add better panic docs
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-forbes committed Apr 30, 2021
1 parent 422c573 commit 6b7cb81
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion p2p/ipld/nmt_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ipld
import (
"bytes"
"crypto/sha256"
"fmt"

"github.com/lazyledger/nmt"
"github.com/lazyledger/nmt/namespace"
Expand Down Expand Up @@ -57,7 +58,7 @@ func (w *ErasuredNamespacedMerkleTree) Push(data []byte, idx rsmt2d.SquareIndex)
nsID := make(namespace.ID, types.NamespaceSize)

if idx.Axis+1 > 2*uint(w.squareSize) || idx.Cell+1 > 2*uint(w.squareSize) {
panic("pushed past predetermined square size")
panic(fmt.Sprintf("pushed past predetermined square size: boundary at %d index at %+v", 2*w.squareSize, idx))
}

// use the parity namespace if the cell is not in Q0 of the extended
Expand Down

0 comments on commit 6b7cb81

Please sign in to comment.