Skip to content

Fix std/recursion/plonk native and emulated examples #968

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

Merged
merged 2 commits into from
Jan 10, 2024

Conversation

wzmuda
Copy link
Contributor

@wzmuda wzmuda commented Dec 15, 2023

Description

While studying in-circuit verification with PLONK, I found the existing examples to be of great help. During my research, I discovered some flaws in them and decided to correct these issues for others who might evaluate the same feature in the future.

Fixes # (issue) Currently, there is no dedicated ticket reporting this problem. This PR is primarily a convenience change that does not alter the actual library code. Therefore, I did not think it was necessary to open a ticket. However, please let me know if doing so is required; I would be happy to create one and update this paragraph accordingly.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How has this been tested?

These examples are not actual Golang tests, but converting them for such use is straightforward. What I did was simply rename func Example_emulated() to func Example_emulated(t *testing.T) (and did the same for the other example). This change is sufficient to transform them into Golang-style test cases and run them accordingly.

One could also create a separate project and copy the code, which is a reasonable first step for anyone developing their own program with in-circuit PLONK verification.

How has this been benchmarked?

Since this is just an example, I did not perform any benchmarking.

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

No, but this does not seem relevant since the examples serve, to some extent, as tests themselves.

  • 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

No, but since I'm modifying only examples, this does not seem to be relevant.

To create a new SRS for outer circuit verification, use the outer constraint
system object rather than the inner one. Using the inner CS results in the
following error:
  panic: interface conversion: kzg.SRS is *kzg.SRS, not *kzg.SRS (types from different packages)

Signed-off-by: Wojciech Zmuda <[email protected]>
Set the right curves for the example to function correctly. Clean up the comments,
as they have got some leftovers from other examples they were based on.

Signed-off-by: Wojciech Zmuda <[email protected]>
@CLAassistant
Copy link

CLAassistant commented Dec 15, 2023

CLA assistant check
All committers have signed the CLA.

@ivokub
Copy link
Collaborator

ivokub commented Dec 21, 2023

Hi @wzmuda - thanks for the contribution. I have been busy before holidays to review but will definitely get to it next year. Sorry for the delay.

@ivokub ivokub self-requested a review January 10, 2024 23:15
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.

Perfect! Thanks for the contribution!

I wrote the buggy examples and it is good that they are really being read!

@ivokub ivokub merged commit 78301b3 into Consensys:master Jan 10, 2024
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.

3 participants