Skip to content

Commit

Permalink
add example to revm crate (#468)
Browse files Browse the repository at this point in the history
  • Loading branch information
lonerapier authored Apr 25, 2023
1 parent 08091e1 commit d0cd897
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 8 deletions.
27 changes: 27 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Last checked revm requires rust v1.65 or higher for `core::error::Error`
There were some big efforts on optimization of revm:
* Optimizing interpreter loop: https://github.com/bluealloy/revm/issues/7
* Introducing Bytecode format (and better bytecode analysis): https://github.com/bluealloy/revm/issues/121
* Unification of instruction signatures: https://github.com/bluealloy/revm/pull/283
* Unification of instruction signatures: https://github.com/bluealloy/revm/pull/283

# Running eth tests

Expand All @@ -48,6 +48,12 @@ cargo run --package revm-test --release --bin snailtracer
cargo flamegraph --root --freq 4000 --min-width 0.001 --package revm-test --bin snailtracer
```

## Running example

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

# Used by:

* Foundry: https://github.com/foundry-rs/foundry
Expand Down
9 changes: 8 additions & 1 deletion crates/revm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ ethers-providers = { version = "2.0", optional = true }
ethers-core = { version = "2.0", optional = true }
futures = { version = "0.3.27", optional = true }


[dev-dependencies]
hex-literal = "0.4"
ethers-contract = { version = "2.0.3", default-features = false }
hex = "0.4.3"
bytes = "1.4.0"
anyhow = "1.0.70"

[features]
default = ["std", "secp256k1"]
Expand All @@ -57,3 +60,7 @@ arbitrary = ["revm-interpreter/arbitrary"]
# deprecated feature
web3db = []
with-serde = []

[[example]]
name = "fork_ref_transact"
path = "../../examples/fork_ref_transact.rs"
10 changes: 4 additions & 6 deletions examples/fork_ref_transact.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
use std::{str::FromStr, sync::Arc};
use anyhow::{Ok, Result};
use bytes::Bytes;
use ethers::{
abi::parse_abi,
prelude::BaseContract,
providers::{Http, Provider},
};
use ethers_contract::BaseContract;
use ethers_core::abi::parse_abi;
use ethers_providers::{Http, Provider};
use revm::{
db::{CacheDB, EmptyDB, EthersDB},
primitives::{ExecutionResult, Output, TransactTo, B160, U256 as rU256},
Database, EVM,
};
use std::{str::FromStr, sync::Arc};

#[tokio::main]
async fn main() -> Result<()> {
Expand Down

0 comments on commit d0cd897

Please sign in to comment.