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/fflonk #498

Open
wants to merge 63 commits into
base: master
Choose a base branch
from
Open

Feat/fflonk #498

wants to merge 63 commits into from

Conversation

ThomasPiellard
Copy link
Contributor

Description

Implementation of shplonk
Implementation of fflonk (only the commitment)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How has this been tested?

Please describe the tests that you ran or implemented to verify your changes. Provide instructions so we can reproduce.

  • see fflonk_test.go
  • see shplonk_test_go

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

Copy link

📦 github.com/consensys/gnark-crypto/ecc/bls12-381/fflonk
TestGetIthRootOne 0s

    fflonk_test.go:140: 
        	Error Trace:	/home/runner/work/gnark-crypto/gnark-crypto/ecc/bls12-381/fflonk/fflonk_test.go:140
        	Error:      	An error is expected but got nil.
        	Test:       	TestGetIthRootOne

📦 github.com/consensys/gnark-crypto/ecc/bls24-315/fflonk
TestGetIthRootOne 0s

    fflonk_test.go:140: 
        	Error Trace:	/home/runner/work/gnark-crypto/gnark-crypto/ecc/bls24-315/fflonk/fflonk_test.go:140
        	Error:      	An error is expected but got nil.
        	Test:       	TestGetIthRootOne

📦 github.com/consensys/gnark-crypto/ecc/bw6-761/fflonk
TestGetIthRootOne 0s

    fflonk_test.go:140: 
        	Error Trace:	/home/runner/work/gnark-crypto/gnark-crypto/ecc/bw6-761/fflonk/fflonk_test.go:140
        	Error:      	An error is expected but got nil.
        	Test:       	TestGetIthRootOne

@ThomasPiellard ThomasPiellard marked this pull request as ready for review May 6, 2024 13:30
@ivokub ivokub self-requested a review September 3, 2024 22:53
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.

I think in general looks good. It was quite straightforward to follow shplonk part, but I'm not sure about fflonk. I think lets go through the paper and implementation together to make sense. The utility methods all look good though, it is only the BatchOpen and BatchVerify methods.

Some notes:

  • I think it would be better to use the polynomial package. It already has some methods implemented what we need and makes it imo relevant. Otherwise we copy-paste methods all over. And I think it also makes it nicer if we have []polynomial.Polynomial instead of [][]fr.Element etc.
  • I think we can also add Points struct as we disccussed in case in the future we want to have some information about the strcture of the points. This would allow to have some optimizations when doing poly-poly multiplication

A few todos on my side what I would like to add:

  • add package examples so that the users have an example to copy-paste the correct usage. The example tests are also in CI, which make it a good documentation source.
  • I'll also want to revisit package documentation a bit to make it better in the doc site (pkg.go.dev), e.g. inline links etc.

ecc/bls12-377/shplonk/shplonk_test.go Outdated Show resolved Hide resolved
ecc/bls12-377/shplonk/shplonk_test.go Show resolved Hide resolved
ecc/bls12-377/shplonk/shplonk_test.go Outdated Show resolved Hide resolved
ecc/bls12-377/shplonk/shplonk.go Show resolved Hide resolved
ecc/bls12-377/shplonk/shplonk.go Outdated Show resolved Hide resolved
ecc/bls12-377/fflonk/fflonk.go Show resolved Hide resolved
ecc/bls12-377/fflonk/fflonk.go Outdated Show resolved Hide resolved
ecc/bls12-377/fflonk/fflonk.go Outdated Show resolved Hide resolved
ecc/bls12-377/fflonk/fflonk.go Outdated Show resolved Hide resolved
ecc/bls12-377/fflonk/fflonk.go Show resolved Hide resolved
@ivokub
Copy link
Collaborator

ivokub commented Sep 18, 2024

@ThomasPiellard - I don't touch the branch currently - I'll add the documentation and examples after you have finished.

@ivokub
Copy link
Collaborator

ivokub commented Sep 19, 2024

As a note - we discussed with @ThomasPiellard about how to compute the n-ths roots of the input points. But in the field implementations we have, n is usually a power of two and we can do successive square roots.

@ivokub
Copy link
Collaborator

ivokub commented Sep 20, 2024

A few TODOs for another PR to improve the packages:

  • instead of using []fr.Element for points in shplonk, we could define a structure a la struct Points { Pts []fr.Element, Shape shplonk.PointShape}. Depending on the shape of the points (they are roots of unity, or some known powers etc.) we can have different approaches for polynomial multiplication etc.

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