Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion Cargo.lock

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

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,17 @@ alloy = { version = "1.4.0", features = [
reth-chainspec = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.0" }

axum = "0.7.5"
backon = { version = "1.6.0", features = ["tokio-sleep"] }
eyre = "0.6.12"
futures-util = "0.3.31"
openssl = { version = "0.10", features = ["vendored"] }
reqwest = { version = "0.12.22", features = ["blocking", "json"] }
serde = { version = "1.0.197", features = ["derive"] }
tracing = "0.1.41"
thiserror = "2.0.17"
tokio = { version = "1.36.0", features = ["full", "macros", "rt-multi-thread"] }
tokio-stream = "0.1.17"
tracing = "0.1.41"
url = "2.5.4"
thiserror = "2.0.17"
futures-util = "0.3.31"

[dev-dependencies]
alloy-hardforks = "0.4.0"
Expand Down
25 changes: 20 additions & 5 deletions src/tasks/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use alloy::{
primitives::{B256, U256},
providers::{Provider, network::Network},
};
use backon::{ExponentialBuilder, Retryable};
use core::time::Duration;
use init4_bin_base::deps::{
opentelemetry::trace::TraceContextExt, tracing_opentelemetry::OpenTelemetrySpanExt,
};
Expand Down Expand Up @@ -305,10 +307,24 @@ impl EnvTask {
// Ensure that we record the OpenTelemetry trace ID in the span.
span.record("trace_id", span.context().span().span_context().trace_id().to_string());

let get_host_block_header = || {
let provider = self.host_provider.clone();
async move { provider.get_header_by_number(host_block_number.into()).await }
};
let backoff = ExponentialBuilder::default()
.with_factor(2.0)
.with_min_delay(Duration::from_millis(50))
.with_max_times(4);
let (host_block_res, quincey_res) = tokio::join!(
self.host_provider
.get_block_by_number(host_block_number.into())
.into_future()
get_host_block_header
.retry(backoff)
.notify(|error, duration| {
tracing::warn!(
?error,
retry_in_ms = duration.as_millis(),
"host block fetch failed, retrying"
);
})
.instrument(
debug_span!(parent: &span, "EnvTask::fetch_host_block").or_current()
),
Expand Down Expand Up @@ -346,8 +362,7 @@ impl EnvTask {
host_block_opt,
span,
warn!("previous host block not found - skipping block construction")
)
.header;
);

span.record("confirmed.host.hash", host_header.hash.to_string());

Expand Down