Skip to content

Commit 8a1e80b

Browse files
committed
cleanup
1 parent 0e82fa5 commit 8a1e80b

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

src/config.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ pub struct BuilderConfig {
7070
/// NOTE: should not include the host_rpc_url value
7171
#[from_env(
7272
var = "TX_BROADCAST_URLS",
73-
desc = "Additional RPC URLs to which to broadcast transactions",
74-
infallible
73+
desc = "Additional RPC URLs to which the builder broadcasts transactions",
74+
infallible,
75+
optional
7576
)]
7677
pub tx_broadcast_urls: Vec<Cow<'static, str>>,
7778
/// address of the Zenith contract on Host.

src/tasks/submit.rs

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use alloy::{
1313
sol_types::{SolCall, SolError},
1414
transports::TransportError,
1515
};
16-
use eyre::{bail, eyre};
16+
use eyre::bail;
1717
use init4_bin_base::deps::{
1818
metrics::{counter, histogram},
1919
tracing::{self, Instrument, debug, debug_span, error, info, instrument, warn},
@@ -105,15 +105,7 @@ impl SubmitTask {
105105
Ok(TransactionRequest::default().with_blob_sidecar(sidecar).with_input(data))
106106
}
107107

108-
/// Returns the next host block height.
109-
async fn next_host_block_height(&self) -> eyre::Result<u64> {
110-
let result = self.provider().get_block_number().await?;
111-
let next = result.checked_add(1).ok_or_else(|| eyre!("next host block height overflow"))?;
112-
debug!(next, "next host block height");
113-
Ok(next)
114-
}
115-
116-
/// Prepares and then sends the EIP-4844 transaction with a sidecar encoded with a rollup block to the network.
108+
/// Prepares and sends the EIP-4844 transaction with a sidecar encoded with a rollup block to the network.
117109
async fn submit_transaction(
118110
&self,
119111
retry_count: usize,
@@ -122,7 +114,7 @@ impl SubmitTask {
122114
) -> eyre::Result<ControlFlow> {
123115
let tx = self.prepare_tx(retry_count, resp, block).await?;
124116

125-
self.send_transaction(retry_count, resp, tx).await
117+
self.send_transaction(resp, tx).await
126118
}
127119

128120
/// Prepares the transaction by extracting the signature components, creating the transaction
@@ -240,7 +232,6 @@ impl SubmitTask {
240232
/// and any additionally configured broadcast providers.
241233
async fn send_transaction(
242234
&self,
243-
retry_count: usize,
244235
resp: &SignResponse,
245236
tx: TransactionRequest,
246237
) -> Result<ControlFlow, eyre::Error> {
@@ -254,10 +245,8 @@ impl SubmitTask {
254245
let fut = spawn_provider_send!(self.provider(), &tx);
255246

256247
// spawn send_tx futures on retry attempts for all additional broadcast host_providers
257-
if retry_count > 0 {
258-
for host_provider in self.config.connect_additional_broadcast() {
259-
spawn_provider_send!(&host_provider, &tx);
260-
}
248+
for host_provider in self.config.connect_additional_broadcast() {
249+
spawn_provider_send!(&host_provider, &tx);
261250
}
262251

263252
// send the in-progress transaction over the outbound_tx_channel
@@ -393,6 +382,12 @@ impl SubmitTask {
393382
let now = std::time::SystemTime::now();
394383
now.duration_since(UNIX_EPOCH).unwrap().as_secs()
395384
}
385+
386+
/// Returns the next host block height.
387+
async fn next_host_block_height(&self) -> eyre::Result<u64> {
388+
let block_num = self.provider().get_block_number().await?;
389+
Ok(block_num + 1)
390+
}
396391

397392
/// Task future for the submit task
398393
/// NB: This task assumes that the simulator will only send it blocks for

0 commit comments

Comments
 (0)