GithubHelp home page GithubHelp logo

leewingch / revm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bluealloy/revm

0.0 0.0 0.0 5.19 MB

Ethereum Virtual Machine written in rust that is fast and simple to use

Home Page: https://bluealloy.github.io/revm/

License: MIT License

Rust 100.00%

revm's Introduction

revm

CI License Chat

Rust Ethereum Virtual Machine

Revm is an EVM written in Rust that is focused on speed and simplicity. It has a fast and flexible implementation with a simple interface and embedded Host. It passes all ethereum/tests test suites.

Here is a list of guiding principles that Revm follows.

  • EVM compatibility and stability - this goes without saying but it is nice to put it here. In the blockchain industry, stability is the most desired attribute of any system.
  • Speed - is one of the most important things and most decisions are made to complement this.
  • Simplicity - simplification of internals so that it can be easily understood and extended, and interface that can be easily used or integrated into other projects.
  • interfacing - [no_std] so that it can be used as wasm lib and integrate with JavaScript and cpp binding if needed.

Project

Structure:

  • crates
    • revm -> main EVM library.
    • revm-primitives -> Primitive data types.
    • revm-interpreter -> Execution loop with instructions
    • revm-precompile -> EVM precompiles
  • bins:
    • revme: cli binary, used for running state test jsons

This project tends to use the newest rust version, so if you're encountering a build error try running rustup update first.

There were some big efforts on optimization of revm:

Building from source

git clone https://github.com/bluealloy/revm.git
cd revm
cargo build --release

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 eth tests

go to cd bins/revme/

Download eth tests from (this will take some time): git clone https://github.com/ethereum/tests

run tests with command: cargo run --release -- statetest tests/GeneralStateTests/ tests/LegacyTests/Constantinople/GeneralStateTests

GeneralStateTests contains all tests related to EVM.

Running benchmarks

Benches can be found in crates/revm/benches.

Currently, available benches include the following.

  • analysis
  • snailtracer
  • transfer

To run the snailtracer bench, execute the cargo bench subcommand below.

cargo bench --package revm --profile release -- snailtracer

Using flamegraph, you can create a visualization breaking down the runtime of various sections of the bench execution - a flame graph. Executing the cargo flamegraph subcommand requires installing flamegraph by running cargo install flamegraph.

cargo flamegraph --root --freq 4000 --min-width 0.001 --package revm --bench bench -- snailtracer

This command will produce a flamegraph image output to flamegraph.svg. Flamegraph also requires sudo mode to run (hence the --root cli arg) and will prompt you for your password if not in sudo mode already.

Running examples

cargo run -p revm --features ethersdb --example fork_ref_transact

Generate block traces and write them to json files in a new traces/ directory. Each file corresponds to a transaction in the block and is named as such: <tx index>.json.

cargo run -p revm --features std,serde-json,ethersdb --example generate_block_traces

Used by:

  • Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
  • Helios is a fully trustless, efficient, and portable Ethereum light client written in Rust.
  • Reth Modular, contributor-friendly and blazing-fast implementation of the Ethereum protocol
  • Arbiter is a framework for stateful Ethereum smart-contract simulation
  • Zeth is an open-source ZK block prover for Ethereum built on the RISC Zero zkVM.
  • VERBS an open-source Ethereum agent-based modelling and simulation library with a Python API.
  • Hardhat is a development environment to compile, deploy, test, and debug your Ethereum software.
  • ...

(If you want to add project to the list, ping me or open the PR)

Documentation

The book can be found at github page here: https://bluealloy.github.io/revm/

The documentation (alas needs some love) can be found here: https://bluealloy.github.io/revm/docs/

To serve the mdbook documentation in a local environment, ensure you have mdbook installed (if not install it with cargo) and then run:

mdbook serve documentation

Contact

There is public telegram group: https://t.me/+Ig4WDWOzikA3MzA0

Or if you want to contact me directly, here is my email: [email protected] and telegram: https://t.me/draganrakita

revm's People

Contributors

rakita avatar dependabot[bot] avatar danipopes avatar mattsse avatar rkrasiuk avatar wodann avatar onbjerg avatar rjected avatar iaroslavmazur avatar refcell avatar evalir avatar gakonst avatar clabby avatar shekhirin avatar thedevbirb avatar ngotchac avatar 0xjepsen avatar github-actions[bot] avatar wtdcode avatar loocapro avatar yjhmelody avatar dothebesttogetthebest avatar perama-v avatar gd-0 avatar omahs avatar wollac avatar valo avatar paulrberg avatar corrm avatar ufoscout 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.