Skip to content

Commit

Permalink
revme some cleanup (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
rakita authored Sep 4, 2022
1 parent 8f4348d commit da041d5
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 1,273 deletions.
543 changes: 38 additions & 505 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions bins/revme/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,16 @@ bytes = "1.1"
hash-db = "0.15"
hashbrown = "0.12"
hex = "0.4"
indicatif = "0.16"
indicatif = "0.17"
plain_hasher = "0.2"
primitive-types = { version = "0.11", features = ["rlp", "serde"] }

revm = { path = "../../crates/revm", version = "1.3", default-features = false, features = ["web3db","std","secp256k1"] }
rlp = { version = "0.5", default-features = false }
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
sha3 = { version = "0.10", default-features = false }
structopt = "0.3"
termwiz = "0.16" # used for debugger ctrl
thiserror = "1.0"
triehash = "0.8"
walkdir = "2.3"
43 changes: 2 additions & 41 deletions bins/revme/README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,4 @@
# Rust EVM executor or short REVME

It is still work in progress and it is published for only reason to take cargo name.

This is binary crate that executed evm multiple ways. Currently there are three parts:
* statetest: takes path to folder where ethereum statetest json can be found. It recursively searches for all json files and execute them. This is how i run all https://github.com/ethereum/tests to check if revm is compliant. Example `revme statests test/GenericEvmTest/`
* debug (WIP):
* (WIP) Interactive debugger with ability to change any parameter of EVM in runtime, specify breakpoints and do everything what you expect from debugger.
* (WIP) Allow inserting accounts,balances,storages.
* Specify web3 interface to bind database, for example use infura with option `--web infura_link`.
* (WIP) revert opcode implemented in EVM we can enable `rewind` of contract call so that you can go to start of contract call and start debugging again. We could even add `rewind opcode` besically rewind call and rerun it until program counter matches.
* (TODO) Specify EVM environment from file or from cli.
* run (TODO): Intention is to be able to specify contract bytes and input and run it. It is useful for testing and benchmarks


It is still WIP,but debugger can be very interesting, it gives you ability to step, modify stack/memory, set breakpoints and do everything what you would expect from standard debugger, with addition of rewinding step and contract calls. You can connect to exteranl web3 supported API and fetch for example live state from mainnet via infura, or you can set data local manupulation, either way this should be useful.

This binary will be console based and interaction will be done via console inputs, this is great showcase this is first step.

Example of commands WIP:
* `help` :)
* `step`
* `continue`
* `exit`
* `stepin`
* `stepout`
* `breakpoint <contract> <pc>`
* `rewind`
* `rewind call`
* `rewind opcode`
* `print`
* `print all`
* `print stack`
* `print opcode`
* `...`
* `state`
* `state <index> <value>`
* `account <address>`
* `account <address> balance <new_balance>`
* `account <address> nonce <new_nonce>`
* `storage <index>`
* `storage set <index> <value>`
* `...`
This is binary crate that executed evm multiple ways. Currently it is used trun ethereum tests:
* statetest: takes path to folder where ethereum statetest json can be found. It recursively searches for all json files and execute them. This is how i run all https://github.com/ethereum/tests to check if revm is compliant. Example `revme statests test/GenericEvmTest/`
8 changes: 1 addition & 7 deletions bins/revme/src/cmd.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
use crate::{runner, statetest};
use structopt::{clap::AppSettings, StructOpt};

use crate::{debugger, runner, statetest};

#[derive(StructOpt, Debug)]
#[structopt(setting = AppSettings::InferSubcommands)]
#[allow(clippy::large_enum_variant)]
pub enum MainCmd {
Statetest(statetest::Cmd),
Debug(debugger::Cmd),
Run(runner::Cmd),
}

Expand All @@ -25,10 +23,6 @@ impl MainCmd {
pub fn run(&self) -> Result<(), Error> {
match self {
Self::Statetest(cmd) => cmd.run().map_err(Error::Statetest),
Self::Debug(cmd) => {
cmd.run();
Ok(())
}
_ => Ok(()),
}
}
Expand Down
56 changes: 0 additions & 56 deletions bins/revme/src/debugger/cmd.rs

This file was deleted.

Loading

0 comments on commit da041d5

Please sign in to comment.