Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0723f57
Drive circuit-breaker probes for validator notification streams with …
ndr-ds Aug 12, 2026
43b45be
Box the listener update-streams future to keep trait-solver Send chec…
ndr-ds Aug 12, 2026
a264550
Merge remote-tracking branch 'upstream/main' into ndr-ds/notification…
ndr-ds Sep 7, 2026
245e3e5
Require an elapsed probe deadline before declaring a validator recove…
ndr-ds Sep 7, 2026
6a6291e
Key circuit-breaker recovery on subscribe having resolved, and arm th…
ndr-ds Sep 11, 2026
0bddf6b
Keep the probe timer armed when an update fails, and pace the retry o…
ndr-ds Sep 14, 2026
042d829
Narrow retry_update_deadline back to private now that no test calls it
ndr-ds Sep 14, 2026
bb2ee4c
Count a healthy validator's subscribes, and correct three mutation cl…
ndr-ds Sep 14, 2026
cefd48d
Cover the in-loop retry arming, and drop three dead constructs
ndr-ds Sep 14, 2026
e390115
Say what the subscribed flag actually separates
ndr-ds Sep 14, 2026
1f5be8c
Key stream health on serving rather than subscribing, and arm every l…
ndr-ds Sep 14, 2026
97e1eee
Report a recovery only for a breaker that actually tripped
ndr-ds Sep 15, 2026
d190457
Charge a stream's first failure at the configured interval, not double
ndr-ds Sep 15, 2026
a8ec5ec
Pin the backoff factor exactly instead of bounding it on one side
ndr-ds Sep 15, 2026
25661e5
Bound probe deadlines on both sides, and cover the per-validator spread
ndr-ds Sep 15, 2026
b236b0d
Cover the retry-deadline clear and the escalation cap
ndr-ds Sep 15, 2026
30f9a7e
Assert the recovery barrier instead of discarding it
ndr-ds Sep 15, 2026
bcb3a88
Sample the clock after the committee read, and make recovery symmetri…
ndr-ds Sep 16, 2026
7c82cdb
Re-arm an elapsed deadline for a stream that is serving but not yet h…
ndr-ds Sep 16, 2026
72994cd
Pin the re-arm instant, and assert the empty-map precondition
ndr-ds Sep 16, 2026
6e71c22
Elapse the briefly-serving fixture by a real margin
ndr-ds Sep 17, 2026
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
4 changes: 2 additions & 2 deletions linera-client/src/client_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ pub struct Options {
#[arg(
long = "notification-circuit-breaker-initial-probe-interval-ms",
default_value = "300000",
value_parser = util::parse_millis
value_parser = util::parse_millis_nonzero
)]
pub notification_circuit_breaker_initial_probe_interval: Duration,

Expand All @@ -139,7 +139,7 @@ pub struct Options {
#[arg(
long = "notification-circuit-breaker-max-probe-interval-ms",
default_value = "3600000",
value_parser = util::parse_millis
value_parser = util::parse_millis_nonzero
)]
pub notification_circuit_breaker_max_probe_interval: Duration,

Expand Down
10 changes: 10 additions & 0 deletions linera-client/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ pub fn parse_millis(s: &str) -> Result<Duration, ParseIntError> {
Ok(Duration::from_millis(s.parse()?))
}

/// Parses a number of milliseconds into a `Duration`, rejecting zero.
///
/// For a delay, zero usually means "no throttle". For anything a timer sleeps on it means
/// "spin as fast as the CPU allows", so the flags that feed one are parsed through here.
pub fn parse_millis_nonzero(s: &str) -> Result<Duration, anyhow::Error> {
let millis = s.parse::<u64>()?;
anyhow::ensure!(millis > 0, "must be greater than zero");
Ok(Duration::from_millis(millis))
}

