Skip to main content

Module encoding

Module encoding 

Source

Functions§

certificate_bytes
Concatenate N₁ and N₂ into the complete N₃ certificate as bytes.
compute_q2
Compute Q₂: run the Q₂ governance on a KotResult. Returns P if the certificate is correctly certified, N if not.
fmt_bits
Format a u128 as a bit string, space-separated pairs.
fmt_hex
Format a u128 as a hex string with the exact number of bytes.
kot_result_to_expr
Encode a KotResult as an Expr in Magma.
pack_governance_sources
Pack all governance source words (concatenated) into a u128. Returns (packed_value, total_bits).
pack_walk
Pack all TraceGen words in a walk into one u128 (concatenated). Returns (packed_value, total_bits).
pack_word
Pack a Word of Trit-typed generators into a u128. Trit i occupies bits [2i+1 : 2i]. Same layout as Tern.
q2_governance
Build the Q₂ governance: checks that a KOT certificate word is all-P.
tracegen_to_word
Encode a TraceGen as a Word in Magma.
tracewalk_to_expr
Encode a TraceWalk as an Expr in the free algebra over Magma.
trit_expr_display
Display an Expr where each Word is shown as a Trit-word.
trit_word_display
Display a Word of Trit-typed generators as their Trit symbols. [P·P·P] not e1·e1·e1·e1. Reveals the Trit structure rather than the generator address.
word_to_tracegen
Decode a Trit-word back into a TraceGen. Returns None if the word is malformed (wrong separator structure).