Merge branch 'unstable' of https://github.com/sigp/lighthouse into gloas-block-and-bid-production

This commit is contained in:
Eitan Seri- Levi
2026-02-10 12:12:24 -08:00
68 changed files with 3276 additions and 1321 deletions

View File

@@ -17,6 +17,8 @@ pub enum Error {
#[cfg(feature = "events")]
/// The `reqwest_eventsource` client raised an error.
SseClient(Box<reqwest_eventsource::Error>),
#[cfg(feature = "events")]
SseEventSource(reqwest_eventsource::CannotCloneRequestError),
/// The server returned an error message where the body was able to be parsed.
ServerMessage(ErrorMessage),
/// The server returned an error message with an array of errors.
@@ -100,6 +102,7 @@ impl Error {
None
}
}
Error::SseEventSource(_) => None,
Error::ServerMessage(msg) => StatusCode::try_from(msg.code).ok(),
Error::ServerIndexedMessage(msg) => StatusCode::try_from(msg.code).ok(),
Error::StatusCode(status) => Some(*status),

View File

@@ -40,7 +40,7 @@ use reqwest::{
header::{HeaderMap, HeaderValue},
};
#[cfg(feature = "events")]
use reqwest_eventsource::{Event, EventSource};
use reqwest_eventsource::{Event, RequestBuilderExt};
use serde::{Serialize, de::DeserializeOwned};
use ssz::{Decode, Encode};
use std::fmt;
@@ -77,6 +77,8 @@ const HTTP_GET_BEACON_BLOCK_SSZ_TIMEOUT_QUOTIENT: u32 = 4;
const HTTP_GET_DEBUG_BEACON_STATE_QUOTIENT: u32 = 4;
const HTTP_GET_DEPOSIT_SNAPSHOT_QUOTIENT: u32 = 4;
const HTTP_GET_VALIDATOR_BLOCK_TIMEOUT_QUOTIENT: u32 = 4;
// Generally the timeout for events should be longer than a slot.
const HTTP_GET_EVENTS_TIMEOUT_MULTIPLIER: u32 = 50;
const HTTP_DEFAULT_TIMEOUT_QUOTIENT: u32 = 4;
/// A struct to define a variety of different timeouts for different validator tasks to ensure
@@ -97,6 +99,7 @@ pub struct Timeouts {
pub get_debug_beacon_states: Duration,
pub get_deposit_snapshot: Duration,
pub get_validator_block: Duration,
pub events: Duration,
pub default: Duration,
}
@@ -117,6 +120,7 @@ impl Timeouts {
get_debug_beacon_states: timeout,
get_deposit_snapshot: timeout,
get_validator_block: timeout,
events: HTTP_GET_EVENTS_TIMEOUT_MULTIPLIER * timeout,
default: timeout,
}
}
@@ -139,6 +143,7 @@ impl Timeouts {
get_debug_beacon_states: base_timeout / HTTP_GET_DEBUG_BEACON_STATE_QUOTIENT,
get_deposit_snapshot: base_timeout / HTTP_GET_DEPOSIT_SNAPSHOT_QUOTIENT,
get_validator_block: base_timeout / HTTP_GET_VALIDATOR_BLOCK_TIMEOUT_QUOTIENT,
events: HTTP_GET_EVENTS_TIMEOUT_MULTIPLIER * base_timeout,
default: base_timeout / HTTP_DEFAULT_TIMEOUT_QUOTIENT,
}
}
@@ -3047,7 +3052,12 @@ impl BeaconNodeHttpClient {
.join(",");
path.query_pairs_mut().append_pair("topics", &topic_string);
let mut es = EventSource::get(path);
let mut es = self
.client
.get(path)
.timeout(self.timeouts.events)
.eventsource()
.map_err(Error::SseEventSource)?;
// If we don't await `Event::Open` here, then the consumer
// will not get any Message events until they start awaiting the stream.
// This is a way to register the stream with the sse server before