Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of a circuit that checks FRI proximity proofs #321

Merged
merged 20 commits into from
Jun 7, 2022

Conversation

ThomasPiellard
Copy link
Collaborator

  • Merkle proofs verification in circuit now use the binary decomposition of the leaf to know the order for hashing (instead of giving a sequence of "proof helpers" before)
  • The rollup example has been fixed accordingly, and also each input is constrained now
  • Addition of the fri verification circuit in std/commitments/fri/. The verification circuit checks radix-2 fri proximity proof as formatted in gnark-crypto. In particular, Fiat Shamir in gnark-crypto, when used with fri, has been modified so that the challenges seen as string outside a circuit and as frontend.Variable inside of the circuit match.

Copy link
Collaborator

@gbotrel gbotrel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to fix staticcheck errors + would have been nicer to have 3 separate PRs :-)

@@ -108,12 +104,28 @@ func (circuit *Circuit) postInit(api frontend.API) error {
circuit.Transfers[i].SenderPubKey = circuit.PublicKeysSender[i]
circuit.Transfers[i].ReceiverPubKey = circuit.PublicKeysReceiver[i]

// allocate the slices for the Merkle proofs
// circuit.allocateSlicesMerkleProofs()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this commented?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allocating the slices for the Merkle proof is only necessary when creating the full circuit and not for testing sub circuits

@@ -195,6 +213,7 @@ func TestCircuitUpdateAccount(t *testing.T) {
assert := test.NewAssert(t)

var updateAccountCircuit circuitUpdateAccount
(*Circuit)(&updateAccountCircuit).allocateSlicesMerkleProofs()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the cast?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type circuitUpdateAccount inherits the fields but not the methods of Circuit

@gbotrel
Copy link
Collaborator

gbotrel commented Jun 6, 2022

👍 just staticcheck linter to fix and is good to merge

@gbotrel gbotrel force-pushed the feat/fri_verifier_circuit branch from a8db486 to 92c57e6 Compare June 7, 2022 21:01
@gbotrel
Copy link
Collaborator

gbotrel commented Jun 7, 2022

@ThomasPiellard did a force push on that one, gnark-crypto update was done in another branch 👍

@gbotrel gbotrel merged commit 1e47608 into develop Jun 7, 2022
@gbotrel gbotrel deleted the feat/fri_verifier_circuit branch June 7, 2022 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants