diff --git a/Cargo.toml b/Cargo.toml index 541358f..54516d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -69,10 +69,13 @@ 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", - "reth-optimism-rpc", "rblib-tests-macros?/optimism", ] @@ -120,16 +123,17 @@ alloy-origin = { version = "1.0.41", package = "alloy", features = [ "rpc-types-mev", ] } alloy-evm = "0.23.0" -alloy-json-rpc = "1.0.41" alloy-serde = "1.0.41" +alloy-json-rpc = "1.0.41" # Reth dependencies 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-db-api = { 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 = [ @@ -139,8 +143,22 @@ reth-ethereum = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3", f reth-network-peers = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" } 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" } +reth-db-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" } + +# Revm dependencies +revm-database = "9.0" # Reth-optimism dependencies (optional) op-alloy = { version = "0.22.0", features = ["full"], optional = true } @@ -149,6 +167,9 @@ reth-optimism-node = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9. 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 } @@ -159,7 +180,7 @@ 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 } ctor = { version = "0.5", optional = true } -tracing-subscriber = { version = "0.3", features = [ +tracing-subscriber = { version = "0.3.20", features = [ "env-filter", "json", ], optional = true } @@ -170,8 +191,5 @@ tikv-jemallocator = { version = "0.6", optional = true } [dev-dependencies] rblib = { path = ".", features = ["test-utils"] } -#[patch.crates-io] -#alloy-primitives = { git = "https://github.com/alloy-rs/core", rev = "8c5713c20e3ed08cf09634ea5cb696d7021002a8" } - [lints] workspace = true diff --git a/src/lib.rs b/src/lib.rs index dc43de2..29f0cd6 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::*; } @@ -103,6 +151,21 @@ pub mod reth { pub mod primitives { pub use reth_optimism_primitives::*; } + pub mod txpool { + pub use reth_optimism_txpool::*; + } + 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..42abaa5 100644 --- a/src/orderpool2/prioritized_pool/step.rs +++ b/src/orderpool2/prioritized_pool/step.rs @@ -8,11 +8,21 @@ use { crate::{ alloy::{ consensus::Transaction, + consensus::transaction::Recovered, primitives::{Address, B256}, }, orderpool2::{AccountNonce, BundleNonce}, payload::CheckpointExt, - prelude::{Bundle, Checkpoint, ControlFlow, Platform, Step, StepContext}, + platform::types::Transaction as PlatformTransaction, + prelude::{ + Bundle, + Checkpoint, + ControlFlow, + Optimism, + Platform, + Step, + StepContext, + }, reth, }, parking_lot::Mutex, @@ -36,7 +46,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 { @@ -74,6 +84,22 @@ where } } +impl OrderpoolOrder for Recovered> { + type ID = B256; + + fn id(&self) -> Self::ID { + *self.tx_hash() + } + + fn nonces(&self) -> Vec { + vec![BundleNonce { + address: self.signer(), + nonce: self.nonce(), + optional: false, + }] + } +} + impl OrderpoolNonceSource for Checkpoint

{ type NonceError = reth::errors::ProviderError; diff --git a/src/orderpool2/sim_tree.rs b/src/orderpool2/sim_tree.rs index ca3f15f..8666fde 100644 --- a/src/orderpool2/sim_tree.rs +++ b/src/orderpool2/sim_tree.rs @@ -271,4 +271,8 @@ where } Ok(()) } + + pub fn is_ready(&self) -> bool { + !self.ready_orders.is_empty() + } }