Skip to content

Commit

Permalink
fix: guarantee that max prefix length is < min prefix length + child …
Browse files Browse the repository at this point in the history
…size
  • Loading branch information
crodriguezvega committed Sep 10, 2024
1 parent a72a6cb commit ac0743b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions go/ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ func (op *InnerOp) CheckAgainstSpec(spec *ProofSpec, b int) error {
return errors.New("spec.InnerSpec.ChildSize must be >= 1")
}

if spec.InnerSpec.MaxPrefixLength >= spec.InnerSpec.MinPrefixLength+spec.InnerSpec.ChildSize {
return errors.New("spec.InnerSpec.MaxPrefixLength must be < spec.InnerSpec.MinPrefixLength + spec.InnerSpec.ChildSize")
}

// ensures soundness, with suffix having to be of correct length
if len(op.Suffix)%int(spec.InnerSpec.ChildSize) != 0 {
return fmt.Errorf("InnerOp suffix malformed")
Expand Down

0 comments on commit ac0743b

Please sign in to comment.