Merge branch 'unstable' into dvt

This commit is contained in:
chonghe
2025-05-09 11:06:44 +08:00
committed by GitHub
101 changed files with 3863 additions and 2412 deletions

View File

@@ -146,6 +146,7 @@ pub struct Timeouts {
pub get_debug_beacon_states: Duration,
pub get_deposit_snapshot: Duration,
pub get_validator_block: Duration,
pub default: Duration,
}
impl Timeouts {
@@ -165,6 +166,7 @@ impl Timeouts {
get_debug_beacon_states: timeout,
get_deposit_snapshot: timeout,
get_validator_block: timeout,
default: timeout,
}
}
}
@@ -239,7 +241,9 @@ impl BeaconNodeHttpClient {
url: U,
builder: impl FnOnce(RequestBuilder) -> RequestBuilder,
) -> Result<Response, Error> {
let response = builder(self.client.get(url)).send().await?;
let response = builder(self.client.get(url).timeout(self.timeouts.default))
.send()
.await?;
ok_or_error(response).await
}
@@ -402,11 +406,10 @@ impl BeaconNodeHttpClient {
body: &T,
timeout: Option<Duration>,
) -> Result<Response, Error> {
let mut builder = self.client.post(url);
if let Some(timeout) = timeout {
builder = builder.timeout(timeout);
}
let builder = self
.client
.post(url)
.timeout(timeout.unwrap_or(self.timeouts.default));
let response = builder.json(body).send().await?;
ok_or_error(response).await
}
@@ -419,10 +422,10 @@ impl BeaconNodeHttpClient {
timeout: Option<Duration>,
fork: ForkName,
) -> Result<Response, Error> {
let mut builder = self.client.post(url);
if let Some(timeout) = timeout {
builder = builder.timeout(timeout);
}
let builder = self
.client
.post(url)
.timeout(timeout.unwrap_or(self.timeouts.default));
let response = builder
.header(CONSENSUS_VERSION_HEADER, fork.to_string())
.json(body)
@@ -437,7 +440,7 @@ impl BeaconNodeHttpClient {
url: U,
body: &T,
) -> Result<Response, Error> {
let builder = self.client.post(url);
let builder = self.client.post(url).timeout(self.timeouts.default);
let mut headers = HeaderMap::new();
headers.insert(
@@ -456,10 +459,10 @@ impl BeaconNodeHttpClient {
timeout: Option<Duration>,
fork: ForkName,
) -> Result<Response, Error> {
let mut builder = self.client.post(url);
if let Some(timeout) = timeout {
builder = builder.timeout(timeout);
}
let builder = self
.client
.post(url)
.timeout(timeout.unwrap_or(self.timeouts.default));
let mut headers = HeaderMap::new();
headers.insert(
CONSENSUS_VERSION_HEADER,
@@ -1872,7 +1875,13 @@ impl BeaconNodeHttpClient {
.push("node")
.push("health");
let status = self.client.get(path).send().await?.status();
let status = self
.client
.get(path)
.timeout(self.timeouts.default)
.send()
.await?
.status();
if status == StatusCode::OK || status == StatusCode::PARTIAL_CONTENT {
Ok(status)
} else {

View File

@@ -212,7 +212,7 @@ macro_rules! define_net {
"../",
"deposit_contract_block.txt"
),
boot_enr: $this_crate::$include_file!($this_crate, "../", "boot_enr.yaml"),
boot_enr: $this_crate::$include_file!($this_crate, "../", "bootstrap_nodes.yaml"),
genesis_state_bytes: $this_crate::$include_file!($this_crate, "../", "genesis.ssz"),
}
}};

View File

@@ -31,7 +31,7 @@ use url::Url;
pub use eth2_config::GenesisStateSource;
pub const DEPLOY_BLOCK_FILE: &str = "deposit_contract_block.txt";
pub const BOOT_ENR_FILE: &str = "boot_enr.yaml";
pub const BOOT_ENR_FILE: &str = "bootstrap_nodes.yaml";
pub const GENESIS_STATE_FILE: &str = "genesis.ssz";
pub const BASE_CONFIG_FILE: &str = "config.yaml";

View File

@@ -11,8 +11,6 @@ test_logger = [] # Print log output to stderr when running tests instead of drop
chrono = { version = "0.4", default-features = false, features = ["clock", "std"] }
logroller = { workspace = true }
metrics = { workspace = true }
once_cell = "1.17.1"
parking_lot = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
tokio = { workspace = true, features = [ "time" ] }

View File

@@ -1,5 +1,4 @@
// TODO(tracing) fix the comments below and remove reference of slog::Drain
//! This module provides an implementation of `slog::Drain` that optionally writes to a channel if
//! This module provides an implementation of `tracing_subscriber::layer::Layer` that optionally writes to a channel if
//! there are subscribers to a HTTP SSE stream.
use serde_json::json;