Skip to content

Commit 003081e

Browse files
authored
Merge branch 'main' into evalir/opt-edition-change
2 parents 0d68d68 + 92628a9 commit 003081e

File tree

5 files changed

+86
-13
lines changed

5 files changed

+86
-13
lines changed

Cargo.toml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,16 @@ signet-node-types = { version = "0.8.0", path = "crates/node-types" }
3838
signet-rpc = { version = "0.8.0", path = "crates/rpc" }
3939
signet-db = { version = "0.8.0", path = "crates/db" }
4040

41-
init4-bin-base = { version = "0.7.1", features = ["alloy"] }
42-
43-
signet-bundle = "0.8.0"
44-
signet-constants = "0.8.0"
45-
signet-evm = "0.8.0"
46-
signet-extract = "0.8.0"
47-
signet-node = "0.8.0"
48-
signet-sim = "0.8.0"
49-
signet-types = "0.8.0"
50-
signet-tx-cache = "0.8.0"
51-
signet-zenith = "0.8.0"
41+
init4-bin-base = { version = "0.9.0", features = ["alloy"] }
42+
43+
signet-bundle = { git = "https://github.com/init4tech/signet-sdk", tag = "v0.8.3" }
44+
signet-constants = { git = "https://github.com/init4tech/signet-sdk", tag = "v0.8.3" }
45+
signet-evm = { git = "https://github.com/init4tech/signet-sdk", tag = "v0.8.3" }
46+
signet-extract = { git = "https://github.com/init4tech/signet-sdk", tag = "v0.8.3" }
47+
signet-tx-cache = { git = "https://github.com/init4tech/signet-sdk", tag = "v0.8.3" }
48+
signet-types = { git = "https://github.com/init4tech/signet-sdk", tag = "v0.8.3" }
49+
signet-zenith = { git = "https://github.com/init4tech/signet-sdk", tag = "v0.8.3" }
50+
5251

5352
# ajj
5453
ajj = { version = "0.3.4" }

crates/blobber/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ reth.workspace = true
2020
reth-chainspec.workspace = true
2121
reth-transaction-pool = { workspace = true, optional = true }
2222

23+
serde.workspace = true
2324
smallvec.workspace = true
2425
tokio.workspace = true
2526
tracing.workspace = true

crates/blobber/src/builder.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::block_data::BlockExtractor;
1+
use crate::{block_data::BlockExtractor, BlockExtractorConfig};
22
use init4_bin_base::utils::calc::SlotCalculator;
33
use reth::transaction_pool::TransactionPool;
44
use url::Url;
@@ -59,6 +59,20 @@ impl<Pool> BlockExtractorBuilder<Pool> {
5959
self.with_pool(reth_transaction_pool::test_utils::testing_pool())
6060
}
6161

62+
/// Set the configuration for the CL url, pylon url, from the provided
63+
/// [`BlockExtractorConfig`].
64+
pub fn with_config(self, config: &BlockExtractorConfig) -> Result<Self, BuilderError> {
65+
let this = self.with_explorer_url(config.blob_explorer_url());
66+
let this =
67+
if let Some(cl_url) = config.cl_url() { this.with_cl_url(cl_url)? } else { this };
68+
69+
if let Some(pylon_url) = config.pylon_url() {
70+
this.with_pylon_url(pylon_url)
71+
} else {
72+
Ok(this)
73+
}
74+
}
75+
6276
/// Set the blob explorer URL to use for the extractor. This will be used
6377
/// to construct a [`foundry_blob_explorers::Client`].
6478
pub fn with_explorer_url(mut self, explorer_url: &str) -> Self {

crates/blobber/src/config.rs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
use init4_bin_base::utils::from_env::FromEnv;
2+
use std::borrow::Cow;
3+
4+
/// Configuration for the block extractor.
5+
#[derive(Debug, Clone, serde::Deserialize, FromEnv)]
6+
#[serde(rename_all = "camelCase")]
7+
pub struct BlockExtractorConfig {
8+
/// URL of the blob explorer.
9+
#[from_env(var = "BLOB_EXPLORER_URL", desc = "URL of the blob explorer", infallible)]
10+
blob_explorer_url: Cow<'static, str>,
11+
12+
/// Consensus layer RPC URL
13+
#[from_env(var = "SIGNET_CL_URL", desc = "Consensus layer URL", infallible, optional)]
14+
cl_url: Option<Cow<'static, str>>,
15+
16+
/// The Pylon node URL
17+
#[from_env(var = "SIGNET_PYLON_URL", desc = "Pylon node URL", infallible, optional)]
18+
pylon_url: Option<Cow<'static, str>>,
19+
}
20+
21+
impl BlockExtractorConfig {
22+
/// Create a new `BlockExtractorConfig` with default values.
23+
pub const fn new(blob_explorer_url: Cow<'static, str>) -> Self {
24+
Self { blob_explorer_url, cl_url: None, pylon_url: None }
25+
}
26+
27+
/// Get the blob explorer URL.
28+
pub fn set_blob_explorer_url(&mut self, blob_explorer_url: Cow<'static, str>) {
29+
self.blob_explorer_url = blob_explorer_url;
30+
}
31+
32+
/// Get the blob explorer URL.
33+
pub fn set_cl_url(&mut self, cl_url: Cow<'static, str>) {
34+
self.cl_url = Some(cl_url);
35+
}
36+
37+
/// Set the Pylon URL.
38+
pub fn set_pylon_url(&mut self, pylon_url: Cow<'static, str>) {
39+
self.pylon_url = Some(pylon_url);
40+
}
41+
42+
/// Create a new `BlockExtractorConfig` with the provided CL URL, Pylon URL,
43+
pub fn cl_url(&self) -> Option<&str> {
44+
self.cl_url.as_deref()
45+
}
46+
47+
/// Get the Pylon URL.
48+
pub fn pylon_url(&self) -> Option<&str> {
49+
self.pylon_url.as_deref()
50+
}
51+
52+
/// Get the blob explorer URL.
53+
pub fn blob_explorer_url(&self) -> &str {
54+
&self.blob_explorer_url
55+
}
56+
}

crates/blobber/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ mod block_data;
1515
pub use block_data::{Blobs, BlockExtractor};
1616

1717
mod builder;
18-
pub use builder::BlockExtractorBuilder;
18+
pub use builder::{BlockExtractorBuilder, BuilderError as BlockExtractorBuilderError};
19+
20+
mod config;
21+
pub use config::BlockExtractorConfig;
1922

2023
mod error;
2124
pub use error::{BlockExtractionError, ExtractionResult};

0 commit comments

Comments
 (0)