//! The pool (rule set 2) โ formats frozen at genesis, `specs/chain.md` ยง11.
//!
//! The pool is off at launch: rule set 1 rejects every pool transaction
//! (kinds 4 and 5 are unknown to its decoder). What genesis freezes is the
//! material and the formats โ the record, its commitment, rho and
//! nullifier, the commitment tree, the anchor window, the turnstile, the
//! `SPEND` public-input encoding, the block-proof statement and the domain
//! tags โ so that switching the pool on adds verifying keys and nothing
//! else. The genesis `p` frame carries a [`Pool`] record whose tags digest
//! is computed here; the chain id therefore commits to every constant below.
//!
//! Every consensus-critical digest of the pool is wide: 64 bytes, two
//! squeezes of hemera's own sponge ([`wide`], `Hasher::finalize_xof`); a
//! tree node is the wide digest of its tagged children ([`node`]). Only the
//! hemera API is used โ no permutation constant, flag or capacity slot is
//! pinned here. The 32-byte particle stays a locator (token, data, link
//! endpoints, chain id).
//! Integers only, little-endian; every 32- and 64-byte field is a sequence
//! of 8-byte limbs, each `< p`, checked by every decoder.
use io;
use P;
use crate;
pub use ;
pub use ;
pub use ;
/// A wide digest: eight canonical Goldilocks limbs, little-endian.
pub type Wide = ;
/// Pool format version written into the genesis `p` frame.
pub const FORMAT: u32 = 1;
/// Bytes of a wide digest (chain.md ยง11.1).
pub const WIDE_BYTES: usize = 64;
/// Limbs of a wide digest.
pub const WIDE_LIMBS: usize = 8;
/// Commitment-tree depth: 2^40 positions.
pub const DEPTH: u8 = 40;
/// A spend in block `h` may name the tree root after any block `b` with
/// `h โ ANCHOR_WINDOW โค b โค h โ 1`.
pub const ANCHOR_WINDOW: u32 = 1_000;
/// Inputs (nullifiers) per spend: at least one, at most four.
pub const MAX_INPUTS: usize = 4;
/// Outputs (commitments) per spend.
pub const MAX_OUTPUTS: usize = 4;
/// Cyberlink outputs per spend.
pub const MAX_LINKS: usize = 4;
/// Bytes of one opaque note.
pub const MAX_NOTE_BYTES: usize = 2_048;
/// `token 32 โ value 8 โ owner 64 โ rho 64 โ r 32 โ data 32 โ predicate 64`.
pub const RECORD_BYTES: usize = 296;
/// Encoded [`Pool`] record at the end of the genesis `p` frame.
pub const POOL_BYTES: usize = 74;
/// Transaction kinds reserved for the pool (unknown to rule set 1).
pub const KIND_DEPOSIT: u8 = 4;
pub const KIND_SPEND: u8 = 5;
/// Deposit body: `from 32 โ nonce 8 โ token 32 โ value 8 โ owner 64 โ r 32 โ data 32 โ predicate 64 โ fee 8`
/// (the record without `rho`, which the chain derives).
pub const DEPOSIT_BODY_BYTES: usize = 32 + 8 + RECORD_BYTES - WIDE_BYTES + 8;
/// Deposit total: envelope 2 + body + NSIG1 102.
pub const DEPOSIT_BYTES: usize = 2 + DEPOSIT_BODY_BYTES + 102;
/// Bytes of one cyberlink output: `p 32 โ q 32 โ weight 8 โ payout 64`.
pub const LINK_BYTES: usize = 136;
/// Bytes of a withdrawal: `to 32 โ token 32 โ amount 8`.
pub const WITHDRAWAL_BYTES: usize = 72;
/// The longest canonical `SPEND` public-input encoding.
pub const MAX_SPEND_BYTES: usize = 32
+ WIDE_BYTES
+ 1
+ WIDE_BYTES * MAX_INPUTS
+ 1
+ WIDE_BYTES * MAX_OUTPUTS
+ 1
+ LINK_BYTES * MAX_LINKS
+ 1
+ WITHDRAWAL_BYTES
+ 32
+ 8
+ WIDE_BYTES *
+ 1
+ MAX_OUTPUTS * ;
/// Spend total: envelope 2 + `len: u16` + public inputs (no signature).
pub const MAX_SPEND_TX_BYTES: usize = 2 + 2 + MAX_SPEND_BYTES;
// Domain tags โ chosen once, documented in chain.md ยง11.9, never reused.
pub const D_OWNER: & = b"soft3/pool/owner/v1\0";
pub const D_CM: & = b"soft3/pool/cm/v1\0";
pub const D_NULL: & = b"soft3/pool/nullifier/v1\0";
pub const D_RHO: & = b"soft3/pool/rho/v1\0";
pub const D_PRED: & = b"soft3/pool/predicate/v1\0";
pub const D_EMPTY: & = b"soft3/pool/empty/v1\0";
pub const D_NODE: & = b"soft3/pool/node/v1\0";
pub const D_SPEND: & = b"soft3/pool/spend/v1\0";
pub const D_BLOCK: & = b"soft3/pool/block/v1\0";
pub const D_TURNSTILE: & = b"soft3/pool/turnstile/v1\0";
pub const D_VK: & = b"soft3/pool/vk/v1\0";
pub const D_TAGS: & = b"soft3/pool/tags/v1\0";
/// The tags in digest order.
pub const TAGS: = ;
pub
/// Every 8-byte little-endian limb of `b` is `< p` (a canonical element).
pub
/// `W(x)`: the first 64 bytes of hemera's extendable output over `x` โ the
/// plain sponge absorbs `x` exactly as `hemera(x)` does, then two squeezes
/// of four elements each (`Hasher::finalize_xof`). `W(x)[..32] = hemera(x)`;
/// separation from every other hemera input is the pool tag `x` begins with.
/// [`wide`] in constant time, for inputs that carry `sk` (same digest).
/// `W(tag โ partsโฆ)`.
pub
/// A tree node (chain.md ยง11.4): `W(D_NODE โ left โ right)`, 147 bytes in.
/// Cost (hemera 0.4, same sponge as 0.3): three absorbing permutations (56-byte rate blocks,
/// the last carrying the padding) and one more for the second squeeze โ
/// four, against one for the narrow node jet over 32-byte children.
/// `W(D_TAGS โ D_OWNER โ D_CM โ D_NULL โ D_RHO โ D_PRED โ D_EMPTY โ D_NODE โ D_SPEND โ D_BLOCK โ D_TURNSTILE โ D_VK)`,
/// each tag with its NUL terminator.
/// The leaf of every unfilled tree position: `W(D_EMPTY)`.
/// `E_0 = EMPTY`, `E_i = node(E_{iโ1}, E_{iโ1})`: the roots of
/// the empty subtrees of every height, `E_DEPTH` the root of the empty tree.
/// The anchor of a chain with no commitments (block 0): `E_DEPTH`.
/// Root of the depth-`DEPTH` tree holding `leaves` at positions
/// `0..leaves.len()` (append order) and `EMPTY` everywhere else.
/// Recompute a root from a leaf at `position` and its 40 siblings, leaf to
/// root (bit `i` of `position` set: the sibling at level `i` is on the left).
/// `owner = W(D_OWNER โ sk)`.
/// `nullifier = W(D_NULL โ chain โ sk โ rho)`.
/// `rho_j = W(D_RHO โ nf_0 โ j: u8)`: the rho of output `j` of a spend whose
/// first nullifier is `nf_0` (derived inside the proof).
/// `rho = W(D_RHO โ txid โ 0: u8)`: the rho of a deposited record, derived
/// by every node from the deposit's transaction id (32-byte seed, so it never
/// meets a spend's 64-byte seed).
/// `predicate = W(D_PRED โ program)` over a nox program's canonical bytes.
/// The turnstile of `token`: `T(token) = hemera(D_TURNSTILE โ token)`, a
/// 32-byte raw key of bbg's balances dimension (a key of the transparent
/// ledger, sized like every balance key). Its input is 56 bytes; every
/// transparent balance key `hemera(owner โ token)` hashes 64, so no
/// transfer, coinbase, claim or genesis frame can reach it. Absent (zero)
/// at genesis.
/// `W(D_VK โ (len: u32 โ vk) โฆ)` over a rule set's verifying keys in the
/// order its activation entry lists them.
Homonyms
cyb/evy/forks/naga/src/back/hlsl/mod.rs
struct Baz { m: mat3x2, } struct Baz { float2 m_0; float2 m_1; float2 m_2; }; float3x2 GetMatmOnBaz(Baz obj) { return float3x2(obj.m_0, obj.m_1, obj.m_2); }