Code Monkey home page Code Monkey logo

suave-andromeda-revm's Introduction

Warning

This repository is a work in progress, and for now only functions as a showcase. This code is not intended to secure any valuable information.

Anrdomeda REVM

This an EVM with precompiles used internally by SUAVE for key management and boostrapping kettles.

How the Andromeda precompiles work

The Andromeda precompiles rely on features from Gramine, provided through the filesystem. The gramine environment is provided separately. Running the examples and tests here just run locally, approximating this.

The tests include a thin wrapper for the precompiles [examples/Andromeda.sol]. This is a small interface, but it should be sufficient to run the Key Manager demo

SUAVE chain state

The revm itself is statless - we don't keep any chain data inside. To provide chain state we have introduced a witness-based database. The database itself is defined in remote_db.rs, and verifying witness is done through helios. For SUAVE chain's Proof of Authority we have added a simple consensus checker that verifies the blocks were signed by one of the trusted block proposers ([0x0981717712ed2c4919fdbc27dfc804800a9eeff9, 0x0e5b9aa4925ed1beeb08d1c5a92477a1b719baa7, 0x0e8705e07bbe1ce2c39093df3d20aaa5120bfc7a]).

State is possibly fetched at two times:

  • Before the execution all of the access list state is pre-fetched
  • During EVM execution if a slot is missing it will be fetched from the execution client

Stateful executor

The main service we provide in this repository is the StatefulExecutor. This is a service which persists volatile memory (for Suave.volatile{Set/Get}) and manages the SUAVE chain light client.

There are two methods that the StatefulExecutor implements:

  • advance [height=latest], which advances the suave chain light client to the requested height
  • execute tx_env, which executes the requested call. The tx_env is expected to be JSON-encoded TxEnv structure.

Building

solcjs --bin -o examples examples/Andromeda.sol
cargo build

Note: clang is required for building revm with c-kzg or secp256k1 feature flags as they depend on C libraries. If you don't have it installed, you can install it with apt install clang.

Running example locally (no gramine)

To mock out /dev/attestation/quote, and /dev/attestation/user_report_data, just try

sudo mkdir /dev/attestation
sudo chown $USER:$USER /dev/attestation
echo "dummnyquote" > /dev/attestation/quote
cargo run -p suave-andromeda-revm --example andromeda_test

License

The code in this project is free software under the MIT license.

suave-andromeda-revm's People

Contributors

fnerdman avatar ruteri 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.