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

renamed OptimismEvmConfig to OpEvmConfig #12284

Merged
merged 1 commit into from
Nov 2, 2024
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
8 changes: 4 additions & 4 deletions crates/optimism/evm/src/execute.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Optimism block execution strategy.

use crate::{l1::ensure_create2_deployer, OptimismBlockExecutionError, OptimismEvmConfig};
use crate::{l1::ensure_create2_deployer, OpEvmConfig, OptimismBlockExecutionError};
use alloc::{boxed::Box, sync::Arc, vec::Vec};
use alloy_consensus::Transaction as _;
use alloy_eips::eip7685::Requests;
Expand Down Expand Up @@ -29,7 +29,7 @@ use tracing::trace;

/// Factory for [`OpExecutionStrategy`].
#[derive(Debug, Clone)]
pub struct OpExecutionStrategyFactory<EvmConfig = OptimismEvmConfig> {
pub struct OpExecutionStrategyFactory<EvmConfig = OpEvmConfig> {
/// The chainspec
chain_spec: Arc<OpChainSpec>,
/// How to create an EVM.
Expand All @@ -39,7 +39,7 @@ pub struct OpExecutionStrategyFactory<EvmConfig = OptimismEvmConfig> {
impl OpExecutionStrategyFactory {
/// Creates a new default optimism executor strategy factory.
pub fn optimism(chain_spec: Arc<OpChainSpec>) -> Self {
Self::new(chain_spec.clone(), OptimismEvmConfig::new(chain_spec))
Self::new(chain_spec.clone(), OpEvmConfig::new(chain_spec))
}
}

Expand Down Expand Up @@ -339,7 +339,7 @@ mod tests {
chain_spec: Arc<OpChainSpec>,
) -> BasicBlockExecutorProvider<OpExecutionStrategyFactory> {
let strategy_factory =
OpExecutionStrategyFactory::new(chain_spec.clone(), OptimismEvmConfig::new(chain_spec));
OpExecutionStrategyFactory::new(chain_spec.clone(), OpEvmConfig::new(chain_spec));

BasicBlockExecutorProvider::new(strategy_factory)
}
Expand Down
20 changes: 10 additions & 10 deletions crates/optimism/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ use revm_primitives::{

/// Optimism-related EVM configuration.
#[derive(Debug, Clone)]
pub struct OptimismEvmConfig {
pub struct OpEvmConfig {
chain_spec: Arc<OpChainSpec>,
}

impl OptimismEvmConfig {
/// Creates a new [`OptimismEvmConfig`] with the given chain spec.
impl OpEvmConfig {
/// Creates a new [`OpEvmConfig`] with the given chain spec.
pub const fn new(chain_spec: Arc<OpChainSpec>) -> Self {
Self { chain_spec }
}
Expand All @@ -54,7 +54,7 @@ impl OptimismEvmConfig {
}
}

impl ConfigureEvmEnv for OptimismEvmConfig {
impl ConfigureEvmEnv for OpEvmConfig {
type Header = Header;
type Error = DecodeError;

Expand Down Expand Up @@ -174,7 +174,7 @@ impl ConfigureEvmEnv for OptimismEvmConfig {
}
}

impl ConfigureEvm for OptimismEvmConfig {
impl ConfigureEvm for OpEvmConfig {
type DefaultExternalContext<'a> = ();

fn evm<DB: Database>(&self, db: DB) -> Evm<'_, Self::DefaultExternalContext<'_>, DB> {
Expand Down Expand Up @@ -226,8 +226,8 @@ mod tests {
sync::Arc,
};

fn test_evm_config() -> OptimismEvmConfig {
OptimismEvmConfig::new(BASE_MAINNET.clone())
fn test_evm_config() -> OpEvmConfig {
OpEvmConfig::new(BASE_MAINNET.clone())
}

#[test]
Expand All @@ -254,9 +254,9 @@ mod tests {
// Define the total difficulty as zero (default)
let total_difficulty = U256::ZERO;

// Use the `OptimismEvmConfig` to fill the `cfg_env` and `block_env` based on the ChainSpec,
// Use the `OpEvmConfig` to fill the `cfg_env` and `block_env` based on the ChainSpec,
// Header, and total difficulty
OptimismEvmConfig::new(Arc::new(OpChainSpec { inner: chain_spec.clone() }))
OpEvmConfig::new(Arc::new(OpChainSpec { inner: chain_spec.clone() }))
.fill_cfg_and_block_env(&mut cfg_env, &mut block_env, &header, total_difficulty);

// Assert that the chain ID in the `cfg_env` is correctly set to the chain ID of the
Expand All @@ -266,7 +266,7 @@ mod tests {

#[test]
fn test_evm_configure() {
// Create a default `OptimismEvmConfig`
// Create a default `OpEvmConfig`
let evm_config = test_evm_config();

// Initialize an empty database wrapped in CacheDB
Expand Down
8 changes: 4 additions & 4 deletions crates/optimism/node/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use reth_node_builder::{
};
use reth_optimism_chainspec::OpChainSpec;
use reth_optimism_consensus::OpBeaconConsensus;
use reth_optimism_evm::{OpExecutionStrategyFactory, OptimismEvmConfig};
use reth_optimism_evm::{OpEvmConfig, OpExecutionStrategyFactory};
use reth_optimism_rpc::OpEthApi;
use reth_payload_builder::{PayloadBuilderHandle, PayloadBuilderService};
use reth_primitives::{Block, Header};
Expand Down Expand Up @@ -185,14 +185,14 @@ impl<Node> ExecutorBuilder<Node> for OpExecutorBuilder
where
Node: FullNodeTypes<Types: NodeTypes<ChainSpec = OpChainSpec>>,
{
type EVM = OptimismEvmConfig;
type EVM = OpEvmConfig;
type Executor = BasicBlockExecutorProvider<OpExecutionStrategyFactory>;

async fn build_evm(
self,
ctx: &BuilderContext<Node>,
) -> eyre::Result<(Self::EVM, Self::Executor)> {
let evm_config = OptimismEvmConfig::new(ctx.chain_spec());
let evm_config = OpEvmConfig::new(ctx.chain_spec());
let strategy_factory =
OpExecutionStrategyFactory::new(ctx.chain_spec(), evm_config.clone());
let executor = BasicBlockExecutorProvider::new(strategy_factory);
Expand Down Expand Up @@ -359,7 +359,7 @@ where
ctx: &BuilderContext<Node>,
pool: Pool,
) -> eyre::Result<PayloadBuilderHandle<OptimismEngineTypes>> {
self.spawn(OptimismEvmConfig::new(ctx.chain_spec()), ctx, pool)
self.spawn(OpEvmConfig::new(ctx.chain_spec()), ctx, pool)
}
}

Expand Down
Loading