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

chore: remove unused methods from EvmEnvProviders #9148

Merged
merged 2 commits into from
Jun 27, 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
14 changes: 0 additions & 14 deletions crates/evm/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,6 @@ pub trait EvmEnvProvider: Send + Sync {
where
EvmConfig: ConfigureEvmEnv;

/// Fills the [BlockEnv] fields with values specific to the given [BlockHashOrNumber].
fn fill_block_env_at(
&self,
block_env: &mut BlockEnv,
at: BlockHashOrNumber,
) -> ProviderResult<()>;

/// Fills the [BlockEnv] fields with values specific to the given [Header].
fn fill_block_env_with_header(
&self,
block_env: &mut BlockEnv,
header: &Header,
) -> ProviderResult<()>;

/// Fills the [`CfgEnvWithHandlerCfg`] fields with values specific to the given
/// [BlockHashOrNumber].
fn fill_cfg_env_at<EvmConfig>(
Expand Down
16 changes: 0 additions & 16 deletions crates/storage/provider/src/providers/database/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,22 +519,6 @@ impl<DB: Database> EvmEnvProvider for ProviderFactory<DB> {
self.provider()?.fill_env_with_header(cfg, block_env, header, evm_config)
}

fn fill_block_env_at(
&self,
block_env: &mut BlockEnv,
at: BlockHashOrNumber,
) -> ProviderResult<()> {
self.provider()?.fill_block_env_at(block_env, at)
}

fn fill_block_env_with_header(
&self,
block_env: &mut BlockEnv,
header: &Header,
) -> ProviderResult<()> {
self.provider()?.fill_block_env_with_header(block_env, header)
}

fn fill_cfg_env_at<EvmConfig>(
&self,
cfg: &mut CfgEnvWithHandlerCfg,
Expand Down
43 changes: 3 additions & 40 deletions crates/storage/provider/src/providers/database/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ use reth_evm::ConfigureEvmEnv;
use reth_execution_types::{Chain, ExecutionOutcome};
use reth_network_p2p::headers::downloader::SyncTarget;
use reth_primitives::{
keccak256,
revm::{config::revm_spec, env::fill_block_env},
Account, Address, Block, BlockHash, BlockHashOrNumber, BlockNumber, BlockWithSenders,
GotExpected, Head, Header, Receipt, Requests, SealedBlock, SealedBlockWithSenders,
keccak256, Account, Address, Block, BlockHash, BlockHashOrNumber, BlockNumber,
BlockWithSenders, GotExpected, Header, Receipt, Requests, SealedBlock, SealedBlockWithSenders,
SealedHeader, StaticFileSegment, StorageEntry, TransactionMeta, TransactionSigned,
TransactionSignedEcRecovered, TransactionSignedNoHash, TxHash, TxNumber, Withdrawal,
Withdrawals, B256, U256,
Expand All @@ -48,7 +46,7 @@ use reth_trie::{
updates::TrieUpdates,
HashedPostState, Nibbles, StateRoot,
};
use revm::primitives::{BlockEnv, CfgEnvWithHandlerCfg, SpecId};
use revm::primitives::{BlockEnv, CfgEnvWithHandlerCfg};
use std::{
cmp::Ordering,
collections::{hash_map, BTreeMap, BTreeSet, HashMap, HashSet},
Expand Down Expand Up @@ -2005,41 +2003,6 @@ impl<TX: DbTx> EvmEnvProvider for DatabaseProvider<TX> {
Ok(())
}

fn fill_block_env_at(
&self,
block_env: &mut BlockEnv,
at: BlockHashOrNumber,
) -> ProviderResult<()> {
let hash = self.convert_number(at)?.ok_or(ProviderError::HeaderNotFound(at))?;
let header = self.header(&hash)?.ok_or(ProviderError::HeaderNotFound(at))?;

self.fill_block_env_with_header(block_env, &header)
}

fn fill_block_env_with_header(
&self,
block_env: &mut BlockEnv,
header: &Header,
) -> ProviderResult<()> {
let total_difficulty = self
.header_td_by_number(header.number)?
.ok_or_else(|| ProviderError::HeaderNotFound(header.number.into()))?;
let spec_id = revm_spec(
&self.chain_spec,
Head {
number: header.number,
timestamp: header.timestamp,
difficulty: header.difficulty,
total_difficulty,
// Not required
hash: Default::default(),
},
);
let after_merge = spec_id >= SpecId::MERGE;
fill_block_env(block_env, &self.chain_spec, header, after_merge);
Ok(())
}

fn fill_cfg_env_at<EvmConfig>(
&self,
cfg: &mut CfgEnvWithHandlerCfg,
Expand Down
16 changes: 0 additions & 16 deletions crates/storage/provider/src/providers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,22 +538,6 @@ where
self.database.provider()?.fill_env_with_header(cfg, block_env, header, evm_config)
}

fn fill_block_env_at(
&self,
block_env: &mut BlockEnv,
at: BlockHashOrNumber,
) -> ProviderResult<()> {
self.database.provider()?.fill_block_env_at(block_env, at)
}

fn fill_block_env_with_header(
&self,
block_env: &mut BlockEnv,
header: &Header,
) -> ProviderResult<()> {
self.database.provider()?.fill_block_env_with_header(block_env, header)
}

fn fill_cfg_env_at<EvmConfig>(
&self,
cfg: &mut CfgEnvWithHandlerCfg,
Expand Down
16 changes: 0 additions & 16 deletions crates/storage/provider/src/test_utils/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -599,22 +599,6 @@ impl EvmEnvProvider for MockEthProvider {
Ok(())
}

fn fill_block_env_at(
&self,
_block_env: &mut BlockEnv,
_at: BlockHashOrNumber,
) -> ProviderResult<()> {
Ok(())
}

fn fill_block_env_with_header(
&self,
_block_env: &mut BlockEnv,
_header: &Header,
) -> ProviderResult<()> {
Ok(())
}

fn fill_cfg_env_at<EvmConfig>(
&self,
_cfg: &mut CfgEnvWithHandlerCfg,
Expand Down
16 changes: 0 additions & 16 deletions crates/storage/provider/src/test_utils/noop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,22 +358,6 @@ impl EvmEnvProvider for NoopProvider {
Ok(())
}

fn fill_block_env_at(
&self,
_block_env: &mut BlockEnv,
_at: BlockHashOrNumber,
) -> ProviderResult<()> {
Ok(())
}

fn fill_block_env_with_header(
&self,
_block_env: &mut BlockEnv,
_header: &Header,
) -> ProviderResult<()> {
Ok(())
}

fn fill_cfg_env_at<EvmConfig>(
&self,
_cfg: &mut CfgEnvWithHandlerCfg,
Expand Down
Loading