Skip to content

Conversation

@lighterabc
Copy link
Contributor

@lighterabc lighterabc commented Feb 14, 2024

Description

This PR adds commitment verification to groth16 recursion AssertProof method. This implementation only supports at most one commitment.

TODO:

Type of change

  • New feature (non-breaking change which adds functionality)

How has this been tested?

  • Added test case TestBN254InBN254Commitment to test inner circuit with commitment

How has this been benchmarked?

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I did not modify files generated from templates
  • golangci-lint does not output errors locally
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@ivokub
Copy link
Collaborator

ivokub commented Feb 15, 2024

Thanks for the contribution! I started reviewing the PR, but it takes a bit time. I'm proposing some refactors related to this PR and some which I wanted to include as part of a cleanup of Groth16 verifier (simpler init of groth16 verifier instance for example).

I'll have a longer response with specific items/suggestions soon.

Copy link
Collaborator

@ivokub ivokub left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! I refactored to be more aligned with PLONK verifier and allow for independent Pedersen commitment verification.

Could you have a look that I hadn't missed something and the refactored version works for you. If you give a go-ahead, then I'll merge.

}

// WithProverChecks forces to run prover checks and disables solver checks.
func WithProverChecks() TestingOption {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd not add the test property. The command assert.CheckCircuit is usually meant for end-to-end testing in CI and its internal behaviour is toggled with build tags:

// default options;
// go test -short 					--> testEngineOnly
// go test 							--> constraintOnlyProfile
// go test -tags=prover_checks 		--> proverOnlyProfile
// go test -tags=release_checks 	--> releaseProfile

Now, if we define and use WithProverCheck option, then when running tests with -short tag or without any tags, we would still be running the prover (which may be really slow).

Better option for testing prover is to use tags=provers_checks tag like

go test -timeout 10m -tags debug,prover_checks -run ^TestBN254InBN254Commitment$ github.com/consensys/gnark/std/recursion/groth16 -v -count=1

@lighterabc
Copy link
Contributor Author

I run our tests with the refactored version. Everything seems fine. I left a comment about subgroupCheck, everything else LGTM. Thanks for the review and refactoring @ivokub

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