mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-02-19 03:04:27 -05:00
chore(op-reth): remove op-reth dependencies from core reth library crates (#21492)
This commit is contained in:
5
Cargo.lock
generated
5
Cargo.lock
generated
@@ -8041,6 +8041,7 @@ dependencies = [
|
||||
"derive_more",
|
||||
"metrics",
|
||||
"modular-bitfield",
|
||||
"op-alloy-consensus",
|
||||
"parity-scale-codec",
|
||||
"proptest",
|
||||
"proptest-arbitrary-interop",
|
||||
@@ -8048,7 +8049,6 @@ dependencies = [
|
||||
"reth-codecs",
|
||||
"reth-db-models",
|
||||
"reth-ethereum-primitives",
|
||||
"reth-optimism-primitives",
|
||||
"reth-primitives-traits",
|
||||
"reth-prune-types",
|
||||
"reth-stages-types",
|
||||
@@ -8319,7 +8319,6 @@ dependencies = [
|
||||
"reth-chainspec",
|
||||
"reth-engine-primitives",
|
||||
"reth-ethereum-engine-primitives",
|
||||
"reth-optimism-chainspec",
|
||||
"reth-payload-builder",
|
||||
"reth-payload-primitives",
|
||||
"reth-primitives-traits",
|
||||
@@ -10526,9 +10525,7 @@ dependencies = [
|
||||
"op-alloy-rpc-types",
|
||||
"reth-ethereum-primitives",
|
||||
"reth-evm",
|
||||
"reth-optimism-primitives",
|
||||
"reth-primitives-traits",
|
||||
"reth-storage-api",
|
||||
"serde_json",
|
||||
"thiserror 2.0.18",
|
||||
]
|
||||
|
||||
@@ -32,9 +32,7 @@ futures-util.workspace = true
|
||||
# misc
|
||||
eyre.workspace = true
|
||||
tracing.workspace = true
|
||||
|
||||
op-alloy-rpc-types-engine = { workspace = true, optional = true }
|
||||
reth-optimism-chainspec = { workspace = true, optional = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
@@ -42,7 +40,6 @@ workspace = true
|
||||
[features]
|
||||
op = [
|
||||
"dep:op-alloy-rpc-types-engine",
|
||||
"dep:reth-optimism-chainspec",
|
||||
"reth-payload-primitives/op",
|
||||
"reth-primitives-traits/op",
|
||||
]
|
||||
|
||||
@@ -72,13 +72,18 @@ where
|
||||
&self,
|
||||
parent: &SealedHeader<ChainSpec::Header>,
|
||||
) -> op_alloy_rpc_types_engine::OpPayloadAttributes {
|
||||
/// Dummy system transaction for dev mode.
|
||||
/// OP Mainnet transaction at index 0 in block 124665056.
|
||||
///
|
||||
/// <https://optimistic.etherscan.io/tx/0x312e290cf36df704a2217b015d6455396830b0ce678b860ebfcc30f41403d7b1>
|
||||
const TX_SET_L1_BLOCK_OP_MAINNET_BLOCK_124665056: [u8; 251] = alloy_primitives::hex!(
|
||||
"7ef8f8a0683079df94aa5b9cf86687d739a60a9b4f0835e520ec4d664e2e415dca17a6df94deaddeaddeaddeaddeaddeaddeaddeaddead00019442000000000000000000000000000000000000158080830f424080b8a4440a5e200000146b000f79c500000000000000040000000066d052e700000000013ad8a3000000000000000000000000000000000000000000000000000000003ef1278700000000000000000000000000000000000000000000000000000000000000012fdf87b89884a61e74b322bbcf60386f543bfae7827725efaaf0ab1de2294a590000000000000000000000006887246668a3b87f54deb3b94ba47a6f63f32985"
|
||||
);
|
||||
|
||||
op_alloy_rpc_types_engine::OpPayloadAttributes {
|
||||
payload_attributes: self.build(parent),
|
||||
// Add dummy system transaction
|
||||
transactions: Some(vec![
|
||||
reth_optimism_chainspec::constants::TX_SET_L1_BLOCK_OP_MAINNET_BLOCK_124665056
|
||||
.into(),
|
||||
]),
|
||||
transactions: Some(vec![TX_SET_L1_BLOCK_OP_MAINNET_BLOCK_124665056.into()]),
|
||||
no_tx_pool: None,
|
||||
gas_limit: None,
|
||||
eip_1559_params: None,
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
//! OP stack variation of chain spec constants.
|
||||
|
||||
use alloy_primitives::hex;
|
||||
|
||||
//------------------------------- BASE MAINNET -------------------------------//
|
||||
|
||||
/// Max gas limit on Base: <https://basescan.org/block/17208876>
|
||||
@@ -11,13 +9,3 @@ pub const BASE_MAINNET_MAX_GAS_LIMIT: u64 = 105_000_000;
|
||||
|
||||
/// Max gas limit on Base Sepolia: <https://sepolia.basescan.org/block/12506483>
|
||||
pub const BASE_SEPOLIA_MAX_GAS_LIMIT: u64 = 45_000_000;
|
||||
|
||||
//----------------------------------- DEV ------------------------------------//
|
||||
|
||||
/// Dummy system transaction for dev mode
|
||||
/// OP Mainnet transaction at index 0 in block 124665056.
|
||||
///
|
||||
/// <https://optimistic.etherscan.io/tx/0x312e290cf36df704a2217b015d6455396830b0ce678b860ebfcc30f41403d7b1>
|
||||
pub const TX_SET_L1_BLOCK_OP_MAINNET_BLOCK_124665056: [u8; 251] = hex!(
|
||||
"7ef8f8a0683079df94aa5b9cf86687d739a60a9b4f0835e520ec4d664e2e415dca17a6df94deaddeaddeaddeaddeaddeaddeaddeaddead00019442000000000000000000000000000000000000158080830f424080b8a4440a5e200000146b000f79c500000000000000040000000066d052e700000000013ad8a3000000000000000000000000000000000000000000000000000000003ef1278700000000000000000000000000000000000000000000000000000000000000012fdf87b89884a61e74b322bbcf60386f543bfae7827725efaaf0ab1de2294a590000000000000000000000006887246668a3b87f54deb3b94ba47a6f63f32985"
|
||||
);
|
||||
|
||||
@@ -4,14 +4,17 @@ use crate::{OpEthApi, OpEthApiError, SequencerClient};
|
||||
use alloy_primitives::{Bytes, B256};
|
||||
use alloy_rpc_types_eth::TransactionInfo;
|
||||
use futures::StreamExt;
|
||||
use op_alloy_consensus::{transaction::OpTransactionInfo, OpTransaction};
|
||||
use op_alloy_consensus::{
|
||||
transaction::{OpDepositInfo, OpTransactionInfo},
|
||||
OpTransaction,
|
||||
};
|
||||
use reth_chain_state::CanonStateSubscriptions;
|
||||
use reth_optimism_primitives::DepositReceipt;
|
||||
use reth_primitives_traits::{Recovered, SignedTransaction, SignerRecoverable, WithEncoded};
|
||||
use reth_rpc_eth_api::{
|
||||
helpers::{spec::SignersForRpc, EthTransactions, LoadReceipt, LoadTransaction, SpawnBlocking},
|
||||
try_into_op_tx_info, EthApiTypes as _, FromEthApiError, FromEvmError, RpcConvert, RpcNodeCore,
|
||||
RpcReceipt, TxInfoMapper,
|
||||
EthApiTypes as _, FromEthApiError, FromEvmError, RpcConvert, RpcNodeCore, RpcReceipt,
|
||||
TxInfoMapper,
|
||||
};
|
||||
use reth_rpc_eth_types::{block::convert_transaction_receipt, EthApiError, TransactionSource};
|
||||
use reth_storage_api::{errors::ProviderError, ProviderTx, ReceiptProvider, TransactionsProvider};
|
||||
@@ -282,6 +285,18 @@ where
|
||||
type Err = ProviderError;
|
||||
|
||||
fn try_map(&self, tx: &T, tx_info: TransactionInfo) -> Result<Self::Out, ProviderError> {
|
||||
try_into_op_tx_info(&self.provider, tx, tx_info)
|
||||
let deposit_meta = if tx.is_deposit() {
|
||||
self.provider.receipt_by_hash(*tx.tx_hash())?.and_then(|receipt| {
|
||||
receipt.as_deposit_receipt().map(|receipt| OpDepositInfo {
|
||||
deposit_receipt_version: receipt.deposit_receipt_version,
|
||||
deposit_nonce: receipt.deposit_nonce,
|
||||
})
|
||||
})
|
||||
} else {
|
||||
None
|
||||
}
|
||||
.unwrap_or_default();
|
||||
|
||||
Ok(OpTransactionInfo::new(tx_info, deposit_meta))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ workspace = true
|
||||
[dependencies]
|
||||
# reth
|
||||
reth-primitives-traits.workspace = true
|
||||
reth-storage-api = { workspace = true, optional = true }
|
||||
reth-evm.workspace = true
|
||||
reth-ethereum-primitives.workspace = true
|
||||
|
||||
@@ -31,7 +30,6 @@ alloy-evm = { workspace = true, features = ["rpc"] }
|
||||
op-alloy-consensus = { workspace = true, optional = true }
|
||||
op-alloy-rpc-types = { workspace = true, optional = true }
|
||||
op-alloy-network = { workspace = true, optional = true }
|
||||
reth-optimism-primitives = { workspace = true, optional = true }
|
||||
|
||||
# io
|
||||
jsonrpsee-types.workspace = true
|
||||
@@ -51,8 +49,6 @@ op = [
|
||||
"dep:op-alloy-consensus",
|
||||
"dep:op-alloy-rpc-types",
|
||||
"dep:op-alloy-network",
|
||||
"dep:reth-optimism-primitives",
|
||||
"dep:reth-storage-api",
|
||||
"reth-evm/op",
|
||||
"reth-primitives-traits/op",
|
||||
"alloy-evm/op",
|
||||
|
||||
@@ -24,6 +24,3 @@ pub use transaction::{
|
||||
};
|
||||
|
||||
pub use alloy_evm::rpc::{CallFees, CallFeesError, EthTxEnvError, TryIntoTxEnv};
|
||||
|
||||
#[cfg(feature = "op")]
|
||||
pub use transaction::op::*;
|
||||
|
||||
@@ -29,7 +29,7 @@ impl TryFromReceiptResponse<alloy_network::Ethereum> for reth_ethereum_primitive
|
||||
}
|
||||
|
||||
#[cfg(feature = "op")]
|
||||
impl TryFromReceiptResponse<op_alloy_network::Optimism> for reth_optimism_primitives::OpReceipt {
|
||||
impl TryFromReceiptResponse<op_alloy_network::Optimism> for op_alloy_consensus::OpReceipt {
|
||||
type Error = Infallible;
|
||||
|
||||
fn from_receipt_response(
|
||||
|
||||
@@ -872,40 +872,8 @@ pub mod op {
|
||||
use super::*;
|
||||
use alloy_consensus::SignableTransaction;
|
||||
use alloy_signer::Signature;
|
||||
use op_alloy_consensus::{
|
||||
transaction::{OpDepositInfo, OpTransactionInfo},
|
||||
OpTxEnvelope,
|
||||
};
|
||||
use op_alloy_consensus::{transaction::OpTransactionInfo, OpTxEnvelope};
|
||||
use op_alloy_rpc_types::OpTransactionRequest;
|
||||
use reth_optimism_primitives::DepositReceipt;
|
||||
use reth_primitives_traits::SignedTransaction;
|
||||
use reth_storage_api::{errors::ProviderError, ReceiptProvider};
|
||||
|
||||
/// Creates [`OpTransactionInfo`] by adding [`OpDepositInfo`] to [`TransactionInfo`] if `tx` is
|
||||
/// a deposit.
|
||||
pub fn try_into_op_tx_info<Tx, T>(
|
||||
provider: &T,
|
||||
tx: &Tx,
|
||||
tx_info: TransactionInfo,
|
||||
) -> Result<OpTransactionInfo, ProviderError>
|
||||
where
|
||||
Tx: op_alloy_consensus::OpTransaction + SignedTransaction,
|
||||
T: ReceiptProvider<Receipt: DepositReceipt>,
|
||||
{
|
||||
let deposit_meta = if tx.is_deposit() {
|
||||
provider.receipt_by_hash(*tx.tx_hash())?.and_then(|receipt| {
|
||||
receipt.as_deposit_receipt().map(|receipt| OpDepositInfo {
|
||||
deposit_receipt_version: receipt.deposit_receipt_version,
|
||||
deposit_nonce: receipt.deposit_nonce,
|
||||
})
|
||||
})
|
||||
} else {
|
||||
None
|
||||
}
|
||||
.unwrap_or_default();
|
||||
|
||||
Ok(OpTransactionInfo::new(tx_info, deposit_meta))
|
||||
}
|
||||
|
||||
impl<T: op_alloy_consensus::OpTransaction + alloy_consensus::Transaction> FromConsensusTx<T>
|
||||
for op_alloy_rpc_types::Transaction<T>
|
||||
@@ -964,9 +932,7 @@ impl TryFromTransactionResponse<alloy_network::Ethereum>
|
||||
}
|
||||
|
||||
#[cfg(feature = "op")]
|
||||
impl TryFromTransactionResponse<op_alloy_network::Optimism>
|
||||
for reth_optimism_primitives::OpTransactionSigned
|
||||
{
|
||||
impl TryFromTransactionResponse<op_alloy_network::Optimism> for op_alloy_consensus::OpTxEnvelope {
|
||||
type Error = Infallible;
|
||||
|
||||
fn from_transaction_response(
|
||||
@@ -1015,7 +981,6 @@ mod transaction_response_tests {
|
||||
fn test_optimism_transaction_conversion() {
|
||||
use op_alloy_consensus::OpTxEnvelope;
|
||||
use op_alloy_network::Optimism;
|
||||
use reth_optimism_primitives::OpTransactionSigned;
|
||||
|
||||
let signed_tx = Signed::new_unchecked(
|
||||
TxLegacy::default(),
|
||||
@@ -1038,7 +1003,10 @@ mod transaction_response_tests {
|
||||
deposit_receipt_version: None,
|
||||
};
|
||||
|
||||
let result = <OpTransactionSigned as TryFromTransactionResponse<Optimism>>::from_transaction_response(tx_response);
|
||||
let result =
|
||||
<OpTxEnvelope as TryFromTransactionResponse<Optimism>>::from_transaction_response(
|
||||
tx_response,
|
||||
);
|
||||
|
||||
assert!(result.is_ok());
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ alloy-genesis.workspace = true
|
||||
alloy-consensus.workspace = true
|
||||
|
||||
# optimism
|
||||
reth-optimism-primitives = { workspace = true, optional = true, features = ["serde", "reth-codec"] }
|
||||
op-alloy-consensus = { workspace = true, optional = true }
|
||||
|
||||
# codecs
|
||||
modular-bitfield.workspace = true
|
||||
@@ -85,11 +85,11 @@ arbitrary = [
|
||||
"reth-prune-types/arbitrary",
|
||||
"reth-stages-types/arbitrary",
|
||||
"alloy-consensus/arbitrary",
|
||||
"reth-optimism-primitives?/arbitrary",
|
||||
"op-alloy-consensus?/arbitrary",
|
||||
"reth-ethereum-primitives/arbitrary",
|
||||
]
|
||||
op = [
|
||||
"dep:reth-optimism-primitives",
|
||||
"dep:op-alloy-consensus",
|
||||
"reth-codecs/op",
|
||||
"reth-primitives-traits/op",
|
||||
]
|
||||
|
||||
@@ -240,9 +240,9 @@ impl_compression_for_compact!(
|
||||
#[cfg(feature = "op")]
|
||||
mod op {
|
||||
use super::*;
|
||||
use reth_optimism_primitives::{OpReceipt, OpTransactionSigned};
|
||||
use op_alloy_consensus::{OpReceipt, OpTxEnvelope};
|
||||
|
||||
impl_compression_for_compact!(OpTransactionSigned, OpReceipt);
|
||||
impl_compression_for_compact!(OpTxEnvelope, OpReceipt);
|
||||
}
|
||||
|
||||
macro_rules! impl_compression_fixed_compact {
|
||||
|
||||
Reference in New Issue
Block a user