Skip to content

Commit

Permalink
feat: restructure part3 fix examples (#1792)
Browse files Browse the repository at this point in the history
* fix contract deployment example

* database component example

* fix examples

* fix uniswap usdc swap

* fmt

* docs

* rm comment
  • Loading branch information
rakita authored Sep 20, 2024
1 parent 5b6846b commit f75998a
Show file tree
Hide file tree
Showing 18 changed files with 295 additions and 382 deletions.
69 changes: 69 additions & 0 deletions Cargo.lock

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

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ members = [
"crates/specification",

# examples
#"examples/block_traces",
#"examples/contract_deployment",
"examples/block_traces",
"examples/contract_deployment",
"examples/database_components",
"examples/database_ref",
"examples/uniswap_get_reserves",
"examples/uniswap_v2_usdc_swap",
#"examples/custom_opcodes",
#"examples/database_components",
#"examples/database_ref",
#"examples/uniswap_get_reserves",
#"examples/uniswap_v2_usdc_swap",
]

[workspace.dependencies]
Expand Down
2 changes: 1 addition & 1 deletion bins/revme/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repository.workspace = true
# revm
database.workspace = true
revm = { workspace = true, features = ["std", "hashbrown", "c-kzg", "blst"] }
inspector = { workspace = true, features = ["std", "serde", "serde-json"] }
inspector = { workspace = true, features = ["std", "serde-json"] }

hash-db = "0.15"
hex = "0.4"
Expand Down
213 changes: 0 additions & 213 deletions crates/database/src/ethersdb.rs

This file was deleted.

16 changes: 15 additions & 1 deletion examples/block_traces/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,18 @@ all = "warn"

[dependencies]
revm.workspace = true
database.workspace = true
database = { workspace = true, features = ["std", "alloydb"] }
inspector = { workspace = true, features = ["std", "serde-json"] }

# tokio
tokio = { version = "1.40", features = ["rt-multi-thread", "macros"] }

# alloy
alloy-eips = "0.3.6"
alloy-provider = "0.3"

# progress bar
indicatif = "0.17"

# mics
anyhow = "1.0.89"
5 changes: 2 additions & 3 deletions examples/block_traces/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@

use alloy_eips::{BlockId, BlockNumberOrTag};
use alloy_provider::{network::primitives::BlockTransactions, Provider, ProviderBuilder};
use database::{AlloyDB, CacheDB, StateBuilder};
use indicatif::ProgressBar;
use inspector::{inspector_handle_register, inspectors::TracerEip3155};
use revm::{
db::{AlloyDB, CacheDB, StateBuilder},
inspector_handle_register,
inspectors::TracerEip3155,
primitives::{TxKind, B256, U256},
specification::eip2930::AccessListItem,
wiring::EthereumWiring,
Expand Down
5 changes: 4 additions & 1 deletion examples/contract_deployment/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@ rust_2018_idioms = "deny"
all = "warn"

[dependencies]
revm.workspace = true
revm = { workspace = true, features = ["std"] }
database.workspace = true

# mics
anyhow = "1.0.89"
2 changes: 1 addition & 1 deletion examples/contract_deployment/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fn main() -> anyhow::Result<()> {
bail!("Failed to write storage in the init code: {result:#?}");
};

println!("storage U256(0) at{address}: {storage0:#?}");
println!("storage U256(0) at {address}: {storage0:#?}");
assert_eq!(storage0.present_value(), param.try_into()?, "{result:#?}");
Ok(())
}
5 changes: 4 additions & 1 deletion examples/database_components/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@ rust_2018_idioms = "deny"
all = "warn"

[dependencies]
# srevm
revm.workspace = true
database.workspace = true

# mics
auto_impl = "1.2"
Loading

0 comments on commit f75998a

Please sign in to comment.