Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Other Components

Besides the ALU, flow-control and memory chips, the core machine has the program table, two lookup tables, the chips for the remaining instructions, the syscall and precompile chips, and the 256-bit word chips. The recursion machine that verifies shard proofs is a separate machine with its own chips; it is described in Recursive STARK.

Program chip

A preprocessed table with one row per instruction of the program image. The preprocessed columns are pc and the decoded instruction (opcode, op_a, op_b, op_c, imm_b, imm_c, op_a_0), and the only main column is a multiplicity. Every instruction row sends (pc, instruction) on the Program bus and the program chip receives it with the multiplicity. The preprocessed commitment is part of the verifying key, so a prover can only execute instructions of the committed program at the addresses where they were loaded.

Lookup tables

  • ByteLookup is preprocessed over all pairs of bytes, \( 2^{16} \) rows. For each pair it lists the results of AND, OR, XOR, NOR, SLL, ShrCarry and LTU, the MSB of a byte, and the U8Range and U16Range checks, with one multiplicity column per operation. Lookups have the form (op, a, b, c).
  • RangeLookup is preprocessed with the pairs (a, bits) for \( a < 2^{bits} \) and \( bits \le 10 \). Its main use is the 10-bit high limb of 26-bit timestamps.

Other instruction chips

  • MovCond proves the conditional moves MOVZ and MOVN (opcodes MEQ and MNE) and the byte swap WSBH.
  • MiscInstrs proves INS, EXT, the sign extensions SEB and SEH (opcode SEXT), the multiply-accumulate instructions MADD, MADDU, MSUB and MSUBU, which read and write HI and LO, and the trap TEQ.
  • SyscallInstrs proves the syscall instruction. The syscall number and two arguments are the registers $v0, $a0 and $a1. The row:
    • sends the call on the Syscall bus when a precompile or a Linux syscall must prove it;
    • advances clk by the call's extra cycles;
    • writes the result to $v0;
    • handles COMMIT and COMMIT_DEFERRED_PROOFS by checking the committed word against the shard's public committed_value_digest or deferred_proofs_digest;
    • on HALT or exit_group, sets next_pc to 0 and requires the exit code to equal the public exit_code.

Syscalls and precompiles

  • SyscallCore and SyscallPrecompile connect execution shards to precompile shards. Precompile events are proved in separate shards, so a syscall made in an execution shard is sent as a global lookup by SyscallCore and received by SyscallPrecompile in the shard that proves it.

  • SysLinux proves the results of the supported Linux syscalls: mmap/mmap2, brk, clone, exit_group, fcntl, read and write, and returns fixed results for a known set of no-op syscalls; any other syscall number has no satisfying row.

  • The precompile chips each prove one operation over memory:

    • hashing: Sha256Extend and Sha256Compress (each with a control chip), KeccakSponge (with a control chip) and Poseidon2Permute;
    • elliptic curves: Ed25519Add, Ed25519Decompress, the add, double and decompress chips for secp256k1, secp256r1 and BLS12-381, and add and double for BN254;
    • field arithmetic: base-field Fp, Fp2Mul and Fp2AddSub for BN254 and BLS12-381;
    • big integers: Uint256Mul (multiplication modulo a 256-bit modulus) and U256x2048Mul.
  • The 256-bit word chips prove the U256_* syscalls, nineteen operations on 32-byte words in memory: U256Copy, U256Swap, U256RevCopy and U256Set (moves), U256AddSub, U256Bitwise (AND, OR, XOR, NOT), U256Compare (LT, GT, SLT, SGT, EQ, ISZERO), U256Shl and U256Shr (SHR, SAR). Unlike the precompiles they run in the shard that makes the call: each chip receives the call from SyscallInstrs, one row per call, and accesses the two word slots through the shard's own memory argument at \( clk + 1 \). Each slot pointer must be aligned and inside the address range, so that no word address wraps around the field.

    A precompile row receives the call from the Syscall bus with its (shard, clk), reads and writes memory at that timestamp through the memory argument, and range-checks every word it writes. The list of syscalls is in MIPS ISA, and the guest interface in Precompiles.

Global lookups

Every value that must travel between shards is a global lookup: the initial and final value of each memory address a shard touches (from MemoryLocal, MemoryGlobalInit, MemoryGlobalFinal and, for the program image, MemoryImage) and each syscall sent to a precompile shard (from SyscallCore and SyscallPrecompile). These chips are committed in the shard's global round, and their global lookups are proved under one challenge for the whole execution, drawn from a hash chain over every shard's global round. They are left out of the shard's proof: global proofs, made once every shard has committed its global round, output the sums of the global fractions, and the recursion checks that these sums add to zero. The construction is described in Memory Consistency Checking.