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

prover: use Keccak256 implementation form Gnark #61

Closed
wants to merge 3 commits into from

Conversation

wzmuda
Copy link
Contributor

@wzmuda wzmuda commented Mar 27, 2024

In keccak package add a wrapper converting []frontend.Variable to
[]uints.U8 expected by NewLegacykeccak256. Use the wrapper in insertion
and deletion circuits instead of our Keccak256 implementation.

Remove the existing Keccak implementation. Add tests of the new
implementation.

wzmuda and others added 2 commits March 28, 2024 23:32
Bump Gnark to v0.9.2-0.20240322153533-3abde1199375 and
gnark-lean-extractor to v3.0.0-20240328211639-501e57e18613.

This project was using very old Gnark revision. Bump to the master
branch from a few days ago. New Gnark is required for further Keccak
development.

Gnark-lean-extractor is a dependency that also uses Gnark.
Gnark-lean-extractor itself got a Gnark update which resulted in
breaking API changes. New API is now v3. Update all uses of this
project.

Updating gnark-lean-extractor requires update to proven-zk in formal
verification

Signed-off-by: Wojciech Zmuda <[email protected]>
@wzmuda wzmuda force-pushed the wz/gnark-keccak256 branch from 976c4ff to e98887b Compare March 29, 2024 00:21
In `keccak` package add a wrapper converting []frontend.Variable to
[]uints.U8 expected by NewLegacykeccak256. Use the wrapper in insertion
and deletion circuits instead of our Keccak256 implementation.

Remove the existing Keccak implementation. Add tests of the new
implementation.

Signed-off-by: Wojciech Zmuda <[email protected]>
@wzmuda wzmuda force-pushed the wz/gnark-keccak256 branch from e98887b to 64aeeeb Compare March 29, 2024 00:22
@wzmuda wzmuda marked this pull request as ready for review March 29, 2024 00:22
@wzmuda
Copy link
Contributor Author

wzmuda commented Mar 29, 2024

Updated according to our conversation:

  • old impl removed
  • tests refactored. You may notice now that the current Keccak256 is just regular Keccak256 with fancy input format. I.e. it returns well-known hashes for well-known inputs.

Also Keccak256 API has slightly changed since the draft. Previously it was defined as func Keccak256(api frontend.API, int inputSize, data ...frontend.Variable) (hash []frontend.Variable, err error) to keep compatibility with the old implementation. Since the old implementation is gone, I see no reason to keep that compatibility, given that accepting just api and slice of frontend.Variable is simpler and works the same. Let me know if the previous API made sense for some specific use case.

@wzmuda wzmuda closed this Jun 13, 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.

2 participants