#vm #triton #snippets #assembly #testing #benchmark #tasm

tasm-lib

Code snippets for Triton VM assembly with tests and statistics

1 unstable release

0.1.0 Jul 6, 2023

#4 in #triton

Apache-2.0 and GPL-2.0 licenses

1MB
28K SLoC

tasm-lib

This repository contains a collection of functions written in Triton VM assembly (tasm). The functions supplied here emulate the standard library of other programming languages: basic functions that are used a lot.

There are two big projects to be written in tasm. They are not contained in this repository. These projects are:

  • The consensus logic of Neptune
  • The recursive Triton VM STARK verifier (recufier)

This repository helps to benchmark snippets written in tasm in order to gauge the complexity of the (Triton VM) prover.

Please place code in the appropriate directories, or create them if non-existent.

Conventions

U64

A u64 type is stored on the stack as two u32 elements that Triton VM provides native support for. A u64 is stored with the least significant part on top of the stack and the most significant part below it. So if the least significant part is st0, then the most significant part is stored in st1.

Authentication Paths from Secret In

1st element is a length indicator that specifies the authentication path length in number of digests. The length indicator must be a valid u32. Then follows the digests. The digests are ordered as: [digest_0_element_4,digest_0_element_3, digest_0_element_2, digest_0_element_1, digest_0_element_0, digest_1_element_4, digest_1_element_3 ... ].

Runtimes

Runtimes are printed in the JSON files in the benchmarks directory. These are generated by tests labeled as benchmark. If you manage to lower any of the numbers by changing a TASM snippet, please make a pull request, so we can get more efficient algorithms :)

Dependencies

~21–36MB
~533K SLoC