MCPcopy Index your code
hub / github.com/AluVM/aluvm

github.com/AluVM/aluvm @v0.12.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.12.0 ↗ · + Follow
212 symbols 435 edges 25 files 54 documented · 25%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

AluVM rust implementation

Build Tests Lints codecov

crates.io Docs unsafe forbidden Apache-2 licensed

Rust implementation of AluVM (arithmetic logic unit virtual machine).

AluVM is a pure functional register-based highly deterministic & exception-less instruction set architecture (ISA) and virtual machine (VM). The AluVM ISA can be extended by an environment running the virtual machine (runtime environment), providing ability to load data to the VM registers and support application-specific instructions (like SIMD).

The main purpose for ALuVM is to be used in distributed systems whether robustness, platform-independent determinism are more important than the speed of computation. The main area of AluVM applications (using appropriate ISA extensions) is blockchain environments, consensus-critical computations, edge computing, multiparty computing (including deterministic machine learning), client-side-validation, sandboxed computing and genetic algorithms.

For more details on AluVM, please check the specification, watch detailed presentation on YouTube or check slides from the presentation.

Design

The robustness lies at the very core of AluVM. It is designed to avoid any undefined behaviour. Specifically,

  • All registers may be in the undefined state;
  • Impossible/incorrect operations put destination register into a special undefined state;
  • Code always extended to 2^16 bytes with zeros, which corresponds to “set st0 register to false and stop execution” op-code;
  • There are no invalid jump operations;
  • There are no invalid instructions;
  • Cycles & jumps are counted with 2^16 limit (bounded-time execution);
  • No ambiguity: any two distinct byte strings always represent strictly distinct programs;
  • Code and embedded data signing;
  • Code commits to the used ISA extensions;
  • Libraries identified by their hashes;
  • Code does not run if not all libraries are present.

Comparison table

Instruction Set Architecture

Instruction set architecture

History

  • The need for AluVM recognized as a part of RGB project in Mar, the 24 & 31st, 2021 (see developers call https://youtu.be/JmKNyOMv68I)
  • Concept was presented on 19th of May 2021(check the recoding)
  • v0.1 release of Rust AluVM implementation on the 28th of May 2021 (ISA & API docs)
  • v0.2 release with multiple enhancements on the 9 Jun 2021 (ISA & API docs) – see presentation on YouTube or read slides
  • At the end of 2024 v0.12 became a complete re-write, abstracting most of the instructions into a ISA extensions. The remaining core of AluVM become zk-STARK and zk-STARK-compatible, so a dedicated ISA extensions can be used to create fully arithmetized applications.

Extension points exported contracts — how you extend this code

Bytecode (Interface)
Non-failing byte encoding for the instruction set. We can't use `io` since (1) we are no_std, (2) it operates data with [3 …
src/isa/bytecode.rs
Register (Interface)
A trait for a set of registers provided by an ISA extension. [1 implementers]
src/core/util.rs
Instruction (Interface)
Trait for instructions [3 implementers]
src/isa/instr.rs
SiteId (Interface)
Trait for program identifiers. This type is required in addition to [`crate::LibId`] in order to achieve proper abstrac [1 …
src/core/util.rs
BytecodeRead (Interface)
Reader from a bytecode for instruction deserialization. [1 implementers]
src/isa/bytecode.rs
CoreExt (Interface)
Extension to the AluVM core provided by an ISA. [1 implementers]
src/core/core.rs
BytecodeWrite (Interface)
Writer converting instructions into a bytecode. [1 implementers]
src/isa/bytecode.rs
Supercore (Interface)
A trait for the external part of AluVM core which can operate with core ISA extensions. [1 implementers]
src/core/core.rs

Core symbols most depended-on inside this repo

roundtrip
called by 17
src/isa/ctrl/bytecode.rs
as_ref
called by 14
src/library/lib.rs
ck
called by 14
src/core/microcode.rs
co
called by 12
src/core/microcode.rs
read
called by 10
src/library/marshaller.rs
write
called by 9
src/library/marshaller.rs
read_word
called by 9
src/library/marshaller.rs
is_eof
called by 7
src/library/marshaller.rs

Shape

Method 129
Function 51
Class 13
Enum 11
Interface 8

Languages

Rust100%

Modules by API surface

src/library/marshaller.rs51 symbols
src/isa/ctrl/exec.rs26 symbols
src/isa/ctrl/bytecode.rs24 symbols
src/core/util.rs20 symbols
src/library/lib.rs13 symbols
src/core/microcode.rs13 symbols
src/core/core.rs12 symbols
src/isa/instr.rs9 symbols
src/isa/bytecode.rs8 symbols
src/library/compiler.rs7 symbols
src/isa/arch.rs6 symbols
src/vm.rs5 symbols

For agents

$ claude mcp add aluvm \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact