mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
renamed OptimismEvmConfig to OpEvmConfig (#12284)
This commit is contained in:
@ -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;
|
||||
@ -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.
|
||||
@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -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 }
|
||||
}
|
||||
@ -54,7 +54,7 @@ impl OptimismEvmConfig {
|
||||
}
|
||||
}
|
||||
|
||||
impl ConfigureEvmEnv for OptimismEvmConfig {
|
||||
impl ConfigureEvmEnv for OpEvmConfig {
|
||||
type Header = Header;
|
||||
type Error = DecodeError;
|
||||
|
||||
@ -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> {
|
||||
@ -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]
|
||||
@ -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
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user