Skip to content

refactor(PR 12): add SecretFr to zerokit, standardize type naming in Wasm and FFI#422

Closed
vinhtc27 wants to merge 10 commits into
masterfrom
refactor/pr12-todo
Closed

refactor(PR 12): add SecretFr to zerokit, standardize type naming in Wasm and FFI#422
vinhtc27 wants to merge 10 commits into
masterfrom
refactor/pr12-todo

Conversation

@vinhtc27

@vinhtc27 vinhtc27 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

No description provided.

vinhtc27 and others added 10 commits June 19, 2026 19:03
…d and pmtree utilities, migrate to pmtree v3, fix override_range bug, generic PmTree<D,H> struct for any persistent backend (#421)

## This PR need the this new release of pmtree
vacp2p/pmtree#6
## Changes: All the changes related to merkle tree impl in Zerokit
- Moved the sled-backed PmTree into rln module, utils module is now
apure, storage-agnostic Merkle-tree crate with no sled/pmtree
dependency.
- Make PmTree generic over the pmtree Database backend via a
PmTreeBackendConfig trait (Sled impl by default). Allow any custom impl
for persistent layer (RocksDB, PostgreSQL,...) with minimal impl via
Database trait.
- ZerokitMerkleTree now has an associated `Error` type. The in-memory
backends keep ZerokitMerkleTreeError, de-overloaded to one variant per
condition; PmTree returns a structured PmTreeError that separates
tree-logic errors (MerkleTree) from storage-backend faults (Backend),
and pre-validates domain conditions so the same misuse yields the same
variant on every backend. Callers match flat variants instead of nested
enums ([#343](#343)).
- Adopted pmtree 3.0.0: PmTree writes
(set/delete/update_next/override_range) are now crash-atomic
([PR](vacp2p/pmtree#6)).
~- PmTree is now generic over the hash (PmTree\<H\> instead of a
hardcoded PoseidonHash), so a future PoseidonHash2 can plug in.~
(Generic over both persistent backend anh hash (PmTree\<D, H\>)
- Fixed override_range: replaced the per-tree span logic and its
separate pre-validation pass (validate_override_range_inputs /
EmptyIndicesPolicy in override_range_validation.rs, now deleted) with
one shared default trait method — write the new leaves from start, reset
only the delete-indices the write doesn't already cover (writes win on
overlap), validate everything before touching the tree.
- Fixed a bug where leaves landed at the wrong indices. Full/Optimal use
the default; PmTree overrides it to apply the whole change in a single
atomic commit.
- Tests: value + cache + validation coverage for override_range across
all three merkle tree.
- Add TODO marked the RLN-math sites still calling Poseidon directly
(id-commitment, nullifier, root recompute) for a later generic hash
trait.
- Fixed silence delete opt in Full/OptimalMerkleTree.
…cretFr opaque type, standardize wasm type naming
…etFr opaque type, standardize FFI type naming
@vinhtc27 vinhtc27 closed this Jul 5, 2026
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