privacy-scaling-explorations / zkevm-circuits

https://privacy-scaling-explorations.github.io/zkevm-circuits/
Other
821 stars 841 forks source link

Move keccak circuit into its own package #1818

Closed ed255 closed 2 weeks ago

ed255 commented 1 month ago

Currently the keccak_circuit is implemented inside the zkevm-circuits package. It would be great to move it to it's own package so that it can be imported by other projects that want to prove keccaks using halo2 without the need to pull in all the dependencies of the zkevm-circuits package.

ed255 commented 2 weeks ago

After taking a look at this I found that this task required some refactoring work because the keccak circuit is using dependencies from other parts of the zkevm-circuits. In particular it's depending on parts that are unrelated to keccak (like all the EVM tables, or the general cell manager which has EVM specific dependencies), so to make keccak independent that needs to be addressed (it's not just moving the code around). So I started doing some of that but quickly remembered that Axiom was also using a fork of the same keccak circuit, but in their case this work of making the circuit independent has already been done https://github.com/axiom-crypto/halo2-lib/tree/community-edition/hashes/zkevm

So considering that Axiom already has a nice crate with the keccak hash circuit that can be imported and used by any halo2 developer, I think it's not worth it that we do the same because it's duplicated work. Moreover their crate is supposed to be compatible with their halo2 fork but also ours (via this feature https://github.com/axiom-crypto/halo2-lib/blob/18d7d6e713d7161e1f5aa15e8721e6160eb36776/hashes/zkevm/Cargo.toml#L44)

So I'm closing this issue and recommend halo2 users that need a keccak circuit to pick this one https://github.com/axiom-crypto/halo2-lib/tree/community-edition/hashes/zkevm/src/keccak