mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-16 11:22:56 +00:00
Update to tokio 1.1 (#2172)
## Issue Addressed resolves #2129 resolves #2099 addresses some of #1712 unblocks #2076 unblocks #2153 ## Proposed Changes - Updates all the dependencies mentioned in #2129, except for web3. They haven't merged their tokio 1.0 update because they are waiting on some dependencies of their own. Since we only use web3 in tests, I think updating it in a separate issue is fine. If they are able to merge soon though, I can update in this PR. - Updates `tokio_util` to 0.6.2 and `bytes` to 1.0.1. - We haven't made a discv5 release since merging tokio 1.0 updates so I'm using a commit rather than release atm. **Edit:** I think we should merge an update of `tokio_util` to 0.6.2 into discv5 before this release because it has panic fixes in `DelayQueue` --> PR in discv5: https://github.com/sigp/discv5/pull/58 ## Additional Info tokio 1.0 changes that required some changes in lighthouse: - `interval.next().await.is_some()` -> `interval.tick().await` - `sleep` future is now `!Unpin` -> https://github.com/tokio-rs/tokio/issues/3028 - `try_recv` has been temporarily removed from `mpsc` -> https://github.com/tokio-rs/tokio/issues/3350 - stream features have moved to `tokio-stream` and `broadcast::Receiver::into_stream()` has been temporarily removed -> `https://github.com/tokio-rs/tokio/issues/2870 - I've copied over the `BroadcastStream` wrapper from this PR, but can update to use `tokio-stream` once it's merged https://github.com/tokio-rs/tokio/pull/3384 Co-authored-by: realbigsean <seananderson33@gmail.com>
This commit is contained in:
@@ -5,9 +5,11 @@ authors = ["Paul Hauner <paul@paulhauner.com>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
warp = { git = "https://github.com/sigp/warp ", branch = "lighthouse" }
|
||||
warp = "0.3.0"
|
||||
serde = { version = "1.0.116", features = ["derive"] }
|
||||
tokio = { version = "0.3.2", features = ["macros","stream","sync"] }
|
||||
tokio = { version = "1.1.0", features = ["macros","sync"] }
|
||||
tokio-stream = "0.1.2"
|
||||
tokio-util = "0.6.3"
|
||||
parking_lot = "0.11.0"
|
||||
types = { path = "../../consensus/types" }
|
||||
hex = "0.4.2"
|
||||
@@ -32,5 +34,4 @@ futures = "0.3.8"
|
||||
store = { path = "../store" }
|
||||
environment = { path = "../../lighthouse/environment" }
|
||||
tree_hash = "0.1.1"
|
||||
discv5 = { version = "0.1.0-beta.2", features = ["libp2p"] }
|
||||
tokio-compat-02 = "0.1"
|
||||
discv5 = { version = "0.1.0-beta.3" }
|
||||
|
||||
66
beacon_node/http_api/src/broadcast_stream.rs
Normal file
66
beacon_node/http_api/src/broadcast_stream.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
// TODO: this should be replaced with the tokio's `BroadcastStream` once it's added to
|
||||
// tokio-stream (https://github.com/tokio-rs/tokio/pull/3384)
|
||||
|
||||
use std::fmt;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use tokio::sync::broadcast::error::RecvError;
|
||||
use tokio::sync::broadcast::Receiver;
|
||||
use tokio_stream::Stream;
|
||||
use tokio_util::sync::ReusableBoxFuture;
|
||||
|
||||
/// A wrapper around [`tokio::sync::broadcast::Receiver`] that implements [`Stream`].
|
||||
///
|
||||
/// [`tokio::sync::broadcast::Receiver`]: struct@tokio::sync::broadcast::Receiver
|
||||
/// [`Stream`]: trait@crate::Stream
|
||||
pub struct BroadcastStream<T> {
|
||||
inner: ReusableBoxFuture<(Result<T, RecvError>, Receiver<T>)>,
|
||||
}
|
||||
|
||||
/// An error returned from the inner stream of a [`BroadcastStream`].
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum BroadcastStreamRecvError {
|
||||
/// The receiver lagged too far behind. Attempting to receive again will
|
||||
/// return the oldest message still retained by the channel.
|
||||
///
|
||||
/// Includes the number of skipped messages.
|
||||
Lagged(u64),
|
||||
}
|
||||
|
||||
async fn make_future<T: Clone>(mut rx: Receiver<T>) -> (Result<T, RecvError>, Receiver<T>) {
|
||||
let result = rx.recv().await;
|
||||
(result, rx)
|
||||
}
|
||||
|
||||
impl<T: 'static + Clone + Send> BroadcastStream<T> {
|
||||
/// Create a new `BroadcastStream`.
|
||||
pub fn new(rx: Receiver<T>) -> Self {
|
||||
Self {
|
||||
inner: ReusableBoxFuture::new(make_future(rx)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: 'static + Clone + Send> Stream for BroadcastStream<T> {
|
||||
type Item = Result<T, BroadcastStreamRecvError>;
|
||||
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
|
||||
let (result, rx) = match self.inner.poll(cx) {
|
||||
std::task::Poll::Ready(t) => t,
|
||||
std::task::Poll::Pending => return std::task::Poll::Pending,
|
||||
};
|
||||
self.inner.set(make_future(rx));
|
||||
match result {
|
||||
Ok(item) => Poll::Ready(Some(Ok(item))),
|
||||
Err(RecvError::Closed) => Poll::Ready(None),
|
||||
Err(RecvError::Lagged(n)) => {
|
||||
Poll::Ready(Some(Err(BroadcastStreamRecvError::Lagged(n))))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> fmt::Debug for BroadcastStream<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("BroadcastStream").finish()
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
mod beacon_proposer_cache;
|
||||
mod block_id;
|
||||
mod broadcast_stream;
|
||||
mod metrics;
|
||||
mod state_id;
|
||||
mod validator_inclusion;
|
||||
@@ -18,7 +19,7 @@ use beacon_chain::{
|
||||
};
|
||||
use beacon_proposer_cache::BeaconProposerCache;
|
||||
use block_id::BlockId;
|
||||
use eth2::types::{self as api_types, EventKind, ValidatorId};
|
||||
use eth2::types::{self as api_types, ValidatorId};
|
||||
use eth2_libp2p::{types::SyncState, EnrExt, NetworkGlobals, PeerId, PubsubMessage};
|
||||
use lighthouse_version::version_with_platform;
|
||||
use network::NetworkMessage;
|
||||
@@ -34,19 +35,17 @@ use std::convert::TryInto;
|
||||
use std::future::Future;
|
||||
use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4};
|
||||
use std::sync::Arc;
|
||||
use tokio::stream::{StreamExt, StreamMap};
|
||||
use tokio::sync::broadcast::error::RecvError;
|
||||
use tokio::sync::mpsc::UnboundedSender;
|
||||
use tokio_stream::StreamExt;
|
||||
use types::{
|
||||
Attestation, AttestationDuty, AttesterSlashing, CloneConfig, CommitteeCache, Epoch, EthSpec,
|
||||
Hash256, ProposerSlashing, PublicKey, PublicKeyBytes, RelativeEpoch, SignedAggregateAndProof,
|
||||
SignedBeaconBlock, SignedVoluntaryExit, Slot, YamlConfig,
|
||||
};
|
||||
use warp::http::StatusCode;
|
||||
use warp::sse::ServerSentEvent;
|
||||
use warp::sse::Event;
|
||||
use warp::Reply;
|
||||
use warp::{http::Response, Filter, Stream};
|
||||
use warp_utils::reject::ServerSentEventError;
|
||||
use warp::{http::Response, Filter};
|
||||
use warp_utils::task::{blocking_json_task, blocking_task};
|
||||
|
||||
const API_PREFIX: &str = "eth";
|
||||
@@ -1610,9 +1609,9 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
.and(warp::path("duties"))
|
||||
.and(warp::path("proposer"))
|
||||
.and(warp::path::param::<Epoch>().or_else(|_| async {
|
||||
Err(warp_utils::reject::custom_bad_request(
|
||||
"Invalid epoch".to_string(),
|
||||
))
|
||||
Err(warp_utils::reject::custom_bad_request(
|
||||
"Invalid epoch".to_string(),
|
||||
))
|
||||
}))
|
||||
.and(warp::path::end())
|
||||
.and(not_while_syncing_filter.clone())
|
||||
@@ -1637,7 +1636,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
if epoch == current_epoch {
|
||||
let dependent_root_slot = current_epoch
|
||||
.start_slot(T::EthSpec::slots_per_epoch()) - 1;
|
||||
let dependent_root = if dependent_root_slot > chain.best_slot().map_err(warp_utils::reject::beacon_chain_error)? {
|
||||
let dependent_root = if dependent_root_slot > chain.best_slot().map_err(warp_utils::reject::beacon_chain_error)? {
|
||||
chain.head_beacon_block_root().map_err(warp_utils::reject::beacon_chain_error)?
|
||||
} else {
|
||||
chain
|
||||
@@ -1649,7 +1648,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
beacon_proposer_cache
|
||||
.lock()
|
||||
.get_proposers(&chain, epoch)
|
||||
.map(|duties| api_types::DutiesResponse{ data: duties, dependent_root} )
|
||||
.map(|duties| api_types::DutiesResponse { data: duties, dependent_root })
|
||||
} else {
|
||||
let state =
|
||||
StateId::slot(epoch.start_slot(T::EthSpec::slots_per_epoch()))
|
||||
@@ -1657,7 +1656,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
|
||||
let dependent_root_slot = state.current_epoch()
|
||||
.start_slot(T::EthSpec::slots_per_epoch()) - 1;
|
||||
let dependent_root = if dependent_root_slot > chain.best_slot().map_err(warp_utils::reject::beacon_chain_error)? {
|
||||
let dependent_root = if dependent_root_slot > chain.best_slot().map_err(warp_utils::reject::beacon_chain_error)? {
|
||||
chain.head_beacon_block_root().map_err(warp_utils::reject::beacon_chain_error)?
|
||||
} else {
|
||||
chain
|
||||
@@ -1691,8 +1690,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
})
|
||||
.collect::<Result<Vec<api_types::ProposerData>, _>>()
|
||||
.map(|duties| {
|
||||
|
||||
api_types::DutiesResponse{
|
||||
api_types::DutiesResponse {
|
||||
dependent_root,
|
||||
data: duties,
|
||||
}
|
||||
@@ -2053,7 +2051,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
"attestation_slot" => aggregate.message.aggregate.data.slot,
|
||||
);
|
||||
failures.push(api_types::Failure::new(index, format!("Verification: {:?}", e)));
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2087,7 +2085,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
|
||||
if !failures.is_empty() {
|
||||
Err(warp_utils::reject::indexed_bad_request("error processing aggregate and proofs".to_string(),
|
||||
failures
|
||||
failures,
|
||||
))
|
||||
} else {
|
||||
Ok(())
|
||||
@@ -2358,24 +2356,6 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
})
|
||||
});
|
||||
|
||||
fn merge_streams<T: EthSpec>(
|
||||
stream_map: StreamMap<
|
||||
String,
|
||||
impl Stream<Item = Result<EventKind<T>, RecvError>> + Unpin + Send + 'static,
|
||||
>,
|
||||
) -> impl Stream<Item = Result<impl ServerSentEvent + Send + 'static, ServerSentEventError>>
|
||||
+ Send
|
||||
+ 'static {
|
||||
// Convert messages into Server-Sent Events and return resulting stream.
|
||||
stream_map.map(move |(topic_name, msg)| match msg {
|
||||
Ok(data) => Ok((warp::sse::event(topic_name), warp::sse::json(data)).boxed()),
|
||||
Err(e) => Err(warp_utils::reject::server_sent_event_error(format!(
|
||||
"{:?}",
|
||||
e
|
||||
))),
|
||||
})
|
||||
}
|
||||
|
||||
let get_events = eth1_v1
|
||||
.and(warp::path("events"))
|
||||
.and(warp::path::end())
|
||||
@@ -2385,7 +2365,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
|topics: api_types::EventQuery, chain: Arc<BeaconChain<T>>| {
|
||||
blocking_task(move || {
|
||||
// for each topic subscribed spawn a new subscription
|
||||
let mut stream_map = StreamMap::with_capacity(topics.topics.0.len());
|
||||
let mut receivers = Vec::with_capacity(topics.topics.0.len());
|
||||
|
||||
if let Some(event_handler) = chain.event_handler.as_ref() {
|
||||
for topic in topics.topics.0.clone() {
|
||||
@@ -2402,7 +2382,24 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
event_handler.subscribe_finalized()
|
||||
}
|
||||
};
|
||||
stream_map.insert(topic.to_string(), Box::pin(receiver.into_stream()));
|
||||
|
||||
receivers.push(broadcast_stream::BroadcastStream::new(receiver).map(
|
||||
|msg| {
|
||||
match msg {
|
||||
Ok(data) => Event::default()
|
||||
.event(data.topic_name())
|
||||
.json_data(data)
|
||||
.map_err(|e| {
|
||||
warp_utils::reject::server_sent_event_error(
|
||||
format!("{:?}", e),
|
||||
)
|
||||
}),
|
||||
Err(e) => Err(warp_utils::reject::server_sent_event_error(
|
||||
format!("{:?}", e),
|
||||
)),
|
||||
}
|
||||
},
|
||||
));
|
||||
}
|
||||
} else {
|
||||
return Err(warp_utils::reject::custom_server_error(
|
||||
@@ -2410,11 +2407,9 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
));
|
||||
}
|
||||
|
||||
let stream = merge_streams(stream_map);
|
||||
let s = futures::stream::select_all(receivers);
|
||||
|
||||
Ok::<_, warp::Rejection>(warp::sse::reply(
|
||||
warp::sse::keep_alive().stream(stream),
|
||||
))
|
||||
Ok::<_, warp::Rejection>(warp::sse::reply(warp::sse::keep_alive().stream(s)))
|
||||
})
|
||||
},
|
||||
);
|
||||
|
||||
@@ -15,6 +15,7 @@ use eth2_libp2p::{
|
||||
Enr, EnrExt, NetworkGlobals, PeerId,
|
||||
};
|
||||
use futures::stream::{Stream, StreamExt};
|
||||
use futures::FutureExt;
|
||||
use http_api::{Config, Context};
|
||||
use network::NetworkMessage;
|
||||
use state_processing::per_slot_processing;
|
||||
@@ -25,7 +26,6 @@ use std::sync::Arc;
|
||||
use tokio::sync::mpsc;
|
||||
use tokio::sync::oneshot;
|
||||
use tokio::time::Duration;
|
||||
use tokio_compat_02::FutureExt;
|
||||
use tree_hash::TreeHash;
|
||||
use types::{
|
||||
test_utils::generate_deterministic_keypairs, AggregateSignature, BeaconState, BitList, Domain,
|
||||
@@ -933,7 +933,7 @@ impl ApiTester {
|
||||
self.client.post_beacon_blocks(next_block).await.unwrap();
|
||||
|
||||
assert!(
|
||||
self.network_rx.try_recv().is_ok(),
|
||||
self.network_rx.recv().await.is_some(),
|
||||
"valid blocks should be sent to network"
|
||||
);
|
||||
|
||||
@@ -947,7 +947,7 @@ impl ApiTester {
|
||||
assert!(self.client.post_beacon_blocks(&next_block).await.is_err());
|
||||
|
||||
assert!(
|
||||
self.network_rx.try_recv().is_ok(),
|
||||
self.network_rx.recv().await.is_some(),
|
||||
"invalid blocks should be sent to network"
|
||||
);
|
||||
|
||||
@@ -997,7 +997,7 @@ impl ApiTester {
|
||||
.unwrap();
|
||||
|
||||
assert!(
|
||||
self.network_rx.try_recv().is_ok(),
|
||||
self.network_rx.recv().await.is_some(),
|
||||
"valid attestation should be sent to network"
|
||||
);
|
||||
|
||||
@@ -1034,7 +1034,7 @@ impl ApiTester {
|
||||
}
|
||||
|
||||
assert!(
|
||||
self.network_rx.try_recv().is_ok(),
|
||||
self.network_rx.recv().await.is_some(),
|
||||
"if some attestations are valid, we should send them to the network"
|
||||
);
|
||||
|
||||
@@ -1064,7 +1064,7 @@ impl ApiTester {
|
||||
.unwrap();
|
||||
|
||||
assert!(
|
||||
self.network_rx.try_recv().is_ok(),
|
||||
self.network_rx.recv().await.is_some(),
|
||||
"valid attester slashing should be sent to network"
|
||||
);
|
||||
|
||||
@@ -1081,7 +1081,7 @@ impl ApiTester {
|
||||
.unwrap_err();
|
||||
|
||||
assert!(
|
||||
self.network_rx.try_recv().is_err(),
|
||||
self.network_rx.recv().now_or_never().is_none(),
|
||||
"invalid attester slashing should not be sent to network"
|
||||
);
|
||||
|
||||
@@ -1110,7 +1110,7 @@ impl ApiTester {
|
||||
.unwrap();
|
||||
|
||||
assert!(
|
||||
self.network_rx.try_recv().is_ok(),
|
||||
self.network_rx.recv().await.is_some(),
|
||||
"valid proposer slashing should be sent to network"
|
||||
);
|
||||
|
||||
@@ -1127,7 +1127,7 @@ impl ApiTester {
|
||||
.unwrap_err();
|
||||
|
||||
assert!(
|
||||
self.network_rx.try_recv().is_err(),
|
||||
self.network_rx.recv().now_or_never().is_none(),
|
||||
"invalid proposer slashing should not be sent to network"
|
||||
);
|
||||
|
||||
@@ -1156,7 +1156,7 @@ impl ApiTester {
|
||||
.unwrap();
|
||||
|
||||
assert!(
|
||||
self.network_rx.try_recv().is_ok(),
|
||||
self.network_rx.recv().await.is_some(),
|
||||
"valid exit should be sent to network"
|
||||
);
|
||||
|
||||
@@ -1173,7 +1173,7 @@ impl ApiTester {
|
||||
.unwrap_err();
|
||||
|
||||
assert!(
|
||||
self.network_rx.try_recv().is_err(),
|
||||
self.network_rx.recv().now_or_never().is_none(),
|
||||
"invalid exit should not be sent to network"
|
||||
);
|
||||
|
||||
@@ -1822,7 +1822,7 @@ impl ApiTester {
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert!(self.network_rx.try_recv().is_ok());
|
||||
assert!(self.network_rx.recv().await.is_some());
|
||||
|
||||
self
|
||||
}
|
||||
@@ -1837,7 +1837,7 @@ impl ApiTester {
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
||||
assert!(self.network_rx.try_recv().is_err());
|
||||
assert!(self.network_rx.recv().now_or_never().is_none());
|
||||
|
||||
self
|
||||
}
|
||||
@@ -1856,7 +1856,7 @@ impl ApiTester {
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
self.network_rx.try_recv().unwrap();
|
||||
self.network_rx.recv().now_or_never().unwrap();
|
||||
|
||||
self
|
||||
}
|
||||
@@ -2127,83 +2127,71 @@ async fn poll_events<S: Stream<Item = Result<EventKind<T>, eth2::Error>> + Unpin
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn get_events() {
|
||||
ApiTester::new().test_get_events().compat().await;
|
||||
ApiTester::new().test_get_events().await;
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn get_events_from_genesis() {
|
||||
ApiTester::new_from_genesis()
|
||||
.test_get_events_from_genesis()
|
||||
.compat()
|
||||
.await;
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn beacon_get() {
|
||||
async {
|
||||
ApiTester::new()
|
||||
.test_beacon_genesis()
|
||||
.await
|
||||
.test_beacon_states_root()
|
||||
.await
|
||||
.test_beacon_states_fork()
|
||||
.await
|
||||
.test_beacon_states_finality_checkpoints()
|
||||
.await
|
||||
.test_beacon_states_validators()
|
||||
.await
|
||||
.test_beacon_states_validator_balances()
|
||||
.await
|
||||
.test_beacon_states_committees()
|
||||
.await
|
||||
.test_beacon_states_validator_id()
|
||||
.await
|
||||
.test_beacon_headers_all_slots()
|
||||
.await
|
||||
.test_beacon_headers_all_parents()
|
||||
.await
|
||||
.test_beacon_headers_block_id()
|
||||
.await
|
||||
.test_beacon_blocks()
|
||||
.await
|
||||
.test_beacon_blocks_attestations()
|
||||
.await
|
||||
.test_beacon_blocks_root()
|
||||
.await
|
||||
.test_get_beacon_pool_attestations()
|
||||
.await
|
||||
.test_get_beacon_pool_attester_slashings()
|
||||
.await
|
||||
.test_get_beacon_pool_proposer_slashings()
|
||||
.await
|
||||
.test_get_beacon_pool_voluntary_exits()
|
||||
.await;
|
||||
}
|
||||
.compat()
|
||||
.await;
|
||||
ApiTester::new()
|
||||
.test_beacon_genesis()
|
||||
.await
|
||||
.test_beacon_states_root()
|
||||
.await
|
||||
.test_beacon_states_fork()
|
||||
.await
|
||||
.test_beacon_states_finality_checkpoints()
|
||||
.await
|
||||
.test_beacon_states_validators()
|
||||
.await
|
||||
.test_beacon_states_validator_balances()
|
||||
.await
|
||||
.test_beacon_states_committees()
|
||||
.await
|
||||
.test_beacon_states_validator_id()
|
||||
.await
|
||||
.test_beacon_headers_all_slots()
|
||||
.await
|
||||
.test_beacon_headers_all_parents()
|
||||
.await
|
||||
.test_beacon_headers_block_id()
|
||||
.await
|
||||
.test_beacon_blocks()
|
||||
.await
|
||||
.test_beacon_blocks_attestations()
|
||||
.await
|
||||
.test_beacon_blocks_root()
|
||||
.await
|
||||
.test_get_beacon_pool_attestations()
|
||||
.await
|
||||
.test_get_beacon_pool_attester_slashings()
|
||||
.await
|
||||
.test_get_beacon_pool_proposer_slashings()
|
||||
.await
|
||||
.test_get_beacon_pool_voluntary_exits()
|
||||
.await;
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn post_beacon_blocks_valid() {
|
||||
ApiTester::new()
|
||||
.test_post_beacon_blocks_valid()
|
||||
.compat()
|
||||
.await;
|
||||
ApiTester::new().test_post_beacon_blocks_valid().await;
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn post_beacon_blocks_invalid() {
|
||||
ApiTester::new()
|
||||
.test_post_beacon_blocks_invalid()
|
||||
.compat()
|
||||
.await;
|
||||
ApiTester::new().test_post_beacon_blocks_invalid().await;
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn beacon_pools_post_attestations_valid() {
|
||||
ApiTester::new()
|
||||
.test_post_beacon_pool_attestations_valid()
|
||||
.compat()
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -2211,7 +2199,6 @@ async fn beacon_pools_post_attestations_valid() {
|
||||
async fn beacon_pools_post_attestations_invalid() {
|
||||
ApiTester::new()
|
||||
.test_post_beacon_pool_attestations_invalid()
|
||||
.compat()
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -2219,7 +2206,6 @@ async fn beacon_pools_post_attestations_invalid() {
|
||||
async fn beacon_pools_post_attester_slashings_valid() {
|
||||
ApiTester::new()
|
||||
.test_post_beacon_pool_attester_slashings_valid()
|
||||
.compat()
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -2227,7 +2213,6 @@ async fn beacon_pools_post_attester_slashings_valid() {
|
||||
async fn beacon_pools_post_attester_slashings_invalid() {
|
||||
ApiTester::new()
|
||||
.test_post_beacon_pool_attester_slashings_invalid()
|
||||
.compat()
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -2235,7 +2220,6 @@ async fn beacon_pools_post_attester_slashings_invalid() {
|
||||
async fn beacon_pools_post_proposer_slashings_valid() {
|
||||
ApiTester::new()
|
||||
.test_post_beacon_pool_proposer_slashings_valid()
|
||||
.compat()
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -2243,7 +2227,6 @@ async fn beacon_pools_post_proposer_slashings_valid() {
|
||||
async fn beacon_pools_post_proposer_slashings_invalid() {
|
||||
ApiTester::new()
|
||||
.test_post_beacon_pool_proposer_slashings_invalid()
|
||||
.compat()
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -2251,7 +2234,6 @@ async fn beacon_pools_post_proposer_slashings_invalid() {
|
||||
async fn beacon_pools_post_voluntary_exits_valid() {
|
||||
ApiTester::new()
|
||||
.test_post_beacon_pool_voluntary_exits_valid()
|
||||
.compat()
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -2259,7 +2241,6 @@ async fn beacon_pools_post_voluntary_exits_valid() {
|
||||
async fn beacon_pools_post_voluntary_exits_invalid() {
|
||||
ApiTester::new()
|
||||
.test_post_beacon_pool_voluntary_exits_invalid()
|
||||
.compat()
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -2267,13 +2248,10 @@ async fn beacon_pools_post_voluntary_exits_invalid() {
|
||||
async fn config_get() {
|
||||
ApiTester::new()
|
||||
.test_get_config_fork_schedule()
|
||||
.compat()
|
||||
.await
|
||||
.test_get_config_spec()
|
||||
.compat()
|
||||
.await
|
||||
.test_get_config_deposit_contract()
|
||||
.compat()
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -2281,10 +2259,8 @@ async fn config_get() {
|
||||
async fn debug_get() {
|
||||
ApiTester::new()
|
||||
.test_get_debug_beacon_states()
|
||||
.compat()
|
||||
.await
|
||||
.test_get_debug_beacon_heads()
|
||||
.compat()
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -2292,34 +2268,24 @@ async fn debug_get() {
|
||||
async fn node_get() {
|
||||
ApiTester::new()
|
||||
.test_get_node_version()
|
||||
.compat()
|
||||
.await
|
||||
.test_get_node_syncing()
|
||||
.compat()
|
||||
.await
|
||||
.test_get_node_identity()
|
||||
.compat()
|
||||
.await
|
||||
.test_get_node_health()
|
||||
.compat()
|
||||
.await
|
||||
.test_get_node_peers_by_id()
|
||||
.compat()
|
||||
.await
|
||||
.test_get_node_peers()
|
||||
.compat()
|
||||
.await
|
||||
.test_get_node_peer_count()
|
||||
.compat()
|
||||
.await;
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn get_validator_duties_attester() {
|
||||
ApiTester::new()
|
||||
.test_get_validator_duties_attester()
|
||||
.compat()
|
||||
.await;
|
||||
ApiTester::new().test_get_validator_duties_attester().await;
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
@@ -2327,16 +2293,12 @@ async fn get_validator_duties_attester_with_skip_slots() {
|
||||
ApiTester::new()
|
||||
.skip_slots(E::slots_per_epoch() * 2)
|
||||
.test_get_validator_duties_attester()
|
||||
.compat()
|
||||
.await;
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn get_validator_duties_proposer() {
|
||||
ApiTester::new()
|
||||
.test_get_validator_duties_proposer()
|
||||
.compat()
|
||||
.await;
|
||||
ApiTester::new().test_get_validator_duties_proposer().await;
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
@@ -2344,13 +2306,12 @@ async fn get_validator_duties_proposer_with_skip_slots() {
|
||||
ApiTester::new()
|
||||
.skip_slots(E::slots_per_epoch() * 2)
|
||||
.test_get_validator_duties_proposer()
|
||||
.compat()
|
||||
.await;
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn block_production() {
|
||||
ApiTester::new().test_block_production().compat().await;
|
||||
ApiTester::new().test_block_production().await;
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
@@ -2358,16 +2319,12 @@ async fn block_production_with_skip_slots() {
|
||||
ApiTester::new()
|
||||
.skip_slots(E::slots_per_epoch() * 2)
|
||||
.test_block_production()
|
||||
.compat()
|
||||
.await;
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn get_validator_attestation_data() {
|
||||
ApiTester::new()
|
||||
.test_get_validator_attestation_data()
|
||||
.compat()
|
||||
.await;
|
||||
ApiTester::new().test_get_validator_attestation_data().await;
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
@@ -2375,7 +2332,6 @@ async fn get_validator_attestation_data_with_skip_slots() {
|
||||
ApiTester::new()
|
||||
.skip_slots(E::slots_per_epoch() * 2)
|
||||
.test_get_validator_attestation_data()
|
||||
.compat()
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -2383,7 +2339,6 @@ async fn get_validator_attestation_data_with_skip_slots() {
|
||||
async fn get_validator_aggregate_attestation() {
|
||||
ApiTester::new()
|
||||
.test_get_validator_aggregate_attestation()
|
||||
.compat()
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -2392,7 +2347,6 @@ async fn get_validator_aggregate_attestation_with_skip_slots() {
|
||||
ApiTester::new()
|
||||
.skip_slots(E::slots_per_epoch() * 2)
|
||||
.test_get_validator_aggregate_attestation()
|
||||
.compat()
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -2400,7 +2354,6 @@ async fn get_validator_aggregate_attestation_with_skip_slots() {
|
||||
async fn get_validator_aggregate_and_proofs_valid() {
|
||||
ApiTester::new()
|
||||
.test_get_validator_aggregate_and_proofs_valid()
|
||||
.compat()
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -2409,7 +2362,6 @@ async fn get_validator_aggregate_and_proofs_valid_with_skip_slots() {
|
||||
ApiTester::new()
|
||||
.skip_slots(E::slots_per_epoch() * 2)
|
||||
.test_get_validator_aggregate_and_proofs_valid()
|
||||
.compat()
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -2417,7 +2369,6 @@ async fn get_validator_aggregate_and_proofs_valid_with_skip_slots() {
|
||||
async fn get_validator_aggregate_and_proofs_invalid() {
|
||||
ApiTester::new()
|
||||
.test_get_validator_aggregate_and_proofs_invalid()
|
||||
.compat()
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -2426,7 +2377,6 @@ async fn get_validator_aggregate_and_proofs_invalid_with_skip_slots() {
|
||||
ApiTester::new()
|
||||
.skip_slots(E::slots_per_epoch() * 2)
|
||||
.test_get_validator_aggregate_and_proofs_invalid()
|
||||
.compat()
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -2434,7 +2384,6 @@ async fn get_validator_aggregate_and_proofs_invalid_with_skip_slots() {
|
||||
async fn get_validator_beacon_committee_subscriptions() {
|
||||
ApiTester::new()
|
||||
.test_get_validator_beacon_committee_subscriptions()
|
||||
.compat()
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -2442,33 +2391,23 @@ async fn get_validator_beacon_committee_subscriptions() {
|
||||
async fn lighthouse_endpoints() {
|
||||
ApiTester::new()
|
||||
.test_get_lighthouse_health()
|
||||
.compat()
|
||||
.await
|
||||
.test_get_lighthouse_syncing()
|
||||
.compat()
|
||||
.await
|
||||
.test_get_lighthouse_proto_array()
|
||||
.compat()
|
||||
.await
|
||||
.test_get_lighthouse_validator_inclusion()
|
||||
.compat()
|
||||
.await
|
||||
.test_get_lighthouse_validator_inclusion_global()
|
||||
.compat()
|
||||
.await
|
||||
.test_get_lighthouse_eth1_syncing()
|
||||
.compat()
|
||||
.await
|
||||
.test_get_lighthouse_eth1_block_cache()
|
||||
.compat()
|
||||
.await
|
||||
.test_get_lighthouse_eth1_deposit_cache()
|
||||
.compat()
|
||||
.await
|
||||
.test_get_lighthouse_beacon_states_ssz()
|
||||
.compat()
|
||||
.await
|
||||
.test_get_lighthouse_staking()
|
||||
.compat()
|
||||
.await;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user