Skip to main content

Module encoding

Module encoding 

Source
Expand description

The byte encoding of an instance and of a witness: the statement as a string, for a proof system in any language to read.

Both encodings are versioned, little-endian, and prefix-free, so an instance can also be absorbed into a transcript as it is. Every list is preceded by its u32 length and every wire is a u32 index. Values of the unit type T are written with their spongefish Encoding, and the header records their width so that a reader need not know T.

instance  "SFRI" u8:1 u32:width u32:unit_len u32:label_len label
          u32:vars_count
          u32:n_public  { u32:var  T:value }*
          u32:n_queries { u32:var*width (input) u32:var*width (output) }*
          u32:n_equations { u32:n_terms { u32:var T:weight }* T:image }*
witness   "SFRW" u8:1 u32:width u32:unit_len
          u32:n_steps { T*width (input) T*width (output) }*

Constantsยง

DIGEST_TAG
The tag PermutationInstance::digest derives its session identifier from.
INSTANCE_MAGIC
The four bytes every encoded instance starts with.
VERSION
The encoding version this crate writes and reads.
WITNESS_MAGIC
The four bytes every encoded witness starts with.