Skip to content

Commit

Permalink
feat: add reth-evm crate (paradigmxyz#7397)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored and Ruteri committed Apr 17, 2024
1 parent a0e542d commit 9fae3a1
Show file tree
Hide file tree
Showing 14 changed files with 53 additions and 22 deletions.
14 changes: 11 additions & 3 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ members = [
"crates/consensus/beacon-core/",
"crates/consensus/common/",
"crates/ethereum-forks/",
"crates/etl",
"crates/etl/",
"crates/evm/",
"crates/interfaces/",
"crates/metrics/",
"crates/metrics/metrics-derive/",
Expand Down Expand Up @@ -206,6 +207,7 @@ reth-eth-wire = { path = "crates/net/eth-wire" }
reth-ethereum-forks = { path = "crates/ethereum-forks" }
reth-ethereum-payload-builder = { path = "crates/payload/ethereum" }
reth-etl = { path = "crates/etl" }
reth-evm = { path = "crates/evm" }
reth-optimism-payload-builder = { path = "crates/payload/optimism" }
reth-interfaces = { path = "crates/interfaces" }
reth-ipc = { path = "crates/rpc/ipc" }
Expand Down
18 changes: 18 additions & 0 deletions crates/evm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "reth-evm"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true

[lints]
workspace = true

[dependencies]
# reth
reth-primitives.workspace = true
revm-primitives.workspace = true
revm.workspace = true

10 changes: 10 additions & 0 deletions crates/node-api/src/evm/traits.rs → crates/evm/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
//! Traits for configuring an EVM specifics.
#![doc(
html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/"
)]
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

use reth_primitives::{revm::env::fill_block_env, Address, ChainSpec, Header, Transaction, U256};
use revm::{Database, Evm, EvmBuilder};
use revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg, SpecId, TxEnv};
Expand Down
7 changes: 3 additions & 4 deletions crates/node-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ workspace = true
# reth
reth-primitives.workspace = true
reth-rpc-types.workspace = true
revm-primitives.workspace = true
thiserror.workspace = true
revm.workspace = true
reth-evm.workspace = true

# io
# misc
serde.workspace = true
thiserror.workspace = true
5 changes: 0 additions & 5 deletions crates/node-api/src/evm/mod.rs

This file was deleted.

3 changes: 1 addition & 2 deletions crates/node-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ pub use engine::{
};

/// Traits and helper types used to abstract over EVM methods and types.
pub mod evm;
pub use evm::{ConfigureEvm, ConfigureEvmEnv};
pub use reth_evm::{ConfigureEvm, ConfigureEvmEnv};

pub mod primitives;

Expand Down
2 changes: 1 addition & 1 deletion crates/storage/provider/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ reth-db.workspace = true
reth-trie = { workspace = true, features = ["metrics"] }
reth-nippy-jar.workspace = true
reth-codecs.workspace = true
reth-node-api.workspace = true
reth-evm.workspace = true

revm.workspace = true

Expand Down
2 changes: 1 addition & 1 deletion crates/storage/provider/src/providers/database/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use crate::{
TransactionVariant, TransactionsProvider, WithdrawalsProvider,
};
use reth_db::{database::Database, init_db, models::StoredBlockBodyIndices, DatabaseEnv};
use reth_evm::ConfigureEvmEnv;
use reth_interfaces::{provider::ProviderResult, RethError, RethResult};
use reth_node_api::ConfigureEvmEnv;
use reth_primitives::{
stage::{StageCheckpoint, StageId},
Address, Block, BlockHash, BlockHashOrNumber, BlockNumber, BlockWithSenders, ChainInfo,
Expand Down
2 changes: 1 addition & 1 deletion crates/storage/provider/src/providers/database/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ use reth_db::{
transaction::{DbTx, DbTxMut},
BlockNumberList, DatabaseError,
};
use reth_evm::ConfigureEvmEnv;
use reth_interfaces::{
p2p::headers::downloader::SyncTarget,
provider::{ProviderResult, RootMismatch},
RethResult,
};
use reth_node_api::ConfigureEvmEnv;
use reth_primitives::{
keccak256,
revm::{config::revm_spec, env::fill_block_env},
Expand Down
2 changes: 1 addition & 1 deletion crates/storage/provider/src/providers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use reth_db::{
database::Database,
models::{AccountBeforeTx, StoredBlockBodyIndices},
};
use reth_evm::ConfigureEvmEnv;
use reth_interfaces::{
blockchain_tree::{
error::{CanonicalError, InsertBlockError},
Expand All @@ -20,7 +21,6 @@ use reth_interfaces::{
provider::ProviderResult,
RethResult,
};
use reth_node_api::ConfigureEvmEnv;
use reth_primitives::{
stage::{StageCheckpoint, StageId},
Account, Address, Block, BlockHash, BlockHashOrNumber, BlockId, BlockNumHash, BlockNumber,
Expand Down
2 changes: 1 addition & 1 deletion crates/storage/provider/src/test_utils/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use crate::{
};
use parking_lot::Mutex;
use reth_db::models::{AccountBeforeTx, StoredBlockBodyIndices};
use reth_evm::ConfigureEvmEnv;
use reth_interfaces::provider::{ProviderError, ProviderResult};
use reth_node_api::ConfigureEvmEnv;
use reth_primitives::{
keccak256, trie::AccountProof, Account, Address, Block, BlockHash, BlockHashOrNumber, BlockId,
BlockNumber, BlockWithSenders, Bytecode, Bytes, ChainInfo, ChainSpec, Header, Receipt,
Expand Down
2 changes: 1 addition & 1 deletion crates/storage/provider/src/test_utils/noop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use crate::{
WithdrawalsProvider,
};
use reth_db::models::{AccountBeforeTx, StoredBlockBodyIndices};
use reth_evm::ConfigureEvmEnv;
use reth_interfaces::provider::ProviderResult;
use reth_node_api::ConfigureEvmEnv;
use reth_primitives::{
stage::{StageCheckpoint, StageId},
trie::AccountProof,
Expand Down
2 changes: 1 addition & 1 deletion crates/storage/provider/src/traits/evm_env.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use reth_evm::ConfigureEvmEnv;
use reth_interfaces::provider::ProviderResult;
use reth_node_api::ConfigureEvmEnv;
use reth_primitives::{BlockHashOrNumber, Header};
use revm::primitives::{BlockEnv, CfgEnv, CfgEnvWithHandlerCfg, SpecId};

Expand Down

0 comments on commit 9fae3a1

Please sign in to comment.