diff --git a/Cargo.lock b/Cargo.lock index 282df19562..ae523f816e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -31,6 +31,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "anyhow" +version = "1.0.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4" + [[package]] name = "arbitrary" version = "1.3.0" @@ -479,6 +485,23 @@ dependencies = [ "uint", ] +[[package]] +name = "ethers-contract" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a328cb42014ac0ac577a8dac32eb658ee0f32b5a9a5317a0329ac1d4201f1c6" +dependencies = [ + "ethers-core", + "ethers-providers", + "futures-util", + "hex", + "once_cell", + "pin-project", + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "ethers-core" version = "2.0.3" @@ -1628,10 +1651,14 @@ dependencies = [ name = "revm" version = "3.2.0" dependencies = [ + "anyhow", "auto_impl", + "bytes", + "ethers-contract", "ethers-core", "ethers-providers", "futures", + "hex", "hex-literal", "revm-interpreter", "revm-precompile", diff --git a/README.md b/README.md index f7513d5334..dd9f20b351 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/crates/revm/Cargo.toml b/crates/revm/Cargo.toml index 7c98a82327..98ab7cdb83 100644 --- a/crates/revm/Cargo.toml +++ b/crates/revm/Cargo.toml @@ -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"] @@ -57,3 +60,7 @@ arbitrary = ["revm-interpreter/arbitrary"] # deprecated feature web3db = [] with-serde = [] + +[[example]] +name = "fork_ref_transact" +path = "../../examples/fork_ref_transact.rs" diff --git a/examples/fork_ref_transact.rs b/examples/fork_ref_transact.rs index 553c2bf3d6..0fba487d2b 100644 --- a/examples/fork_ref_transact.rs +++ b/examples/fork_ref_transact.rs @@ -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<()> {