Module shielded_common

Module shielded_common 

Source
Expand description

Common validation logic shared by shielded transitions (proof verification)

Constants§

FLAGS_OUTPUTS_ONLY
Orchard bundle flags byte: only outputs are real (spends are dummy). Used for shield and shield-from-asset-lock transitions where funds enter the pool.
FLAGS_SPENDS_AND_OUTPUTS
Orchard bundle flags byte: both spends and outputs are real. Used for shielded transfers, unshield, and shielded-withdrawal transitions.

Functions§

compute_platform_sighash
Computes the platform sighash from an Orchard bundle commitment and optional transparent field data.
read_pool_total_balance
Read the current shielded pool total balance from GroveDB. Returns 0 if the balance key doesn’t exist yet.
reconstruct_and_verify_bundle
Reconstructs an orchard Bundle<Authorized, i64, DashMemo> from the serialized fields of a shielded state transition and verifies the Halo 2 ZK proof along with all RedPallas signatures (spend auth + binding).
validate_anchor_exists
Verify that the anchor exists in the recorded anchors tree. Uses O(1) key lookup instead of scanning the entire tree. Returns a consensus error if the anchor is not found.
validate_minimum_pool_notes
Check minimum notes threshold for outgoing transitions (anonymity set).
validate_nullifiers
Defense-in-depth: reject duplicate nullifiers within the same bundle, then check that no nullifier has already been spent in state.
warmup_shielded_verifying_key
Pre-builds the shielded verifying key so that the first shielded transaction does not pay the ~5-15 s construction cost at check_tx time.