diff --git a/Cargo.lock b/Cargo.lock index b439d259b7a9a..6404ad637a762 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5931,6 +5931,15 @@ dependencies = [ "tempfile", ] +[[package]] +name = "reth-evm" +version = "0.2.0-beta.4" +dependencies = [ + "reth-primitives", + "revm", + "revm-primitives", +] + [[package]] name = "reth-interfaces" version = "0.2.0-beta.4" @@ -6141,10 +6150,9 @@ dependencies = [ name = "reth-node-api" version = "0.2.0-beta.4" dependencies = [ + "reth-evm", "reth-primitives", "reth-rpc-types", - "revm", - "revm-primitives", "serde", "thiserror", ] @@ -6417,10 +6425,10 @@ dependencies = [ "rayon", "reth-codecs", "reth-db", + "reth-evm", "reth-interfaces", "reth-metrics", "reth-nippy-jar", - "reth-node-api", "reth-primitives", "reth-trie", "revm", diff --git a/Cargo.toml b/Cargo.toml index 65cdbf6a80e43..4f3d41ffd7c3c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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/", @@ -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" } diff --git a/crates/evm/Cargo.toml b/crates/evm/Cargo.toml new file mode 100644 index 0000000000000..b100c83b7b668 --- /dev/null +++ b/crates/evm/Cargo.toml @@ -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 + diff --git a/crates/node-api/src/evm/traits.rs b/crates/evm/src/lib.rs similarity index 86% rename from crates/node-api/src/evm/traits.rs rename to crates/evm/src/lib.rs index bc0b900719a35..2bf1f72a1cc84 100644 --- a/crates/node-api/src/evm/traits.rs +++ b/crates/evm/src/lib.rs @@ -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}; diff --git a/crates/node-api/Cargo.toml b/crates/node-api/Cargo.toml index 6b01dd8c07542..0dbd20adee83f 100644 --- a/crates/node-api/Cargo.toml +++ b/crates/node-api/Cargo.toml @@ -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 diff --git a/crates/node-api/src/evm/mod.rs b/crates/node-api/src/evm/mod.rs deleted file mode 100644 index e93d66480f6f5..0000000000000 --- a/crates/node-api/src/evm/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -//! Traits and structs for working with a configurable EVM. - -/// Traits for working with a configurable EVM. -mod traits; -pub use traits::{ConfigureEvm, ConfigureEvmEnv}; diff --git a/crates/node-api/src/lib.rs b/crates/node-api/src/lib.rs index e103f59ff6f31..d3e08fc9be914 100644 --- a/crates/node-api/src/lib.rs +++ b/crates/node-api/src/lib.rs @@ -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; diff --git a/crates/storage/provider/Cargo.toml b/crates/storage/provider/Cargo.toml index 26e6a84b5df21..c54adc050c5e9 100644 --- a/crates/storage/provider/Cargo.toml +++ b/crates/storage/provider/Cargo.toml @@ -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 diff --git a/crates/storage/provider/src/providers/database/mod.rs b/crates/storage/provider/src/providers/database/mod.rs index 639cc74663727..2540336544b31 100644 --- a/crates/storage/provider/src/providers/database/mod.rs +++ b/crates/storage/provider/src/providers/database/mod.rs @@ -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, diff --git a/crates/storage/provider/src/providers/database/provider.rs b/crates/storage/provider/src/providers/database/provider.rs index 85b46550d993e..df51b19b8c6ff 100644 --- a/crates/storage/provider/src/providers/database/provider.rs +++ b/crates/storage/provider/src/providers/database/provider.rs @@ -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}, diff --git a/crates/storage/provider/src/providers/mod.rs b/crates/storage/provider/src/providers/mod.rs index 4af73fcbad4e4..611aca349591c 100644 --- a/crates/storage/provider/src/providers/mod.rs +++ b/crates/storage/provider/src/providers/mod.rs @@ -10,6 +10,7 @@ use reth_db::{ database::Database, models::{AccountBeforeTx, StoredBlockBodyIndices}, }; +use reth_evm::ConfigureEvmEnv; use reth_interfaces::{ blockchain_tree::{ error::{CanonicalError, InsertBlockError}, @@ -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, diff --git a/crates/storage/provider/src/test_utils/mock.rs b/crates/storage/provider/src/test_utils/mock.rs index 26e09e5a1a59f..13e4a5a8ff595 100644 --- a/crates/storage/provider/src/test_utils/mock.rs +++ b/crates/storage/provider/src/test_utils/mock.rs @@ -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, diff --git a/crates/storage/provider/src/test_utils/noop.rs b/crates/storage/provider/src/test_utils/noop.rs index 2272f09a03b9a..13a2f3b4018f5 100644 --- a/crates/storage/provider/src/test_utils/noop.rs +++ b/crates/storage/provider/src/test_utils/noop.rs @@ -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, diff --git a/crates/storage/provider/src/traits/evm_env.rs b/crates/storage/provider/src/traits/evm_env.rs index 2eb8f3e5d889b..8c821984601d9 100644 --- a/crates/storage/provider/src/traits/evm_env.rs +++ b/crates/storage/provider/src/traits/evm_env.rs @@ -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};