Skip to content

Make workspace dependencies no-std compatible#3547

Draft
richardpringle wants to merge 3 commits intomasterfrom
no-std-kimchi-4
Draft

Make workspace dependencies no-std compatible#3547
richardpringle wants to merge 3 commits intomasterfrom
no-std-kimchi-4

Conversation

@richardpringle
Copy link
Copy Markdown
Collaborator

Set default-features = false for external dependencies (ark-ec, ark-ff, ark-poly, ark-serialize, ark-std, bcs, hex, itertools, num-bigint, num-integer, rand, serde, serde_with, sha2) and internal crates (o1-utils, poly-commitment, groupmap, mina-curves, mina-poseidon) at workspace level.

Each consumer crate now explicitly opts into the features it needs. Crates on the no-std path (kimchi, poly-commitment, groupmap, curves, poseidon) propagate parallel/std features through their own feature flags. Always-std crates add features directly on their dep lines.

Key changes:

  • poly-commitment/ipa.rs: cfg-gate prover-only SRS methods behind "std", add no-std lagrange_bases cache via Rc<RefCell>
  • kimchi/constraints.rs: cfg-gate LazyCache with preinit fallback for no-std
  • kimchi: re-export collections from poly-commitment instead of hashbrown
  • poseidon: add parallel feature, make rayon optional
  • groupmap/curves: add parallel feature flags
  • lookup/index.rs: replace itertools duplicates() with BTreeSet for no-std
  • Add kimchi/no-std-check/ standalone verification crate
  • Patch bcs to o1-labs fork for no-std support

@richardpringle richardpringle force-pushed the no-std-kimchi-4 branch 3 times, most recently from dff6fb5 to 79bec79 Compare March 24, 2026 17:50
@richardpringle richardpringle marked this pull request as draft March 24, 2026 17:50
Base automatically changed from no-std-kimchi-3 to master March 26, 2026 17:16
Set default-features = false for external dependencies (ark-ec, ark-ff,
ark-poly, ark-serialize, ark-std, bcs, hex, itertools, num-bigint,
num-integer, rand, serde, serde_with, sha2) and internal crates
(o1-utils, poly-commitment, groupmap, mina-curves, mina-poseidon) at
workspace level.

Each consumer crate now explicitly opts into the features it needs.
Crates on the no-std path (kimchi, poly-commitment, groupmap, curves,
poseidon) propagate parallel/std features through their own feature
flags. Always-std crates add features directly on their dep lines.

Key changes:
- poly-commitment/ipa.rs: cfg-gate prover-only SRS methods behind "std",
  add no-std lagrange_bases cache via Rc<RefCell<HashMap>>
- kimchi/constraints.rs: cfg-gate LazyCache with preinit fallback for no-std
- kimchi: re-export collections from poly-commitment instead of hashbrown
- poseidon: add parallel feature, make rayon optional
- groupmap/curves: add parallel feature flags
- lookup/index.rs: replace itertools duplicates() with BTreeSet for no-std
- Add kimchi/no-std-check/ standalone verification crate
- Patch bcs to o1-labs fork for no-std support
// lives as long as the SRS. The reference is valid as long as the entry exists.
let map = self.borrow();
let ptr = map.get(&key).unwrap() as *const Vec<PolyComm<G>>;
unsafe { &*ptr }
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is really ugly, but this is what's happening in the old code...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Actually, this is unsound. I'm going to try to fix the code I copied on master first


/// Turns a non-hiding polynomial commitment into a hiding polynomial
/// commitment. Transforms each given `<a, G>` into `(<a, G> + wH, w)` with
/// a random `w` per commitment.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Not sure why claude deletes these

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.

1 participant