Skip to main content

encode_field

Function encode_field 

Source
pub fn encode_field(value: &RuntimeValue) -> Result<AlignedValue>
Expand description

Encode a Field literal as an AlignedValue with AlignmentAtom::Field (matches the upstream Aligned for Fr impl in transient-crypto/src/curve.rs:291).

JSON representation for Field is a hex-encoded little-endian byte string of the underlying Fr (32 bytes for BLS12-381’s scalar field). This matches what Expression::CastFromBytes produces: the input bytes are read little-endian (per compact-runtime/dist/casts.js::convertBytesToField), zero-padded to 32 bytes, and the result is the same hex string.