refactor: BlockchainTestCase::run rm repetitive convert ForkSpec to ChainSpec (#11896)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
nk_ysg
2024-10-24 13:26:25 +08:00
committed by GitHub
parent d7f08cd876
commit fcca8b1523
2 changed files with 7 additions and 9 deletions

View File

@ -6,6 +6,7 @@ use crate::{
};
use alloy_rlp::Decodable;
use rayon::iter::{ParallelBridge, ParallelIterator};
use reth_chainspec::ChainSpec;
use reth_primitives::{BlockBody, SealedBlock, StaticFileSegment};
use reth_provider::{
providers::StaticFileWriter, test_utils::create_test_provider_factory_with_chain_spec,
@ -83,11 +84,10 @@ impl Case for BlockchainTestCase {
.par_bridge()
.try_for_each(|case| {
// Create a new test database and initialize a provider for the test case.
let provider = create_test_provider_factory_with_chain_spec(Arc::new(
case.network.clone().into(),
))
.database_provider_rw()
.unwrap();
let chain_spec: Arc<ChainSpec> = Arc::new(case.network.into());
let provider = create_test_provider_factory_with_chain_spec(chain_spec.clone())
.database_provider_rw()
.unwrap();
// Insert initial test state into the provider.
provider.insert_historical_block(
@ -127,9 +127,7 @@ impl Case for BlockchainTestCase {
// Execute the execution stage using the EVM processor factory for the test case
// network.
let _ = ExecutionStage::new_with_executor(
reth_evm_ethereum::execute::EthExecutorProvider::ethereum(Arc::new(
case.network.clone().into(),
)),
reth_evm_ethereum::execute::EthExecutorProvider::ethereum(chain_spec),
)
.execute(
&provider,

View File

@ -257,7 +257,7 @@ impl Account {
}
/// Fork specification.
#[derive(Debug, PartialEq, Eq, PartialOrd, Hash, Ord, Clone, Deserialize)]
#[derive(Debug, PartialEq, Eq, PartialOrd, Hash, Ord, Clone, Copy, Deserialize)]
pub enum ForkSpec {
/// Frontier
Frontier,