Skip to content

Commit

Permalink
use node provider in rbuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
liamaharon committed Oct 21, 2024
1 parent 0c21d6b commit 469f1dc
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 18 deletions.
48 changes: 37 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ reth-chain-state = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6"
reth-beacon-consensus = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
reth-db = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
reth-db-common = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
reth-db-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
reth-errors = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
reth-libmdbx = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
reth-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
Expand Down Expand Up @@ -91,7 +92,7 @@ alloy-rlp = "0.3.4"
alloy-chains = "0.1.23"
alloy-provider = { version = "0.3.0", features = ["ipc", "pubsub"] }
alloy-pubsub = { version = "0.3.0" }
alloy-eips = { version = "0.3.0" }
alloy-eips = { version = "0.3.6" }
alloy-rpc-types = { version = "0.3.0" }
alloy-json-rpc = { version = "0.3.0" }
alloy-transport-http = { version = "0.3.0" }
Expand All @@ -100,7 +101,7 @@ alloy-transport = { version = "0.3.0" }
alloy-node-bindings = { version = "0.3.0" }
alloy-consensus = { version = "0.3.0", features = ["kzg"] }
alloy-serde = { version = "0.3.0" }
alloy-rpc-types-beacon = { version = "0.3.0", features = [
alloy-rpc-types-beacon = { version = "0.3.6", features = [
"ssz",
] }
alloy-rpc-types-engine = { version = "0.3.0", features = [
Expand Down
2 changes: 1 addition & 1 deletion crates/op-rbuilder/node/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ where
.require_l1_data_gas_fee(!ctx.config().dev.dev)
});

let bundle_ops = BundlePoolOps::new()
let bundle_ops = BundlePoolOps::new(ctx.provider().clone())
.await
.expect("Failed to instantiate RbuilderBundlePoolOps");
let transaction_pool = OpRbuilderTransactionPool::new(
Expand Down
2 changes: 1 addition & 1 deletion crates/rbuilder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ ethereum_ssz.workspace = true
test_utils = { path = "src/test_utils" }
metrics_macros = { path = "src/telemetry/metrics_macros" }

reqwest = { version = "0.11.20", features = ["blocking"] }
reqwest = { workspace = true, features = ["blocking"] }
serde_with = { version = "3.8.1", features = ["time_0_3"] }
primitive-types = "0.12.1"
url.workspace = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ transaction-pool-bundle-ext = { path = "../.." }
rbuilder = { path = "../../../rbuilder" }

reth-primitives = { workspace = true }
reth-provider = { workspace = true }
reth-db-api = { workspace = true }
reth-rpc-types = { workspace = true }
reth-chainspec = { workspace = true }
reth-chain-state = { workspace = true }
Expand All @@ -25,5 +27,7 @@ tracing = { workspace = true }
optimism = [
"reth-chainspec/optimism",
"reth-primitives/optimism",
"rbuilder/optimism"
"rbuilder/optimism",
"reth-provider/optimism",
"reth-db-api/optimism"
]
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ use rbuilder::{
building::builders::{UnfinishedBlockBuildingSink, UnfinishedBlockBuildingSinkFactory},
live_builder::{base_config::BaseConfig, payload_events::MevBoostSlotData, SlotSource},
};
use reth_chainspec::EthChainSpec;
use reth_db_api::Database;
use reth_primitives::{Bytes, B256};
use reth_provider::{DatabaseProviderFactory, FullProvider, HeaderProvider, StateProviderFactory};
use reth_rpc_types::{beacon::events::PayloadAttributesEvent, mev::EthSendBundle};
use tokio::sync::mpsc::{self, error::SendError};
use tokio_util::sync::CancellationToken;
Expand Down Expand Up @@ -59,7 +62,10 @@ impl SlotSource for OurSlotSource {
}

impl BundlePoolOps {
pub async fn new() -> Result<Self, Error> {
pub async fn new<P, DB>(provider: P) -> Result<Self, Error> where
DB: Database + Clone + 'static,
P: DatabaseProviderFactory<DB> + StateProviderFactory + HeaderProvider + Clone + 'static,
{
// Create the payload source to trigger new block building
let cancellation_token = CancellationToken::new();
let (payload_attributes_tx, payload_attributes_rx) = mpsc::unbounded_channel();
Expand All @@ -75,13 +81,15 @@ impl BundlePoolOps {
Some("/Users/liamaharon/Library/Application Support/reth/901/".into());
dbg!(&config);
let builder = config
.create_builder::<OurSlotSource>(
.create_builder_with_provider_factory::<P, DB, OurSlotSource>(
cancellation_token,
Box::new(sink_factory),
slot_source,
provider
)
.await?;
builder.run().await?;
dbg!("Builder running!!");

Ok(BundlePoolOps {
payload_attributes_tx,
Expand Down

0 comments on commit 469f1dc

Please sign in to comment.