Skip to content

deps(commitment-tree): migrate orchard to 0.14.0 (circuit soundness fix) - #758

Merged
QuantumExplorer merged 1 commit into
developfrom
claude/eager-shirley-f0d2e7
Jun 4, 2026
Merged

deps(commitment-tree): migrate orchard to 0.14.0 (circuit soundness fix)#758
QuantumExplorer merged 1 commit into
developfrom
claude/eager-shirley-f0d2e7

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Jun 4, 2026

Copy link
Copy Markdown
Member

Closes #756.

What

Pins orchard in grovedb-commitment-tree/Cargo.toml to the dashified-0.14.0 tag, replacing the previous 0.13.1-based rev pin:

-orchard = { git = "https://github.com/dashpay/orchard.git", rev = "898258d76aab2822249492aede59a02d49278fff", features = ["circuit"] }
+orchard = { git = "https://github.com/dashpay/orchard.git", tag = "dashified-0.14.0", features = ["circuit"] }

The tag dereferences to commit f0555739orchard 0.14.0 + the Dash MemoSize commits, pulling in halo2_gadgets 0.5.0. Cargo.lock is gitignored in this workspace, so this is the sole tracked change.

Why (security)

orchard < 0.14.0 / halo2_gadgets < 0.5.0 contain a disclosed soundness bug in the Orchard zero-knowledge circuit: variable-base scalar multiplication (ecc::chip::mul) never constrained the incomplete double-and-add loop's per-iteration base to the real base, so a prover could compute [a]·base + [b]·B' instead of [scalar]·base — potentially enabling double-spends within an Orchard pool. The fix changes the circuit and therefore requires a new verifying key.

0.14.0 also adds proof-size bounding for bundles from untrusted parts (GHSA-2x4w-pxqw-58v9) and an epk validity check in Action::from_parts.

This crate enables the circuit feature and uses builder::Builder, bundle::{Authorized, Flags, BatchValidator}, and circuit::{ProvingKey, VerifyingKey}, so it is directly exposed.

Why no code/API changes were needed

  • The 0.14.0 breaking changes — Action::from_partsResult, removal of Bundle::from_parts (→ try_from_parts + ProofSizeEnforcement), OrchardCircuitVersion threading — are not used directly anywhere in this crate or its benches.
  • The verification bench's Builder::new / build / create_proof / apply_signatures / BatchValidator signatures are unchanged. Builder::new and ProvingKey::build / VerifyingKey::build all default to the secure FixedPostNu6_2 circuit, so proofs are built and verified against the fixed VK automatically.
  • Nothing to regenerate: the crate commits no proving/verifying keys, VK fingerprints, or serialized proof/test vectors. The verification bench builds keys+proofs at runtime; the seeding bench uses random data.
  • MSRV: workspace toolchain is stable; orchard's 1.85.1 MSRV is satisfied.
  • No crate version bumpgrovedb-commitment-tree has never shipped to production.

Verification

  • cargo build -p grovedb-commitment-tree --all-features (lib + benches) ✓
  • cargo test -p grovedb-commitment-tree --all-features108 passed, 0 failed, 2 ignored ✓
  • cargo clippy -p grovedb-commitment-tree --all-features --all-targets → no warnings ✓
  • cargo fmt -p grovedb-commitment-tree -- --check → clean ✓
  • Final build + test-link re-resolved against the remote source git+https://github.com/dashpay/orchard.git?tag=dashified-0.14.0#f0555739

Coordination (follow-up, not in this PR)

dashpay/platform and dashpay/dash-evo-tool also depend on the dashpay/orchard fork — they should pin the same dashified-0.14.0 tag so versions stay consistent across the stack.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated core dependency to a specific version tag for improved compatibility and stability.

Pin `orchard` to the `dashified-0.14.0` tag (orchard 0.14.0 + Dash
`MemoSize` commits, commit f0555739), replacing the previous 0.13.1-based
`rev` pin. orchard 0.14.0 / halo2_gadgets 0.5.0 contain the disclosed
soundness fix for the Orchard zero-knowledge circuit (variable-base
scalar multiplication was unconstrained), plus proof-size bounding
(GHSA-2x4w-pxqw-58v9) and an `epk` validity check.

This crate enables the `circuit` feature and uses `builder::Builder`,
`bundle::{Authorized, Flags, BatchValidator}`, and
`circuit::{ProvingKey, VerifyingKey}`, so it is directly exposed.

