Skip to main content

Module shielded

Module shielded 

Source
Expand description

Builders for shielded bundles on the zcash_primitives transaction types.

Zebraโ€™s Transaction wraps zcash_primitives::transaction::Transaction, whose bundles are owned by the upstream crates and cannot be mutated in place. Tests therefore cannot reach in and edit shielded data the way they could when Transaction was an enum of Zebra-owned structs.

This module builds Orchard-shaped bundles (used by both the Orchard and Ironwood pools) directly from their constituent parts, so property tests and vector tests can exercise shielded code paths.

The bundles are structurally valid โ€” they carry real, canonically-encoded Pallas points and a proof of the canonical length, so they serialize, deserialize, and commit correctly โ€” but they are not consensus-valid: the proofs are zeroed and the signatures are arbitrary. They are for exercising parsing, indexing, and nullifier bookkeeping, not proof verification.

Constantsยง

ACTION_WIRE_SIZE
The size of one serialized Orchard action: cv, nullifier, rk, cmx and ephemeralKey (32 bytes each), then encCiphertext and outCiphertext.
NOTE_VECTOR_SEED ๐Ÿ”’
The seed used for fields the note-encryption vectors do not constrain.
V5_FIRST_ACTION_RK_OFFSET
The offset of the first Orchard actionโ€™s rk field, within a v5 transaction that has no transparent and no Sapling bundle.

Functionsยง

base_from_seed ๐Ÿ”’
Derives a canonically-encoded pallas::Base from a seed.
fake_action ๐Ÿ”’
Builds a structurally valid Orchard [Action] from a seed.
fake_bundle_for_branch
Builds a bundle for pool that is valid under branch_id, or None if the pool is not defined for that consensus branch (Ironwood before NU6.3).
fake_orchard_bundle
Builds a structurally valid Orchard-shaped bundle.
fake_orchard_bundle_duplicate_nullifiers
Builds an Orchard-shaped bundle whose actions all share a single nullifier.
fake_orchard_bundle_with_note
Builds a single-action Orchard-shaped bundle carrying caller-supplied note-encryption fields.
fake_v6_transaction
Builds a V6 transaction carrying the given Orchard and Ironwood bundles.
insert_fake_orchard_shielded_data
Returns a copy of tx carrying a dummy single-action Orchard bundle.
outputs_enabled_flags
Returns the flag set with outputs enabled that is representable under bundle_version.
scalar_from_seed ๐Ÿ”’
Derives a canonically-encoded pallas::Scalar from a seed.
v6_ironwood_flags_offset
The offset of the flagsOrchard byte of the Ironwood bundle, within a v6 transaction that has no transparent and no Sapling bundle, an empty Orchard bundle, and an Ironwood bundle with n_ironwood_actions actions.
v6_orchard_flags_offset
The offset of the flagsOrchard byte of the Orchard bundle, within a v6 transaction that has no transparent and no Sapling bundle, and whose Orchard bundle has n_actions actions.
verification_key_from_seed ๐Ÿ”’
Builds a non-identity RedPallas verification key from a seed.
with_garbage_orchard_authorization
Returns a copy of tx whose Orchard bundle keeps its effects but has garbage authorizing data: a corrupt proof, binding signature, and spend authorization signatures.
with_orchard_flags
Returns a copy of tx whose Orchard bundle carries flags.
with_orchard_value_balance
Returns a copy of tx whose Orchard bundle carries value_balance.