privacy-scaling-explorations / zk-kit

A monorepo of reusable libraries for zero-knowledge technologies.
https://zkkit.pse.dev
MIT License
291 stars 79 forks source link

`binary-merkle-root.circom` verifies zero root for `depth > MAX_DEPTH` #211

Closed 0xbok closed 8 months ago

0xbok commented 8 months ago

For depth > MAX_DEPTH, root and isDepth below is calculated as 0. Thus, out = 0 will be always be verified successfully.

https://github.com/privacy-scaling-explorations/zk-kit/blob/0b5b5e4f1f828d3d93a09f166780ed30cc978cf7/packages/circuits/circom/binary-merkle-root.circom#L40-L42

Recommendation is to add a warning in comments for integrators.