Repository navigation
v12 issues - #74
v12 issues#74
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 14e50f4. Configure here.
Summary verdictThe PR is mostly a clean simplification — pruning the The biggest soundness concern is the newly introduced 1.
|
| # | Severity | Status | Notes |
|---|---|---|---|
| 1 | High | Already fixed in 0fb53cb |
hash_compact was pub(crate) while imported in benches/poseidon_benchmarks.rs and bin/ct_bench.rs. The dedupe commit removed those imports — bench now uses hash_bytes, ct_bench uses * glob (which won't pick up pub(crate) items). I confirmed cargo build --all-features --all-targets passes. |
| 2 | Low | Still real | generate_test_vectors still prints tuples with both compact and bytes hashes ("\t({}, \"{}\", \"{}\"),"), but test_known_value_hashes now consumes (Vec<u8>, &str). The generator can't be copy-pasted into the consumer test without manual re-formatting. Trivial fix: drop the compact_hash column from the printer (or re-add a fixed-size compact KAT row, see (1) above). |
| 3 | Low | Already fixed in 0fb53cb |
The redundant _hash_padded/_hash_variable are gone; the integrated CT test now exercises hash_bytes → rehash_to_bytes → hash_squeeze_twice, which is actually better (chains two distinct paths). |
6. Other minor things I'd suggest
- The KAT comment block now reads
/// hash_bytes uses injective encoding (4 bytes/felt with terminator).— good. Keep that comment, and add a parallel one near thehash_pubkeydefinition pointing to its KAT once added. core/Cargo.tomldropsrand_chacha(good, consistent withposeidon2_from_seedremoval). I'd also confirm the README incore/no longer referenceshash_for_circuit/PoseidonCore::hash_for_circuit— line 19 incore/README.mdstill does (per earlier grep). Update or it'll become a stale-doc trap.- CT-bench coverage: deleting all the constant-time tests for the compact / padded path is fine since those code paths are gone, but the new
hash_pubkeyshould arguably grow its own CT test (singleClass::Left = [0u8; 2592]vsClass::Right = random 2592 bytes) — it's the most security-sensitive of the new public functions and runs on every account creation. clippy.shmirrors CI, harmless and useful. Fine.
7. Pre-merge checklist for soundness
If I were merging this, I'd want:
-
hash_pubkeyeither gets used in the same release or its "recommended" doc wording is softened. - Add a
[u8; 2592]→ 32-byte KAT forhash_pubkey. - Confirm chain PR #571 lands together (the substrate crate removal hard-breaks chain
main). - Fix bot comment Refactored #2 (generator/consumer schema mismatch) — one-line fix.
- Update
core/README.mdto stop advertisinghash_for_circuit.
Everything else looks clean. The mathematical/cryptographic core (Poseidon2State, sponge absorption, padding, double-hash, squeeze-twice) is byte-identical to main — I diffed it and the new hash_twice / rehash_to_bytes KAT vectors are sufficient to prove that.
Happy to draft the hash_pubkey KAT addition or the README/generator fix as a follow-up commit if you'd like.
|
it looks like nobody is using hash_pubkey - maybe we can remove it? |
Re-review of PR #74New commit since last round: What changedThe author took my biggest soundness concern head-on and removed it. Removed:
Rewired:
Soundness verdictThis is exactly the right call. All of the soundness asks I flagged last round are gone, because the API surface that introduced them is gone:
Crucially, This is the correct shape: compact encoding stays as a low-level building block that callers compose explicitly (with full responsibility for fixed-length and prime-range assumptions), and no high-level wrapper hides those assumptions behind a misleading name. Quick sanity checkI ran on the new head (
The core hash primitives ( Remaining nits (non-blocking)
The next function under it is
Bottom lineFrom a hash-function soundness standpoint, this round is clean. The previous footgun is removed, the public API is now exactly what the chain actually uses, and the test surface includes KAT vectors for every public hashing primitive. I'd merge it once:
No other open issues. |
…rk/qp-poseidon into illuzen/v12-issues

Note
High Risk
Removing
hash_for_circuit,PoseidonHasher, and theqp-poseidoncrate is a breaking change for any consumer still on Substrate or fixed-size padded hashes; release workflow changes affect how versions are bumped and what gets published.Overview
This PR narrows the repo to
qp-poseidon-coreonly and drops the Substrate-facingqp-poseidoncrate (substrate/sources and workspace membership). Release automation now locks and updates onlyqp-poseidon-coreinCargo.lock, and publishes just that crate to crates.io (no wait/publish step forqp-poseidon).The core public API is simplified around injective
hash_bytes/ field-element hashing: circuit-padded helpers (hash_for_circuit,hash_felts_for_circuit,pad_and_hash,poseidon2_from_seed) and proof-node sizing constants are removed. Tests, benchmarks, and constant-time benches are updated accordingly; KAT vectors now coverhash_bytesonly, with added stability tests forhash_twiceandrehash_to_bytes.Cargo.lockshrinks sharply after shedding Substrate/sp-*dependencies.Docs and tooling reflect the slimmer surface: root and
coreREADMEs describe the core crate only, andclippy.shruns workspace clippy like CI.Reviewed by Cursor Bugbot for commit 88607de. Bugbot is set up for automated code reviews on this repo. Configure here.