Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
rename to ConfigureEvm
  • Loading branch information
Rjected committed Feb 23, 2024
commit 6566a8d9fbc7aff7daaffe0eb2cd1d946ddf9bad
6 changes: 3 additions & 3 deletions crates/consensus/auto-seal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use reth_interfaces::{
consensus::{Consensus, ConsensusError},
executor::{BlockExecutionError, BlockValidationError},
};
use reth_node_api::{ConfigureEvmEnv, EngineTypes};
use reth_node_api::{ConfigureEvm, EngineTypes};
use reth_primitives::{
constants::{EMPTY_RECEIPTS, EMPTY_TRANSACTIONS, ETHEREUM_BLOCK_GAS_LIMIT},
proofs, Block, BlockBody, BlockHash, BlockHashOrNumber, BlockNumber, BlockWithSenders, Bloom,
Expand Down Expand Up @@ -320,7 +320,7 @@ impl StorageInner {
executor: &mut EVMProcessor<'_, EvmConfig>,
) -> Result<(BundleStateWithReceipts, u64), BlockExecutionError>
where
EvmConfig: reth_node_api::EvmConfig,
EvmConfig: ConfigureEvm,
{
trace!(target: "consensus::auto", transactions=?&block.body, "executing transactions");
// TODO: there isn't really a parent beacon block root here, so not sure whether or not to
Expand Down Expand Up @@ -434,7 +434,7 @@ impl StorageInner {
evm_config: EvmConfig,
) -> Result<(SealedHeader, BundleStateWithReceipts), BlockExecutionError>
where
EvmConfig: reth_node_api::EvmConfig,
EvmConfig: ConfigureEvm,
{
let header = self.build_header_template(&transactions, chain_spec.clone());

Expand Down
4 changes: 2 additions & 2 deletions crates/consensus/auto-seal/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{mode::MiningMode, Storage};
use futures_util::{future::BoxFuture, FutureExt};
use reth_beacon_consensus::{BeaconEngineMessage, ForkchoiceStatus};
use reth_interfaces::consensus::ForkchoiceState;
use reth_node_api::{ConfigureEvmEnv, EngineTypes};
use reth_node_api::{ConfigureEvm, EngineTypes};
use reth_primitives::{Block, ChainSpec, IntoRecoveredTransaction, SealedBlockWithSenders};
use reth_provider::{CanonChainTracker, CanonStateNotificationSender, Chain, StateProviderFactory};
use reth_stages::PipelineEvent;
Expand Down Expand Up @@ -88,7 +88,7 @@ where
Pool: TransactionPool + Unpin + 'static,
<Pool as TransactionPool>::Transaction: IntoRecoveredTransaction,
Engine: EngineTypes + 'static,
EvmConfig: reth_node_api::EvmConfig + Clone + Unpin + Send + Sync + 'static,
EvmConfig: ConfigureEvm + Clone + Unpin + Send + Sync + 'static,
{
type Output = ();

Expand Down
5 changes: 1 addition & 4 deletions crates/node-api/src/evm/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
//! Traits and structs for working with a configurable EVM.

// /// EVM configuration trait.
// pub trait EvmConfig: ConfigureEvmEnv + Clone + Send + Sync + 'static {}

/// Traits for working with a configurable EVM.
mod traits;
pub use traits::{ConfigureEvmEnv, EvmConfig};
pub use traits::{ConfigureEvm, ConfigureEvmEnv};
2 changes: 1 addition & 1 deletion crates/node-api/src/evm/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use revm::{Database, Evm, EvmBuilder};
use revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg, SpecId, TxEnv};

/// Trait for configuring the EVM for executing full blocks.
pub trait EvmConfig: ConfigureEvmEnv {
pub trait ConfigureEvm: ConfigureEvmEnv {
/// Returns new EVM with the given database
fn evm<'a, DB: Database + 'a>(db: DB) -> Evm<'a, (), DB> {
EvmBuilder::default().with_db(db).build()
Expand Down
2 changes: 1 addition & 1 deletion crates/node-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ pub use engine::{

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

pub mod primitives;
4 changes: 2 additions & 2 deletions crates/node-builder/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
};
use reth_db::database::Database;
use reth_network::NetworkHandle;
use reth_node_api::{evm::EvmConfig, primitives::NodePrimitives, EngineTypes};
use reth_node_api::{evm::ConfigureEvm, primitives::NodePrimitives, EngineTypes};
use reth_node_core::{
cli::components::FullProvider,
dirs::{ChainPath, DataDirPath},
Expand All @@ -21,7 +21,7 @@ pub trait NodeTypes: Send + Sync + 'static {
/// The node's engine types.
type Engine: EngineTypes;
/// The node's evm configuration.
type Evm: EvmConfig;
type Evm: ConfigureEvm;

/// Returns the node's evm config.
fn evm_config(&self) -> Self::Evm;
Expand Down
8 changes: 4 additions & 4 deletions crates/node-core/src/node_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use reth_network::{
transactions::{TransactionFetcherConfig, TransactionsManagerConfig},
NetworkBuilder, NetworkConfig, NetworkHandle, NetworkManager,
};
use reth_node_api::ConfigureEvmEnv;
use reth_node_api::ConfigureEvm;
use reth_primitives::{
constants::eip4844::{LoadKzgSettingsError, MAINNET_KZG_TRUSTED_SETUP},
kzg::KzgSettings,
Expand Down Expand Up @@ -433,7 +433,7 @@ impl NodeConfig {
) -> eyre::Result<BlockchainTree<DB, EvmProcessorFactory<EvmConfig>>>
where
DB: Database + Unpin + Clone + 'static,
EvmConfig: reth_node_api::EvmConfig + Clone + 'static,
EvmConfig: ConfigureEvm + Clone + 'static,
{
// configure blockchain tree
let tree_externals = TreeExternals::new(
Expand Down Expand Up @@ -547,7 +547,7 @@ impl NodeConfig {
where
DB: Database + Unpin + Clone + 'static,
Client: HeadersClient + BodiesClient + Clone + 'static,
EvmConfig: reth_node_api::EvmConfig + Clone + 'static,
EvmConfig: ConfigureEvm + Clone + 'static,
{
// building network downloaders using the fetch client
let header_downloader = ReverseHeadersDownloaderBuilder::new(config.headers)
Expand Down Expand Up @@ -796,7 +796,7 @@ impl NodeConfig {
DB: Database + Clone + 'static,
H: HeaderDownloader + 'static,
B: BodyDownloader + 'static,
EvmConfig: reth_node_api::EvmConfig + Clone + 'static,
EvmConfig: ConfigureEvm + Clone + 'static,
{
let mut builder = Pipeline::builder();

Expand Down
4 changes: 2 additions & 2 deletions crates/node-ethereum/src/evm.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use reth_node_api::{ConfigureEvmEnv, EvmConfig};
use reth_node_api::{ConfigureEvm, ConfigureEvmEnv};
use reth_primitives::{
revm::{config::revm_spec, env::fill_tx_env},
revm_primitives::{AnalysisKind, CfgEnvWithHandlerCfg, TxEnv},
Expand Down Expand Up @@ -44,7 +44,7 @@ impl ConfigureEvmEnv for EthEvmConfig {
}
}

impl EvmConfig for EthEvmConfig {}
impl ConfigureEvm for EthEvmConfig {}

#[cfg(test)]
mod tests {
Expand Down
4 changes: 2 additions & 2 deletions crates/revm/src/factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
stack::{InspectorStack, InspectorStackConfig},
};
use reth_interfaces::executor::BlockExecutionError;
use reth_node_api::ConfigureEvmEnv;
use reth_node_api::ConfigureEvm;
use reth_primitives::ChainSpec;
use reth_provider::{ExecutorFactory, PrunableBlockExecutor, StateProvider};
use std::sync::Arc;
Expand Down Expand Up @@ -39,7 +39,7 @@ impl<EvmConfig> EvmProcessorFactory<EvmConfig> {

impl<EvmConfig> ExecutorFactory for EvmProcessorFactory<EvmConfig>
where
EvmConfig: reth_node_api::EvmConfig + Send + Sync + Clone + 'static,
EvmConfig: ConfigureEvm + Send + Sync + Clone + 'static,
{
fn with_state<'a, SP: StateProvider + 'a>(
&'a self,
Expand Down
27 changes: 12 additions & 15 deletions crates/revm/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
state_change::{apply_beacon_root_contract_call, post_block_balance_increments},
};
use reth_interfaces::executor::{BlockExecutionError, BlockValidationError};
use reth_node_api::ConfigureEvmEnv;
use reth_node_api::ConfigureEvm;
use reth_primitives::{
Address, Block, BlockNumber, BlockWithSenders, Bloom, ChainSpec, GotExpected, Hardfork, Header,
PruneMode, PruneModes, PruneSegmentError, Receipt, ReceiptWithBloom, Receipts,
Expand Down Expand Up @@ -83,7 +83,7 @@ pub struct EVMProcessor<'a, EvmConfig> {

impl<'a, EvmConfig> EVMProcessor<'a, EvmConfig>
where
EvmConfig: reth_node_api::EvmConfig,
EvmConfig: ConfigureEvm,
{
/// Return chain spec.
pub fn chain_spec(&self) -> &Arc<ChainSpec> {
Expand All @@ -93,17 +93,14 @@ where
/// Create a new pocessor with the given chain spec.
pub fn new(chain_spec: Arc<ChainSpec>, evm_config: EvmConfig) -> Self {
// create evm with boxed empty db that is going to be set later.
let evm = Evm::builder()
.with_db(
Box::new(
StateBuilder::new()
.with_database_boxed(Box::new(EmptyDBTyped::<ProviderError>::new())),
)
.build(),
)
// Hook and inspector stack that we want to invoke on that hook.
.with_external_context(InspectorStack::new(InspectorStackConfig::default()))
.build();
let db = Box::new(
StateBuilder::new().with_database_boxed(Box::new(EmptyDBTyped::<ProviderError>::new())),
)
.build();

// Hook and inspector stack that we want to invoke on that hook.
let stack = InspectorStack::new(InspectorStackConfig::default());
let evm = EvmConfig::evm_with_inspector(db, stack);
EVMProcessor {
chain_spec,
evm,
Expand Down Expand Up @@ -407,7 +404,7 @@ where
#[cfg(not(feature = "optimism"))]
impl<'a, EvmConfig> BlockExecutor for EVMProcessor<'a, EvmConfig>
where
EvmConfig: reth_node_api::EvmConfig,
EvmConfig: ConfigureEvm,
{
type Error = BlockExecutionError;

Expand Down Expand Up @@ -521,7 +518,7 @@ where

impl<'a, EvmConfig> PrunableBlockExecutor for EVMProcessor<'a, EvmConfig>
where
EvmConfig: reth_node_api::EvmConfig,
EvmConfig: ConfigureEvm,
{
fn set_tip(&mut self, tip: BlockNumber) {
self.tip = Some(tip);
Expand Down