Skip to content

Commit

Permalink
unused input removed
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmenendez committed Nov 7, 2024
1 parent 0317c96 commit 61b7a65
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
7 changes: 1 addition & 6 deletions arbo/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,7 @@ func isValid(api frontend.API, sibling, prevSibling, leaf, prevLeaf frontend.Var

// CheckProof receives the parameters of a proof of Arbo to recalculate the
// root with them and compare it with the provided one, verifiying the proof.
func CheckProof(api frontend.API, key, value, root, nsiblings frontend.Variable, siblings []frontend.Variable) error {
// ensure that the number of valid siblings are less or equal to the number
// of provided siblings
api.AssertIsLessOrEqual(nsiblings, len(siblings))
// get a map with the valid siblings
// valid := validSiblings(api, siblings, nsiblings)
func CheckProof(api frontend.API, key, value, root frontend.Variable, siblings []frontend.Variable) error {
// calculate the path from the provided key to decide which leaf is the
// correct one in every level of the tree
path := api.ToBinary(key, api.Compiler().FieldBitLen())
Expand Down
4 changes: 1 addition & 3 deletions arbo/verifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ type testVerifierCircuit struct {
Root frontend.Variable
Key frontend.Variable
Value frontend.Variable
NSiblings frontend.Variable
Siblings [160]frontend.Variable
}

func (circuit *testVerifierCircuit) Define(api frontend.API) error {
return CheckProof(api, circuit.Key, circuit.Value, circuit.Root, circuit.NSiblings, circuit.Siblings[:])
return CheckProof(api, circuit.Key, circuit.Value, circuit.Root, circuit.Siblings[:])
}

func successInputs(t *testing.T, n int) testVerifierCircuit {
Expand Down Expand Up @@ -79,7 +78,6 @@ func successInputs(t *testing.T, n int) testVerifierCircuit {
Key: arbo.BytesLEToBigInt(key),
Value: value,
Siblings: siblings,
NSiblings: new(big.Int).SetInt64(int64(len(uSiblings))),
}
}

Expand Down

0 comments on commit 61b7a65

Please sign in to comment.