Skip to content

Commit 2796925

Browse files
committed
PoC obtaining TXs from auction running on pod
1 parent 09555c6 commit 2796925

File tree

10 files changed

+476
-163
lines changed

10 files changed

+476
-163
lines changed

Cargo.lock

Lines changed: 211 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/op-rbuilder/Cargo.toml

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ alloy-network.workspace = true
6969
alloy-provider.workspace = true
7070
alloy-serde.workspace = true
7171
alloy-json-rpc.workspace = true
72+
alloy-rlp.workspace = true
7273

7374
# op
7475
alloy-op-evm.workspace = true
@@ -132,6 +133,10 @@ tar = { version = "0.4", optional = true }
132133
ctor = { version = "0.4.2", optional = true }
133134
rlimit = { version = "0.10", optional = true }
134135
macros = { path = "src/tests/framework/macros", optional = true }
136+
# pod-sdk = { git = "https://github.com/podnetwork/pod-sdk", rev = "faeab8c02e4d1b117362b25027969e85006c5515", version = "0.1.0" }
137+
pod-sdk = { path = "../../../pod-sdk/rust-sdk/" }
138+
pod-auction = { package = "optimism-tx-auction", path = "../../../pod-sdk/examples/optimism-tx-auction" }
139+
itertools = "0.14.0"
135140

136141
[target.'cfg(unix)'.dependencies]
137142
tikv-jemallocator = { version = "0.6", optional = true }
@@ -142,7 +147,7 @@ vergen-git2.workspace = true
142147

143148
[dev-dependencies]
144149
alloy-provider = { workspace = true, default-features = true, features = [
145-
"txpool-api",
150+
"txpool-api",
146151
] }
147152
tempfile = "3.8"
148153
macros = { path = "src/tests/framework/macros" }
@@ -158,15 +163,15 @@ rlimit = { version = "0.10" }
158163
default = ["jemalloc"]
159164

160165
jemalloc = [
161-
"dep:tikv-jemallocator",
162-
"reth-cli-util/jemalloc",
163-
"reth-optimism-cli/jemalloc",
166+
"dep:tikv-jemallocator",
167+
"reth-cli-util/jemalloc",
168+
"reth-optimism-cli/jemalloc",
164169
]
165170
jemalloc-prof = [
166-
"jemalloc",
167-
"tikv-jemallocator?/profiling",
168-
"reth/jemalloc-prof",
169-
"reth-cli-util/jemalloc-prof",
171+
"jemalloc",
172+
"tikv-jemallocator?/profiling",
173+
"reth/jemalloc-prof",
174+
"reth-cli-util/jemalloc-prof",
170175
]
171176

172177
min-error-logs = ["tracing/release_max_level_error"]
@@ -176,14 +181,14 @@ min-debug-logs = ["tracing/release_max_level_debug"]
176181
min-trace-logs = ["tracing/release_max_level_trace"]
177182

178183
testing = [
179-
"dashmap",
180-
"nanoid",
181-
"reth-ipc",
182-
"reth-node-builder/test-utils",
183-
"bollard",
184-
"ctor",
185-
"macros",
186-
"rlimit",
184+
"dashmap",
185+
"nanoid",
186+
"reth-ipc",
187+
"reth-node-builder/test-utils",
188+
"bollard",
189+
"ctor",
190+
"macros",
191+
"rlimit",
187192
]
188193

189194
interop = []
@@ -202,10 +207,10 @@ ci-features = [
202207
"min-info-logs",
203208
"min-debug-logs",
204209
"min-trace-logs",
205-
"testing",
206-
"interop",
207-
"telemetry",
208-
"custom-engine-api",
210+
"testing",
211+
"interop",
212+
"telemetry",
213+
"custom-engine-api",
209214
]
210215

211216
[[bin]]

crates/op-rbuilder/src/args/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ impl CliExt for Cli {
7575
if node_command.ext.flashblocks.enabled {
7676
return BuilderMode::Flashblocks;
7777
}
78+
if node_command.ext.pod.is_enabled {
79+
return BuilderMode::Pod;
80+
}
7881
}
7982
BuilderMode::Standard
8083
}

crates/op-rbuilder/src/args/op.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
//! clap [Args](clap::Args) for optimism rollup configuration
66
77
use crate::{flashtestations::args::FlashtestationsArgs, tx_signer::Signer};
8+
use alloy_primitives::Address;
89
use anyhow::{anyhow, Result};
910
use clap::Parser;
1011
use reth_optimism_cli::commands::Commands;
@@ -51,6 +52,8 @@ pub struct OpRbuilderArgs {
5152
)]
5253
pub playground: Option<PathBuf>,
5354
#[command(flatten)]
55+
pub pod: PodArgs,
56+
#[command(flatten)]
5457
pub flashblocks: FlashblocksArgs,
5558
#[command(flatten)]
5659
pub telemetry: TelemetryArgs,
@@ -149,6 +152,26 @@ impl Default for FlashblocksArgs {
149152
}
150153
}
151154

