announcing Triton VM v0.36.0

⚓ Neptune    📅 2023-12-22    👤 jfs    👁️ 1170      

jfs

Warning

This post was published 334 days ago. The infomation described in this article may have changed.

Triton VM v0.36.0 is now live. The main highlights are:

More Ergonomic and Faster Instructions

Previously, Triton VM’s stack could grow or shrink by at most one element per instruction. As of this version, this limitation is lifted. Many instructions can now change the stack size by up to five elements at once. This greatly improves speed: for example, all input / output instructions, whether for memory or one of the standard streams, can now process batches of size up to five. It also increases ergonomics: instructions operating on multiple extension field elements such as xxadd now remove both operands from the stack, leaving only the result.

These are just a some examples. The updated instruction set architecture can be found in the specification.

Triton TUI

Triton TUI is a Terminal User Interface for Triton VM. It greatly simplifies running programs written in Triton assembly, and helps with debugging those programs. To get started, install it via cargo install triton-tui, then check out the example program.

The main features of Triton TUI are:

  • visualization of the state Triton VM is currently in
  • step debugging similar to gdb – continue to the next breakpoint, step forward one instruction, step out of current function, etc.
  • annotations – assign names and types to stack and memory elements and have them tracked as Triton VM runs
  • RAM inspection – navigate freely through all of memory
  • hot reload & reset – change your program on disk and reload it in the same session of Triton TUI
  • adaptive interface – you choose which information to show

Improved Error Reporting

Triton VM now reports any failure through custom errors. This allows better error handling downstream. Examples of such errors are failing asserts of the program executed by Triton VM, or the attempt to divide by 0, among many others. Whenever applicable, Triton VM now also returns the state it was in when a crash happened.

Full Changelog

✨ Features

  • Add benchmark for execution tracing (11b360d6)
  • Record opstack underflow read/write in AET (a57ef7c3)
  • Make Op Stack Table variable length (b606dc60)
  • (!) Instruction hash only puts digest on stack (2e37fb2f)
  • (!) Make instruction pop take an argument in range 1..=5 (81248b90)
  • (!) Make instruction divine take an argument in range 1..=5 (5bf3541a)
  • (!) Instruction divine_sibling pushes divined digest onto stack (4602fad8)
  • Sponge instructions change stack size (0fac3fc8)
  • Extension field instructions change stack size (f0b3ab8f)
  • (!) Make instruction read_io take an argument in range 1..=5 (e138f0a0)
  • (!) Make instruction write_io take an argument in range 1..=5 (b8e5f978)
  • Instruction assert_vector shrinks stack by 5 elements (6a0e19cc)
  • (!) Make memory instructions take an argument in range 1..=5 (8ef132af)
  • Add benchmark just executing a Triton VM program (8301d5db)
  • (!) Improve error reporting (48ee1099)
  • Only change VM state if instruction execution will work (d7fbb3fd)
  • Add triton-tui, a TUI for debugging programs in Triton assembly (d0d79bce)
  • Allow installing triton-tui as a binary (047bed9b)
  • (de)serialize VMState (8df0723c)

🐛 Bug Fixes

  • Crash VM when executing swap 0 (215f2ede)
  • Overflowing subtractions when accessing op stack underflow (2aa72e77)
  • (doc) Correct explanations for previous designs (4bbc2d2a)
  • Account for op stack table length dominating the AET (f465f756)
  • Correct calculation of total available memory in Triton VM (18af2b40)
  • Fail Sponge instructions if Sponge state is uninitialized (881b6c0d)

⚡️ Performance

  • Remove redundant constraint preventing op stack underflow (6215c108)
  • Use instruction’s fast-fail for error reporting, not cloning (08bbc41f)

📚 Documentation

  • Add TIP-0008 “Continuations” (4b38d01b)
  • Consistently use a space in “op stack” and “jump stack” (eb8dc840)
  • Delete out-of-date cheat sheet (69aac2dc)
  • Prose and example for Op Stack Table behavior (db01232f)
  • Update AET relations diagram (f177d658)
  • Op Stack Table padding (ad09b8d2)
  • Update Op Stack Table’s AIR (3fb003b6)
  • Update Processor Table’s AET and AIR (e59eedeb)
  • Reflect changes to instructions, constraints, and mechanics (ccf123b8)
  • Exemplify error handling (90151d6c)
  • Add changelog (4d1fc2c0)

⚙️ Miscellaneous

  • Simplify uses (51878fae)
  • (test) Remove unnecessary paths (4323b202)
  • read_mem starts reading at current address (7faad183)
  • (!) Rename & change debugging methods of Program (abd17904)
  • Fix spelling of collinear (not colinear) (2e9ebd7c)
  • Improve changelog generation configuration (9e3432f3)
  • (!) Remove Default derivation from Program (868f49d9)
  • Allow tracing program execution from a given starting state (5f702d47)
  • Upgrade dependency cargo-tarpaulin (560f2555)

♻️ Refactor

  • (examples) Return program, not instructions (55c731ed)
  • Improve API of VMProfiler (202cb74b)
  • (vm) Rename ramp to ram_pointer (612714d0)
  • (processor_table) Remove never-triggered panics (6ced006a)
  • (processor_table) Remove unused struct ExtProcessorTraceRow (d39230f2)
  • (test) Use crate test-strategy (01e5e229)
  • (test) Improve testing instruction’s transition constraints (77948e1a)
  • (op_stack) Simplify recording of op stack underflow I/O calls (f3803676)
  • Turn python script for computing opcodes into a rust test (ddb220f2)
  • (test) Also test transition constraints on extension table (4bd9cf16)
  • (test) Split test program enumeration into individual tests (cc79cfad)
  • Abstract over legal argument range for various instructions (a76097e9)
  • (!) On success, Stark::verify returns Ok(()), not Ok(true) (9d3a7065)
  • (!) Remove terminal_state, allow running a VM state instead (fbd58f1c)
  • Simplify indexing into OpStack (4b31b2fe)

✅ Testing

  • Op stack table row sorting (7418502b)
  • Factor for running product with Op Stack Table never panics (224e7923)
  • Turn extension field instruction tests into property tests (067d0053)
  • Turn get_colinear_y into a property test (39bd4668)
  • Use proptest, not ad-hoc prop tests, for program parsing tests (d2acbbf8)
  • Delete some ignored, obsolete tests (8deb268a)
  • Instructions fail before they modify the state (c680fab2)
🏷️ release 🏷️ triton-vm