Repository navigation
Deprecate invertible MiMC gadget family for removal and update docs - #122
Conversation
|
[reviewer1] Changes requested on
|
|
Initial automated review · Aster Hi @satran004, thanks for the PR! 🙏 This is an automatic first check by an AI reviewer. It does not replace maintainer review and may be wrong. Reviewed commit: Issues found:
Not tested: Code and tests were read only; I did not run the build, tests, or migration examples. |
|
[reviewer3] Review of head What I verified
Blocking: the in-code migration targets point at the BN254 overloads The source Javadoc, which is what IDEs show in the deprecation tooltip, sends users to the no-params Poseidon overloads. Those use the back-compat
This contradicts the PR's own docs, which say "never use the no-params Poseidon overload … for Cardano". For a security-motivated deprecation, the migration target in the deprecation text should be right. Please point these at the explicit-params overloads:
Each should be used with Non-blocking (P3)
|
…note, and fixture labels
|
Addressed all review items in commit
Verification (
|
|
[reviewer1] Approved on I built the circuit-library Javadocs and reran the deprecation-annotation check, parameterized Poseidon tests, and both circuit-example suites on this SHA. All 36 selected tests passed with zero skips. |
|
[reviewer3] Re-review of head The blocking item and all P3s from my review of
No further findings. |
Summary
@Deprecated(forRemoval = true)):MiMC,SignalMiMC,MiMCSponge,ZkMiMC, andZkMerkle.HashType.MIMC.MiMC.hash(api, left, right)computes a 91-round keyed bijectionE_right(left)((state + rc_i + key)^7, returningstate + key) without Miyaguchi–Preneel / Davies–Meyer feed-forward. Becausegcd(7, r - 1) = 1on BN254, anyone can invert all 91 rounds for any target output and chosenrightin milliseconds to forge preimages, collisions, and Merkle membership proofs.MiMC.roundConstantuses SHA-256 ("mimc_round_" + round), not Keccak-256, and neitherMiMCnorMiMCSpongeis circomlib-compatible.README.md,zeroj-circuit-lib/README.md,zeroj-circuit-annotation-api/README.md,docs/guides,docs/adr/circuit-annotation/cardano-gadget-support-matrix.md,www/scripts/circuit-catalog.mjs, andwww/src/content/docs/...pages (gadgets.md,annotations.md,circuit-dsl.md,api-cheatsheet.md,private-allowlist.mdx,ai/starter-pack.md).docs/getting-started.mdanddocs/pure-java-prover-guide.mdentries whereSealedBidandAnonymousVotingalready use BLS12-381 Poseidon.MiMCDeprecationAndInvertibilityTestasserting@Deprecated(forRemoval = true)on all five public symbols and demonstrating exact 91-round R1CS preimage inversion and collision forgery.@SuppressWarnings("removal")and fixedNewStdlibTestJavadoc.Verification
./gradlew :zeroj-circuit-lib:check :zeroj-circuit-annotation-processor:test :zeroj-integration-tests:compileTestJava --stacktrace— PASSED./gradlew :zeroj-circuit-lib:test --tests 'org.zeroj.circuit.lib.MiMCDeprecationAndInvertibilityTest' :zeroj-integration-tests:test --tests '*AnnotatedCircuitExamplesTest' --tests '*ParameterizedCircuitE2ETest' --stacktrace— PASSEDnode -e "import('./www/scripts/circuit-catalog.mjs').then(m => m.buildCatalog())..."— PASSED (catalog extractsZkMiMCwith deprecation warning and note)