No source/API changes were required: the 0.14.0 breaking changes
(`Action::from_parts` -> Result, removal of `Bundle::from_parts`,
`OrchardCircuitVersion` threading) are not used directly by this crate
or its benches. `Builder::new` and `ProvingKey/VerifyingKey::build`
default to the secure `FixedPostNu6_2` circuit, so proofs are built and
verified against the fixed VK automatically. The crate commits no keys,
VK fingerprints, or serialized proof vectors, so nothing needs
regeneration. No crate version bump (never shipped to production).

Verified: cargo build --all-features (lib + benches), cargo test
-p grovedb-commitment-tree --all-features (108 passed, 0 failed),
cargo clippy --all-features --all-targets (no warnings), cargo fmt
--check (clean).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Updated the orchard dependency in grovedb-commitment-tree/Cargo.toml from a pinned commit hash to the git tag dashified-0.14.0, enabling orchard 0.14.0 which includes critical circuit soundness and proof validation fixes.

Changes

Orchard 0.14.0 dependency update

Layer / File(s) Summary
Orchard dependency version pin
grovedb-commitment-tree/Cargo.toml
Orchard dependency reference changed from pinned commit hash to pinned git tag dashified-0.14.0, keeping the circuit feature enabled.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A tag replaces the old commit line,
Orchard 0.14 now shines so fine,
The circuits fixed, the proofs are sound,
Security gains all around! 🌳

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR addresses only the dependency update but omits critical required tasks: no code API changes, no verifying key regeneration, no crate version bump, and no coordination confirmation. Complete the remaining objectives from issue #756: regenerate verifying keys, adapt to API changes (Action::from_parts, Bundle::from_parts), bump crate version, update test vectors, and coordinate with downstream dependencies.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: migrating the orchard dependency to version 0.14.0 for a circuit soundness fix, which aligns with the changeset.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the orchard migration objective; no extraneous modifications detected outside the linked issue requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/eager-shirley-f0d2e7

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@grovedb-commitment-tree/Cargo.toml`:
- Line 20: Replace the mutable git tag pin for the orchard dependency with an
immutable commit SHA: in the Cargo.toml dependency entry for orchard (the line
currently using tag = "dashified-0.14.0"), change it to use rev =
"f05557390a5843bc4eb04c66d8140bc9ef0fe9b7" while keeping the same git URL and
features = ["circuit"] so the dependency is immutably pinned to that commit.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 99106356-fbbd-4887-a25b-0e836cdf2607

📥 Commits

Reviewing files that changed from the base of the PR and between a18f792 and be309ec.

📒 Files selected for processing (1)
  • grovedb-commitment-tree/Cargo.toml


[dependencies]
orchard = { git = "https://github.com/dashpay/orchard.git", rev = "898258d76aab2822249492aede59a02d49278fff", features = ["circuit"] }
orchard = { git = "https://github.com/dashpay/orchard.git", tag = "dashified-0.14.0", features = ["circuit"] }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Verify what commit the current remote tag points to (repeat over time to detect drift).
git ls-remote --tags https://github.com/dashpay/orchard.git 'refs/tags/dashified-0.14.0'
git ls-remote --tags https://github.com/dashpay/orchard.git 'refs/tags/dashified-0.14.0^{}'

# Optional: compare with expected commit from PR notes.
# Replace EXPECTED with the intended immutable commit (e.g., f0555739...).
EXPECTED="f0555739"
ACTUAL="$(git ls-remote --tags https://github.com/dashpay/orchard.git 'refs/tags/dashified-0.14.0^{}' | awk '{print $1}' | head -n1)"
echo "actual=$ACTUAL expected_prefix=$EXPECTED"
[[ "$ACTUAL" == "$EXPECTED"* ]] && echo "OK: tag currently matches expected commit" || echo "MISMATCH: tag target differs"

Repository: dashpay/grovedb

Length of output: 313


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Cargo.lock tracked?"
git ls-files | rg -n 'Cargo\.lock$' || true

echo "== grovedb-commitment-tree/Cargo.toml (lines 1-80)"
nl -ba grovedb-commitment-tree/Cargo.toml | sed -n '1,80p'

echo "== Orchard dependency lines (manifest)"
rg -n 'orchard\s*=.*(git|rev|tag)' grovedb-commitment-tree/Cargo.toml || true

echo "== Workspace Cargo.lock presence (if any)"
ls -la | rg -n 'Cargo\.lock$' || true
find . -maxdepth 3 -name 'Cargo.lock' -print

Repository: dashpay/grovedb

Length of output: 194


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Cargo.lock tracked?"
git ls-files | rg -n '(^|/)Cargo\.lock$' || true

echo "== grovedb-commitment-tree/Cargo.toml (lines 1-80)"
cat -n grovedb-commitment-tree/Cargo.toml | sed -n '1,80p'

echo "== Orchard dependency lines (manifest)"
rg -n 'orchard\s*=.*(git|rev|tag)' grovedb-commitment-tree/Cargo.toml || true

echo "== Cargo.lock files in repo (anywhere)"
find . -maxdepth 4 -name 'Cargo.lock' -print

Repository: dashpay/grovedb

Length of output: 2364


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== grovedb-commitment-tree/src/lib.rs (lines 60-130)"
cat -n grovedb-commitment-tree/src/lib.rs | sed -n '60,130p'

Repository: dashpay/grovedb

Length of output: 3649


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Resolve tag target (including peeled commit) and ensure it matches the intended immutable commit.
git ls-remote --tags https://github.com/dashpay/orchard.git 'refs/tags/dashified-0.14.0'
git ls-remote --tags https://github.com/dashpay/orchard.git 'refs/tags/dashified-0.14.0^{}'

EXPECTED="f0555739"
ACTUAL="$(git ls-remote --tags https://github.com/dashpay/orchard.git 'refs/tags/dashified-0.14.0^{}' | awk '{print $1}' | head -n1)"
[[ "$ACTUAL" == "$EXPECTED"* ]] && echo "OK: tag currently matches expected commit" || echo "MISMATCH: tag target differs"

Repository: dashpay/grovedb

Length of output: 240


🏁 Script executed:

#!/bin/bash
set -euo pipefail
EXPECTED="f05557390a5843bc4eb04c66d8140bc9ef0fe9b7"
ACTUAL="$(git ls-remote --tags https://github.com/dashpay/orchard.git 'refs/tags/dashified-0.14.0^{}' | awk '{print $1}' | head -n1)"
[[ "$ACTUAL" == "$EXPECTED" ]] || { echo "MISMATCH: $ACTUAL != $EXPECTED"; exit 1; }
echo "OK: tag target matches expected commit"

Repository: dashpay/grovedb

Length of output: 98


Pin Orchard with an immutable git rev instead of a (mutable) tag

grovedb-commitment-tree/Cargo.toml (line 20) uses tag = "dashified-0.14.0" for the security-critical orchard dependency whose bundle/circuit APIs are re-exported. This repo does not track any Cargo.lock, so builds rely on the tag’s current target; tags can be retargeted over time (even though dashified-0.14.0^{} currently resolves to f05557390a5843bc4eb04c66d8140bc9ef0fe9b7). Switching to rev = "f05557390a5843bc4eb04c66d8140bc9ef0fe9b7" restores immutable pinning.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@grovedb-commitment-tree/Cargo.toml` at line 20, Replace the mutable git tag
pin for the orchard dependency with an immutable commit SHA: in the Cargo.toml
dependency entry for orchard (the line currently using tag =
"dashified-0.14.0"), change it to use rev =
"f05557390a5843bc4eb04c66d8140bc9ef0fe9b7" while keeping the same git URL and
features = ["circuit"] so the dependency is immutably pinned to that commit.

@codecov

codecov Bot commented Jun 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.44%. Comparing base (a18f792) to head (be309ec).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #758   +/-   ##
========================================
  Coverage    91.44%   91.44%           
========================================
  Files          237      237           
  Lines        67298    67298           
========================================
  Hits         61540    61540           
  Misses        5758     5758           
Components Coverage Δ
grovedb-core 88.97% <ø> (ø)
merk 92.26% <ø> (ø)
storage 86.20% <ø> (ø)
commitment-tree 96.03% <ø> (ø)
mmr 96.79% <ø> (ø)
bulk-append-tree 89.82% <ø> (ø)
element 97.38% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@QuantumExplorer
QuantumExplorer merged commit caa0ec7 into develop Jun 4, 2026
10 of 11 checks passed
@QuantumExplorer
QuantumExplorer deleted the claude/eager-shirley-f0d2e7 branch June 4, 2026 06:02
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.

Migrate grovedb-commitment-tree to orchard 0.14.0 (critical Orchard circuit soundness fix)

1 participant