Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add example to revm crate #468

Merged
merged 1 commit into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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