Expand description
Descriptor → AlignedValue helpers.
The IR’s descriptors table assigns numeric IDs to every type that
appears at a runtime boundary. Encoding a JSON literal into an
AlignedValue (Compact’s wire-format atom) requires knowing the
target descriptor: a Uint<16> literal of 5 is one byte sequence;
a Uint<64> literal of 5 is a different one. This module is the
mapping from descriptor + JSON value to AlignedValue.
Structs§
- Circuit
Input Plan - Pre-compiled encoder for a circuit’s full argument tuple (
encode_input). - FabPlan
- Pre-compiled FAB
AlignedValueencoder for aTypeDescriptor.
Functions§
- decode_
aligned_ value - Decode an
AlignedValueto a JSON value typed bydescriptor— the inverse ofencode_literal. Used both to decode circuit arguments back into JSON-shaped local bindings and to surface popeq read results (Cell.read, Map.lookup, etc.) inside the interpreter. - decode_
aligned_ value_ full - Convenience wrapper: decode a complete
AlignedValueagainst a descriptor and verify exact atom count. - encode_
bool - Encode a boolean literal.
- encode_
bytes - Encode a fixed-length Bytes literal. Accepts hex-encoded strings.
- encode_
default - Produce the wire-format zero
AlignedValuefor any descriptor — the value{vm: null, type: ...}carries in IR pushdowns. Recurses through compound types so a defaultEitheris(false, default ZswapCoinPublicKey, default ContractAddress), etc. - encode_
field - Encode a
Fieldliteral as anAlignedValuewithAlignmentAtom::Field(matches the upstreamAligned for Frimpl intransient-crypto/src/curve.rs:291). - encode_
literal - Convert a JSON literal to an
AlignedValuetyped bydescriptor. - encode_
uint - Encode a Uint literal sized by its
maxval. Picks the alignment width matching the JS backend’s_descriptor_N-emit convention:≤ u8::MAX→ 1 byte,≤ u16::MAX→ 2 bytes,≤ u32::MAX→ 4 bytes,≤ u64::MAX→ 8 bytes, otherwise 16 bytes. - json_
as_ u128 - Decode a JSON value as
u128. Accepts unsigned numbers and decimal strings (matching the IR’s big-int convention).