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

feat: allow configurable hash-to-field function for Groth16 Solidity verifier #1102

Merged
merged 7 commits into from
Sep 5, 2024

Conversation

ivokub
Copy link
Collaborator

@ivokub ivokub commented Apr 18, 2024

Description

To allow different compatibility, it is beneficial to support different hash-to-field functions to hash the commitments to field in Solidity contract. This PR extends the ExportSolidity method to take in options which allow changing the functions. Later, we could possibly use the extendability to also change the HTF function for PLONK Solidity verifier, but keeping unchanged for now.

Also added TargetSolidity options for the prover and verifier which chooses all the parameters optimally for Solidity verifier. For PLONK prover it is currently no-op, but this allows more simply to change the hash functions we use within (with corresponding little gas savings).

Ref #1094

Type of change

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

How has this been tested?

In package backend/solidity:

  • TestNoCommitment
  • TestSingleCommitment
  • TestTwoCommitments

And the subtests

How has this been benchmarked?

Not benchmarked, only changes Solidity verifier

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 ivokub self-assigned this Apr 18, 2024
@ivokub ivokub added consolidate strengthen an existing feature P3: Low Issue priority: low labels Apr 18, 2024
@ivokub ivokub force-pushed the feat/solidity-groth16-hashfn branch from 8f46a87 to d263ef2 Compare September 5, 2024 11:19
@ivokub ivokub marked this pull request as ready for review September 5, 2024 11:23
@ivokub ivokub force-pushed the feat/solidity-groth16-hashfn branch from d263ef2 to a314982 Compare September 5, 2024 11:23
@ivokub ivokub merged commit d651b89 into master Sep 5, 2024
6 checks passed
@ivokub ivokub deleted the feat/solidity-groth16-hashfn branch September 5, 2024 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consolidate strengthen an existing feature P3: Low Issue priority: low
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants