From 08ececd954dc0d62f947051361e8a2810cb22634 Mon Sep 17 00:00:00 2001 From: julio4 <30329843+julio4@users.noreply.github.com> Date: Thu, 1 Jan 2026 15:47:59 +0900 Subject: [PATCH 1/3] feat(wip): initial separation --- Cargo.toml | 149 +--- crates/core/Cargo.toml | 115 +++ {src => crates/core/src}/lib.rs | 28 +- {src => crates/core/src}/payload/block.rs | 1 + .../core/src}/payload/checkpoint.rs | 1 + {src => crates/core/src}/payload/exec.rs | 748 +++++++++--------- {src => crates/core/src}/payload/ext/block.rs | 0 .../core/src}/payload/ext/cached_state.rs | 0 .../core/src}/payload/ext/checkpoint.rs | 0 {src => crates/core/src}/payload/ext/mod.rs | 0 {src => crates/core/src}/payload/ext/span.rs | 11 +- {src => crates/core/src}/payload/mod.rs | 0 {src => crates/core/src}/payload/span.rs | 0 .../core/src}/platform/bundle/ext.rs | 0 .../core/src}/platform/bundle/flashbots.rs | 0 .../core/src}/platform/bundle/mod.rs | 0 {src => crates/core/src}/platform/context.rs | 0 .../core/src}/platform/ethereum/limits.rs | 0 .../core/src}/platform/ethereum/mod.rs | 0 .../core/src}/platform/ethereum/pool.rs | 0 {src => crates/core/src}/platform/limits.rs | 0 {src => crates/core/src}/platform/mod.rs | 16 +- .../core/src}/platform/optimism/ext.rs | 0 .../core/src}/platform/optimism/limits.rs | 0 .../core/src}/platform/optimism/mod.rs | 0 crates/core/src/platform/traits.rs | 114 +++ {src => crates/core/src}/platform/types.rs | 0 {src => crates/core/src}/platform/utils.rs | 0 .../core/src}/test_utils/accounts.rs | 0 .../core/src}/test_utils/exts/mock.rs | 9 +- .../core/src}/test_utils/exts/mod.rs | 0 {src => crates/core/src}/test_utils/mock.rs | 0 crates/core/src/test_utils/mod.rs | 51 ++ .../core/src}/test_utils/transactions.rs | 0 .../pipeline-macros}/Cargo.toml | 16 +- .../pipeline-macros}/src/lib.rs | 0 .../pipeline-macros}/src/metrics/mod.rs | 4 +- .../pipeline-macros}/src/metrics/set.rs | 0 .../pipeline-macros}/src/variants.rs | 0 crates/pipeline/Cargo.toml | 91 +++ crates/pipeline/src/lib.rs | 31 + .../pipeline/src}/orderpool2/mod.rs | 0 .../src}/orderpool2/prioritized_pool/mod.rs | 0 .../src}/orderpool2/prioritized_pool/step.rs | 7 +- .../src}/orderpool2/prioritized_pool/tests.rs | 0 .../pipeline/src}/orderpool2/sim_tree.rs | 0 .../pipeline/src}/pipelines/events.rs | 0 .../pipeline/src}/pipelines/exec/mod.rs | 0 .../pipeline/src}/pipelines/exec/navi.rs | 0 .../pipeline/src}/pipelines/exec/scope.rs | 0 .../pipeline/src}/pipelines/iter.rs | 0 {src => crates/pipeline/src}/pipelines/job.rs | 0 .../pipeline/src}/pipelines/limits.rs | 0 .../pipeline/src}/pipelines/metrics.rs | 1 + {src => crates/pipeline/src}/pipelines/mod.rs | 120 --- .../pipeline/src}/pipelines/service.rs | 7 +- .../pipeline/src}/pipelines/step/context.rs | 0 .../pipeline/src}/pipelines/step/instance.rs | 0 .../pipeline/src}/pipelines/step/metrics.rs | 0 .../pipeline/src}/pipelines/step/mod.rs | 0 .../pipeline/src}/pipelines/step/name.rs | 0 .../pipeline/src}/pipelines/tests/mod.rs | 0 .../pipeline/src}/pipelines/tests/revert.rs | 0 .../pipeline/src}/pipelines/tests/smoke.rs | 0 .../pipeline/src}/pipelines/tests/syntax.rs | 4 +- {src => crates/pipeline/src}/pool/host.rs | 0 {src => crates/pipeline/src}/pool/maintain.rs | 0 {src => crates/pipeline/src}/pool/mod.rs | 0 {src => crates/pipeline/src}/pool/native.rs | 0 {src => crates/pipeline/src}/pool/report.rs | 0 {src => crates/pipeline/src}/pool/rpc.rs | 0 {src => crates/pipeline/src}/pool/select.rs | 0 {src => crates/pipeline/src}/pool/setup.rs | 0 {src => crates/pipeline/src}/pool/step.rs | 0 {src => crates/pipeline/src}/steps/builder.rs | 0 .../pipeline/src}/steps/combinator/atomic.rs | 0 .../pipeline/src}/steps/combinator/chain.rs | 0 .../pipeline/src}/steps/combinator/mod.rs | 0 {src => crates/pipeline/src}/steps/mod.rs | 0 .../pipeline/src}/steps/optimism.rs | 0 .../pipeline/src}/steps/ordering/mod.rs | 0 .../pipeline/src}/steps/ordering/profit.rs | 0 .../pipeline/src}/steps/ordering/tip.rs | 0 {src => crates/pipeline/src}/steps/revert.rs | 0 {src => crates/pipeline/src}/steps/utils.rs | 0 .../pipeline/src}/test_utils/ethereum.rs | 3 +- .../pipeline/src}/test_utils/mod.rs | 26 +- .../pipeline/src}/test_utils/node.rs | 0 .../pipeline/src}/test_utils/optimism.rs | 12 +- .../pipeline/src}/test_utils/platform.rs | 0 .../pipeline/src}/test_utils/step.rs | 0 crates/rblib/Cargo.toml | 34 + .../rblib/examples}/checkpoints-eth.rs | 0 .../rblib/examples}/checkpoints-op.rs | 0 .../rblib/examples}/custom-platform.rs | 2 +- .../rblib/examples}/node-builder.md | 0 .../rblib/examples}/pipeline-op.rs | 11 +- crates/rblib/src/lib.rs | 27 + .../test-utils-macros}/Cargo.toml | 11 +- .../test-utils-macros}/src/lib.rs | 15 +- 100 files changed, 953 insertions(+), 712 deletions(-) create mode 100644 crates/core/Cargo.toml rename {src => crates/core/src}/lib.rs (87%) rename {src => crates/core/src}/payload/block.rs (99%) rename {src => crates/core/src}/payload/checkpoint.rs (99%) rename {src => crates/core/src}/payload/exec.rs (56%) rename {src => crates/core/src}/payload/ext/block.rs (100%) rename {src => crates/core/src}/payload/ext/cached_state.rs (100%) rename {src => crates/core/src}/payload/ext/checkpoint.rs (100%) rename {src => crates/core/src}/payload/ext/mod.rs (100%) rename {src => crates/core/src}/payload/ext/span.rs (96%) rename {src => crates/core/src}/payload/mod.rs (100%) rename {src => crates/core/src}/payload/span.rs (100%) rename {src => crates/core/src}/platform/bundle/ext.rs (100%) rename {src => crates/core/src}/platform/bundle/flashbots.rs (100%) rename {src => crates/core/src}/platform/bundle/mod.rs (100%) rename {src => crates/core/src}/platform/context.rs (100%) rename {src => crates/core/src}/platform/ethereum/limits.rs (100%) rename {src => crates/core/src}/platform/ethereum/mod.rs (100%) rename {src => crates/core/src}/platform/ethereum/pool.rs (100%) rename {src => crates/core/src}/platform/limits.rs (100%) rename {src => crates/core/src}/platform/mod.rs (92%) rename {src => crates/core/src}/platform/optimism/ext.rs (100%) rename {src => crates/core/src}/platform/optimism/limits.rs (100%) rename {src => crates/core/src}/platform/optimism/mod.rs (100%) create mode 100644 crates/core/src/platform/traits.rs rename {src => crates/core/src}/platform/types.rs (100%) rename {src => crates/core/src}/platform/utils.rs (100%) rename {src => crates/core/src}/test_utils/accounts.rs (100%) rename {src => crates/core/src}/test_utils/exts/mock.rs (96%) rename {src => crates/core/src}/test_utils/exts/mod.rs (100%) rename {src => crates/core/src}/test_utils/mock.rs (100%) create mode 100644 crates/core/src/test_utils/mod.rs rename {src => crates/core/src}/test_utils/transactions.rs (100%) rename {src/pipelines/macros => crates/pipeline-macros}/Cargo.toml (60%) rename {src/pipelines/macros => crates/pipeline-macros}/src/lib.rs (100%) rename {src/pipelines/macros => crates/pipeline-macros}/src/metrics/mod.rs (87%) rename {src/pipelines/macros => crates/pipeline-macros}/src/metrics/set.rs (100%) rename {src/pipelines/macros => crates/pipeline-macros}/src/variants.rs (100%) create mode 100644 crates/pipeline/Cargo.toml create mode 100644 crates/pipeline/src/lib.rs rename {src => crates/pipeline/src}/orderpool2/mod.rs (100%) rename {src => crates/pipeline/src}/orderpool2/prioritized_pool/mod.rs (100%) rename {src => crates/pipeline/src}/orderpool2/prioritized_pool/step.rs (97%) rename {src => crates/pipeline/src}/orderpool2/prioritized_pool/tests.rs (100%) rename {src => crates/pipeline/src}/orderpool2/sim_tree.rs (100%) rename {src => crates/pipeline/src}/pipelines/events.rs (100%) rename {src => crates/pipeline/src}/pipelines/exec/mod.rs (100%) rename {src => crates/pipeline/src}/pipelines/exec/navi.rs (100%) rename {src => crates/pipeline/src}/pipelines/exec/scope.rs (100%) rename {src => crates/pipeline/src}/pipelines/iter.rs (100%) rename {src => crates/pipeline/src}/pipelines/job.rs (100%) rename {src => crates/pipeline/src}/pipelines/limits.rs (100%) rename {src => crates/pipeline/src}/pipelines/metrics.rs (99%) rename {src => crates/pipeline/src}/pipelines/mod.rs (77%) rename {src => crates/pipeline/src}/pipelines/service.rs (98%) rename {src => crates/pipeline/src}/pipelines/step/context.rs (100%) rename {src => crates/pipeline/src}/pipelines/step/instance.rs (100%) rename {src => crates/pipeline/src}/pipelines/step/metrics.rs (100%) rename {src => crates/pipeline/src}/pipelines/step/mod.rs (100%) rename {src => crates/pipeline/src}/pipelines/step/name.rs (100%) rename {src => crates/pipeline/src}/pipelines/tests/mod.rs (100%) rename {src => crates/pipeline/src}/pipelines/tests/revert.rs (100%) rename {src => crates/pipeline/src}/pipelines/tests/smoke.rs (100%) rename {src => crates/pipeline/src}/pipelines/tests/syntax.rs (98%) rename {src => crates/pipeline/src}/pool/host.rs (100%) rename {src => crates/pipeline/src}/pool/maintain.rs (100%) rename {src => crates/pipeline/src}/pool/mod.rs (100%) rename {src => crates/pipeline/src}/pool/native.rs (100%) rename {src => crates/pipeline/src}/pool/report.rs (100%) rename {src => crates/pipeline/src}/pool/rpc.rs (100%) rename {src => crates/pipeline/src}/pool/select.rs (100%) rename {src => crates/pipeline/src}/pool/setup.rs (100%) rename {src => crates/pipeline/src}/pool/step.rs (100%) rename {src => crates/pipeline/src}/steps/builder.rs (100%) rename {src => crates/pipeline/src}/steps/combinator/atomic.rs (100%) rename {src => crates/pipeline/src}/steps/combinator/chain.rs (100%) rename {src => crates/pipeline/src}/steps/combinator/mod.rs (100%) rename {src => crates/pipeline/src}/steps/mod.rs (100%) rename {src => crates/pipeline/src}/steps/optimism.rs (100%) rename {src => crates/pipeline/src}/steps/ordering/mod.rs (100%) rename {src => crates/pipeline/src}/steps/ordering/profit.rs (100%) rename {src => crates/pipeline/src}/steps/ordering/tip.rs (100%) rename {src => crates/pipeline/src}/steps/revert.rs (100%) rename {src => crates/pipeline/src}/steps/utils.rs (100%) rename {src => crates/pipeline/src}/test_utils/ethereum.rs (98%) rename {src => crates/pipeline/src}/test_utils/mod.rs (82%) rename {src => crates/pipeline/src}/test_utils/node.rs (100%) rename {src => crates/pipeline/src}/test_utils/optimism.rs (92%) rename {src => crates/pipeline/src}/test_utils/platform.rs (100%) rename {src => crates/pipeline/src}/test_utils/step.rs (100%) create mode 100644 crates/rblib/Cargo.toml rename {examples => crates/rblib/examples}/checkpoints-eth.rs (100%) rename {examples => crates/rblib/examples}/checkpoints-op.rs (100%) rename {examples => crates/rblib/examples}/custom-platform.rs (99%) rename {examples => crates/rblib/examples}/node-builder.md (100%) rename {examples => crates/rblib/examples}/pipeline-op.rs (90%) create mode 100644 crates/rblib/src/lib.rs rename {src/test_utils/macros => crates/test-utils-macros}/Cargo.toml (76%) rename {src/test_utils/macros => crates/test-utils-macros}/src/lib.rs (95%) diff --git a/Cargo.toml b/Cargo.toml index 743c9f7..aed72e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,21 +1,23 @@ -[workspace] -members = [ - ".", # The main rblib library - "src/pipelines/macros", - "src/test_utils/macros", -] -resolver = "2" - [workspace.package] version = "0.4.2" edition = "2024" -rust-version = "1.91" +rust-version = "1.92" license = "MIT" homepage = "https://github.com/flashbots/rblib" repository = "https://github.com/flashbots/rblib" -authors = ["Flashbots ", "Karim Agha "] +authors = ["Flashbots ", "Karim Agha ", "Jules Doumeche "] exclude = [".github/"] +[workspace] +members = [ + "crates/rblib", + "crates/core", + "crates/pipeline", + "crates/pipeline-macros", + "crates/test-utils-macros", +] +resolver = "2" + [workspace.lints.rust] type_alias_bounds = "allow" unreachable_pub = "warn" @@ -33,73 +35,8 @@ cast_precision_loss = "allow" [workspace.metadata.scripts] lint = "cargo clippy --all-targets -- -D warnings" -[package] -name = "rblib" -description = "Modular SDK for building ethereum block builders." -version.workspace = true -edition.workspace = true -rust-version.workspace = true -license.workspace = true -homepage.workspace = true -repository.workspace = true -authors.workspace = true -exclude.workspace = true - -[lib] -doctest = false - -[features] -default = ["optimism", "jemalloc"] - -jemalloc = [ - "dep:tikv-jemallocator", - "reth-origin/jemalloc", - "reth-optimism-cli?/jemalloc", -] - -jemalloc-prof = [ - "jemalloc", - "tikv-jemallocator?/profiling", - "reth-origin/jemalloc-prof", -] - -optimism = [ - "op-alloy", - "op-alloy-rpc-types-engine", - "reth-optimism-node", - "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", - "rblib-tests-macros?/optimism", -] - -test-utils = [ - "nanoid", - "tokio/full", - "alloy-genesis", - "reth-ipc", - "reth-ethereum/test-utils", - "reth-optimism-rpc/client", - "rblib-tests-macros", - "jsonrpsee-core", - "tracing-subscriber", - "ctor", -] - -long-pipelines-syntax = [] - -[dependencies] -# internal dependencies -pipelines-macros = { path = "src/pipelines/macros" } - -# Common dependencies +[workspace.dependencies] +# Common itertools = "0.14" eyre = "0.6" thiserror = "2.0" @@ -150,7 +87,7 @@ reth-node-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2" } reth-chainspec = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2" } reth-metrics = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2" } reth-provider = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2" } -reth-ipc = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2", optional = true } +reth-ipc = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2" } reth-tracing-otlp = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2" } reth-db = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2" } reth-eth-wire-types = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2" } @@ -162,36 +99,32 @@ reth-db-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2" } revm-database = "10.0" # Reth-optimism dependencies (optional) -op-alloy = { version = "0.23.1", features = ["full"], optional = true } -op-alloy-rpc-types-engine = { version = "0.23.1", default-features = false, optional = true } +op-alloy = { version = "0.23.1", features = ["full"] } +op-alloy-rpc-types-engine = { version = "0.23.1", default-features = false } op-alloy-flz = "0.13.1" -reth-optimism-node = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2", optional = true } -reth-optimism-chainspec = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2", optional = true } -reth-optimism-forks = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2", optional = true } -reth-optimism-rpc = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2", optional = true } -reth-optimism-txpool = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2", optional = true } -reth-optimism-consensus = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2", optional = true } -reth-optimism-evm = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2", optional = true } -reth-payload-util = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2", optional = true } -reth-optimism-cli = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2", optional = true } -reth-optimism-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2", optional = true } +reth-optimism-node = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2" } +reth-optimism-chainspec = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2" } +reth-optimism-forks = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2" } +reth-optimism-rpc = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2" } +reth-optimism-txpool = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2" } +reth-optimism-consensus = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2" } +reth-optimism-evm = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2" } +reth-payload-util = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2" } +reth-optimism-cli = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2" } +reth-optimism-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.10.2" } # 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.5.2", default-features = false, optional = true } -ctor = { version = "0.5", optional = true } -tracing-subscriber = { version = "0.3.20", features = [ - "env-filter", - "json", -], optional = true } - -[target.'cfg(unix)'.dependencies] -tikv-jemallocator = { version = "0.6", optional = true } - -[dev-dependencies] -rblib = { path = ".", features = ["test-utils"] } - -[lints] -workspace = true +jsonrpsee-core = { version = "0.26.0", features = ["client"] } +nanoid = "0.4" +alloy-genesis = { version = "1.0", default-features = false } +ctor = "0.5" +tracing-subscriber = { version = "0.3.20", features = ["env-filter", "json"] } + +# unix-only allocator +tikv-jemallocator = "0.6" + +# macro +proc-macro2 = "1.0" +quote = "1.0" +syn = { version = "2.0", features = ["full"] } +proc-macro-crate = "3.3.0" diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml new file mode 100644 index 0000000..2775b3e --- /dev/null +++ b/crates/core/Cargo.toml @@ -0,0 +1,115 @@ +[package] +name = "rblib-core" +description = "Modular Payload SDK for building ethereum block builders." +version.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true +authors.workspace = true +exclude.workspace = true + +[lints] +workspace = true + +[lib] +doctest = false + +[features] +default = ["optimism", "jemalloc"] +jemalloc = ["dep:tikv-jemallocator", "reth-origin/jemalloc"] +jemalloc-prof = ["jemalloc", "tikv-jemallocator?/profiling", "reth-origin/jemalloc-prof"] + +optimism = [ + "dep:op-alloy", + "dep:op-alloy-rpc-types-engine", + "dep:reth-optimism-node", + "dep:reth-optimism-chainspec", + "dep:reth-optimism-forks", + "dep:reth-optimism-primitives", + "dep:reth-optimism-txpool", + "dep:reth-optimism-rpc", + "dep:reth-optimism-consensus", + "dep:reth-optimism-evm", + "dep:reth-payload-util", + "dep:reth-optimism-cli", + "dep:op-alloy-flz" +] + +test-utils = [ + "reth-ethereum/test-utils", + "dep:alloy-genesis" +] + +[target.'cfg(unix)'.dependencies] +tikv-jemallocator = { workspace = true, optional = true } + +[dependencies] +# Common +itertools.workspace = true +thiserror.workspace = true +tracing.workspace = true +dashmap.workspace = true +uuid.workspace = true +serde.workspace = true +metrics.workspace = true + +# test utils +rand.workspace = true +eyre.workspace = true + +# Alloy +alloy-origin.workspace = true +alloy-evm.workspace = true +alloy-serde.workspace = true + +# Reth +reth-origin.workspace = true +reth-evm.workspace = true +reth-errors.workspace = true +reth-cli.workspace = true +reth-cli-commands.workspace = true +reth-rpc-eth-types.workspace = true +reth-basic-payload-builder.workspace = true +reth-ethereum-payload-builder.workspace = true +reth-ethereum.workspace = true +reth-network-peers.workspace = true +reth-transaction-pool.workspace = true +reth-payload-builder.workspace = true +reth-payload-primitives.workspace = true +reth-node-builder.workspace = true +reth-node-api.workspace = true +reth-chainspec.workspace = true +reth-metrics.workspace = true +reth-provider.workspace = true +reth-tracing-otlp.workspace = true +reth-db.workspace = true +reth-eth-wire-types.workspace = true +reth-network.workspace = true +reth-node-types.workspace = true + +# Revm +revm-database.workspace = true + +# Optimism (optional) +op-alloy = { workspace = true, optional = true } +op-alloy-rpc-types-engine = { workspace = true, optional = true } + +reth-optimism-node = { workspace = true, optional = true } +reth-optimism-chainspec = { workspace = true, optional = true } +reth-optimism-forks = { workspace = true, optional = true } +reth-optimism-rpc = { workspace = true, optional = true } +reth-optimism-txpool = { workspace = true, optional = true } +reth-optimism-consensus = { workspace = true, optional = true } +reth-optimism-evm = { workspace = true, optional = true } +reth-payload-util = { workspace = true, optional = true } +reth-optimism-cli = { workspace = true, optional = true } +reth-optimism-primitives = { workspace = true, optional = true } +op-alloy-flz = { workspace = true, optional = true } + +# test utils +alloy-genesis = { workspace = true, optional = true } + +[dev-dependencies] +rblib-core = { path = ".", features = ["test-utils"] } \ No newline at end of file diff --git a/src/lib.rs b/crates/core/src/lib.rs similarity index 87% rename from src/lib.rs rename to crates/core/src/lib.rs index 857aff4..d3b33ac 100644 --- a/src/lib.rs +++ b/crates/core/src/lib.rs @@ -1,14 +1,15 @@ -// core modules, partially re-exported through `rblib::prelude` -mod payload; -mod pipelines; -mod platform; +// Core payload API and platform abstractions. +pub mod payload; +pub mod platform; + +#[cfg(any(test, feature = "test-utils"))] +pub mod test_utils; // RBLib Core Public API Prelude pub mod prelude { pub use { - super::{payload::*, pipelines::*, platform::*}, + super::{payload::*, platform::*}, metrics::{Counter, Gauge, Histogram}, - pipelines_macros::MetricsSet, }; pub(crate) use super::Variant; @@ -19,20 +20,7 @@ pub mod metrics_util { pub use metrics::*; } -/// Order Pool Public API -pub mod pool; - -/// Common steps library -pub mod steps; - -/// Orderpool utils -pub mod orderpool2; - -// Externally available test utilities -#[cfg(any(test, feature = "test-utils"))] -pub mod test_utils; - -// Reexport reth version that is used by rblib as a convenience for downstream +// Reexport reth version used by rblib as a convenience for downstream // users. Those exports should be enough to get started with a simple node. pub mod reth { pub use reth_origin::*; diff --git a/src/payload/block.rs b/crates/core/src/payload/block.rs similarity index 99% rename from src/payload/block.rs rename to crates/core/src/payload/block.rs index 90d7c75..7b55028 100644 --- a/src/payload/block.rs +++ b/crates/core/src/payload/block.rs @@ -5,6 +5,7 @@ use { api::ConfigureEvm, errors::ProviderError, evm::{block::BlockExecutionError, execute::BlockBuilder}, + payload::builder::PayloadBuilderError, primitives::SealedHeader, providers::{StateProvider, StateProviderBox, StateProviderFactory}, revm::{State, database::StateProviderDatabase}, diff --git a/src/payload/checkpoint.rs b/crates/core/src/payload/checkpoint.rs similarity index 99% rename from src/payload/checkpoint.rs rename to crates/core/src/payload/checkpoint.rs index 48ac8b2..91ff40e 100644 --- a/src/payload/checkpoint.rs +++ b/crates/core/src/payload/checkpoint.rs @@ -8,6 +8,7 @@ use { core::fmt::{Debug, Display}, reth::{ errors::ProviderError, + payload::PayloadBuilderError, primitives::Recovered, revm::{ DatabaseRef, diff --git a/src/payload/exec.rs b/crates/core/src/payload/exec.rs similarity index 56% rename from src/payload/exec.rs rename to crates/core/src/payload/exec.rs index a0f92c7..7aa625d 100644 --- a/src/payload/exec.rs +++ b/crates/core/src/payload/exec.rs @@ -439,376 +439,378 @@ impl ExecutionResult

{ } } -#[cfg(test)] -mod tests { - use { - super::*, - crate::test_utils::{ - BlockContextMocked, - TestablePlatform, - test_bundle, - test_tx, - test_txs, - }, - rblib_tests_macros::rblib_test, - }; - - #[rblib_test(Ethereum, Optimism)] - fn test_executable_transaction_returns_single_transaction< - P: TestablePlatform, - >() { - let tx = test_tx::

(0, 0); - let executable = Executable::

::Transaction(tx.clone()); - - assert_eq!(executable.transactions().len(), 1); - assert_eq!(executable.transactions()[0], tx); - assert!(executable.is_transaction()); - assert!(!executable.is_bundle()); - } - - #[rblib_test(Ethereum, Optimism)] - fn test_executable_bundle_returns_all_transactions

() - where - P: TestablePlatform>, - { - let (bundle, txs) = test_bundle::

(0, 0); - let executable = Executable::

::Bundle(bundle); - - assert_eq!(executable.transactions().len(), txs.len()); - assert_eq!(executable.transactions(), txs.as_slice()); - assert!(!executable.is_transaction()); - assert!(executable.is_bundle()); - } - - #[rblib_test(Ethereum, Optimism)] - fn test_execute_transaction_success

() - where - P: TestablePlatform, - BlockContext

: BlockContextMocked

, - { - let block = BlockContext::

::mocked(); - let checkpoint = block.start(); - let tx = test_tx::

(0, 0); - - let result = Executable::execute_transaction( - tx.clone(), - &block, - &checkpoint, - checkpoint.context(), - ); - - let exec_result = result.unwrap(); - assert_eq!(exec_result.results().len(), 1); - assert_eq!(exec_result.transactions().len(), 1); - assert_eq!(exec_result.transactions()[0], tx); - assert!(exec_result.results()[0].is_success()); - } - - #[rblib_test(Ethereum, Optimism)] - fn test_execute_transaction_produces_state_changes

() - where - P: TestablePlatform, - BlockContext

: BlockContextMocked

, - { - let block = BlockContext::

::mocked(); - let checkpoint = block.start(); - let tx = test_tx::

(0, 0); - - let result = Executable::execute_transaction( - tx, - &block, - &checkpoint, - checkpoint.context(), - ); - - let exec_result = result.unwrap(); - assert!(!exec_result.state().is_empty()); - assert!(exec_result.gas_used() > 0); - } - - #[rblib_test(Ethereum, Optimism)] - fn test_execute_via_execute_method

() - where - P: TestablePlatform, - BlockContext

: BlockContextMocked

, - { - let block = BlockContext::

::mocked(); - let checkpoint = block.start(); - let tx = test_tx::

(0, 0); - let executable = Executable::

::Transaction(tx); - - let result = executable.execute(&block, &checkpoint, checkpoint.context()); - assert_eq!(result.unwrap().results().len(), 1); - } - - #[rblib_test(Ethereum, Optimism)] - fn test_execute_bundle_all_successful

() - where - P: TestablePlatform>, - BlockContext

: BlockContextMocked

, - { - let block = BlockContext::

::mocked(); - let checkpoint = block.start(); - let (bundle, txs) = test_bundle::

(0, 0); - - let result = Executable::execute_bundle( - bundle, - &block, - &checkpoint, - checkpoint.context(), - ); - - let exec_result = result.unwrap(); - assert_eq!(exec_result.results().len(), txs.len()); - assert!(exec_result.results().iter().all(|r| r.is_success())); - assert_eq!(exec_result.transactions().len(), txs.len()); - assert_eq!(exec_result.transactions(), txs.as_slice()); - } - - #[rblib_test(Ethereum, Optimism)] - fn test_execute_bundle_aggregates_gas

() - where - P: TestablePlatform>, - BlockContext

: BlockContextMocked

, - { - let block = BlockContext::

::mocked(); - let checkpoint = block.start(); - let (bundle, _) = test_bundle::

(0, 0); - - let result = Executable::execute_bundle( - bundle, - &block, - &checkpoint, - checkpoint.context(), - ); - - let exec_result = result.unwrap(); - let total_gas = exec_result.gas_used(); - let sum_gas: u64 = exec_result.results().iter().map(|r| r.gas_used()).sum(); - assert_eq!(total_gas, sum_gas); - assert!(total_gas > 0); - } - - #[rblib_test(Ethereum, Optimism)] - fn test_execute_bundle_sequential_execution

() - where - P: TestablePlatform>, - BlockContext

: BlockContextMocked

, - { - // Each transaction in a bundle executes on the state from the previous - let block = BlockContext::

::mocked(); - let checkpoint = block.start(); - // Use the same account for all transactions to test sequential nonces - let txs = test_txs::

(0, 0, 3); - let (bundle, _) = test_bundle::

(0, 0); - - let result = Executable::execute_bundle( - bundle, - &block, - &checkpoint, - checkpoint.context(), - ); - - let exec_result = result.unwrap(); - assert_eq!(exec_result.results().len(), txs.len()); - assert!(exec_result.results().iter().all(|r| r.is_success())); - } - - #[rblib_test(Ethereum, Optimism)] - fn test_into_executable_from_recovered_transaction() { - let tx = test_tx::

(0, 0); - let result: Result, _> = - IntoExecutable::>::try_into_executable(tx.clone()); - - let executable = result.unwrap(); - assert!(executable.is_transaction()); - assert_eq!(executable.transactions()[0], tx); - } - - #[rblib_test(Ethereum, Optimism)] - fn test_into_executable_from_bundle

() - where - P: TestablePlatform>, - { - let (bundle, _) = test_bundle::

(0, 0); - let result: Result, _> = - IntoExecutable::>::try_into_executable(bundle); - - assert!(result.unwrap().is_bundle()); - } - - #[rblib_test(Ethereum, Optimism)] - fn test_into_executable_from_executable() { - let tx = test_tx::

(0, 0); - let executable = Executable::

