Skip to content

TrueBitProject/lanai

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

Lanai Interpreter

Lanai is a processor architecture developed by google. The reason it is used for TrueBit is because it is a very simplistic architecture (it is easy to implement an interpreter in Solidity and it does not have complex memory access patterns) and there is an actively maintained compiler from C/C++/Rust to this architecture (llvm).

How to run the example

To run the example, you have to compile the C code into a Lanai binary. This will also compile clang for lanai in a docker container because it is still an experimental backend:

cd llvm
./build.sh

This will generate example.o (the binary) and example.s (the lanai assembly for reference).

Now compile the interpreter:

cd ../interpreter
mkdir build && cd build
cmake .. && make

Now you can run the binary file in the interpreter:

./lanai-int ../../llvm/example.o

It will tell you the result of the computation and the number of steps it took. You can set a verbosity flag in main.cpp to get more output.

Note that the number of steps is quite large because Lanai does not have multiplication opcodes, but that is mostly irrelevant for Truebit because of its logarithmic scalability - it is possible to verify 1000000 computational steps in about five rounds and for 100000000 steps it takes eight rounds.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published