diff --git a/Cargo.toml b/Cargo.toml index 29ebf01..28d7956 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -69,6 +69,10 @@ optimism = [ "reth-optimism-chainspec", "reth-optimism-forks", "reth-optimism-primitives", + "reth-optimism-txpool", + "reth-optimism-rpc", + "reth-optimism-consensus", + "reth-optimism-evm", "reth-node-builder/op", "reth-payload-util", "reth-optimism-cli", @@ -79,7 +83,6 @@ test-utils = [ "nanoid", "tokio/full", "alloy-genesis", - "rand", "reth-ipc", "reth-ethereum/test-utils", "reth-optimism-rpc/client", @@ -112,51 +115,68 @@ jsonrpsee = "0.26.0" parking_lot = "0.12" metrics = "0.24.0" priority-queue = "2.0.0" - +rand = { version = "0.9"} # Alloy dependencies -alloy-origin = { version = "1.0.37", package = "alloy", features = [ +alloy-origin = { version = "1.0.41", package = "alloy", features = [ "k256", "rpc-types-mev", ] } -alloy-evm = "0.21.2" -alloy-serde = "1.0.37" +alloy-evm = "0.23.0" +alloy-serde = "1.0.41" # Reth dependencies -reth-origin = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2", package = "reth" } -reth-evm = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" } -reth-errors = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" } -reth-cli = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" } -reth-rpc-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" } -reth-basic-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" } -reth-ethereum-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" } -reth-ethereum = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2", features = [ +reth-origin = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3", package = "reth" } +reth-evm = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" } +reth-errors = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" } +reth-cli = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" } +reth-cli-commands = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" } +reth-rpc-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" } +reth-rpc-eth-types = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" } +reth-basic-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" } +reth-ethereum-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" } +reth-ethereum = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3", features = [ "node", "evm", ] } -reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" } -reth-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" } -reth-node-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" } -reth-ipc = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2", optional = true } +reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" } +reth-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" } +reth-payload-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" } +reth-node-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" } +reth-node-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" } +reth-chainspec = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" } +reth-metrics = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" } +reth-provider = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" } +reth-ipc = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3", optional = true } +reth-tracing-otlp = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" } +reth-db = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" } +reth-eth-wire-types = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" } +reth-network = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" } +reth-node-types = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" } + +# Revm dependencies +revm-database = "9.0" # Reth-optimism dependencies (optional) -op-alloy = { version = "0.20.0", features = ["full"], optional = true } -reth-optimism-node = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2", optional = true } -reth-optimism-chainspec = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2", optional = true } -reth-optimism-forks = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2", optional = true } -reth-optimism-rpc = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2", optional = true } -reth-payload-util = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2", optional = true } -reth-optimism-cli = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2", optional = true } -reth-optimism-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2", optional = true } +op-alloy = { version = "0.22.0", features = ["full"], optional = true } +reth-optimism-node = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3", optional = true } +reth-optimism-chainspec = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3", optional = true } +reth-optimism-forks = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3", optional = true } +reth-optimism-rpc = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3", optional = true } +reth-optimism-txpool = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3", optional = true } +reth-optimism-consensus = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3", optional = true } +reth-optimism-evm = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3", optional = true } +reth-payload-util = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3", optional = true } +reth-optimism-cli = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3", optional = true } +reth-optimism-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3", optional = true } # test-utils rblib-tests-macros = { path = "src/test_utils/macros", optional = true } jsonrpsee-core = { version = "0.26.0", optional = true, features = ["client"] } nanoid = { version = "0.4", optional = true } alloy-genesis = { version = "1.0", default-features = false, optional = true } -rand = { version = "0.9", optional = true } ctor = { version = "0.5", optional = true } -tracing-subscriber = { version = "0.3", features = [ +tracing-subscriber = { version = "0.3.20", features = [ "env-filter", "json", ], optional = true } diff --git a/src/lib.rs b/src/lib.rs index c5343df..9da40f5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -37,8 +37,16 @@ pub mod test_utils; pub mod reth { pub use reth_origin::*; + pub mod chainspec { + pub use reth_chainspec::*; + } + pub mod cli { pub use {reth_cli::*, reth_origin::cli::*}; + + pub mod commands { + pub use reth_cli_commands::*; + } } pub mod evm { @@ -49,6 +57,10 @@ pub mod reth { pub use reth_errors::*; } + pub mod metrics { + pub use reth_metrics::*; + } + pub mod payload { pub use ::reth_origin::payload::*; pub mod builder { @@ -59,6 +71,10 @@ pub mod reth { }; } + pub mod primitives { + pub use reth_payload_primitives::*; + } + #[cfg(feature = "optimism")] pub mod util { pub use reth_payload_util::*; @@ -66,6 +82,10 @@ pub mod reth { } pub mod node { + pub mod api { + pub use reth_node_api::*; + } + pub mod builder { pub use reth_node_builder::*; } @@ -75,6 +95,34 @@ pub mod reth { } } + pub mod provider { + pub use reth_provider::*; + } + + pub mod rpc_eth_types { + pub use reth_rpc_eth_types::*; + } + + pub mod tracing_otlp { + pub use reth_tracing_otlp::*; + } + + pub mod db { + pub use reth_db::*; + } + + pub mod eth_wire_types { + pub use reth_eth_wire_types::*; + } + + pub mod network { + pub use reth_network::*; + } + + pub mod node_types { + pub use reth_node_types::*; + } + pub mod ethereum { pub use reth_ethereum::*; } @@ -96,6 +144,24 @@ pub mod reth { pub mod primitives { pub use reth_optimism_primitives::*; } + pub mod txpool { + pub use reth_optimism_txpool::*; + } + pub mod rpc { + pub use reth_optimism_rpc::*; + } + pub mod consensus { + pub use reth_optimism_consensus::*; + } + pub mod evm { + pub use reth_optimism_evm::*; + } + } +} + +pub mod revm { + pub mod database { + pub use revm_database::*; } } diff --git a/src/orderpool2/prioritized_pool/step.rs b/src/orderpool2/prioritized_pool/step.rs index 9c48d0d..6289a93 100644 --- a/src/orderpool2/prioritized_pool/step.rs +++ b/src/orderpool2/prioritized_pool/step.rs @@ -36,7 +36,7 @@ where B: Bundle

, P: Platform, { - fn new(bundle: B) -> Self { + pub fn new(bundle: B) -> Self { let txs = bundle.transactions(); let mut nonces = Vec::with_capacity(txs.len()); for tx in txs { diff --git a/src/platform/ethereum/mod.rs b/src/platform/ethereum/mod.rs index f883dee..c2e6a89 100644 --- a/src/platform/ethereum/mod.rs +++ b/src/platform/ethereum/mod.rs @@ -208,8 +208,8 @@ where .map_err(PayloadBuilderError::other)?; let mut cumulative_gas_used = 0; - let block_gas_limit: u64 = builder.evm_mut().block().gas_limit; - let base_fee = builder.evm_mut().block().basefee; + let block_gas_limit: u64 = builder.evm_mut().block().gas_limit(); + let base_fee = builder.evm_mut().block().basefee(); let mut best_txs = best_txs(BestTransactionsAttributes::new( base_fee, @@ -272,10 +272,10 @@ where if is_osaka && estimated_block_size_with_tx > MAX_RLP_BLOCK_SIZE { best_txs.mark_invalid( &pool_tx, - InvalidPoolTransactionError::OversizedData( - estimated_block_size_with_tx, - MAX_RLP_BLOCK_SIZE, - ), + InvalidPoolTransactionError::OversizedData { + size: estimated_block_size_with_tx, + limit: MAX_RLP_BLOCK_SIZE, + }, ); continue; } diff --git a/src/platform/optimism/mod.rs b/src/platform/optimism/mod.rs index 5f63d33..2cbb686 100644 --- a/src/platform/optimism/mod.rs +++ b/src/platform/optimism/mod.rs @@ -10,7 +10,14 @@ use { chainspec::EthChainSpec, optimism::{ forks::OpHardforks, - node::{payload::builder::*, txpool::OpPooledTransaction, *}, + node::{ + payload::{ + builder::*, + config::{OpBuilderConfig, OpGasLimitConfig}, + }, + txpool::OpPooledTransaction, + *, + }, }, payload::{builder::*, util::PayloadTransactionsFixed}, primitives::Recovered, @@ -54,8 +61,25 @@ impl Platform for Optimism { where P: traits::PlatformExecBounds, { + let timestamp = attributes.payload_attributes.timestamp; + let extra_data = if chainspec.is_jovian_active_at_timestamp(timestamp) { + attributes + .get_jovian_extra_data( + chainspec.base_fee_params_at_timestamp(timestamp), + ) + .unwrap_or_default() + } else if chainspec.is_holocene_active_at_timestamp(timestamp) { + attributes + .get_holocene_extra_data( + chainspec.base_fee_params_at_timestamp(timestamp), + ) + .unwrap_or_default() + } else { + Bytes::default() + }; + OpNextBlockEnvAttributes { - timestamp: attributes.payload_attributes.timestamp, + timestamp, suggested_fee_recipient: attributes .payload_attributes .suggested_fee_recipient, @@ -64,17 +88,7 @@ impl Platform for Optimism { parent_beacon_block_root: attributes .payload_attributes .parent_beacon_block_root, - extra_data: if chainspec.is_holocene_active_at_timestamp( - attributes.payload_attributes.timestamp, - ) { - attributes - .get_holocene_extra_data(chainspec.base_fee_params_at_timestamp( - attributes.payload_attributes.timestamp, - )) - .unwrap_or_default() - } else { - Bytes::default() - }, + extra_data, } } @@ -102,7 +116,10 @@ impl Platform for Optimism { let context = OpPayloadBuilderCtx { evm_config: block.evm_config(), - da_config: OpDAConfig::default(), + builder_config: OpBuilderConfig::new( + OpDAConfig::default(), + OpGasLimitConfig::default(), + ), chain_spec: block.chainspec().clone(), config: PayloadConfig::, _>::new( block.parent().clone().into(), diff --git a/src/test_utils/mock.rs b/src/test_utils/mock.rs index 80b2263..2397866 100644 --- a/src/test_utils/mock.rs +++ b/src/test_utils/mock.rs @@ -7,7 +7,6 @@ use { core::ops::RangeBounds, reth::{ chainspec::{ChainInfo, ChainSpecProvider, EthChainSpec}, - ethereum::primitives::AlloyBlockHeader, primitives::{Account, Bytecode, SealedHeader}, providers::*, revm::db::BundleState, @@ -236,9 +235,9 @@ impl HeaderProvider for GenesisProviderFactory

{ /// Get header by block hash fn header( &self, - block_hash: &BlockHash, + block_hash: BlockHash, ) -> ProviderResult> { - if block_hash == &self.chainspec.genesis_hash() { + if block_hash == self.chainspec.genesis_hash() { return Ok(Some(self.chainspec.genesis_header().clone())); } Ok(None) @@ -252,25 +251,6 @@ impl HeaderProvider for GenesisProviderFactory

{ Ok(None) } - /// Get total difficulty by block hash. - fn header_td(&self, hash: &BlockHash) -> ProviderResult> { - if hash == &self.chainspec.genesis_hash() { - return Ok(Some(self.chainspec.genesis_header().difficulty())); - } - Ok(None) - } - - /// Get total difficulty by block number. - fn header_td_by_number( - &self, - number: BlockNumber, - ) -> ProviderResult> { - if number == 0 { - return Ok(Some(self.chainspec.genesis_header().difficulty())); - } - Ok(None) - } - /// Get headers in range of block numbers fn headers_range( &self, diff --git a/src/test_utils/optimism.rs b/src/test_utils/optimism.rs index 7b07c6a..177bff8 100644 --- a/src/test_utils/optimism.rs +++ b/src/test_utils/optimism.rs @@ -89,6 +89,7 @@ where TX_SET_L1_BLOCK_OP_MAINNET_BLOCK_124665056.into(), ]), gas_limit: Some(BASE_MAINNET_MAX_GAS_LIMIT), + min_base_fee: Some(0), ..Default::default() };