::Transaction(tx); - let result: Result, _> = - IntoExecutable::>::try_into_executable(executable.clone()); - - assert_eq!(result.unwrap(), executable); - } - - #[rblib_test(Ethereum, Optimism)] - fn test_into_executable_from_checkpoint

() - where - P: TestablePlatform>, - BlockContext

: BlockContextMocked

, - { - let block = BlockContext::

::mocked(); - let checkpoint = block.start(); - let tx = test_tx::

(0, 0); - let checkpoint_with_tx = checkpoint.apply(tx.clone()).unwrap(); - - let result: Result, _> = - IntoExecutable::>::try_into_executable(checkpoint_with_tx); - - let executable = result.unwrap(); - assert!(executable.is_transaction()); - assert_eq!(executable.transactions()[0], tx); - } - - #[rblib_test(Ethereum, Optimism)] - fn test_into_executable_from_checkpoint_ref

() - where - P: TestablePlatform>, - BlockContext

: BlockContextMocked

, - { - let block = BlockContext::

::mocked(); - let checkpoint = block.start(); - let tx = test_tx::

(0, 0); - let checkpoint_with_tx = checkpoint.apply(tx.clone()).unwrap(); - - let result: Result, _> = - IntoExecutable::>::try_into_executable(&checkpoint_with_tx); - - let executable = result.unwrap(); - assert!(executable.is_transaction()); - assert_eq!(executable.transactions()[0], tx); - } - - #[rblib_test(Ethereum, Optimism)] - fn test_into_executable_from_barrier_checkpoint_fails

() - where - P: TestablePlatform, - BlockContext

: BlockContextMocked

, - { - let block = BlockContext::

::mocked(); - let checkpoint = block.start(); - let barrier = checkpoint.barrier(); - - let result: Result, _> = - IntoExecutable::>::try_into_executable(&barrier); - - assert!(result.is_err()); - } - - #[rblib_test(Ethereum, Optimism)] - fn test_execution_result_source

() - where - P: TestablePlatform, - BlockContext

: BlockContextMocked

, - { - let block = BlockContext::

::mocked(); - let checkpoint = block.start(); - let tx = test_tx::

(0, 0); - let executable = Executable::

::Transaction(tx.clone()); - - let result = executable - .execute(&block, &checkpoint, checkpoint.context()) - .unwrap(); - - match result.source() { - Executable::Transaction(result_tx) => assert_eq!(*result_tx, tx), - Executable::Bundle(_) => panic!("Expected transaction source"), - } - } - - #[rblib_test(Ethereum, Optimism)] - fn test_execution_result_transactions

() - where - P: TestablePlatform>, - BlockContext

: BlockContextMocked

, - { - let block = BlockContext::

::mocked(); - let checkpoint = block.start(); - let (bundle, txs) = test_bundle::

(0, 0); - let executable = Executable::

::Bundle(bundle); - - let result = executable - .execute(&block, &checkpoint, checkpoint.context()) - .unwrap(); - - assert_eq!(result.transactions(), txs.as_slice()); - } - - #[rblib_test(Ethereum, Optimism)] - fn test_executable_hash_transaction() { - let tx = test_tx::

(0, 0); - let expected_hash = *tx.tx_hash(); - let executable = Executable::

::Transaction(tx); - - assert_eq!(executable.hash(), expected_hash); - } - - #[rblib_test(Ethereum, Optimism)] - fn test_executable_hash_bundle

() - where - P: TestablePlatform>, - { - let (bundle, _) = test_bundle::

(0, 0); - let expected_hash = bundle.hash(); - let executable = Executable::

::Bundle(bundle); - - assert_eq!(executable.hash(), expected_hash); - } - - #[rblib_test(Ethereum, Optimism)] - fn test_execution_error_invalid_signature_display() { - let err = ExecutionError::

::InvalidSignature(RecoveryError::new()); - let display = format!("{err}"); - assert!(display.contains("Invalid signature")); - } - - #[rblib_test(Ethereum, Optimism)] - fn test_execution_result_state_is_bundle_state

() - where - P: TestablePlatform, - BlockContext

: BlockContextMocked

, - { - let block = BlockContext::

::mocked(); - let checkpoint = block.start(); - let tx = test_tx::

(0, 0); - - let result = Executable::execute_transaction( - tx, - &block, - &checkpoint, - checkpoint.context(), - ) - .unwrap(); - - // State should be a BundleState with changes - assert!(!result.state().is_empty()); - } - - #[rblib_test(Ethereum, Optimism)] - fn test_execution_result_clone

() - where - P: TestablePlatform, - BlockContext

: BlockContextMocked

, - { - let block = BlockContext::

::mocked(); - let checkpoint = block.start(); - let tx = test_tx::

(0, 0); - - let result = Executable::execute_transaction( - tx, - &block, - &checkpoint, - checkpoint.context(), - ) - .unwrap(); - let cloned = result.clone(); - - assert_eq!(result, cloned); - } -} +// TODO: rework this without TestablePlatform? +// or adapt testable platform to not depend on pipeline +// #[cfg(test)] +// mod tests { +// use { +// super::*, +// crate::test_utils::{ +// BlockContextMocked, +// TestablePlatform, +// test_bundle, +// test_tx, +// test_txs, +// }, +// rblib_tests_macros::rblib_test, +// }; +// +// #[rblib_test(Ethereum, Optimism)] +// fn test_executable_transaction_returns_single_transaction< +// P: TestablePlatform, +// >() { +// let tx = test_tx::

(0, 0); +// let executable = Executable::

::Transaction(tx.clone()); +// +// assert_eq!(executable.transactions().len(), 1); +// assert_eq!(executable.transactions()[0], tx); +// assert!(executable.is_transaction()); +// assert!(!executable.is_bundle()); +// } +// +// #[rblib_test(Ethereum, Optimism)] +// fn test_executable_bundle_returns_all_transactions

() +// where +// P: TestablePlatform>, +// { +// let (bundle, txs) = test_bundle::

(0, 0); +// let executable = Executable::

::Bundle(bundle); +// +// assert_eq!(executable.transactions().len(), txs.len()); +// assert_eq!(executable.transactions(), txs.as_slice()); +// assert!(!executable.is_transaction()); +// assert!(executable.is_bundle()); +// } +// +// #[rblib_test(Ethereum, Optimism)] +// fn test_execute_transaction_success

() +// where +// P: TestablePlatform, +// BlockContext

: BlockContextMocked

, +// { +// let block = BlockContext::

::mocked(); +// let checkpoint = block.start(); +// let tx = test_tx::

(0, 0); +// +// let result = Executable::execute_transaction( +// tx.clone(), +// &block, +// &checkpoint, +// checkpoint.context(), +// ); +// +// let exec_result = result.unwrap(); +// assert_eq!(exec_result.results().len(), 1); +// assert_eq!(exec_result.transactions().len(), 1); +// assert_eq!(exec_result.transactions()[0], tx); +// assert!(exec_result.results()[0].is_success()); +// } +// +// #[rblib_test(Ethereum, Optimism)] +// fn test_execute_transaction_produces_state_changes

() +// where +// P: TestablePlatform, +// BlockContext

: BlockContextMocked

, +// { +// let block = BlockContext::

::mocked(); +// let checkpoint = block.start(); +// let tx = test_tx::

(0, 0); +// +// let result = Executable::execute_transaction( +// tx, +// &block, +// &checkpoint, +// checkpoint.context(), +// ); +// +// let exec_result = result.unwrap(); +// assert!(!exec_result.state().is_empty()); +// assert!(exec_result.gas_used() > 0); +// } +// +// #[rblib_test(Ethereum, Optimism)] +// fn test_execute_via_execute_method

() +// where +// P: TestablePlatform, +// BlockContext

: BlockContextMocked

, +// { +// let block = BlockContext::

::mocked(); +// let checkpoint = block.start(); +// let tx = test_tx::

(0, 0); +// let executable = Executable::

::Transaction(tx); +// +// let result = executable.execute(&block, &checkpoint, checkpoint.context()); +// assert_eq!(result.unwrap().results().len(), 1); +// } +// +// #[rblib_test(Ethereum, Optimism)] +// fn test_execute_bundle_all_successful

() +// where +// P: TestablePlatform>, +// BlockContext

: BlockContextMocked

, +// { +// let block = BlockContext::

::mocked(); +// let checkpoint = block.start(); +// let (bundle, txs) = test_bundle::

(0, 0); +// +// let result = Executable::execute_bundle( +// bundle, +// &block, +// &checkpoint, +// checkpoint.context(), +// ); +// +// let exec_result = result.unwrap(); +// assert_eq!(exec_result.results().len(), txs.len()); +// assert!(exec_result.results().iter().all(|r| r.is_success())); +// assert_eq!(exec_result.transactions().len(), txs.len()); +// assert_eq!(exec_result.transactions(), txs.as_slice()); +// } +// +// #[rblib_test(Ethereum, Optimism)] +// fn test_execute_bundle_aggregates_gas

() +// where +// P: TestablePlatform>, +// BlockContext

: BlockContextMocked

, +// { +// let block = BlockContext::

::mocked(); +// let checkpoint = block.start(); +// let (bundle, _) = test_bundle::

(0, 0); +// +// let result = Executable::execute_bundle( +// bundle, +// &block, +// &checkpoint, +// checkpoint.context(), +// ); +// +// let exec_result = result.unwrap(); +// let total_gas = exec_result.gas_used(); +// let sum_gas: u64 = exec_result.results().iter().map(|r| +// r.gas_used()).sum(); assert_eq!(total_gas, sum_gas); +// assert!(total_gas > 0); +// } +// +// #[rblib_test(Ethereum, Optimism)] +// fn test_execute_bundle_sequential_execution

() +// where +// P: TestablePlatform>, +// BlockContext

: BlockContextMocked

, +// { +// // Each transaction in a bundle executes on the state from the previous +// let block = BlockContext::

::mocked(); +// let checkpoint = block.start(); +// // Use the same account for all transactions to test sequential nonces +// let txs = test_txs::

(0, 0, 3); +// let (bundle, _) = test_bundle::

(0, 0); +// +// let result = Executable::execute_bundle( +// bundle, +// &block, +// &checkpoint, +// checkpoint.context(), +// ); +// +// let exec_result = result.unwrap(); +// assert_eq!(exec_result.results().len(), txs.len()); +// assert!(exec_result.results().iter().all(|r| r.is_success())); +// } +// +// #[rblib_test(Ethereum, Optimism)] +// fn test_into_executable_from_recovered_transaction() { +// let tx = test_tx::

(0, 0); +// let result: Result, _> = +// IntoExecutable::>::try_into_executable(tx.clone()); +// +// let executable = result.unwrap(); +// assert!(executable.is_transaction()); +// assert_eq!(executable.transactions()[0], tx); +// } +// +// #[rblib_test(Ethereum, Optimism)] +// fn test_into_executable_from_bundle

() +// where +// P: TestablePlatform>, +// { +// let (bundle, _) = test_bundle::

(0, 0); +// let result: Result, _> = +// IntoExecutable::>::try_into_executable(bundle); +// +// assert!(result.unwrap().is_bundle()); +// } +// +// #[rblib_test(Ethereum, Optimism)] +// fn test_into_executable_from_executable() { +// let tx = test_tx::

(0, 0); +// let executable = Executable::

::Transaction(tx); +// let result: Result, _> = +// IntoExecutable::>::try_into_executable(executable.clone()); +// +// assert_eq!(result.unwrap(), executable); +// } +// +// #[rblib_test(Ethereum, Optimism)] +// fn test_into_executable_from_checkpoint

() +// where +// P: TestablePlatform>, +// BlockContext

: BlockContextMocked

, +// { +// let block = BlockContext::

::mocked(); +// let checkpoint = block.start(); +// let tx = test_tx::

(0, 0); +// let checkpoint_with_tx = checkpoint.apply(tx.clone()).unwrap(); +// +// let result: Result, _> = +// IntoExecutable::>::try_into_executable(checkpoint_with_tx); +// +// let executable = result.unwrap(); +// assert!(executable.is_transaction()); +// assert_eq!(executable.transactions()[0], tx); +// } +// +// #[rblib_test(Ethereum, Optimism)] +// fn test_into_executable_from_checkpoint_ref

() +// where +// P: TestablePlatform>, +// BlockContext

: BlockContextMocked

, +// { +// let block = BlockContext::

::mocked(); +// let checkpoint = block.start(); +// let tx = test_tx::

(0, 0); +// let checkpoint_with_tx = checkpoint.apply(tx.clone()).unwrap(); +// +// let result: Result, _> = +// IntoExecutable::>::try_into_executable(&checkpoint_with_tx); +// +// let executable = result.unwrap(); +// assert!(executable.is_transaction()); +// assert_eq!(executable.transactions()[0], tx); +// } +// +// #[rblib_test(Ethereum, Optimism)] +// fn test_into_executable_from_barrier_checkpoint_fails

() +// where +// P: TestablePlatform, +// BlockContext

: BlockContextMocked

, +// { +// let block = BlockContext::

::mocked(); +// let checkpoint = block.start(); +// let barrier = checkpoint.barrier(); +// +// let result: Result, _> = +// IntoExecutable::>::try_into_executable(&barrier); +// +// assert!(result.is_err()); +// } +// +// #[rblib_test(Ethereum, Optimism)] +// fn test_execution_result_source

() +// where +// P: TestablePlatform, +// BlockContext

: BlockContextMocked

, +// { +// let block = BlockContext::

::mocked(); +// let checkpoint = block.start(); +// let tx = test_tx::

(0, 0); +// let executable = Executable::

::Transaction(tx.clone()); +// +// let result = executable +// .execute(&block, &checkpoint, checkpoint.context()) +// .unwrap(); +// +// match result.source() { +// Executable::Transaction(result_tx) => assert_eq!(*result_tx, tx), +// Executable::Bundle(_) => panic!("Expected transaction source"), +// } +// } +// +// #[rblib_test(Ethereum, Optimism)] +// fn test_execution_result_transactions

() +// where +// P: TestablePlatform>, +// BlockContext

: BlockContextMocked

, +// { +// let block = BlockContext::

::mocked(); +// let checkpoint = block.start(); +// let (bundle, txs) = test_bundle::

(0, 0); +// let executable = Executable::

::Bundle(bundle); +// +// let result = executable +// .execute(&block, &checkpoint, checkpoint.context()) +// .unwrap(); +// +// assert_eq!(result.transactions(), txs.as_slice()); +// } +// +// #[rblib_test(Ethereum, Optimism)] +// fn test_executable_hash_transaction() { +// let tx = test_tx::

(0, 0); +// let expected_hash = *tx.tx_hash(); +// let executable = Executable::

::Transaction(tx); +// +// assert_eq!(executable.hash(), expected_hash); +// } +// +// #[rblib_test(Ethereum, Optimism)] +// fn test_executable_hash_bundle

() +// where +// P: TestablePlatform>, +// { +// let (bundle, _) = test_bundle::

(0, 0); +// let expected_hash = bundle.hash(); +// let executable = Executable::

::Bundle(bundle); +// +// assert_eq!(executable.hash(), expected_hash); +// } +// +// #[rblib_test(Ethereum, Optimism)] +// fn test_execution_error_invalid_signature_display() { +// let err = ExecutionError::

::InvalidSignature(RecoveryError::new()); +// let display = format!("{err}"); +// assert!(display.contains("Invalid signature")); +// } +// +// #[rblib_test(Ethereum, Optimism)] +// fn test_execution_result_state_is_bundle_state