155+
#[derive(Debug, Clone, PartialEq, Eq, clap::Args)]
156+
pub struct PodArgs {
157+
#[arg(long = "pod.enabled", default_value = "false", env = "ENABLE_POD")]
158+
pub is_enabled: bool,
159+
160+
#[arg(
161+
long = "pod.rpc-url",
162+
env = "POD_RPC_URL",
163+
default_value = "ws://127.0.0.1:8545"
164+
)]
165+
pub pod_rpc_url: String,
166+
167+
#[arg(
168+
long = "pod.contract-address",
169+
env = "POD_CONTRACT_ADDRESS",
170+
default_value = "0x12296f2D128530a834460DF6c36a2895B793F26d"
171+
)]
172+
pub pod_contract_address: Address,
173+
}
174+
152175
/// Parameters for telemetry configuration
153176
#[derive(Debug, Clone, Default, PartialEq, Eq, clap::Args)]
154177
pub struct TelemetryArgs {

crates/op-rbuilder/src/builders/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ mod builder_tx;
1818
mod context;
1919
mod flashblocks;
2020
mod generator;
21+
mod pod;
2122
mod standard;
2223

2324
pub use builder_tx::BuilderTx;
2425
pub use flashblocks::FlashblocksBuilder;
26+
pub use pod::PodBuilder;
2527
pub use standard::StandardBuilder;
2628

2729
/// Defines the payload building mode for the OP builder.
@@ -34,6 +36,10 @@ pub enum BuilderMode {
3436
/// block every short interval and makes it available through a websocket update
3537
/// then merges them into a full block every chain block time.
3638
Flashblocks,
39+
/// Uses the pod payload builder that builds blocks every chain block time
40+
/// but picks transactions from an auction running on pod, selecting the highest
41+
/// bidding transactions.
42+
Pod,
3743
}
3844

3945
/// Defines the interface for any block builder implementation API entry point.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
use crate::args::OpRbuilderArgs;
2+
use alloy_primitives::Address;
3+
4+
/// Configuration values that are specific to the flashblocks builder.
5+
#[derive(Debug, Clone)]
6+
pub struct Config {
7+
pub rpc_url: String,
8+
pub contract_address: Address,
9+
}
10+
11+
impl TryFrom<OpRbuilderArgs> for Config {
12+
type Error = eyre::Report;
13+
14+
fn try_from(args: OpRbuilderArgs) -> Result<Self, Self::Error> {
15+
Ok(Self {
16+
rpc_url: args.pod.pod_rpc_url,
17+
contract_address: args.pod.pod_contract_address,
18+
})
19+
}
20+
}
Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
1-
use payload::StandardPayloadBuilderBuilder;
1+
use config::Config;
2+
use payload::PodPayloadBuilderBuilder;
23
use reth_node_builder::components::BasicPayloadServiceBuilder;
34

45
use crate::traits::{NodeBounds, PoolBounds};
56

67
use super::BuilderConfig;
78

9+
mod config;
810
mod payload;
11+
mod pod_client;
912

10-
/// Block building strategy that builds blocks using the standard approach by
13+
/// Block building strategy that builds blocks using auction running on pod by
1114
/// producing blocks every chain block time.
12-
pub struct StandardBuilder;
15+
pub struct PodBuilder;
1316

14-
impl super::PayloadBuilder for StandardBuilder {
15-
type Config = ();
17+
impl super::PayloadBuilder for PodBuilder {
18+
type Config = Config;
1619

1720
type ServiceBuilder<Node, Pool>
18-
= BasicPayloadServiceBuilder<StandardPayloadBuilderBuilder>
21+
= BasicPayloadServiceBuilder<PodPayloadBuilderBuilder>
1922
where
2023
Node: NodeBounds,
2124
Pool: PoolBounds;
@@ -27,8 +30,8 @@ impl super::PayloadBuilder for StandardBuilder {
2730
Node: NodeBounds,
2831
Pool: PoolBounds,
2932
{
30-
Ok(BasicPayloadServiceBuilder::new(
31-
StandardPayloadBuilderBuilder(config),
32-
))
33+
Ok(BasicPayloadServiceBuilder::new(PodPayloadBuilderBuilder(
34+
config,
35+
)))
3336
}
3437
}

0 commit comments

Comments
 (0)