mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 10:22:38 +00:00
Merge branch 'unstable' into peerdas-devnet-7
This commit is contained in:
@@ -4,6 +4,9 @@ version = "0.2.0"
|
||||
authors = ["Sigma Prime <contact@sigmaprime.io>"]
|
||||
edition = { workspace = true }
|
||||
|
||||
[features]
|
||||
libp2p-websocket = []
|
||||
|
||||
[dependencies]
|
||||
alloy-primitives = { workspace = true }
|
||||
alloy-rlp = { workspace = true }
|
||||
@@ -53,7 +56,21 @@ unused_port = { workspace = true }
|
||||
[dependencies.libp2p]
|
||||
version = "0.55"
|
||||
default-features = false
|
||||
features = ["identify", "yamux", "noise", "dns", "tcp", "tokio", "plaintext", "secp256k1", "macros", "ecdsa", "metrics", "quic", "upnp"]
|
||||
features = [
|
||||
"identify",
|
||||
"yamux",
|
||||
"noise",
|
||||
"dns",
|
||||
"tcp",
|
||||
"tokio",
|
||||
"plaintext",
|
||||
"secp256k1",
|
||||
"macros",
|
||||
"ecdsa",
|
||||
"metrics",
|
||||
"quic",
|
||||
"upnp",
|
||||
]
|
||||
|
||||
[dev-dependencies]
|
||||
async-channel = { workspace = true }
|
||||
@@ -61,6 +78,3 @@ logging = { workspace = true }
|
||||
quickcheck = { workspace = true }
|
||||
quickcheck_macros = { workspace = true }
|
||||
tempfile = { workspace = true }
|
||||
|
||||
[features]
|
||||
libp2p-websocket = []
|
||||
|
||||
@@ -12,7 +12,7 @@ use std::sync::Arc;
|
||||
use std::time::{Duration, Instant};
|
||||
use tokio::runtime::Runtime;
|
||||
use tokio::time::sleep;
|
||||
use tracing::{debug, error, warn};
|
||||
use tracing::{debug, error, info_span, warn, Instrument};
|
||||
use types::{
|
||||
BeaconBlock, BeaconBlockAltair, BeaconBlockBase, BeaconBlockBellatrix, BlobSidecar, ChainSpec,
|
||||
EmptyBlock, Epoch, EthSpec, FixedBytesExtended, ForkName, Hash256, MinimalEthSpec,
|
||||
@@ -55,7 +55,7 @@ fn bellatrix_block_large(spec: &ChainSpec) -> BeaconBlock<E> {
|
||||
fn test_tcp_status_rpc() {
|
||||
// Set up the logging.
|
||||
let log_level = "debug";
|
||||
let enable_logging = false;
|
||||
let enable_logging = true;
|
||||
build_tracing_subscriber(log_level, enable_logging);
|
||||
|
||||
let rt = Arc::new(Runtime::new().unwrap());
|
||||
@@ -117,7 +117,8 @@ fn test_tcp_status_rpc() {
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
.instrument(info_span!("Sender"));
|
||||
|
||||
// build the receiver future
|
||||
let receiver_future = async {
|
||||
@@ -141,7 +142,8 @@ fn test_tcp_status_rpc() {
|
||||
_ => {} // Ignore other events
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
.instrument(info_span!("Receiver"));
|
||||
|
||||
tokio::select! {
|
||||
_ = sender_future => {}
|
||||
@@ -159,7 +161,7 @@ fn test_tcp_status_rpc() {
|
||||
fn test_tcp_blocks_by_range_chunked_rpc() {
|
||||
// Set up the logging.
|
||||
let log_level = "debug";
|
||||
let enable_logging = false;
|
||||
let enable_logging = true;
|
||||
build_tracing_subscriber(log_level, enable_logging);
|
||||
|
||||
let messages_to_send = 6;
|
||||
@@ -245,7 +247,8 @@ fn test_tcp_blocks_by_range_chunked_rpc() {
|
||||
_ => {} // Ignore other behaviour events
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
.instrument(info_span!("Sender"));
|
||||
|
||||
// build the receiver future
|
||||
let receiver_future = async {
|
||||
@@ -286,7 +289,8 @@ fn test_tcp_blocks_by_range_chunked_rpc() {
|
||||
_ => {} // Ignore other events
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
.instrument(info_span!("Receiver"));
|
||||
|
||||
tokio::select! {
|
||||
_ = sender_future => {}
|
||||
@@ -304,7 +308,7 @@ fn test_tcp_blocks_by_range_chunked_rpc() {
|
||||
fn test_blobs_by_range_chunked_rpc() {
|
||||
// Set up the logging.
|
||||
let log_level = "debug";
|
||||
let enable_logging = false;
|
||||
let enable_logging = true;
|
||||
build_tracing_subscriber(log_level, enable_logging);
|
||||
|
||||
let slot_count = 32;
|
||||
@@ -373,7 +377,8 @@ fn test_blobs_by_range_chunked_rpc() {
|
||||
_ => {} // Ignore other behaviour events
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
.instrument(info_span!("Sender"));
|
||||
|
||||
// build the receiver future
|
||||
let receiver_future = async {
|
||||
@@ -407,7 +412,8 @@ fn test_blobs_by_range_chunked_rpc() {
|
||||
_ => {} // Ignore other events
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
.instrument(info_span!("Receiver"));
|
||||
|
||||
tokio::select! {
|
||||
_ = sender_future => {}
|
||||
@@ -425,7 +431,7 @@ fn test_blobs_by_range_chunked_rpc() {
|
||||
fn test_tcp_blocks_by_range_over_limit() {
|
||||
// Set up the logging.
|
||||
let log_level = "debug";
|
||||
let enable_logging = false;
|
||||
let enable_logging = true;
|
||||
build_tracing_subscriber(log_level, enable_logging);
|
||||
|
||||
let messages_to_send = 5;
|
||||
@@ -479,7 +485,8 @@ fn test_tcp_blocks_by_range_over_limit() {
|
||||
_ => {} // Ignore other behaviour events
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
.instrument(info_span!("Sender"));
|
||||
|
||||
// build the receiver future
|
||||
let receiver_future = async {
|
||||
@@ -512,7 +519,8 @@ fn test_tcp_blocks_by_range_over_limit() {
|
||||
_ => {} // Ignore other events
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
.instrument(info_span!("Receiver"));
|
||||
|
||||
tokio::select! {
|
||||
_ = sender_future => {}
|
||||
@@ -529,7 +537,7 @@ fn test_tcp_blocks_by_range_over_limit() {
|
||||
fn test_tcp_blocks_by_range_chunked_rpc_terminates_correctly() {
|
||||
// Set up the logging.
|
||||
let log_level = "debug";
|
||||
let enable_logging = false;
|
||||
let enable_logging = true;
|
||||
build_tracing_subscriber(log_level, enable_logging);
|
||||
|
||||
let messages_to_send = 10;
|
||||
@@ -601,7 +609,8 @@ fn test_tcp_blocks_by_range_chunked_rpc_terminates_correctly() {
|
||||
_ => {} // Ignore other behaviour events
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
.instrument(info_span!("Sender"));
|
||||
|
||||
// determine messages to send (PeerId, RequestId). If some, indicates we still need to send
|
||||
// messages
|
||||
@@ -648,7 +657,8 @@ fn test_tcp_blocks_by_range_chunked_rpc_terminates_correctly() {
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
.instrument(info_span!("Receiver"));
|
||||
|
||||
tokio::select! {
|
||||
_ = sender_future => {}
|
||||
@@ -666,7 +676,7 @@ fn test_tcp_blocks_by_range_chunked_rpc_terminates_correctly() {
|
||||
fn test_tcp_blocks_by_range_single_empty_rpc() {
|
||||
// Set up the logging.
|
||||
let log_level = "trace";
|
||||
let enable_logging = false;
|
||||
let enable_logging = true;
|
||||
build_tracing_subscriber(log_level, enable_logging);
|
||||
|
||||
let rt = Arc::new(Runtime::new().unwrap());
|
||||
@@ -734,7 +744,8 @@ fn test_tcp_blocks_by_range_single_empty_rpc() {
|
||||
_ => {} // Ignore other behaviour events
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
.instrument(info_span!("Sender"));
|
||||
|
||||
// build the receiver future
|
||||
let receiver_future = async {
|
||||
@@ -767,7 +778,8 @@ fn test_tcp_blocks_by_range_single_empty_rpc() {
|
||||
_ => {} // Ignore other events
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
.instrument(info_span!("Receiver"));
|
||||
tokio::select! {
|
||||
_ = sender_future => {}
|
||||
_ = receiver_future => {}
|
||||
@@ -787,7 +799,7 @@ fn test_tcp_blocks_by_range_single_empty_rpc() {
|
||||
fn test_tcp_blocks_by_root_chunked_rpc() {
|
||||
// Set up the logging.
|
||||
let log_level = "debug";
|
||||
let enable_logging = false;
|
||||
let enable_logging = true;
|
||||
build_tracing_subscriber(log_level, enable_logging);
|
||||
|
||||
let messages_to_send = 6;
|
||||
@@ -877,7 +889,8 @@ fn test_tcp_blocks_by_root_chunked_rpc() {
|
||||
_ => {} // Ignore other behaviour events
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
.instrument(info_span!("Sender"));
|
||||
|
||||
// build the receiver future
|
||||
let receiver_future = async {
|
||||
@@ -916,7 +929,8 @@ fn test_tcp_blocks_by_root_chunked_rpc() {
|
||||
_ => {} // Ignore other events
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
.instrument(info_span!("Receiver"));
|
||||
tokio::select! {
|
||||
_ = sender_future => {}
|
||||
_ = receiver_future => {}
|
||||
@@ -932,7 +946,7 @@ fn test_tcp_blocks_by_root_chunked_rpc() {
|
||||
fn test_tcp_blocks_by_root_chunked_rpc_terminates_correctly() {
|
||||
// Set up the logging.
|
||||
let log_level = "debug";
|
||||
let enable_logging = false;
|
||||
let enable_logging = true;
|
||||
build_tracing_subscriber(log_level, enable_logging);
|
||||
|
||||
let messages_to_send: u64 = 10;
|
||||
@@ -1015,7 +1029,8 @@ fn test_tcp_blocks_by_root_chunked_rpc_terminates_correctly() {
|
||||
_ => {} // Ignore other behaviour events
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
.instrument(info_span!("Sender"));
|
||||
|
||||
// determine messages to send (PeerId, RequestId). If some, indicates we still need to send
|
||||
// messages
|
||||
@@ -1062,7 +1077,8 @@ fn test_tcp_blocks_by_root_chunked_rpc_terminates_correctly() {
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
.instrument(info_span!("Receiver"));
|
||||
|
||||
tokio::select! {
|
||||
_ = sender_future => {}
|
||||
@@ -1115,7 +1131,8 @@ fn goodbye_test(log_level: &str, enable_logging: bool, protocol: Protocol) {
|
||||
_ => {} // Ignore other RPC messages
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
.instrument(info_span!("Sender"));
|
||||
|
||||
// build the receiver future
|
||||
let receiver_future = async {
|
||||
@@ -1125,7 +1142,8 @@ fn goodbye_test(log_level: &str, enable_logging: bool, protocol: Protocol) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
.instrument(info_span!("Receiver"));
|
||||
|
||||
let total_future = futures::future::join(sender_future, receiver_future);
|
||||
|
||||
@@ -1143,7 +1161,7 @@ fn goodbye_test(log_level: &str, enable_logging: bool, protocol: Protocol) {
|
||||
#[allow(clippy::single_match)]
|
||||
fn tcp_test_goodbye_rpc() {
|
||||
let log_level = "debug";
|
||||
let enabled_logging = false;
|
||||
let enabled_logging = true;
|
||||
goodbye_test(log_level, enabled_logging, Protocol::Tcp);
|
||||
}
|
||||
|
||||
@@ -1152,13 +1170,15 @@ fn tcp_test_goodbye_rpc() {
|
||||
#[allow(clippy::single_match)]
|
||||
fn quic_test_goodbye_rpc() {
|
||||
let log_level = "debug";
|
||||
let enabled_logging = false;
|
||||
let enabled_logging = true;
|
||||
goodbye_test(log_level, enabled_logging, Protocol::Quic);
|
||||
}
|
||||
|
||||
// Test that the receiver delays the responses during response rate-limiting.
|
||||
#[test]
|
||||
fn test_delayed_rpc_response() {
|
||||
// Set up the logging.
|
||||
build_tracing_subscriber("debug", true);
|
||||
let rt = Arc::new(Runtime::new().unwrap());
|
||||
let spec = Arc::new(E::default_spec());
|
||||
|
||||
@@ -1214,7 +1234,7 @@ fn test_delayed_rpc_response() {
|
||||
app_request_id: _,
|
||||
response,
|
||||
} => {
|
||||
debug!(%request_id, "Sender received");
|
||||
debug!(%request_id, elapsed = ?request_sent_at.elapsed(), "Sender received response");
|
||||
assert_eq!(response, rpc_response);
|
||||
|
||||
match request_id {
|
||||
@@ -1289,6 +1309,8 @@ fn test_delayed_rpc_response() {
|
||||
// once, thanks to the self-limiter on the sender side.
|
||||
#[test]
|
||||
fn test_active_requests() {
|
||||
// Set up the logging.
|
||||
build_tracing_subscriber("debug", true);
|
||||
let rt = Arc::new(Runtime::new().unwrap());
|
||||
let spec = Arc::new(E::default_spec());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user