Giter Club home page Giter Club logo

dapptools-rs's Introduction

dapptools.rs

Rust port of DappTools

Github Actions Telegram Chat Crates.io

Why?! DappTools is great!

Developer experience is the #1 thing we should be optimizing for in development. Tests MUST be fast, non-trivial tests (e.g. proptests) MUST be easy to write, compilation MUST be fast.

Before getting into technical reasons, my simple answer is: rewriting software in Rust is fun. I enjoy it, and that could be the end of the "why" section.

DappTools is REALLY great. You should try it, especially the symbolic execution and step debugger features.

But it has some shortcomings:

It's written in a mix of Bash, Javascript and Haskell. In my opinion, this makes it hard to contribute, you don't have a "standard" way to test things, and it happens to be that there are not that many Haskell developers in the Ethereum community.

It is also hard to distribute. It requires installing Nix, and that's a barrier to entry to many already because (for whatever reason) Nix doesn't always install properly the first time.

The more technical reasons I decided to use it are:

  1. It is easier to write regression tests in Rust vs in Bash
  2. Rust binaries are cross-platform and easy to distribute
  3. Compilation speed: We can use native bindings to the Solidity compiler (instead of calling out to solcjs or even to the compiled binary) for extra compilation speed
  4. Testing speed: HEVM tests are really fast, but I believe we can go faster by leveraging Rust's high performance multithreading and resource allocation system.
  5. There seems to be an emerging community of Rust-Ethereum developers

Benchmarks TBD in the future, but:

  1. Using a Rust EVM w/ forked RPC mode was claimed to be as high as 10x faster than HEVM's forking mode.
  2. Native bindings to the Solidity compiler have shown to be 10x faster than the JS bindings or even just calling out to the native binary
  3. seth and dapp are less than 7mb when built with cargo build --release

Features

  • seth
    • --from-ascii / --from-utf8
    • --to-hex
    • --to-checksum-address
    • --to-ascii
    • --to-bytes32
    • --to-dec
    • --to-fix
    • --to-uint256
    • --to-wei
    • block
    • block-number
    • chain-id
    • age
    • basefee
    • gas-price
    • call (partial)
    • send (partial)
    • balance
    • ens
    • abi encoding
    • 4byte resolution
  • dapp
    • test
      • simple unit tests
        • Gas costs
        • DappTools style test output
        • JSON test output
        • matching on regex
        • DSTest-style assertions support
      • fuzzing
      • symbolic execution
      • coverage
      • HEVM-style Solidity cheatcodes
        • roll
        • warp
        • ffi
        • store
        • load
        • sign
        • addr
        • makeEOA
        • ...?
      • structured tracing with abi decoding
      • per-line gas profiling
      • forking mode
      • automatic solc selection
    • build
      • can read DappTools-style .sol.json artifacts
      • manual remappings
      • automatic remappings
      • multiple compiler versions
      • incremental compilation
      • can read Hardhat-style artifacts
      • can read Truffle-style artifacts
    • install
    • update
    • debug
    • CLI Tracing with RUST_LOG=dapp=trace

Tested Against

This repository has been tested against the following DappTools repos:

  • LootLoose (minus the FFI tests)
  • solmate (replace all the prove symbolic tests with fuzz tests, and skip invariant tests for now)

Development

Rust Toolchain

We use the stable Rust toolchain. Install by running: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Minimum Supported Rust Version

The current minimum supported Rust version is rustc 1.54.0 (a178d0322 2021-07-26).

Building & testing

cargo check
cargo test
cargo doc --open
cargo build [--release]

Formatting

cargo +nightly fmt
cargo clippy

Getting Help

First, see if the answer to your question can be found in the API documentation. If the answer is not there, try opening an issue with the question.

Join the turbodapptools telegram to chat with the community!

dapptools-rs's People

Contributors

gakonst avatar mattsse avatar odyslam avatar 0x-r4bbit avatar samwilsn avatar guanqun avatar anish-agnihotri avatar tarrencev avatar endophysics avatar transmissions11 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.