/// Converts a `Duration` to `Option<Duration>`, treating zero as `None`.
pub fn non_zero_duration(d: Duration) -> Option<Duration> {
if d.is_zero() {
Expand Down
553 changes: 473 additions & 80 deletions linera-core/src/client/chain_client/mod.rs

Large diffs are not rendered by default.

25 changes: 7 additions & 18 deletions linera-core/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ use crate::{
remote_node::RemoteNode,
updater::{communicate_with_quorum, CommunicateAction, RemoteNodeUpdater},
worker::{Notification, ProcessableCertificate, Reason, WorkerError, WorkerState},
ChainWorkerConfig, ProcessConfirmedBlockMode, CHAIN_INFO_MAX_RECEIVED_LOG_ENTRIES,
ChainWorkerConfig, MaybeSendBoxFuture, ProcessConfirmedBlockMode,
CHAIN_INFO_MAX_RECEIVED_LOG_ENTRIES,
};

/// The client for interacting with a single chain.
Expand Down Expand Up @@ -388,15 +389,9 @@ pub struct Client<Env: Environment> {
options: chain_client::Options,
}

/// Boxed future returned by `receive_sender_certificate`. It is `Send` off the `web`
/// target (where futures must be `Send`) and `?Send` on `web` (single-threaded, where
/// the validator node is not `Sync`).
#[cfg(not(web))]
type ReceiveSenderCertificateFuture<'a> =
std::pin::Pin<Box<dyn Future<Output = Result<(), chain_client::Error>> + Send + 'a>>;
#[cfg(web)]
type ReceiveSenderCertificateFuture<'a> =
std::pin::Pin<Box<dyn Future<Output = Result<(), chain_client::Error>> + 'a>>;
/// Boxed future returned by `receive_sender_certificate`. `?Send` on `web` because the
/// validator node is not `Sync` there.
type ReceiveSenderCertificateFuture<'a> = MaybeSendBoxFuture<'a, Result<(), chain_client::Error>>;

impl<Env: Environment> Client<Env> {
/// Creates a new `Client` with a new cache and notifiers.
Expand Down Expand Up @@ -761,14 +756,8 @@ impl<Env: Environment> Client<Env> {
// Download remaining certificates from the remote node using a pipelined
// sliding window. A background task downloads up to `max_concurrent_batch_downloads`
// batches concurrently and sends them through a channel for sequential processing.
#[cfg(not(web))]
type CertificateBatchFuture = std::pin::Pin<
Box<dyn Future<Output = Result<Vec<ConfirmedBlockCertificate>, NodeError>> + Send>,
>;
#[cfg(web)]
type CertificateBatchFuture = std::pin::Pin<
Box<dyn Future<Output = Result<Vec<ConfirmedBlockCertificate>, NodeError>>>,
>;
type CertificateBatchFuture =
crate::MaybeSendBoxFuture<'static, Result<Vec<ConfirmedBlockCertificate>, NodeError>>;

let max_concurrent = self.options.max_concurrent_batch_downloads;
let batch_size = self.options.certificate_download_batch_size;
Expand Down
10 changes: 10 additions & 0 deletions linera-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ mod local_node;
pub mod node;
/// Utilities for notifying subscribers about chain events.
pub mod notifier;

/// A boxed future that is `Send` on native targets and not on web, where there is a
/// single thread. Keeps the `Send` policy for boxed futures in one place.
#[cfg(not(web))]
pub(crate) use futures::future::BoxFuture as MaybeSendBoxFuture;
/// A boxed future that is `Send` on native targets and not on web, where there is a
/// single thread. Keeps the `Send` policy for boxed futures in one place.
#[cfg(web)]
pub(crate) use futures::future::LocalBoxFuture as MaybeSendBoxFuture;

pub mod proof;
/// A validator node paired with the validator's public key.
pub mod remote_node;
Expand Down
6 changes: 3 additions & 3 deletions linera-core/src/proof/notifications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ pub trait NotificationChannelIsLossy {}
/// same future calls `Client::synchronize_chain_state_from` against that validator before yielding
/// the stream, precisely because, in the code's own words, "we may have missed notifications since
/// the last time we synchronized". Since `update_notification_streams` is re-run on every
/// `Reason::NewBlock`, and a dropped connection is re-established through the same path, a gap in
/// the stream is closed by *state synchronization* rather than by recovering the messages that fell
/// in it.
/// `Reason::NewBlock`, on the death of any validator stream, and on the circuit breaker's probe
/// timer, and a dropped connection is re-established through the same path, a gap in the stream is
/// closed by *state synchronization* rather than by recovering the messages that fell in it.
///
/// *Coalescing.* No handler applies the change it was told about; each brings the chain up to date.
/// In `linera_client::chain_listener`, `Reason::NewIncomingBundle` and `Reason::NewEvents` both
Expand Down
Loading
Loading