Git Product home page Git Product logo

lanai's Introduction

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.

lanai's People

Contributors

chriseth avatar step21 avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.