mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: rm optimism feature from chainspec (#11722)
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -6532,7 +6532,6 @@ dependencies = [
|
|||||||
"once_cell",
|
"once_cell",
|
||||||
"reth-ethereum-forks",
|
"reth-ethereum-forks",
|
||||||
"reth-network-peers",
|
"reth-network-peers",
|
||||||
"reth-optimism-forks",
|
|
||||||
"reth-primitives-traits",
|
"reth-primitives-traits",
|
||||||
"reth-trie-common",
|
"reth-trie-common",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
|||||||
@ -17,9 +17,6 @@ reth-network-peers.workspace = true
|
|||||||
reth-trie-common.workspace = true
|
reth-trie-common.workspace = true
|
||||||
reth-primitives-traits.workspace = true
|
reth-primitives-traits.workspace = true
|
||||||
|
|
||||||
# op-reth
|
|
||||||
reth-optimism-forks = { workspace = true, optional = true }
|
|
||||||
|
|
||||||
# ethereum
|
# ethereum
|
||||||
alloy-chains = { workspace = true, features = ["serde", "rlp"] }
|
alloy-chains = { workspace = true, features = ["serde", "rlp"] }
|
||||||
alloy-eips = { workspace = true, features = ["serde"] }
|
alloy-eips = { workspace = true, features = ["serde"] }
|
||||||
@ -42,7 +39,6 @@ alloy-genesis.workspace = true
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std"]
|
default = ["std"]
|
||||||
optimism = ["reth-optimism-forks"]
|
|
||||||
std = [
|
std = [
|
||||||
"alloy-chains/std",
|
"alloy-chains/std",
|
||||||
"alloy-eips/std",
|
"alloy-eips/std",
|
||||||
|
|||||||
@ -99,6 +99,6 @@ impl EthChainSpec for ChainSpec {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn is_optimism(&self) -> bool {
|
fn is_optimism(&self) -> bool {
|
||||||
Self::is_optimism(self)
|
self.chain.is_optimism()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,7 +33,7 @@ pub use reth_ethereum_forks::*;
|
|||||||
|
|
||||||
pub use api::EthChainSpec;
|
pub use api::EthChainSpec;
|
||||||
pub use info::ChainInfo;
|
pub use info::ChainInfo;
|
||||||
#[cfg(feature = "test-utils")]
|
#[cfg(any(test, feature = "test-utils"))]
|
||||||
pub use spec::test_fork_ids;
|
pub use spec::test_fork_ids;
|
||||||
pub use spec::{
|
pub use spec::{
|
||||||
BaseFeeParams, BaseFeeParamsKind, ChainSpec, ChainSpecBuilder, ChainSpecProvider,
|
BaseFeeParams, BaseFeeParamsKind, ChainSpec, ChainSpecBuilder, ChainSpecProvider,
|
||||||
|
|||||||
@ -239,21 +239,6 @@ impl ChainSpec {
|
|||||||
self.chain.is_ethereum()
|
self.chain.is_ethereum()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns `true` if this chain contains Optimism configuration.
|
|
||||||
#[inline]
|
|
||||||
#[cfg(feature = "optimism")]
|
|
||||||
pub fn is_optimism(&self) -> bool {
|
|
||||||
self.chain.is_optimism() ||
|
|
||||||
self.hardforks.get(reth_optimism_forks::OptimismHardfork::Bedrock).is_some()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns `true` if this chain contains Optimism configuration.
|
|
||||||
#[inline]
|
|
||||||
#[cfg(not(feature = "optimism"))]
|
|
||||||
pub const fn is_optimism(&self) -> bool {
|
|
||||||
self.chain.is_optimism()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns `true` if this chain is Optimism mainnet.
|
/// Returns `true` if this chain is Optimism mainnet.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_optimism_mainnet(&self) -> bool {
|
pub fn is_optimism_mainnet(&self) -> bool {
|
||||||
@ -706,9 +691,6 @@ impl EthereumHardforks for ChainSpec {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "optimism")]
|
|
||||||
impl reth_optimism_forks::OptimismHardforks for ChainSpec {}
|
|
||||||
|
|
||||||
/// A trait for reading the current chainspec.
|
/// A trait for reading the current chainspec.
|
||||||
#[auto_impl::auto_impl(&, Arc)]
|
#[auto_impl::auto_impl(&, Arc)]
|
||||||
pub trait ChainSpecProvider: Send + Sync {
|
pub trait ChainSpecProvider: Send + Sync {
|
||||||
|
|||||||
@ -28,6 +28,7 @@ reth-tokio-util.workspace = true
|
|||||||
reth-engine-primitives.workspace = true
|
reth-engine-primitives.workspace = true
|
||||||
reth-network-p2p.workspace = true
|
reth-network-p2p.workspace = true
|
||||||
reth-node-types.workspace = true
|
reth-node-types.workspace = true
|
||||||
|
reth-chainspec = { workspace = true, optional = true }
|
||||||
|
|
||||||
# ethereum
|
# ethereum
|
||||||
alloy-primitives.workspace = true
|
alloy-primitives.workspace = true
|
||||||
@ -48,8 +49,6 @@ thiserror.workspace = true
|
|||||||
schnellru.workspace = true
|
schnellru.workspace = true
|
||||||
itertools.workspace = true
|
itertools.workspace = true
|
||||||
|
|
||||||
reth-chainspec = { workspace = true, optional = true }
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
# reth
|
# reth
|
||||||
reth-payload-builder = { workspace = true, features = ["test-utils"] }
|
reth-payload-builder = { workspace = true, features = ["test-utils"] }
|
||||||
@ -78,8 +77,8 @@ assert_matches.workspace = true
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
optimism = [
|
optimism = [
|
||||||
|
"reth-chainspec",
|
||||||
"reth-primitives/optimism",
|
"reth-primitives/optimism",
|
||||||
"reth-provider/optimism",
|
"reth-provider/optimism",
|
||||||
"reth-blockchain-tree/optimism",
|
"reth-blockchain-tree/optimism",
|
||||||
"reth-chainspec"
|
|
||||||
]
|
]
|
||||||
|
|||||||
@ -462,8 +462,7 @@ where
|
|||||||
) -> bool {
|
) -> bool {
|
||||||
// On Optimism, the proposers are allowed to reorg their own chain at will.
|
// On Optimism, the proposers are allowed to reorg their own chain at will.
|
||||||
#[cfg(feature = "optimism")]
|
#[cfg(feature = "optimism")]
|
||||||
if reth_chainspec::EthChainSpec::chain(self.blockchain.chain_spec().as_ref()).is_optimism()
|
if reth_chainspec::EthChainSpec::is_optimism(&self.blockchain.chain_spec()) {
|
||||||
{
|
|
||||||
debug!(
|
debug!(
|
||||||
target: "consensus::engine",
|
target: "consensus::engine",
|
||||||
fcu_head_num=?header.number,
|
fcu_head_num=?header.number,
|
||||||
|
|||||||
@ -13,7 +13,7 @@ workspace = true
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# reth
|
# reth
|
||||||
reth-chainspec = { workspace = true, features = ["optimism"] }
|
reth-chainspec.workspace = true
|
||||||
reth-ethereum-forks.workspace = true
|
reth-ethereum-forks.workspace = true
|
||||||
reth-primitives-traits.workspace = true
|
reth-primitives-traits.workspace = true
|
||||||
reth-network-peers.workspace = true
|
reth-network-peers.workspace = true
|
||||||
|
|||||||
@ -36,6 +36,7 @@ use reth_chainspec::{
|
|||||||
};
|
};
|
||||||
use reth_ethereum_forks::{ChainHardforks, EthereumHardfork, ForkCondition, Hardfork};
|
use reth_ethereum_forks::{ChainHardforks, EthereumHardfork, ForkCondition, Hardfork};
|
||||||
use reth_network_peers::NodeRecord;
|
use reth_network_peers::NodeRecord;
|
||||||
|
use reth_optimism_forks::OptimismHardforks;
|
||||||
use reth_primitives_traits::Header;
|
use reth_primitives_traits::Header;
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
pub(crate) use std::sync::LazyLock;
|
pub(crate) use std::sync::LazyLock;
|
||||||
@ -267,6 +268,8 @@ impl EthereumHardforks for OpChainSpec {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl OptimismHardforks for OpChainSpec {}
|
||||||
|
|
||||||
impl From<Genesis> for OpChainSpec {
|
impl From<Genesis> for OpChainSpec {
|
||||||
fn from(genesis: Genesis) -> Self {
|
fn from(genesis: Genesis) -> Self {
|
||||||
use reth_optimism_forks::OptimismHardfork;
|
use reth_optimism_forks::OptimismHardfork;
|
||||||
|
|||||||
@ -124,7 +124,7 @@ impl ConfigureEvmEnv for OptimismEvmConfig {
|
|||||||
cfg_env.perf_analyse_created_bytecodes = AnalysisKind::Analyse;
|
cfg_env.perf_analyse_created_bytecodes = AnalysisKind::Analyse;
|
||||||
|
|
||||||
cfg_env.handler_cfg.spec_id = spec_id;
|
cfg_env.handler_cfg.spec_id = spec_id;
|
||||||
cfg_env.handler_cfg.is_optimism = self.chain_spec.is_optimism();
|
cfg_env.handler_cfg.is_optimism = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn next_cfg_and_block_env(
|
fn next_cfg_and_block_env(
|
||||||
|
|||||||
@ -79,7 +79,6 @@ op-alloy-consensus.workspace = true
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
optimism = [
|
optimism = [
|
||||||
"reth-chainspec/optimism",
|
|
||||||
"reth-primitives/optimism",
|
"reth-primitives/optimism",
|
||||||
"reth-provider/optimism",
|
"reth-provider/optimism",
|
||||||
"reth-optimism-evm/optimism",
|
"reth-optimism-evm/optimism",
|
||||||
|
|||||||
@ -49,7 +49,6 @@ sha2.workspace = true
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
optimism = [
|
optimism = [
|
||||||
"reth-chainspec/optimism",
|
|
||||||
"reth-primitives/optimism",
|
"reth-primitives/optimism",
|
||||||
"reth-provider/optimism",
|
"reth-provider/optimism",
|
||||||
"reth-optimism-evm/optimism",
|
"reth-optimism-evm/optimism",
|
||||||
|
|||||||
@ -4,7 +4,6 @@ use alloy_eips::eip2718::Encodable2718;
|
|||||||
use alloy_rpc_types::{AnyReceiptEnvelope, Log, TransactionReceipt};
|
use alloy_rpc_types::{AnyReceiptEnvelope, Log, TransactionReceipt};
|
||||||
use op_alloy_consensus::{OpDepositReceipt, OpDepositReceiptWithBloom, OpReceiptEnvelope};
|
use op_alloy_consensus::{OpDepositReceipt, OpDepositReceiptWithBloom, OpReceiptEnvelope};
|
||||||
use op_alloy_rpc_types::{receipt::L1BlockInfo, OpTransactionReceipt, OpTransactionReceiptFields};
|
use op_alloy_rpc_types::{receipt::L1BlockInfo, OpTransactionReceipt, OpTransactionReceiptFields};
|
||||||
use reth_chainspec::ChainSpec;
|
|
||||||
use reth_node_api::{FullNodeComponents, NodeTypes};
|
use reth_node_api::{FullNodeComponents, NodeTypes};
|
||||||
use reth_optimism_chainspec::OpChainSpec;
|
use reth_optimism_chainspec::OpChainSpec;
|
||||||
use reth_optimism_evm::RethL1BlockInfo;
|
use reth_optimism_evm::RethL1BlockInfo;
|
||||||
@ -55,25 +54,6 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N> OpEthApi<N>
|
|
||||||
where
|
|
||||||
N: FullNodeComponents<Types: NodeTypes<ChainSpec = ChainSpec>>,
|
|
||||||
{
|
|
||||||
/// Builds a receipt w.r.t. chain spec.
|
|
||||||
pub fn build_op_receipt_meta(
|
|
||||||
&self,
|
|
||||||
tx: &TransactionSigned,
|
|
||||||
l1_block_info: revm::L1BlockInfo,
|
|
||||||
receipt: &Receipt,
|
|
||||||
) -> Result<OpTransactionReceiptFields, OpEthApiError> {
|
|
||||||
Ok(OpReceiptFieldsBuilder::default()
|
|
||||||
.l1_block_info(&self.inner.provider().chain_spec(), tx, l1_block_info)?
|
|
||||||
.deposit_nonce(receipt.deposit_nonce)
|
|
||||||
.deposit_version(receipt.deposit_receipt_version)
|
|
||||||
.build())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// L1 fee and data gas for a non-deposit transaction, or deposit nonce and receipt version for a
|
/// L1 fee and data gas for a non-deposit transaction, or deposit nonce and receipt version for a
|
||||||
/// deposit transaction.
|
/// deposit transaction.
|
||||||
#[derive(Debug, Default, Clone)]
|
#[derive(Debug, Default, Clone)]
|
||||||
@ -113,7 +93,7 @@ impl OpReceiptFieldsBuilder {
|
|||||||
/// Applies [`L1BlockInfo`](revm::L1BlockInfo).
|
/// Applies [`L1BlockInfo`](revm::L1BlockInfo).
|
||||||
pub fn l1_block_info(
|
pub fn l1_block_info(
|
||||||
mut self,
|
mut self,
|
||||||
chain_spec: &ChainSpec,
|
chain_spec: &OpChainSpec,
|
||||||
tx: &TransactionSigned,
|
tx: &TransactionSigned,
|
||||||
l1_block_info: revm::L1BlockInfo,
|
l1_block_info: revm::L1BlockInfo,
|
||||||
) -> Result<Self, OpEthApiError> {
|
) -> Result<Self, OpEthApiError> {
|
||||||
|
|||||||
Reference in New Issue
Block a user