() +// where +// P: TestablePlatform, +// BlockContext

: BlockContextMocked

, +// { +// let block = BlockContext::

::mocked(); +// let checkpoint = block.start(); +// let tx = test_tx::

(0, 0); +// +// let result = Executable::execute_transaction( +// tx, +// &block, +// &checkpoint, +// checkpoint.context(), +// ) +// .unwrap(); +// +// // State should be a BundleState with changes +// assert!(!result.state().is_empty()); +// } +// +// #[rblib_test(Ethereum, Optimism)] +// fn test_execution_result_clone

() +// where +// P: TestablePlatform, +// BlockContext

: BlockContextMocked

, +// { +// let block = BlockContext::

::mocked(); +// let checkpoint = block.start(); +// let tx = test_tx::

(0, 0); +// +// let result = Executable::execute_transaction( +// tx, +// &block, +// &checkpoint, +// checkpoint.context(), +// ) +// .unwrap(); +// let cloned = result.clone(); +// +// assert_eq!(result, cloned); +// } +// } diff --git a/src/payload/ext/block.rs b/crates/core/src/payload/ext/block.rs similarity index 100% rename from src/payload/ext/block.rs rename to crates/core/src/payload/ext/block.rs diff --git a/src/payload/ext/cached_state.rs b/crates/core/src/payload/ext/cached_state.rs similarity index 100% rename from src/payload/ext/cached_state.rs rename to crates/core/src/payload/ext/cached_state.rs diff --git a/src/payload/ext/checkpoint.rs b/crates/core/src/payload/ext/checkpoint.rs similarity index 100% rename from src/payload/ext/checkpoint.rs rename to crates/core/src/payload/ext/checkpoint.rs diff --git a/src/payload/ext/mod.rs b/crates/core/src/payload/ext/mod.rs similarity index 100% rename from src/payload/ext/mod.rs rename to crates/core/src/payload/ext/mod.rs diff --git a/src/payload/ext/span.rs b/crates/core/src/payload/ext/span.rs similarity index 96% rename from src/payload/ext/span.rs rename to crates/core/src/payload/ext/span.rs index 5f03f3e..b1ea5db 100644 --- a/src/payload/ext/span.rs +++ b/crates/core/src/payload/ext/span.rs @@ -109,14 +109,11 @@ impl SpanExt

for Span

{ #[cfg(test)] mod span_ext_tests { - use { - crate::{ - payload::{Span, SpanExt}, - prelude::{BlockContext, Checkpoint, Ethereum}, - test_utils::{BlockContextMocked, transfer_tx}, - }, + use crate::{ alloy::primitives::U256, - rblib::{alloy, test_utils::FundedAccounts}, + payload::{Span, SpanExt}, + prelude::{BlockContext, Checkpoint, Ethereum}, + test_utils::{BlockContextMocked, FundedAccounts, transfer_tx}, }; #[test] diff --git a/src/payload/mod.rs b/crates/core/src/payload/mod.rs similarity index 100% rename from src/payload/mod.rs rename to crates/core/src/payload/mod.rs diff --git a/src/payload/span.rs b/crates/core/src/payload/span.rs similarity index 100% rename from src/payload/span.rs rename to crates/core/src/payload/span.rs diff --git a/src/platform/bundle/ext.rs b/crates/core/src/platform/bundle/ext.rs similarity index 100% rename from src/platform/bundle/ext.rs rename to crates/core/src/platform/bundle/ext.rs diff --git a/src/platform/bundle/flashbots.rs b/crates/core/src/platform/bundle/flashbots.rs similarity index 100% rename from src/platform/bundle/flashbots.rs rename to crates/core/src/platform/bundle/flashbots.rs diff --git a/src/platform/bundle/mod.rs b/crates/core/src/platform/bundle/mod.rs similarity index 100% rename from src/platform/bundle/mod.rs rename to crates/core/src/platform/bundle/mod.rs diff --git a/src/platform/context.rs b/crates/core/src/platform/context.rs similarity index 100% rename from src/platform/context.rs rename to crates/core/src/platform/context.rs diff --git a/src/platform/ethereum/limits.rs b/crates/core/src/platform/ethereum/limits.rs similarity index 100% rename from src/platform/ethereum/limits.rs rename to crates/core/src/platform/ethereum/limits.rs diff --git a/src/platform/ethereum/mod.rs b/crates/core/src/platform/ethereum/mod.rs similarity index 100% rename from src/platform/ethereum/mod.rs rename to crates/core/src/platform/ethereum/mod.rs diff --git a/src/platform/ethereum/pool.rs b/crates/core/src/platform/ethereum/pool.rs similarity index 100% rename from src/platform/ethereum/pool.rs rename to crates/core/src/platform/ethereum/pool.rs diff --git a/src/platform/limits.rs b/crates/core/src/platform/limits.rs similarity index 100% rename from src/platform/limits.rs rename to crates/core/src/platform/limits.rs diff --git a/src/platform/mod.rs b/crates/core/src/platform/mod.rs similarity index 92% rename from src/platform/mod.rs rename to crates/core/src/platform/mod.rs index f6e3808..b8aa845 100644 --- a/src/platform/mod.rs +++ b/crates/core/src/platform/mod.rs @@ -1,6 +1,6 @@ //! Platform abstraction layer //! -//! This module fines the platform specific extension points for the underlying +//! This module fines the platform-specific extension points for the underlying //! node that executes pipelines. By default, rblib provides implementations of //! the standard Ethereum and Optimism platforms, but it can be extended to //! support other platforms as well. @@ -12,7 +12,10 @@ use { network::Network as AlloyNetwork, signers::Signature, }, - reth::ethereum::primitives::SignedTransaction, + reth::{ + ethereum::primitives::SignedTransaction, + payload::PayloadBuilderError, + }, serde::{Serialize, de::DeserializeOwned}, std::sync::Arc, }; @@ -21,6 +24,7 @@ mod bundle; mod context; mod ethereum; mod limits; +pub mod traits; pub mod types; mod utils; @@ -57,11 +61,11 @@ pub trait Platform: /// Type that configures the essential types of an Ethereum-like node. /// /// Implementations of this trait describe all types that are used by the - /// consensus engine such as transactions, blocks, headers, etc. + /// consensus engine, such as transactions, blocks, headers, etc. /// - /// Two well known implementations of this trait are: - /// - [`EthereumNode`](crate::reth::ethereum::node::EthereumNode) for Ethereum - /// L1 mainnet, + /// Two well-known implementations of this trait are: + /// - [`EthereumNode`](reth::ethereum::node::EthereumNode) for Ethereum L1 + /// mainnet, #[cfg_attr( feature = "optimism", doc = " - [`OpNode`](crate::reth::optimism::node::OpNode) for Optimism \ diff --git a/src/platform/optimism/ext.rs b/crates/core/src/platform/optimism/ext.rs similarity index 100% rename from src/platform/optimism/ext.rs rename to crates/core/src/platform/optimism/ext.rs diff --git a/src/platform/optimism/limits.rs b/crates/core/src/platform/optimism/limits.rs similarity index 100% rename from src/platform/optimism/limits.rs rename to crates/core/src/platform/optimism/limits.rs diff --git a/src/platform/optimism/mod.rs b/crates/core/src/platform/optimism/mod.rs similarity index 100% rename from src/platform/optimism/mod.rs rename to crates/core/src/platform/optimism/mod.rs diff --git a/crates/core/src/platform/traits.rs b/crates/core/src/platform/traits.rs new file mode 100644 index 0000000..59b00dd --- /dev/null +++ b/crates/core/src/platform/traits.rs @@ -0,0 +1,114 @@ +use crate::{ + prelude::*, + reth::{ + api::FullNodeTypes, + evm::ConfigureEvm, + node::builder::NodeTypes, + providers::{ChainSpecProvider, HeaderProvider, StateProviderFactory}, + transaction_pool::{PoolTransaction, TransactionPool}, + }, +}; + +pub trait NodeBounds: FullNodeTypes {} + +impl NodeBounds

for T where + T: FullNodeTypes +{ +} + +/// Bounds for the provider factory required to build payloads. +pub trait ProviderFactoryBounds: + StateProviderFactory + + ChainSpecProvider> + + Send + + Sync +{ +} + +impl ProviderFactoryBounds

for T where + T: StateProviderFactory + + ChainSpecProvider> + + Send + + Sync +{ +} + +pub trait ProviderBounds: + ProviderFactoryBounds

+ + HeaderProvider

> + + Clone + + 'static +{ +} + +impl ProviderBounds

for T where + T: ProviderFactoryBounds

+ + HeaderProvider

> + + Clone + + 'static +{ +} + +pub trait PoolBounds: + TransactionPool + Unpin + 'static +{ +} + +impl PoolBounds

for T where + T: TransactionPool + Unpin + 'static +{ +} + +pub trait PooledTransactionBounds: + PoolTransaction> + Send + Sync + 'static +{ +} + +pub trait EvmConfigBounds: + ConfigureEvm> + Send + Sync +{ +} + +impl EvmConfigBounds

for T where + T: ConfigureEvm> + Send + Sync +{ +} + +pub trait PlatformExecBounds: + Platform< + NodeTypes: NodeTypes< + ChainSpec = types::ChainSpec

, + Primitives = types::Primitives

, + Payload = types::PayloadTypes

, + >, + EvmConfig = types::EvmConfig

, + ExtraLimits = types::ExtraLimits

, + > +{ +} + +impl PlatformExecBounds for P where + T: Platform< + NodeTypes: NodeTypes< + ChainSpec = types::ChainSpec

, + Primitives = types::Primitives

, + Payload = types::PayloadTypes

, + >, + EvmConfig = types::EvmConfig

, + ExtraLimits = types::ExtraLimits

, + > +{ +} + +// equal to `PlatformExecBounds` but with stricter checkpoint context +pub trait PlatformExecCtxBounds: + PlatformExecBounds

+ + Platform> +{ +} + +impl PlatformExecCtxBounds for P where + P: PlatformExecBounds + + Platform> +{ +} diff --git a/src/platform/types.rs b/crates/core/src/platform/types.rs similarity index 100% rename from src/platform/types.rs rename to crates/core/src/platform/types.rs diff --git a/src/platform/utils.rs b/crates/core/src/platform/utils.rs similarity index 100% rename from src/platform/utils.rs rename to crates/core/src/platform/utils.rs diff --git a/src/test_utils/accounts.rs b/crates/core/src/test_utils/accounts.rs similarity index 100% rename from src/test_utils/accounts.rs rename to crates/core/src/test_utils/accounts.rs diff --git a/src/test_utils/exts/mock.rs b/crates/core/src/test_utils/exts/mock.rs similarity index 96% rename from src/test_utils/exts/mock.rs rename to crates/core/src/test_utils/exts/mock.rs index 663b386..1682d39 100644 --- a/src/test_utils/exts/mock.rs +++ b/crates/core/src/test_utils/exts/mock.rs @@ -3,11 +3,8 @@ use { super::*, - crate::test_utils::optimism::{ - DEFAULT_EIP_1559_PARAMS, - DEFAULT_MIN_BASE_FEE, - }, alloy::primitives::{Address, B64, B256}, + optimism_constants::{DEFAULT_EIP_1559_PARAMS, DEFAULT_MIN_BASE_FEE}, reth::{ chainspec::EthChainSpec, ethereum::{ @@ -28,7 +25,7 @@ pub trait PlatformWithTestnet: Platform { /// Blanket implementation for ethereum impl PlatformWithTestnet for Ethereum { fn dev_chainspec() -> Arc> { - LazyLock::force(&crate::reth::chainspec::DEV) + LazyLock::force(&reth::chainspec::DEV) .clone() .with_funded_accounts() } @@ -38,7 +35,7 @@ impl PlatformWithTestnet for Ethereum { #[cfg(feature = "optimism")] impl PlatformWithTestnet for Optimism { fn dev_chainspec() -> Arc> { - LazyLock::force(&crate::reth::optimism::chainspec::OP_DEV) + LazyLock::force(&reth::optimism::chainspec::OP_DEV) .clone() .with_funded_accounts() } diff --git a/src/test_utils/exts/mod.rs b/crates/core/src/test_utils/exts/mod.rs similarity index 100% rename from src/test_utils/exts/mod.rs rename to crates/core/src/test_utils/exts/mod.rs diff --git a/src/test_utils/mock.rs b/crates/core/src/test_utils/mock.rs similarity index 100% rename from src/test_utils/mock.rs rename to crates/core/src/test_utils/mock.rs diff --git a/crates/core/src/test_utils/mod.rs b/crates/core/src/test_utils/mod.rs new file mode 100644 index 0000000..b84c3ae --- /dev/null +++ b/crates/core/src/test_utils/mod.rs @@ -0,0 +1,51 @@ +//! rblib-core testing infrastructure +//! +//! Those are utilities that provide ways to test platforms and other primitives +//! defined by rblib-core and downstream crates extending and building on top of +//! rblib such as rblib-pipeline. +//! +//! By default, two test platforms are defined for the two platforms maintained +//! by flashbots: +//! - [`Ethereum`] +//! - [`Optimism`] +//! +//! If you want to make your own [`crate::Platform`] type implementation +//! available for testing with those utils, you need to implement the +//! [`TestablePlatform`] trait for it. + +mod accounts; + +mod exts; + +mod mock; + +mod transactions; + +pub use { + accounts::{FundedAccounts, WithFundedAccounts}, + exts::*, + mock::{GenesisProviderFactory, GenesisStateProvider}, + transactions::{ + invalid_tx, + reverting_tx, + test_bundle, + test_tx, + test_txs, + transfer_tx, + }, +}; + +pub const ONE_ETH: u128 = 1_000_000_000_000_000_000; +pub const TEST_COINBASE: crate::alloy::primitives::Address = // + crate::alloy::primitives::address!( + "0x0000000000000000000000000000000000012345" + ); + +#[cfg(feature = "optimism")] +pub mod optimism_constants { + pub const DEFAULT_DENOMINATOR: u32 = 50; + pub const DEFAULT_ELASTICITY: u32 = 2; + pub const DEFAULT_EIP_1559_PARAMS: u64 = + ((DEFAULT_DENOMINATOR as u64) << 32) | (DEFAULT_ELASTICITY as u64); + pub const DEFAULT_MIN_BASE_FEE: u64 = 0; +} diff --git a/src/test_utils/transactions.rs b/crates/core/src/test_utils/transactions.rs similarity index 100% rename from src/test_utils/transactions.rs rename to crates/core/src/test_utils/transactions.rs diff --git a/src/pipelines/macros/Cargo.toml b/crates/pipeline-macros/Cargo.toml similarity index 60% rename from src/pipelines/macros/Cargo.toml rename to crates/pipeline-macros/Cargo.toml index c8d9d20..d09c902 100644 --- a/src/pipelines/macros/Cargo.toml +++ b/crates/pipeline-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pipelines-macros" -description = "Internal helper macros for the rblib pipelines API." +description = "Internal helper macros for rblib pipelines SDK." version.workspace = true edition.workspace = true rust-version.workspace = true @@ -11,15 +11,17 @@ authors.workspace = true exclude.workspace = true publish = false +[lints] +workspace = true + [lib] +doctest = false proc-macro = true [dependencies] -proc-macro2 = "1.0" -quote = "1.0" -syn = { version = "2.0", features = ["full"] } -proc-macro-crate = "3.3.0" +proc-macro2.workspace = true +quote.workspace = true +syn = { workspace = true, features = ["full"] } +proc-macro-crate.workspace = true -[lints] -workspace = true diff --git a/src/pipelines/macros/src/lib.rs b/crates/pipeline-macros/src/lib.rs similarity index 100% rename from src/pipelines/macros/src/lib.rs rename to crates/pipeline-macros/src/lib.rs diff --git a/src/pipelines/macros/src/metrics/mod.rs b/crates/pipeline-macros/src/metrics/mod.rs similarity index 87% rename from src/pipelines/macros/src/metrics/mod.rs rename to crates/pipeline-macros/src/metrics/mod.rs index 0cb18fa..6e50add 100644 --- a/src/pipelines/macros/src/metrics/mod.rs +++ b/crates/pipeline-macros/src/metrics/mod.rs @@ -8,9 +8,9 @@ fn rblib_path() -> proc_macro2::TokenStream { quote::quote, }; - match crate_name("rblib") { + match crate_name("rblib-pipeline") { Ok(FoundCrate::Itself) => { - // We are inside the rblib crate itself. + // We are inside the rblib-pipeline crate itself. quote!(crate) } Ok(FoundCrate::Name(name)) => { diff --git a/src/pipelines/macros/src/metrics/set.rs b/crates/pipeline-macros/src/metrics/set.rs similarity index 100% rename from src/pipelines/macros/src/metrics/set.rs rename to crates/pipeline-macros/src/metrics/set.rs diff --git a/src/pipelines/macros/src/variants.rs b/crates/pipeline-macros/src/variants.rs similarity index 100% rename from src/pipelines/macros/src/variants.rs rename to crates/pipeline-macros/src/variants.rs diff --git a/crates/pipeline/Cargo.toml b/crates/pipeline/Cargo.toml new file mode 100644 index 0000000..bf58c8f --- /dev/null +++ b/crates/pipeline/Cargo.toml @@ -0,0 +1,91 @@ +[package] +name = "rblib-pipeline" +description = "Pipeline orchestration and steps for rblib." +version.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true +authors.workspace = true +exclude.workspace = true + +[lints] +workspace = true + +[lib] +doctest = false + +[features] +default = ["rblib-core/default", "optimism", "jemalloc"] +optimism = ["rblib-core/optimism"] +jemalloc = ["rblib-core/jemalloc", "reth-optimism-cli?/jemalloc"] +jemalloc-prof = ["rblib-core/jemalloc-prof"] +long-pipelines-syntax = [] + +test-utils = [ + "rblib-core/test-utils", + "dep:nanoid", + "tokio/full", + "reth-optimism-rpc/client", + "dep:rblib-tests-macros", + "dep:jsonrpsee-core", + "dep:tracing-subscriber", + "dep:ctor", + "dep:reth-ipc" +] + +[target.'cfg(unix)'.dependencies] +tikv-jemallocator = { workspace = true, optional = true } + +[dependencies] +rblib-core = { path = "../core", default-features = true } +pipelines-macros = { path = "../pipeline-macros" } +rblib-tests-macros = { path = "../test-utils-macros", optional = true } + +# Common +eyre.workspace = true +derive_more.workspace = true +smallvec.workspace = true +dashmap.workspace = true +uuid.workspace = true +futures.workspace = true +tokio.workspace = true +tokio-stream.workspace = true +serde.workspace = true +jsonrpsee.workspace = true +parking_lot.workspace = true +priority-queue.workspace = true +rand.workspace = true +tracing.workspace = true +metrics.workspace = true + +# Reth +reth-evm.workspace = true +reth-errors.workspace = true +reth-rpc-api.workspace = true +reth-transaction-pool.workspace = true +reth-payload-builder.workspace = true + +# Optimism (optional) +reth-optimism-node = { workspace = true, optional = true } +reth-optimism-rpc = { workspace = true, optional = true } +reth-optimism-cli = { workspace = true, optional = true } + +# test utils +jsonrpsee-core = { workspace = true, optional = true } +nanoid = { workspace = true, optional = true } +alloy-genesis = { workspace = true, optional = true } +ctor = { workspace = true, optional = true } +tracing-subscriber = { workspace = true, optional = true, features = [ + "env-filter", + "json", +] } + +# Optional reth extras +reth-ipc = { workspace = true, optional = true } +reth-ethereum = { workspace = true, optional = true } +reth-node-builder = { workspace = true, optional = true } + +[dev-dependencies] +rblib-pipeline = { path = ".", features = ["test-utils"] } \ No newline at end of file diff --git a/crates/pipeline/src/lib.rs b/crates/pipeline/src/lib.rs new file mode 100644 index 0000000..3078127 --- /dev/null +++ b/crates/pipeline/src/lib.rs @@ -0,0 +1,31 @@ +// Pipelines, steps, pools, and other orchestration utilities for rblib. +pub use rblib_core::{ + Variant, + alloy, + metrics_util, + payload, + platform, + reth, + revm, + uuid, +}; + +pub mod orderpool2; +pub mod pipelines; +pub mod pool; +pub mod steps; + +#[cfg(any(test, feature = "test-utils"))] +pub mod test_utils; + +pub use {orderpool2::*, pipelines::*, pool::*, steps::*}; + +pub mod prelude { + pub(crate) use rblib_core::Variant; + pub use { + super::{orderpool2::*, pipelines::*, pool::*, steps::*}, + metrics::{Counter, Gauge, Histogram}, + pipelines_macros::MetricsSet, + rblib_core::prelude::*, + }; +} diff --git a/src/orderpool2/mod.rs b/crates/pipeline/src/orderpool2/mod.rs similarity index 100% rename from src/orderpool2/mod.rs rename to crates/pipeline/src/orderpool2/mod.rs diff --git a/src/orderpool2/prioritized_pool/mod.rs b/crates/pipeline/src/orderpool2/prioritized_pool/mod.rs similarity index 100% rename from src/orderpool2/prioritized_pool/mod.rs rename to crates/pipeline/src/orderpool2/prioritized_pool/mod.rs diff --git a/src/orderpool2/prioritized_pool/step.rs b/crates/pipeline/src/orderpool2/prioritized_pool/step.rs similarity index 97% rename from src/orderpool2/prioritized_pool/step.rs rename to crates/pipeline/src/orderpool2/prioritized_pool/step.rs index b78a9d8..1f65fb1 100644 --- a/src/orderpool2/prioritized_pool/step.rs +++ b/crates/pipeline/src/orderpool2/prioritized_pool/step.rs @@ -14,10 +14,9 @@ use { payload::CheckpointExt, prelude::{Bundle, Checkpoint, ControlFlow, Platform, Step, StepContext}, reth, + reth::revm::DatabaseRef, }, parking_lot::Mutex, - reth_ethereum::primitives::transaction::TxHashRef, - reth_evm::revm::DatabaseRef, std::{ marker::{PhantomData, Send, Sync}, sync::Arc, @@ -26,7 +25,7 @@ use { #[cfg(feature = "optimism")] use crate::{ - alloy::consensus::transaction::Recovered, + alloy::consensus::transaction::{Recovered, TxHashRef}, platform::types::Transaction as PlatformTransaction, prelude::Optimism, }; @@ -35,7 +34,7 @@ use crate::{ pub struct BundleWithNonces { bundle: B, nonces: Vec, - phantom: std::marker::PhantomData

, + phantom: PhantomData

, } impl BundleWithNonces diff --git a/src/orderpool2/prioritized_pool/tests.rs b/crates/pipeline/src/orderpool2/prioritized_pool/tests.rs similarity index 100% rename from src/orderpool2/prioritized_pool/tests.rs rename to crates/pipeline/src/orderpool2/prioritized_pool/tests.rs diff --git a/src/orderpool2/sim_tree.rs b/crates/pipeline/src/orderpool2/sim_tree.rs similarity index 100% rename from src/orderpool2/sim_tree.rs rename to crates/pipeline/src/orderpool2/sim_tree.rs diff --git a/src/pipelines/events.rs b/crates/pipeline/src/pipelines/events.rs similarity index 100% rename from src/pipelines/events.rs rename to crates/pipeline/src/pipelines/events.rs diff --git a/src/pipelines/exec/mod.rs b/crates/pipeline/src/pipelines/exec/mod.rs similarity index 100% rename from src/pipelines/exec/mod.rs rename to crates/pipeline/src/pipelines/exec/mod.rs diff --git a/src/pipelines/exec/navi.rs b/crates/pipeline/src/pipelines/exec/navi.rs similarity index 100% rename from src/pipelines/exec/navi.rs rename to crates/pipeline/src/pipelines/exec/navi.rs diff --git a/src/pipelines/exec/scope.rs b/crates/pipeline/src/pipelines/exec/scope.rs similarity index 100% rename from src/pipelines/exec/scope.rs rename to crates/pipeline/src/pipelines/exec/scope.rs diff --git a/src/pipelines/iter.rs b/crates/pipeline/src/pipelines/iter.rs similarity index 100% rename from src/pipelines/iter.rs rename to crates/pipeline/src/pipelines/iter.rs diff --git a/src/pipelines/job.rs b/crates/pipeline/src/pipelines/job.rs similarity index 100% rename from src/pipelines/job.rs rename to crates/pipeline/src/pipelines/job.rs diff --git a/src/pipelines/limits.rs b/crates/pipeline/src/pipelines/limits.rs similarity index 100% rename from src/pipelines/limits.rs rename to crates/pipeline/src/pipelines/limits.rs diff --git a/src/pipelines/metrics.rs b/crates/pipeline/src/pipelines/metrics.rs similarity index 99% rename from src/pipelines/metrics.rs rename to crates/pipeline/src/pipelines/metrics.rs index 20a25b2..a5fb246 100644 --- a/src/pipelines/metrics.rs +++ b/crates/pipeline/src/pipelines/metrics.rs @@ -3,6 +3,7 @@ use { alloy::consensus::BlockHeader, core::{panic::Location, time::Duration}, metrics::{Counter, Gauge, Histogram}, + pipelines_macros::MetricsSet, reth::node::builder::{BuiltPayload, PayloadBuilderAttributes}, std::time::{SystemTime, UNIX_EPOCH}, }; diff --git a/src/pipelines/mod.rs b/crates/pipeline/src/pipelines/mod.rs similarity index 77% rename from src/pipelines/mod.rs rename to crates/pipeline/src/pipelines/mod.rs index b7f1b2d..80aa68c 100644 --- a/src/pipelines/mod.rs +++ b/crates/pipeline/src/pipelines/mod.rs @@ -340,126 +340,6 @@ impl core::fmt::Debug for Pipeline

{ } } -pub mod traits { - use crate::{ - prelude::*, - reth::{ - api::FullNodeTypes, - evm::ConfigureEvm, - node::builder::NodeTypes, - providers::{ChainSpecProvider, HeaderProvider, StateProviderFactory}, - transaction_pool::{PoolTransaction, TransactionPool}, - }, - }; - - pub trait NodeBounds: - FullNodeTypes - { - } - - impl NodeBounds

for T where - T: FullNodeTypes - { - } - - /// Bounds for the provider factory required to build payloads. - pub trait ProviderFactoryBounds: - StateProviderFactory - + ChainSpecProvider> - + Send - + Sync - { - } - - impl ProviderFactoryBounds

for T where - T: StateProviderFactory - + ChainSpecProvider> - + Send - + Sync - { - } - - pub trait ProviderBounds: - ProviderFactoryBounds

- + HeaderProvider

> - + Clone - + 'static - { - } - - impl ProviderBounds

for T where - T: ProviderFactoryBounds

- + HeaderProvider

> - + Clone - + 'static - { - } - - pub trait PoolBounds: - TransactionPool + Unpin + 'static - { - } - - impl PoolBounds

for T where - T: TransactionPool + Unpin + 'static - { - } - - pub trait PooledTransactionBounds: - PoolTransaction> + Send + Sync + 'static - { - } - - pub trait EvmConfigBounds: - ConfigureEvm> + Send + Sync - { - } - - impl EvmConfigBounds

for T where - T: ConfigureEvm> + Send + Sync - { - } - - pub trait PlatformExecBounds: - Platform< - NodeTypes: NodeTypes< - ChainSpec = types::ChainSpec

, - Primitives = types::Primitives

, - Payload = types::PayloadTypes

, - >, - EvmConfig = types::EvmConfig

, - ExtraLimits = types::ExtraLimits

, - > - { - } - - impl PlatformExecBounds for P where - T: Platform< - NodeTypes: NodeTypes< - ChainSpec = types::ChainSpec

, - Primitives = types::Primitives

, - Payload = types::PayloadTypes

, - >, - EvmConfig = types::EvmConfig

, - ExtraLimits = types::ExtraLimits

, - > - { - } - - // equal to `PlatformExecBounds` but with stricter checkpoint context - pub trait PlatformExecCtxBounds: - PlatformExecBounds

- + Platform> - { - } - - impl PlatformExecCtxBounds for P where - P: PlatformExecBounds - + Platform> - { - } -} - // internal utilities #[cfg(any(test, feature = "test-utils"))] pub(crate) use exec::clone_payload_error_lossy; diff --git a/src/pipelines/service.rs b/crates/pipeline/src/pipelines/service.rs similarity index 98% rename from src/pipelines/service.rs rename to crates/pipeline/src/pipelines/service.rs index 4cb2337..8f30ac2 100644 --- a/src/pipelines/service.rs +++ b/crates/pipeline/src/pipelines/service.rs @@ -15,10 +15,13 @@ use { }, node::builder::NodePrimitives, payload::builder::{PayloadBuilderHandle, PayloadBuilderService, *}, - providers::{CanonStateSubscriptions, StateProviderFactory}, + providers::{ + CanonStateNotification, + CanonStateSubscriptions, + StateProviderFactory, + }, }, }, - reth_ethereum::provider::CanonStateNotification, std::sync::Arc, tracing::debug, }; diff --git a/src/pipelines/step/context.rs b/crates/pipeline/src/pipelines/step/context.rs similarity index 100% rename from src/pipelines/step/context.rs rename to crates/pipeline/src/pipelines/step/context.rs diff --git a/src/pipelines/step/instance.rs b/crates/pipeline/src/pipelines/step/instance.rs similarity index 100% rename from src/pipelines/step/instance.rs rename to crates/pipeline/src/pipelines/step/instance.rs diff --git a/src/pipelines/step/metrics.rs b/crates/pipeline/src/pipelines/step/metrics.rs similarity index 100% rename from src/pipelines/step/metrics.rs rename to crates/pipeline/src/pipelines/step/metrics.rs diff --git a/src/pipelines/step/mod.rs b/crates/pipeline/src/pipelines/step/mod.rs similarity index 100% rename from src/pipelines/step/mod.rs rename to crates/pipeline/src/pipelines/step/mod.rs diff --git a/src/pipelines/step/name.rs b/crates/pipeline/src/pipelines/step/name.rs similarity index 100% rename from src/pipelines/step/name.rs rename to crates/pipeline/src/pipelines/step/name.rs diff --git a/src/pipelines/tests/mod.rs b/crates/pipeline/src/pipelines/tests/mod.rs similarity index 100% rename from src/pipelines/tests/mod.rs rename to crates/pipeline/src/pipelines/tests/mod.rs diff --git a/src/pipelines/tests/revert.rs b/crates/pipeline/src/pipelines/tests/revert.rs similarity index 100% rename from src/pipelines/tests/revert.rs rename to crates/pipeline/src/pipelines/tests/revert.rs diff --git a/src/pipelines/tests/smoke.rs b/crates/pipeline/src/pipelines/tests/smoke.rs similarity index 100% rename from src/pipelines/tests/smoke.rs rename to crates/pipeline/src/pipelines/tests/smoke.rs diff --git a/src/pipelines/tests/syntax.rs b/crates/pipeline/src/pipelines/tests/syntax.rs similarity index 98% rename from src/pipelines/tests/syntax.rs rename to crates/pipeline/src/pipelines/tests/syntax.rs index 0e08fef..9bd04b3 100644 --- a/src/pipelines/tests/syntax.rs +++ b/crates/pipeline/src/pipelines/tests/syntax.rs @@ -1,6 +1,6 @@ use { - crate::{prelude::*, steps::*, test_utils::*}, - alloy_origin::signers::local::LocalSigner, + crate::{alloy, prelude::*, steps::*, test_utils::*}, + alloy::signers::local::LocalSigner, tracing::info, }; diff --git a/src/pool/host.rs b/crates/pipeline/src/pool/host.rs similarity index 100% rename from src/pool/host.rs rename to crates/pipeline/src/pool/host.rs diff --git a/src/pool/maintain.rs b/crates/pipeline/src/pool/maintain.rs similarity index 100% rename from src/pool/maintain.rs rename to crates/pipeline/src/pool/maintain.rs diff --git a/src/pool/mod.rs b/crates/pipeline/src/pool/mod.rs similarity index 100% rename from src/pool/mod.rs rename to crates/pipeline/src/pool/mod.rs diff --git a/src/pool/native.rs b/crates/pipeline/src/pool/native.rs similarity index 100% rename from src/pool/native.rs rename to crates/pipeline/src/pool/native.rs diff --git a/src/pool/report.rs b/crates/pipeline/src/pool/report.rs similarity index 100% rename from src/pool/report.rs rename to crates/pipeline/src/pool/report.rs diff --git a/src/pool/rpc.rs b/crates/pipeline/src/pool/rpc.rs similarity index 100% rename from src/pool/rpc.rs rename to crates/pipeline/src/pool/rpc.rs diff --git a/src/pool/select.rs b/crates/pipeline/src/pool/select.rs similarity index 100% rename from src/pool/select.rs rename to crates/pipeline/src/pool/select.rs diff --git a/src/pool/setup.rs b/crates/pipeline/src/pool/setup.rs similarity index 100% rename from src/pool/setup.rs rename to crates/pipeline/src/pool/setup.rs diff --git a/src/pool/step.rs b/crates/pipeline/src/pool/step.rs similarity index 100% rename from src/pool/step.rs rename to crates/pipeline/src/pool/step.rs diff --git a/src/steps/builder.rs b/crates/pipeline/src/steps/builder.rs similarity index 100% rename from src/steps/builder.rs rename to crates/pipeline/src/steps/builder.rs diff --git a/src/steps/combinator/atomic.rs b/crates/pipeline/src/steps/combinator/atomic.rs similarity index 100% rename from src/steps/combinator/atomic.rs rename to crates/pipeline/src/steps/combinator/atomic.rs diff --git a/src/steps/combinator/chain.rs b/crates/pipeline/src/steps/combinator/chain.rs similarity index 100% rename from src/steps/combinator/chain.rs rename to crates/pipeline/src/steps/combinator/chain.rs diff --git a/src/steps/combinator/mod.rs b/crates/pipeline/src/steps/combinator/mod.rs similarity index 100% rename from src/steps/combinator/mod.rs rename to crates/pipeline/src/steps/combinator/mod.rs diff --git a/src/steps/mod.rs b/crates/pipeline/src/steps/mod.rs similarity index 100% rename from src/steps/mod.rs rename to crates/pipeline/src/steps/mod.rs diff --git a/src/steps/optimism.rs b/crates/pipeline/src/steps/optimism.rs similarity index 100% rename from src/steps/optimism.rs rename to crates/pipeline/src/steps/optimism.rs diff --git a/src/steps/ordering/mod.rs b/crates/pipeline/src/steps/ordering/mod.rs similarity index 100% rename from src/steps/ordering/mod.rs rename to crates/pipeline/src/steps/ordering/mod.rs diff --git a/src/steps/ordering/profit.rs b/crates/pipeline/src/steps/ordering/profit.rs similarity index 100% rename from src/steps/ordering/profit.rs rename to crates/pipeline/src/steps/ordering/profit.rs diff --git a/src/steps/ordering/tip.rs b/crates/pipeline/src/steps/ordering/tip.rs similarity index 100% rename from src/steps/ordering/tip.rs rename to crates/pipeline/src/steps/ordering/tip.rs diff --git a/src/steps/revert.rs b/crates/pipeline/src/steps/revert.rs similarity index 100% rename from src/steps/revert.rs rename to crates/pipeline/src/steps/revert.rs diff --git a/src/steps/utils.rs b/crates/pipeline/src/steps/utils.rs similarity index 100% rename from src/steps/utils.rs rename to crates/pipeline/src/steps/utils.rs diff --git a/src/test_utils/ethereum.rs b/crates/pipeline/src/test_utils/ethereum.rs similarity index 98% rename from src/test_utils/ethereum.rs rename to crates/pipeline/src/test_utils/ethereum.rs index 1002133..140674b 100644 --- a/src/test_utils/ethereum.rs +++ b/crates/pipeline/src/test_utils/ethereum.rs @@ -16,10 +16,9 @@ use { node::EthereumAddOns, }, payload::builder::PayloadId, - rpc::types::engine::ForkchoiceState, + rpc::{api::EngineApiClient, types::engine::ForkchoiceState}, }, reth_ipc::client::IpcClientBuilder, - reth_rpc_api::EngineApiClient, }; impl TestNodeFactory for Ethereum { diff --git a/src/test_utils/mod.rs b/crates/pipeline/src/test_utils/mod.rs similarity index 82% rename from src/test_utils/mod.rs rename to crates/pipeline/src/test_utils/mod.rs index 553e388..46f1a77 100644 --- a/src/test_utils/mod.rs +++ b/crates/pipeline/src/test_utils/mod.rs @@ -17,23 +17,16 @@ //! [`Ethereum`]: crate::prelude::Ethereum //! [`Optimism`]: crate::prelude::Optimism -mod accounts; -mod ethereum; -mod exts; -mod mock; mod node; mod platform; mod step; -mod transactions; pub use { crate::fake_step, - accounts::{FundedAccounts, WithFundedAccounts}, ethereum::EthConsensusDriver, - exts::*, - mock::{GenesisProviderFactory, GenesisStateProvider}, node::{ConsensusDriver, LocalNode}, platform::{TestNodeFactory, TestablePlatform}, + rblib_core::test_utils::*, rblib_tests_macros::{assert_is_dyn_safe, if_platform, rblib_test}, step::{ AlwaysBreakStep, @@ -43,28 +36,15 @@ pub use { OneStep, StringEvent, }, - transactions::{ - invalid_tx, - reverting_tx, - test_bundle, - test_tx, - test_txs, - transfer_tx, - }, }; +// Platform specific +mod ethereum; #[cfg(feature = "optimism")] mod optimism; - #[cfg(feature = "optimism")] pub use optimism::OptimismConsensusDriver; -pub const ONE_ETH: u128 = 1_000_000_000_000_000_000; -pub const TEST_COINBASE: crate::alloy::primitives::Address = // - crate::alloy::primitives::address!( - "0x0000000000000000000000000000000000012345" - ); - /// This gets invoked before any tests, when the cargo test framework loads the /// test library. #[cfg(feature = "test-utils")] diff --git a/src/test_utils/node.rs b/crates/pipeline/src/test_utils/node.rs similarity index 100% rename from src/test_utils/node.rs rename to crates/pipeline/src/test_utils/node.rs diff --git a/src/test_utils/optimism.rs b/crates/pipeline/src/test_utils/optimism.rs similarity index 92% rename from src/test_utils/optimism.rs rename to crates/pipeline/src/test_utils/optimism.rs index 4409d51..cada73f 100644 --- a/src/test_utils/optimism.rs +++ b/crates/pipeline/src/test_utils/optimism.rs @@ -10,6 +10,7 @@ use { primitives::B256, providers::Provider, }, + optimism_constants::{DEFAULT_EIP_1559_PARAMS, DEFAULT_MIN_BASE_FEE}, reth::{ ethereum::node::engine::EthPayloadAttributes as PayloadAttributes, node::builder::Node, @@ -21,14 +22,13 @@ use { TX_SET_L1_BLOCK_OP_MAINNET_BLOCK_124665056, }, }, - node::{OpEngineTypes, OpNode, OpPayloadAttributes}, + node::{OpEngineTypes, OpNode, OpPayloadAttributes, args::RollupArgs}, + rpc::OpEngineApiClient, }, payload::builder::PayloadId, rpc::types::{Block, engine::ForkchoiceState}, }, reth_ipc::client::IpcClientBuilder, - reth_optimism_node::args::RollupArgs, - reth_optimism_rpc::OpEngineApiClient, }; impl TestNodeFactory for Optimism { @@ -51,12 +51,6 @@ impl TestNodeFactory for Optimism { } } -pub(super) const DEFAULT_DENOMINATOR: u32 = 50; -pub(super) const DEFAULT_ELASTICITY: u32 = 2; -pub(super) const DEFAULT_EIP_1559_PARAMS: u64 = - ((DEFAULT_DENOMINATOR as u64) << 32) | (DEFAULT_ELASTICITY as u64); -pub(super) const DEFAULT_MIN_BASE_FEE: u64 = 0; - pub struct OptimismConsensusDriver; impl

ConsensusDriver

for OptimismConsensusDriver where diff --git a/src/test_utils/platform.rs b/crates/pipeline/src/test_utils/platform.rs similarity index 100% rename from src/test_utils/platform.rs rename to crates/pipeline/src/test_utils/platform.rs diff --git a/src/test_utils/step.rs b/crates/pipeline/src/test_utils/step.rs similarity index 100% rename from src/test_utils/step.rs rename to crates/pipeline/src/test_utils/step.rs diff --git a/crates/rblib/Cargo.toml b/crates/rblib/Cargo.toml new file mode 100644 index 0000000..ab343e3 --- /dev/null +++ b/crates/rblib/Cargo.toml @@ -0,0 +1,34 @@ +[package] +name = "rblib" +description = "Facade crate for backward compatibility. Alias of rblib-pipeline." +version.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true +authors.workspace = true +exclude.workspace = true +publish = false + +[lints] +workspace = true + +[lib] +doctest = false + +[features] +default = ["rblib-pipeline/default"] +jemalloc = ["rblib-pipeline/jemalloc"] +jemalloc-prof = ["rblib-pipeline/jemalloc-prof"] +optimism = ["rblib-pipeline/optimism"] +test-utils = ["rblib-pipeline/test-utils"] + +[dependencies] +rblib-core = { path = "../core" } +rblib-pipeline = { path = "../pipeline" } + +[dev-dependencies] +rblib = { path = ".", features = ["test-utils"] } +eyre.workspace = true +serde.workspace = true diff --git a/examples/checkpoints-eth.rs b/crates/rblib/examples/checkpoints-eth.rs similarity index 100% rename from examples/checkpoints-eth.rs rename to crates/rblib/examples/checkpoints-eth.rs diff --git a/examples/checkpoints-op.rs b/crates/rblib/examples/checkpoints-op.rs similarity index 100% rename from examples/checkpoints-op.rs rename to crates/rblib/examples/checkpoints-op.rs diff --git a/examples/custom-platform.rs b/crates/rblib/examples/custom-platform.rs similarity index 99% rename from examples/custom-platform.rs rename to crates/rblib/examples/custom-platform.rs index 44fc7c4..da3cf18 100644 --- a/examples/custom-platform.rs +++ b/crates/rblib/examples/custom-platform.rs @@ -67,7 +67,7 @@ impl Platform for CustomPlatform { impl PlatformWithTestnet for CustomPlatform { fn dev_chainspec() -> Arc> { - LazyLock::force(&crate::reth::optimism::chainspec::OP_DEV) + LazyLock::force(&reth::optimism::chainspec::OP_DEV) .clone() .with_funded_accounts() } diff --git a/examples/node-builder.md b/crates/rblib/examples/node-builder.md similarity index 100% rename from examples/node-builder.md rename to crates/rblib/examples/node-builder.md diff --git a/examples/pipeline-op.rs b/crates/rblib/examples/pipeline-op.rs similarity index 90% rename from examples/pipeline-op.rs rename to crates/rblib/examples/pipeline-op.rs index 3e4e689..ff5b947 100644 --- a/examples/pipeline-op.rs +++ b/crates/rblib/examples/pipeline-op.rs @@ -6,14 +6,11 @@ use { prelude::*, steps::{OptimismPrologue, OrderByPriorityFee}, }, - reth_optimism_cli::Cli, - reth_optimism_node::{ - OpAddOns, - OpEngineApiBuilder, - OpEngineValidatorBuilder, - OpNode, + rblib_core::reth::optimism::{ + cli::Cli, + node::{OpAddOns, OpEngineApiBuilder, OpEngineValidatorBuilder, OpNode}, + rpc::OpEthApiBuilder, }, - reth_optimism_rpc::OpEthApiBuilder, }; /// Basic block builder diff --git a/crates/rblib/src/lib.rs b/crates/rblib/src/lib.rs new file mode 100644 index 0000000..6ccadcd --- /dev/null +++ b/crates/rblib/src/lib.rs @@ -0,0 +1,27 @@ +pub mod prelude { + // rblib_pipeline already include rblib core + pub use rblib_pipeline::prelude::*; +} + +pub mod pool { + pub use rblib_pipeline::pool::*; +} + +pub mod steps { + pub use rblib_pipeline::steps::*; +} + +pub mod reth { + pub use rblib_core::reth::*; +} +pub mod revm { + pub use rblib_core::revm::*; +} +pub mod alloy { + pub use rblib_core::alloy::*; +} + +#[cfg(any(test, feature = "test-utils"))] +pub mod test_utils { + pub use rblib_pipeline::test_utils::*; +} diff --git a/src/test_utils/macros/Cargo.toml b/crates/test-utils-macros/Cargo.toml similarity index 76% rename from src/test_utils/macros/Cargo.toml rename to crates/test-utils-macros/Cargo.toml index d590c46..8da4d61 100644 --- a/src/test_utils/macros/Cargo.toml +++ b/crates/test-utils-macros/Cargo.toml @@ -11,16 +11,17 @@ authors.workspace = true exclude.workspace = true publish = false +[lints] +workspace = true + [lib] doctest = false proc-macro = true [features] default = [] -optimism = [] [dependencies] -syn = "2.0" -quote = "1.0" -proc-macro2 = { version = "1.0" } -paste = "1.0" +proc-macro2.workspace = true +quote.workspace = true +syn = { workspace = true, features = ["full"] } diff --git a/src/test_utils/macros/src/lib.rs b/crates/test-utils-macros/src/lib.rs similarity index 95% rename from src/test_utils/macros/src/lib.rs rename to crates/test-utils-macros/src/lib.rs index 67bfbb9..9dad9f2 100644 --- a/src/test_utils/macros/src/lib.rs +++ b/crates/test-utils-macros/src/lib.rs @@ -47,9 +47,8 @@ pub fn rblib_test(args: TokenStream, input: TokenStream) -> TokenStream { // Preserve return type only when it is `eyre::Result<()>` let generic_fn_output = if returns_eyre_result_unit { - let ty = match output { - syn::ReturnType::Type(_, ty) => ty, - _ => unreachable!(), + let syn::ReturnType::Type(_, ty) = output else { + unreachable!() }; quote! { -> #ty } } else { @@ -116,8 +115,8 @@ pub fn if_platform(input: TokenStream) -> TokenStream { /// dyn safe. /// /// Usage examples: -/// assert_is_dyn_safe!(MyTrait); -/// assert_is_dyn_safe!(MyTrait

, P: SomeBound + AnotherBound); +/// `assert_is_dyn_safe!(MyTrait);` +/// `assert_is_dyn_safe!(MyTrait

, P: SomeBound + AnotherBound);` /// /// [dyn safe]: https://doc.rust-lang.org/reference/items/traits.html#object-safety #[proc_macro] @@ -222,7 +221,7 @@ pub fn assert_is_dyn_safe(input: TokenStream) -> TokenStream { let fallback = Ident::new("trait_is_dyn_safe", Span::call_site()); let ident = last_ident_of_type(&trait_ty).unwrap_or(fallback.clone()); let snake = to_snake_case(&ident.to_string()); - Ident::new(&format!("{}_is_dyn_safe", snake), ident.span()) + Ident::new(&format!("{snake}_is_dyn_safe"), ident.span()) }; // Create a private scope with a type that includes Box>. @@ -246,11 +245,11 @@ struct IfPlatformInput { impl Parse for IfPlatformInput { fn parse(input: ParseStream) -> syn::Result { let platform = input.parse()?; - let _arrow = input.parse()?; + let arrow = input.parse()?; let code = input.parse()?; Ok(IfPlatformInput { platform, - _arrow, + _arrow: arrow, code, }) } From e358021e903197cb27e6caae26907f212fe3f630 Mon Sep 17 00:00:00 2001 From: julio4 <30329843+julio4@users.noreply.github.com> Date: Mon, 5 Jan 2026 10:43:18 +0900 Subject: [PATCH 2/3] refactor: updated tests and fixes --- crates/core/src/payload/exec.rs | 682 ++++++++---------- crates/pipeline/Cargo.toml | 4 +- .../src/orderpool2/prioritized_pool/step.rs | 3 +- crates/rblib/Cargo.toml | 1 - crates/rblib/examples/pipeline-op.rs | 12 +- crates/rblib/src/lib.rs | 6 +- 6 files changed, 319 insertions(+), 389 deletions(-) diff --git a/crates/core/src/payload/exec.rs b/crates/core/src/payload/exec.rs index 7aa625d..e071cbd 100644 --- a/crates/core/src/payload/exec.rs +++ b/crates/core/src/payload/exec.rs @@ -439,378 +439,310 @@ impl ExecutionResult

{ } } -// TODO: rework this without TestablePlatform? -// or adapt testable platform to not depend on pipeline -// #[cfg(test)] -// mod tests { -// use { -// super::*, -// crate::test_utils::{ -// BlockContextMocked, -// TestablePlatform, -// test_bundle, -// test_tx, -// test_txs, -// }, -// rblib_tests_macros::rblib_test, -// }; -// -// #[rblib_test(Ethereum, Optimism)] -// fn test_executable_transaction_returns_single_transaction< -// P: TestablePlatform, -// >() { -// let tx = test_tx::

(0, 0); -// let executable = Executable::

::Transaction(tx.clone()); -// -// assert_eq!(executable.transactions().len(), 1); -// assert_eq!(executable.transactions()[0], tx); -// assert!(executable.is_transaction()); -// assert!(!executable.is_bundle()); -// } -// -// #[rblib_test(Ethereum, Optimism)] -// fn test_executable_bundle_returns_all_transactions

() -// where -// P: TestablePlatform>, -// { -// let (bundle, txs) = test_bundle::

(0, 0); -// let executable = Executable::

::Bundle(bundle); -// -// assert_eq!(executable.transactions().len(), txs.len()); -// assert_eq!(executable.transactions(), txs.as_slice()); -// assert!(!executable.is_transaction()); -// assert!(executable.is_bundle()); -// } -// -// #[rblib_test(Ethereum, Optimism)] -// fn test_execute_transaction_success

() -// where -// P: TestablePlatform, -// BlockContext

: BlockContextMocked

, -// { -// let block = BlockContext::

::mocked(); -// let checkpoint = block.start(); -// let tx = test_tx::

(0, 0); -// -// let result = Executable::execute_transaction( -// tx.clone(), -// &block, -// &checkpoint, -// checkpoint.context(), -// ); -// -// let exec_result = result.unwrap(); -// assert_eq!(exec_result.results().len(), 1); -// assert_eq!(exec_result.transactions().len(), 1); -// assert_eq!(exec_result.transactions()[0], tx); -// assert!(exec_result.results()[0].is_success()); -// } -// -// #[rblib_test(Ethereum, Optimism)] -// fn test_execute_transaction_produces_state_changes

() -// where -// P: TestablePlatform, -// BlockContext

: BlockContextMocked

, -// { -// let block = BlockContext::

::mocked(); -// let checkpoint = block.start(); -// let tx = test_tx::

(0, 0); -// -// let result = Executable::execute_transaction( -// tx, -// &block, -// &checkpoint, -// checkpoint.context(), -// ); -// -// let exec_result = result.unwrap(); -// assert!(!exec_result.state().is_empty()); -// assert!(exec_result.gas_used() > 0); -// } -// -// #[rblib_test(Ethereum, Optimism)] -// fn test_execute_via_execute_method

() -// where -// P: TestablePlatform, -// BlockContext

: BlockContextMocked

, -// { -// let block = BlockContext::

::mocked(); -// let checkpoint = block.start(); -// let tx = test_tx::

(0, 0); -// let executable = Executable::

::Transaction(tx); -// -// let result = executable.execute(&block, &checkpoint, checkpoint.context()); -// assert_eq!(result.unwrap().results().len(), 1); -// } -// -// #[rblib_test(Ethereum, Optimism)] -// fn test_execute_bundle_all_successful

() -// where -// P: TestablePlatform>, -// BlockContext

: BlockContextMocked

, -// { -// let block = BlockContext::

::mocked(); -// let checkpoint = block.start(); -// let (bundle, txs) = test_bundle::

(0, 0); -// -// let result = Executable::execute_bundle( -// bundle, -// &block, -// &checkpoint, -// checkpoint.context(), -// ); -// -// let exec_result = result.unwrap(); -// assert_eq!(exec_result.results().len(), txs.len()); -// assert!(exec_result.results().iter().all(|r| r.is_success())); -// assert_eq!(exec_result.transactions().len(), txs.len()); -// assert_eq!(exec_result.transactions(), txs.as_slice()); -// } -// -// #[rblib_test(Ethereum, Optimism)] -// fn test_execute_bundle_aggregates_gas

() -// where -// P: TestablePlatform>, -// BlockContext

: BlockContextMocked

, -// { -// let block = BlockContext::

::mocked(); -// let checkpoint = block.start(); -// let (bundle, _) = test_bundle::

(0, 0); -// -// let result = Executable::execute_bundle( -// bundle, -// &block, -// &checkpoint, -// checkpoint.context(), -// ); -// -// let exec_result = result.unwrap(); -// let total_gas = exec_result.gas_used(); -// let sum_gas: u64 = exec_result.results().iter().map(|r| -// r.gas_used()).sum(); assert_eq!(total_gas, sum_gas); -// assert!(total_gas > 0); -// } -// -// #[rblib_test(Ethereum, Optimism)] -// fn test_execute_bundle_sequential_execution

() -// where -// P: TestablePlatform>, -// BlockContext

: BlockContextMocked

, -// { -// // Each transaction in a bundle executes on the state from the previous -// let block = BlockContext::

::mocked(); -// let checkpoint = block.start(); -// // Use the same account for all transactions to test sequential nonces -// let txs = test_txs::

(0, 0, 3); -// let (bundle, _) = test_bundle::

(0, 0); -// -// let result = Executable::execute_bundle( -// bundle, -// &block, -// &checkpoint, -// checkpoint.context(), -// ); -// -// let exec_result = result.unwrap(); -// assert_eq!(exec_result.results().len(), txs.len()); -// assert!(exec_result.results().iter().all(|r| r.is_success())); -// } -// -// #[rblib_test(Ethereum, Optimism)] -// fn test_into_executable_from_recovered_transaction() { -// let tx = test_tx::

(0, 0); -// let result: Result, _> = -// IntoExecutable::>::try_into_executable(tx.clone()); -// -// let executable = result.unwrap(); -// assert!(executable.is_transaction()); -// assert_eq!(executable.transactions()[0], tx); -// } -// -// #[rblib_test(Ethereum, Optimism)] -// fn test_into_executable_from_bundle

() -// where -// P: TestablePlatform>, -// { -// let (bundle, _) = test_bundle::

(0, 0); -// let result: Result, _> = -// IntoExecutable::>::try_into_executable(bundle); -// -// assert!(result.unwrap().is_bundle()); -// } -// -// #[rblib_test(Ethereum, Optimism)] -// fn test_into_executable_from_executable() { -// let tx = test_tx::

(0, 0); -// let executable = Executable::

::Transaction(tx); -// let result: Result, _> = -// IntoExecutable::>::try_into_executable(executable.clone()); -// -// assert_eq!(result.unwrap(), executable); -// } -// -// #[rblib_test(Ethereum, Optimism)] -// fn test_into_executable_from_checkpoint

() -// where -// P: TestablePlatform>, -// BlockContext

: BlockContextMocked

, -// { -// let block = BlockContext::

::mocked(); -// let checkpoint = block.start(); -// let tx = test_tx::

(0, 0); -// let checkpoint_with_tx = checkpoint.apply(tx.clone()).unwrap(); -// -// let result: Result, _> = -// IntoExecutable::>::try_into_executable(checkpoint_with_tx); -// -// let executable = result.unwrap(); -// assert!(executable.is_transaction()); -// assert_eq!(executable.transactions()[0], tx); -// } -// -// #[rblib_test(Ethereum, Optimism)] -// fn test_into_executable_from_checkpoint_ref

() -// where -// P: TestablePlatform>, -// BlockContext

: BlockContextMocked

, -// { -// let block = BlockContext::

::mocked(); -// let checkpoint = block.start(); -// let tx = test_tx::

(0, 0); -// let checkpoint_with_tx = checkpoint.apply(tx.clone()).unwrap(); -// -// let result: Result, _> = -// IntoExecutable::>::try_into_executable(&checkpoint_with_tx); -// -// let executable = result.unwrap(); -// assert!(executable.is_transaction()); -// assert_eq!(executable.transactions()[0], tx); -// } -// -// #[rblib_test(Ethereum, Optimism)] -// fn test_into_executable_from_barrier_checkpoint_fails

() -// where -// P: TestablePlatform, -// BlockContext

: BlockContextMocked

, -// { -// let block = BlockContext::

::mocked(); -// let checkpoint = block.start(); -// let barrier = checkpoint.barrier(); -// -// let result: Result, _> = -// IntoExecutable::>::try_into_executable(&barrier); -// -// assert!(result.is_err()); -// } -// -// #[rblib_test(Ethereum, Optimism)] -// fn test_execution_result_source

() -// where -// P: TestablePlatform, -// BlockContext

: BlockContextMocked

, -// { -// let block = BlockContext::

::mocked(); -// let checkpoint = block.start(); -// let tx = test_tx::

(0, 0); -// let executable = Executable::

::Transaction(tx.clone()); -// -// let result = executable -// .execute(&block, &checkpoint, checkpoint.context()) -// .unwrap(); -// -// match result.source() { -// Executable::Transaction(result_tx) => assert_eq!(*result_tx, tx), -// Executable::Bundle(_) => panic!("Expected transaction source"), -// } -// } -// -// #[rblib_test(Ethereum, Optimism)] -// fn test_execution_result_transactions

() -// where -// P: TestablePlatform>, -// BlockContext

: BlockContextMocked

, -// { -// let block = BlockContext::

::mocked(); -// let checkpoint = block.start(); -// let (bundle, txs) = test_bundle::

(0, 0); -// let executable = Executable::

::Bundle(bundle); -// -// let result = executable -// .execute(&block, &checkpoint, checkpoint.context()) -// .unwrap(); -// -// assert_eq!(result.transactions(), txs.as_slice()); -// } -// -// #[rblib_test(Ethereum, Optimism)] -// fn test_executable_hash_transaction() { -// let tx = test_tx::

(0, 0); -// let expected_hash = *tx.tx_hash(); -// let executable = Executable::

::Transaction(tx); -// -// assert_eq!(executable.hash(), expected_hash); -// } -// -// #[rblib_test(Ethereum, Optimism)] -// fn test_executable_hash_bundle

() -// where -// P: TestablePlatform>, -// { -// let (bundle, _) = test_bundle::

(0, 0); -// let expected_hash = bundle.hash(); -// let executable = Executable::

::Bundle(bundle); -// -// assert_eq!(executable.hash(), expected_hash); -// } -// -// #[rblib_test(Ethereum, Optimism)] -// fn test_execution_error_invalid_signature_display() { -// let err = ExecutionError::

::InvalidSignature(RecoveryError::new()); -// let display = format!("{err}"); -// assert!(display.contains("Invalid signature")); -// } -// -// #[rblib_test(Ethereum, Optimism)] -// fn test_execution_result_state_is_bundle_state

() -// where -// P: TestablePlatform, -// BlockContext

: BlockContextMocked

, -// { -// let block = BlockContext::

::mocked(); -// let checkpoint = block.start(); -// let tx = test_tx::

(0, 0); -// -// let result = Executable::execute_transaction( -// tx, -// &block, -// &checkpoint, -// checkpoint.context(), -// ) -// .unwrap(); -// -// // State should be a BundleState with changes -// assert!(!result.state().is_empty()); -// } -// -// #[rblib_test(Ethereum, Optimism)] -// fn test_execution_result_clone

() -// where -// P: TestablePlatform, -// BlockContext

: BlockContextMocked

, -// { -// let block = BlockContext::

::mocked(); -// let checkpoint = block.start(); -// let tx = test_tx::

(0, 0); -// -// let result = Executable::execute_transaction( -// tx, -// &block, -// &checkpoint, -// checkpoint.context(), -// ) -// .unwrap(); -// let cloned = result.clone(); -// -// assert_eq!(result, cloned); -// } -// } +#[cfg(test)] +mod tests { + use { + super::*, + crate::test_utils::{BlockContextMocked, test_bundle, test_tx, test_txs}, + }; + + #[test] + fn test_executable_transaction_returns_single_transaction() { + let tx = test_tx::(0, 0); + let executable = Executable::::Transaction(tx.clone()); + + assert_eq!(executable.transactions().len(), 1); + assert_eq!(executable.transactions()[0], tx); + assert!(executable.is_transaction()); + assert!(!executable.is_bundle()); + } + + #[test] + fn test_executable_bundle_returns_all_transactions() { + let (bundle, txs) = test_bundle::(0, 0); + let executable = Executable::::Bundle(bundle); + + assert_eq!(executable.transactions().len(), txs.len()); + assert_eq!(executable.transactions(), txs.as_slice()); + assert!(!executable.is_transaction()); + assert!(executable.is_bundle()); + } + + #[test] + fn test_execute_transaction_success() { + let block = BlockContext::::mocked(); + let checkpoint = block.start(); + let tx = test_tx::(0, 0); + + let result = Executable::execute_transaction( + tx.clone(), + &block, + &checkpoint, + checkpoint.context(), + ); + + let exec_result = result.unwrap(); + assert_eq!(exec_result.results().len(), 1); + assert_eq!(exec_result.transactions().len(), 1); + assert_eq!(exec_result.transactions()[0], tx); + assert!(exec_result.results()[0].is_success()); + } + + #[test] + fn test_execute_transaction_produces_state_changes() { + let block = BlockContext::::mocked(); + let checkpoint = block.start(); + let tx = test_tx::(0, 0); + + let result = Executable::execute_transaction( + tx, + &block, + &checkpoint, + checkpoint.context(), + ); + + let exec_result = result.unwrap(); + assert!(!exec_result.state().is_empty()); + assert!(exec_result.gas_used() > 0); + } + + #[test] + fn test_execute_via_execute_method() { + let block = BlockContext::::mocked(); + let checkpoint = block.start(); + let tx = test_tx::(0, 0); + let executable = Executable::Transaction(tx); + + let result = executable.execute(&block, &checkpoint, checkpoint.context()); + assert_eq!(result.unwrap().results().len(), 1); + } + + #[test] + fn test_execute_bundle_all_successful() { + let block = BlockContext::::mocked(); + let checkpoint = block.start(); + let (bundle, txs) = test_bundle(0, 0); + + let result = Executable::execute_bundle( + bundle, + &block, + &checkpoint, + checkpoint.context(), + ); + + let exec_result = result.unwrap(); + assert_eq!(exec_result.results().len(), txs.len()); + assert!(exec_result.results().iter().all(|r| r.is_success())); + assert_eq!(exec_result.transactions().len(), txs.len()); + assert_eq!(exec_result.transactions(), txs.as_slice()); + } + + #[test] + fn test_execute_bundle_aggregates_gas() { + let block = BlockContext::::mocked(); + let checkpoint = block.start(); + let (bundle, _) = test_bundle(0, 0); + + let result = Executable::execute_bundle( + bundle, + &block, + &checkpoint, + checkpoint.context(), + ); + + let exec_result = result.unwrap(); + let total_gas = exec_result.gas_used(); + let sum_gas: u64 = exec_result.results().iter().map(|r| r.gas_used()).sum(); + assert_eq!(total_gas, sum_gas); + assert!(total_gas > 0); + } + + #[test] + fn test_execute_bundle_sequential_execution() { + // Each transaction in a bundle executes on the state from the previous + let block = BlockContext::::mocked(); + let checkpoint = block.start(); + // Use the same account for all transactions to test sequential nonces + let txs = test_txs::(0, 0, 3); + let (bundle, _) = test_bundle(0, 0); + + let result = Executable::execute_bundle( + bundle, + &block, + &checkpoint, + checkpoint.context(), + ); + + let exec_result = result.unwrap(); + assert_eq!(exec_result.results().len(), txs.len()); + assert!(exec_result.results().iter().all(|r| r.is_success())); + } + + #[test] + fn test_into_executable_from_recovered_transaction() { + let tx = test_tx::(0, 0); + let result = + IntoExecutable::>::try_into_executable(tx.clone()); + + let executable = result.unwrap(); + assert!(executable.is_transaction()); + assert_eq!(executable.transactions()[0], tx); + } + + #[test] + fn test_into_executable_from_bundle() { + let (bundle, _) = test_bundle::(0, 0); + let result = + IntoExecutable::>::try_into_executable(bundle); + + assert!(result.unwrap().is_bundle()); + } + + #[test] + fn test_into_executable_from_executable() { + let tx = test_tx::(0, 0); + let executable = Executable::Transaction(tx); + let result = IntoExecutable::>::try_into_executable( + executable.clone(), + ); + + assert_eq!(result.unwrap(), executable); + } + + #[test] + fn test_into_executable_from_checkpoint() { + let block = BlockContext::::mocked(); + let checkpoint = block.start(); + let tx = test_tx::(0, 0); + let checkpoint_with_tx = checkpoint.apply(tx.clone()).unwrap(); + + let result = IntoExecutable::>::try_into_executable( + checkpoint_with_tx, + ); + + let executable = result.unwrap(); + assert!(executable.is_transaction()); + assert_eq!(executable.transactions()[0], tx); + } + + #[test] + fn test_into_executable_from_checkpoint_ref() { + let block = BlockContext::::mocked(); + let checkpoint = block.start(); + let tx = test_tx::(0, 0); + let checkpoint_with_tx = checkpoint.apply(tx.clone()).unwrap(); + + let result = IntoExecutable::>::try_into_executable( + &checkpoint_with_tx, + ); + + let executable = result.unwrap(); + assert!(executable.is_transaction()); + assert_eq!(executable.transactions()[0], tx); + } + + #[test] + fn test_into_executable_from_barrier_checkpoint_fails() { + let block = BlockContext::::mocked(); + let checkpoint = block.start(); + let barrier = checkpoint.barrier(); + + let result = + IntoExecutable::>::try_into_executable(&barrier); + + assert!(result.is_err()); + } + + #[test] + fn test_execution_result_source() { + let block = BlockContext::::mocked(); + let checkpoint = block.start(); + let tx = test_tx::(0, 0); + let executable = Executable::Transaction(tx.clone()); + + let result = executable + .execute(&block, &checkpoint, checkpoint.context()) + .unwrap(); + + match result.source() { + Executable::Transaction(result_tx) => assert_eq!(*result_tx, tx), + Executable::Bundle(_) => panic!("Expected transaction source"), + } + } + + #[test] + fn test_execution_result_transactions() { + let block = BlockContext::::mocked(); + let checkpoint = block.start(); + let (bundle, txs) = test_bundle(0, 0); + let executable = Executable::Bundle(bundle); + + let result = executable + .execute(&block, &checkpoint, checkpoint.context()) + .unwrap(); + + assert_eq!(result.transactions(), txs.as_slice()); + } + + #[test] + fn test_executable_hash_transaction() { + let tx = test_tx::(0, 0); + let expected_hash = *tx.tx_hash(); + let executable = Executable::::Transaction(tx); + + assert_eq!(executable.hash(), expected_hash); + } + + #[test] + fn test_executable_hash_bundle() { + let (bundle, _) = test_bundle::(0, 0); + let expected_hash = bundle.hash(); + let executable = Executable::::Bundle(bundle); + + assert_eq!(executable.hash(), expected_hash); + } + + #[test] + fn test_execution_error_invalid_signature_display() { + let err = + ExecutionError::::InvalidSignature(RecoveryError::new()); + let display = format!("{err}"); + assert!(display.contains("Invalid signature")); + } + + #[test] + fn test_execution_result_state_is_bundle_state() { + let block = BlockContext::::mocked(); + let checkpoint = block.start(); + let tx = test_tx::(0, 0); + + let result = Executable::execute_transaction( + tx, + &block, + &checkpoint, + checkpoint.context(), + ) + .unwrap(); + + // State should be a BundleState with changes + assert!(!result.state().is_empty()); + } + + #[test] + fn test_execution_result_clone() { + let block = BlockContext::::mocked(); + let checkpoint = block.start(); + let tx = test_tx::(0, 0); + + let result = Executable::execute_transaction( + tx, + &block, + &checkpoint, + checkpoint.context(), + ) + .unwrap(); + let cloned = result.clone(); + + assert_eq!(result, cloned); + } +} diff --git a/crates/pipeline/Cargo.toml b/crates/pipeline/Cargo.toml index bf58c8f..031f2e3 100644 --- a/crates/pipeline/Cargo.toml +++ b/crates/pipeline/Cargo.toml @@ -39,7 +39,7 @@ test-utils = [ tikv-jemallocator = { workspace = true, optional = true } [dependencies] -rblib-core = { path = "../core", default-features = true } +rblib-core = { path = "../core", default-features = false } pipelines-macros = { path = "../pipeline-macros" } rblib-tests-macros = { path = "../test-utils-macros", optional = true } @@ -88,4 +88,4 @@ reth-ethereum = { workspace = true, optional = true } reth-node-builder = { workspace = true, optional = true } [dev-dependencies] -rblib-pipeline = { path = ".", features = ["test-utils"] } \ No newline at end of file +rblib-pipeline = { path = ".", features = ["test-utils"] } diff --git a/crates/pipeline/src/orderpool2/prioritized_pool/step.rs b/crates/pipeline/src/orderpool2/prioritized_pool/step.rs index 1f65fb1..5072d50 100644 --- a/crates/pipeline/src/orderpool2/prioritized_pool/step.rs +++ b/crates/pipeline/src/orderpool2/prioritized_pool/step.rs @@ -8,6 +8,7 @@ use { crate::{ alloy::{ consensus::Transaction, + consensus::transaction::TxHashRef, primitives::{Address, B256}, }, orderpool2::{AccountNonce, BundleNonce}, @@ -25,7 +26,7 @@ use { #[cfg(feature = "optimism")] use crate::{ - alloy::consensus::transaction::{Recovered, TxHashRef}, + alloy::consensus::transaction::Recovered, platform::types::Transaction as PlatformTransaction, prelude::Optimism, }; diff --git a/crates/rblib/Cargo.toml b/crates/rblib/Cargo.toml index ab343e3..8f00964 100644 --- a/crates/rblib/Cargo.toml +++ b/crates/rblib/Cargo.toml @@ -25,7 +25,6 @@ optimism = ["rblib-pipeline/optimism"] test-utils = ["rblib-pipeline/test-utils"] [dependencies] -rblib-core = { path = "../core" } rblib-pipeline = { path = "../pipeline" } [dev-dependencies] diff --git a/crates/rblib/examples/pipeline-op.rs b/crates/rblib/examples/pipeline-op.rs index ff5b947..2479d0b 100644 --- a/crates/rblib/examples/pipeline-op.rs +++ b/crates/rblib/examples/pipeline-op.rs @@ -1,16 +1,14 @@ //! Example of creating a basic block builder for OP stack chains -use { - rblib::{ - pool::{AppendOrders, HostNodeInstaller, OrderPool}, - prelude::*, - steps::{OptimismPrologue, OrderByPriorityFee}, - }, - rblib_core::reth::optimism::{ +use rblib::{ + pool::{AppendOrders, HostNodeInstaller, OrderPool}, + prelude::*, + reth::optimism::{ cli::Cli, node::{OpAddOns, OpEngineApiBuilder, OpEngineValidatorBuilder, OpNode}, rpc::OpEthApiBuilder, }, + steps::{OptimismPrologue, OrderByPriorityFee}, }; /// Basic block builder diff --git a/crates/rblib/src/lib.rs b/crates/rblib/src/lib.rs index 6ccadcd..6c127d9 100644 --- a/crates/rblib/src/lib.rs +++ b/crates/rblib/src/lib.rs @@ -12,13 +12,13 @@ pub mod steps { } pub mod reth { - pub use rblib_core::reth::*; + pub use rblib_pipeline::reth::*; } pub mod revm { - pub use rblib_core::revm::*; + pub use rblib_pipeline::revm::*; } pub mod alloy { - pub use rblib_core::alloy::*; + pub use rblib_pipeline::alloy::*; } #[cfg(any(test, feature = "test-utils"))] From 1e02de6690d4e8f439ac5d30367211942f7eb871 Mon Sep 17 00:00:00 2001 From: julio4 <30329843+julio4@users.noreply.github.com> Date: Fri, 9 Jan 2026 00:11:26 +0900 Subject: [PATCH 3/3] fix: MetricsSet derive macro --- crates/core/src/lib.rs | 19 +++++++++---------- crates/pipeline-macros/src/metrics/mod.rs | 6 +++--- crates/pipeline/src/lib.rs | 7 ++++++- crates/pipeline/src/pipelines/metrics.rs | 1 - crates/rblib/src/lib.rs | 2 ++ 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/crates/core/src/lib.rs b/crates/core/src/lib.rs index d3b33ac..bfd658c 100644 --- a/crates/core/src/lib.rs +++ b/crates/core/src/lib.rs @@ -5,21 +5,20 @@ pub mod platform; #[cfg(any(test, feature = "test-utils"))] pub mod test_utils; -// RBLib Core Public API Prelude -pub mod prelude { - pub use { - super::{payload::*, platform::*}, - metrics::{Counter, Gauge, Histogram}, - }; - - pub(crate) use super::Variant; -} - #[doc(hidden)] pub mod metrics_util { pub use metrics::*; } +pub mod prelude { + pub(crate) use super::Variant; + pub use super::{ + metrics_util::{Counter, Gauge, Histogram}, + payload::*, + platform::*, + }; +} + // Reexport reth version used by rblib as a convenience for downstream // users. Those exports should be enough to get started with a simple node. pub mod reth { diff --git a/crates/pipeline-macros/src/metrics/mod.rs b/crates/pipeline-macros/src/metrics/mod.rs index 6e50add..cbe6a6d 100644 --- a/crates/pipeline-macros/src/metrics/mod.rs +++ b/crates/pipeline-macros/src/metrics/mod.rs @@ -10,7 +10,7 @@ fn rblib_path() -> proc_macro2::TokenStream { match crate_name("rblib-pipeline") { Ok(FoundCrate::Itself) => { - // We are inside the rblib-pipeline crate itself. + // We are inside rblib-pipeline crate itself. quote!(crate) } Ok(FoundCrate::Name(name)) => { @@ -20,9 +20,9 @@ fn rblib_path() -> proc_macro2::TokenStream { quote!(::#ident) } Err(_) => { - // Fallback: assume the crate is available as `::rblib`. + // Fallback: assume the crate is available as `::pipeline`. // Emit a helpful error if that also fails at type-check time. - quote!(::rblib) + quote!(::rblib::pipeline) } } } diff --git a/crates/pipeline/src/lib.rs b/crates/pipeline/src/lib.rs index 3078127..a516d59 100644 --- a/crates/pipeline/src/lib.rs +++ b/crates/pipeline/src/lib.rs @@ -1,8 +1,8 @@ // Pipelines, steps, pools, and other orchestration utilities for rblib. pub use rblib_core::{ + self as core, Variant, alloy, - metrics_util, payload, platform, reth, @@ -10,6 +10,11 @@ pub use rblib_core::{ uuid, }; +#[doc(hidden)] +pub mod metrics_util { + pub use rblib_core::metrics_util::*; +} + pub mod orderpool2; pub mod pipelines; pub mod pool; diff --git a/crates/pipeline/src/pipelines/metrics.rs b/crates/pipeline/src/pipelines/metrics.rs index a5fb246..20a25b2 100644 --- a/crates/pipeline/src/pipelines/metrics.rs +++ b/crates/pipeline/src/pipelines/metrics.rs @@ -3,7 +3,6 @@ use { alloy::consensus::BlockHeader, core::{panic::Location, time::Duration}, metrics::{Counter, Gauge, Histogram}, - pipelines_macros::MetricsSet, reth::node::builder::{BuiltPayload, PayloadBuilderAttributes}, std::time::{SystemTime, UNIX_EPOCH}, }; diff --git a/crates/rblib/src/lib.rs b/crates/rblib/src/lib.rs index 6c127d9..466e56b 100644 --- a/crates/rblib/src/lib.rs +++ b/crates/rblib/src/lib.rs @@ -1,3 +1,5 @@ +pub use rblib_pipeline::{self as pipeline, core}; + pub mod prelude { // rblib_pipeline already include rblib core pub use rblib_pipeline::prelude::*;