Skip to main content

Module frozen

Module frozen 

Source
Expand description

Frozen-set (compliance blacklist) Indexed Merkle Tree over BN254 Fr.

Mirrors PERC20 circuits/frozen_cmx_nonmember.circom and the prover’s poseidon_merkle_bn254 IMT helpers — the root produced here is the on-chain cmxFrozenRoot() / circuit rt_frozen and must match byte-for-byte.

Non-membership of cmx is proven by a single Merkle inclusion of a sorted “low-leaf” (val, next_val) that strictly brackets it (val < cmx < next_val, next_val == 0 being the +inf sentinel). The tree is kept as a sorted linked list: inserting v splices it after its predecessor (update the predecessor’s next, append the new leaf). Depth bounds the blacklist capacity (2^DEPTH), not the key space, so distinct cmx never collide regardless of depth.

Structs§

FrozenImt
Sorted Indexed Merkle Tree of frozen cmx values.
FrozenNonMembershipWitness
Non-membership witness for one cmx, matching FrozenCmxNonMember’s inputs.

Constants§

FROZEN_IMT_DEPTH
Indexed-MT depth = log2(capacity). Must equal circom FROZEN_IMT_DEPTH() and poseidon_merkle_bn254::FROZEN_IMT_DEPTH.
FROZEN_IMT_LEAF_DOMAIN
Leaf domain: leaf = Poseidon(LEAF_DOMAIN, val, next_val).
FROZEN_IMT_NODE_D0
Internal-node domain base: node at level i = Poseidon(NODE_D0 + i, left, right).

Functions§

fr_from_be_bytes
Big-endian 32 bytes (EVM uint256) → Fr. None if not a canonical field element.
fr_to_be_bytes
Fr → big-endian 32 bytes (EVM uint256 order; inverse of fr_from_be_bytes).
fr_to_le_bytes
Fr → little-endian 32 bytes (the indexer’s on-the-wire convention).
fr_to_le_hex
Fr0x-prefixed little-endian 32-byte hex (matches /merkle_path siblings).
frozen_imt_leaf
Low-leaf hash, matching FrozenCmxNonMember’s leaf gate.