Fix Rust beta compiler errors 1.78.0-beta.1 (#5439)
* remove redundant imports * fix test * contains key * fmt * Merge branch 'unstable' into fix-beta-compiler
This commit is contained in:
@@ -72,7 +72,7 @@ use crate::{
|
||||
kzg_utils, metrics, AvailabilityPendingExecutedBlock, BeaconChainError, BeaconForkChoiceStore,
|
||||
BeaconSnapshot, CachedHead,
|
||||
};
|
||||
use eth2::types::{EventKind, SseBlobSidecar, SseBlock, SseExtendedPayloadAttributes, SyncDuty};
|
||||
use eth2::types::{EventKind, SseBlobSidecar, SseBlock, SseExtendedPayloadAttributes};
|
||||
use execution_layer::{
|
||||
BlockProposalContents, BlockProposalContentsType, BuilderParams, ChainHealth, ExecutionLayer,
|
||||
FailedCondition, PayloadAttributes, PayloadStatus,
|
||||
@@ -120,8 +120,7 @@ use store::{
|
||||
use task_executor::{ShutdownReason, TaskExecutor};
|
||||
use tokio_stream::Stream;
|
||||
use tree_hash::TreeHash;
|
||||
use types::beacon_state::CloneConfig;
|
||||
use types::blob_sidecar::{BlobSidecarList, FixedBlobSidecarList};
|
||||
use types::blob_sidecar::FixedBlobSidecarList;
|
||||
use types::payload::BlockProductionVersion;
|
||||
use types::*;
|
||||
|
||||
|
||||
@@ -780,7 +780,7 @@ mod test {
|
||||
use store::{HotColdDB, ItemStore, LevelDB, StoreConfig};
|
||||
use tempfile::{tempdir, TempDir};
|
||||
use types::non_zero_usize::new_non_zero_usize;
|
||||
use types::{ChainSpec, ExecPayload, MinimalEthSpec};
|
||||
use types::{ExecPayload, MinimalEthSpec};
|
||||
|
||||
const LOW_VALIDATOR_COUNT: usize = 32;
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ use crate::{
|
||||
use parking_lot::RwLock;
|
||||
use proto_array::Block as ProtoBlock;
|
||||
use std::sync::Arc;
|
||||
use types::blob_sidecar::BlobSidecarList;
|
||||
use types::*;
|
||||
|
||||
pub struct CacheItem<E: EthSpec> {
|
||||
|
||||
@@ -9,7 +9,6 @@ use ssz_derive::{Decode, Encode};
|
||||
use state_processing::per_block_processing::get_new_eth1_data;
|
||||
use std::cmp::Ordering;
|
||||
use std::collections::HashMap;
|
||||
use std::iter::DoubleEndedIterator;
|
||||
use std::marker::PhantomData;
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
use store::{DBColumn, Error as StoreError, StoreItem};
|
||||
@@ -736,7 +735,7 @@ mod test {
|
||||
mod eth1_chain_json_backend {
|
||||
use super::*;
|
||||
use eth1::DepositLog;
|
||||
use types::{test_utils::generate_deterministic_keypair, EthSpec, MainnetEthSpec};
|
||||
use types::{test_utils::generate_deterministic_keypair, MainnetEthSpec};
|
||||
|
||||
fn get_eth1_chain() -> Eth1Chain<CachingEth1Backend<E>, E> {
|
||||
let eth1_config = Eth1Config {
|
||||
|
||||
@@ -111,7 +111,7 @@ mod tests {
|
||||
use super::*;
|
||||
use bls::Hash256;
|
||||
use std::sync::Arc;
|
||||
use types::{BlobSidecar, MainnetEthSpec};
|
||||
use types::MainnetEthSpec;
|
||||
|
||||
type E = MainnetEthSpec;
|
||||
|
||||
|
||||
@@ -367,10 +367,7 @@ impl<T: EthSpec> SnapshotCache<T> {
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::test_utils::{BeaconChainHarness, EphemeralHarnessType};
|
||||
use types::{
|
||||
test_utils::generate_deterministic_keypair, BeaconBlock, Epoch, MainnetEthSpec,
|
||||
SignedBeaconBlock, Slot,
|
||||
};
|
||||
use types::{test_utils::generate_deterministic_keypair, BeaconBlock, MainnetEthSpec};
|
||||
|
||||
fn get_harness() -> BeaconChainHarness<EphemeralHarnessType<MainnetEthSpec>> {
|
||||
let harness = BeaconChainHarness::builder(MainnetEthSpec)
|
||||
|
||||
@@ -61,7 +61,6 @@ use task_executor::TaskExecutor;
|
||||
use task_executor::{test_utils::TestRuntime, ShutdownReason};
|
||||
use tree_hash::TreeHash;
|
||||
use types::payload::BlockProductionVersion;
|
||||
use types::sync_selection_proof::SyncSelectionProof;
|
||||
pub use types::test_utils::generate_deterministic_keypairs;
|
||||
use types::test_utils::TestRandom;
|
||||
use types::{typenum::U4294967296, *};
|
||||
|
||||
@@ -15,7 +15,6 @@ use state_processing::per_epoch_processing::{
|
||||
errors::EpochProcessingError, EpochProcessingSummary,
|
||||
};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::convert::TryFrom;
|
||||
use std::io;
|
||||
use std::marker::PhantomData;
|
||||
use std::str::Utf8Error;
|
||||
|
||||
@@ -2,7 +2,6 @@ use crate::errors::BeaconChainError;
|
||||
use crate::{BeaconChainTypes, BeaconStore};
|
||||
use ssz::{Decode, Encode};
|
||||
use std::collections::HashMap;
|
||||
use std::convert::TryInto;
|
||||
use std::marker::PhantomData;
|
||||
use store::{DBColumn, Error as StoreError, StoreItem, StoreOp};
|
||||
use types::{BeaconState, Hash256, PublicKey, PublicKeyBytes};
|
||||
@@ -195,7 +194,7 @@ mod test {
|
||||
use logging::test_logger;
|
||||
use std::sync::Arc;
|
||||
use store::HotColdDB;
|
||||
use types::{BeaconState, EthSpec, Keypair, MainnetEthSpec};
|
||||
use types::{EthSpec, Keypair, MainnetEthSpec};
|
||||
|
||||
type E = MainnetEthSpec;
|
||||
type T = EphemeralHarnessType<E>;
|
||||
|
||||
@@ -964,7 +964,6 @@ impl<S: SlotClock> ReprocessQueue<S> {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use slot_clock::TestingSlotClock;
|
||||
use types::Slot;
|
||||
|
||||
#[test]
|
||||
fn backfill_processing_schedule_calculation() {
|
||||
|
||||
@@ -118,7 +118,7 @@ impl Default for Config {
|
||||
impl Config {
|
||||
/// Updates the data directory for the Client.
|
||||
pub fn set_data_dir(&mut self, data_dir: PathBuf) {
|
||||
self.data_dir = data_dir.clone();
|
||||
self.data_dir.clone_from(&data_dir);
|
||||
self.http_api.data_dir = data_dir;
|
||||
}
|
||||
|
||||
|
||||
@@ -196,7 +196,6 @@ impl BlockCache {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use types::Hash256;
|
||||
|
||||
fn get_block(i: u64, interval_secs: u64) -> Eth1Block {
|
||||
Eth1Block {
|
||||
|
||||
@@ -99,7 +99,6 @@ async fn new_anvil_instance() -> Result<AnvilEth1Instance, String> {
|
||||
|
||||
mod eth1_cache {
|
||||
use super::*;
|
||||
use types::{EthSpec, MainnetEthSpec};
|
||||
|
||||
#[tokio::test]
|
||||
async fn simple_scenario() {
|
||||
|
||||
@@ -17,7 +17,6 @@ pub use json_structures::{JsonWithdrawal, TransitionConfigurationV1};
|
||||
use pretty_reqwest_error::PrettyReqwestError;
|
||||
use reqwest::StatusCode;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::convert::TryFrom;
|
||||
use strum::IntoStaticStr;
|
||||
use superstruct::superstruct;
|
||||
pub use types::{
|
||||
|
||||
@@ -11,7 +11,6 @@ use std::collections::HashSet;
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use std::time::{Duration, Instant};
|
||||
use types::EthSpec;
|
||||
|
||||
pub use deposit_log::{DepositLog, Log};
|
||||
pub use reqwest::Client;
|
||||
@@ -1191,7 +1190,7 @@ mod test {
|
||||
use std::future::Future;
|
||||
use std::str::FromStr;
|
||||
use std::sync::Arc;
|
||||
use types::{ExecutionPayloadMerge, MainnetEthSpec, Transactions, Unsigned, VariableList};
|
||||
use types::{MainnetEthSpec, Unsigned};
|
||||
|
||||
struct Tester {
|
||||
server: MockServer<MainnetEthSpec>,
|
||||
|
||||
@@ -4,10 +4,7 @@ use strum::EnumString;
|
||||
use superstruct::superstruct;
|
||||
use types::beacon_block_body::KzgCommitments;
|
||||
use types::blob_sidecar::BlobsList;
|
||||
use types::{
|
||||
EthSpec, ExecutionBlockHash, ExecutionPayload, ExecutionPayloadCapella, ExecutionPayloadDeneb,
|
||||
ExecutionPayloadMerge, FixedVector, Transactions, Unsigned, VariableList, Withdrawal,
|
||||
};
|
||||
use types::{FixedVector, Unsigned};
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
|
||||
@@ -5,7 +5,6 @@ use crate::test_utils::DEFAULT_MOCK_EL_PAYLOAD_VALUE_WEI;
|
||||
use serde::{de::DeserializeOwned, Deserialize};
|
||||
use serde_json::Value as JsonValue;
|
||||
use std::sync::Arc;
|
||||
use types::{EthSpec, ForkName};
|
||||
|
||||
pub const GENERIC_ERROR_CODE: i64 = -1234;
|
||||
pub const BAD_PARAMS_ERROR_CODE: i64 = -32602;
|
||||
|
||||
@@ -71,8 +71,6 @@ pub trait BidStuff<E: EthSpec> {
|
||||
fn set_withdrawals_root(&mut self, withdrawals_root: Hash256);
|
||||
|
||||
fn sign_builder_message(&mut self, sk: &SecretKey, spec: &ChainSpec) -> Signature;
|
||||
|
||||
fn to_signed_bid(self, signature: Signature) -> SignedBuilderBid<E>;
|
||||
}
|
||||
|
||||
impl<E: EthSpec> BidStuff<E> for BuilderBid<E> {
|
||||
@@ -183,13 +181,6 @@ impl<E: EthSpec> BidStuff<E> for BuilderBid<E> {
|
||||
let message = self.signing_root(domain);
|
||||
sk.sign(message)
|
||||
}
|
||||
|
||||
fn to_signed_bid(self, signature: Signature) -> SignedBuilderBid<E> {
|
||||
SignedBuilderBid {
|
||||
message: self,
|
||||
signature,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
|
||||
@@ -2,14 +2,12 @@ use crate::{
|
||||
test_utils::{
|
||||
MockServer, DEFAULT_JWT_SECRET, DEFAULT_TERMINAL_BLOCK, DEFAULT_TERMINAL_DIFFICULTY,
|
||||
},
|
||||
Config, *,
|
||||
*,
|
||||
};
|
||||
use keccak_hash::H256;
|
||||
use kzg::Kzg;
|
||||
use sensitive_url::SensitiveUrl;
|
||||
use task_executor::TaskExecutor;
|
||||
use tempfile::NamedTempFile;
|
||||
use types::{Address, ChainSpec, Epoch, EthSpec, Hash256, MainnetEthSpec};
|
||||
use types::MainnetEthSpec;
|
||||
|
||||
pub struct MockExecutionLayer<T: EthSpec> {
|
||||
pub server: MockServer<T>,
|
||||
|
||||
@@ -137,7 +137,7 @@ pub fn interop_genesis_state_with_withdrawal_credentials<T: EthSpec>(
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use types::{test_utils::generate_deterministic_keypairs, EthSpec, MinimalEthSpec};
|
||||
use types::{test_utils::generate_deterministic_keypairs, MinimalEthSpec};
|
||||
|
||||
type TestEthSpec = MinimalEthSpec;
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ impl<T: EthSpec> PackingEfficiencyHandler<T> {
|
||||
}
|
||||
|
||||
// Remove duplicate attestations as these yield no reward.
|
||||
attestations_in_block.retain(|x, _| self.included_attestations.get(x).is_none());
|
||||
attestations_in_block.retain(|x, _| !self.included_attestations.contains_key(x));
|
||||
self.included_attestations
|
||||
.extend(attestations_in_block.clone());
|
||||
|
||||
@@ -179,8 +179,9 @@ impl<T: EthSpec> PackingEfficiencyHandler<T> {
|
||||
.collect::<Vec<_>>()
|
||||
};
|
||||
|
||||
self.committee_store.previous_epoch_committees =
|
||||
self.committee_store.current_epoch_committees.clone();
|
||||
self.committee_store
|
||||
.previous_epoch_committees
|
||||
.clone_from(&self.committee_store.current_epoch_committees);
|
||||
|
||||
self.committee_store.current_epoch_committees = new_committees;
|
||||
|
||||
|
||||
@@ -525,7 +525,7 @@ where
|
||||
return Err(SubscriptionError::NotAllowed);
|
||||
}
|
||||
|
||||
if self.mesh.get(&topic_hash).is_some() {
|
||||
if self.mesh.contains_key(&topic_hash) {
|
||||
tracing::debug!(%topic, "Topic is already in the mesh");
|
||||
return Ok(false);
|
||||
}
|
||||
@@ -551,7 +551,7 @@ where
|
||||
tracing::debug!(%topic, "Unsubscribing from topic");
|
||||
let topic_hash = topic.hash();
|
||||
|
||||
if self.mesh.get(&topic_hash).is_none() {
|
||||
if !self.mesh.contains_key(&topic_hash) {
|
||||
tracing::debug!(topic=%topic_hash, "Already unsubscribed from topic");
|
||||
// we are not subscribed
|
||||
return Ok(false);
|
||||
|
||||
@@ -22,18 +22,13 @@
|
||||
|
||||
use super::*;
|
||||
use crate::gossipsub::subscription_filter::WhitelistSubscriptionFilter;
|
||||
use crate::gossipsub::transform::{DataTransform, IdentityTransform};
|
||||
use crate::gossipsub::types::{RpcOut, RpcReceiver};
|
||||
use crate::gossipsub::ValidationError;
|
||||
use crate::gossipsub::{
|
||||
config::Config, config::ConfigBuilder, types::Rpc, IdentTopic as Topic, TopicScoreParams,
|
||||
};
|
||||
use crate::gossipsub::types::RpcReceiver;
|
||||
use crate::gossipsub::{config::ConfigBuilder, types::Rpc, IdentTopic as Topic};
|
||||
use async_std::net::Ipv4Addr;
|
||||
use byteorder::{BigEndian, ByteOrder};
|
||||
use libp2p::core::{ConnectedPoint, Endpoint};
|
||||
use libp2p::core::ConnectedPoint;
|
||||
use rand::Rng;
|
||||
use std::thread::sleep;
|
||||
use std::time::Duration;
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
struct InjectNodes<D, F>
|
||||
@@ -427,7 +422,7 @@ fn test_subscribe() {
|
||||
.create_network();
|
||||
|
||||
assert!(
|
||||
gs.mesh.get(&topic_hashes[0]).is_some(),
|
||||
gs.mesh.contains_key(&topic_hashes[0]),
|
||||
"Subscribe should add a new entry to the mesh[topic] hashmap"
|
||||
);
|
||||
|
||||
@@ -477,7 +472,7 @@ fn test_unsubscribe() {
|
||||
"Topic_peers contain a topic entry"
|
||||
);
|
||||
assert!(
|
||||
gs.mesh.get(topic_hash).is_some(),
|
||||
gs.mesh.contains_key(topic_hash),
|
||||
"mesh should contain a topic entry"
|
||||
);
|
||||
}
|
||||
@@ -511,7 +506,7 @@ fn test_unsubscribe() {
|
||||
// check we clean up internal structures
|
||||
for topic_hash in &topic_hashes {
|
||||
assert!(
|
||||
gs.mesh.get(topic_hash).is_none(),
|
||||
!gs.mesh.contains_key(topic_hash),
|
||||
"All topics should have been removed from the mesh"
|
||||
);
|
||||
}
|
||||
@@ -694,7 +689,7 @@ fn test_publish_without_flood_publishing() {
|
||||
.create_network();
|
||||
|
||||
assert!(
|
||||
gs.mesh.get(&topic_hashes[0]).is_some(),
|
||||
gs.mesh.contains_key(&topic_hashes[0]),
|
||||
"Subscribe should add a new entry to the mesh[topic] hashmap"
|
||||
);
|
||||
|
||||
@@ -774,7 +769,7 @@ fn test_fanout() {
|
||||
.create_network();
|
||||
|
||||
assert!(
|
||||
gs.mesh.get(&topic_hashes[0]).is_some(),
|
||||
gs.mesh.contains_key(&topic_hashes[0]),
|
||||
"Subscribe should add a new entry to the mesh[topic] hashmap"
|
||||
);
|
||||
// Unsubscribe from topic
|
||||
@@ -946,7 +941,7 @@ fn test_handle_received_subscriptions() {
|
||||
);
|
||||
|
||||
assert!(
|
||||
gs.connected_peers.get(&unknown_peer).is_none(),
|
||||
!gs.connected_peers.contains_key(&unknown_peer),
|
||||
"Unknown peer should not have been added"
|
||||
);
|
||||
|
||||
@@ -1347,7 +1342,7 @@ fn test_handle_graft_multiple_topics() {
|
||||
}
|
||||
|
||||
assert!(
|
||||
gs.mesh.get(&topic_hashes[2]).is_none(),
|
||||
!gs.mesh.contains_key(&topic_hashes[2]),
|
||||
"Expected the second topic to not be in the mesh"
|
||||
);
|
||||
}
|
||||
@@ -5228,7 +5223,7 @@ fn test_graft_without_subscribe() {
|
||||
.create_network();
|
||||
|
||||
assert!(
|
||||
gs.mesh.get(&topic_hashes[0]).is_some(),
|
||||
gs.mesh.contains_key(&topic_hashes[0]),
|
||||
"Subscribe should add a new entry to the mesh[topic] hashmap"
|
||||
);
|
||||
|
||||
|
||||
@@ -903,10 +903,8 @@ impl std::fmt::Debug for Config {
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::gossipsub::topic::IdentityHash;
|
||||
use crate::gossipsub::types::PeerKind;
|
||||
use crate::gossipsub::Topic;
|
||||
use libp2p::core::UpgradeInfo;
|
||||
use libp2p::swarm::StreamProtocol;
|
||||
use std::collections::hash_map::DefaultHasher;
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
||||
|
||||
@@ -221,9 +221,7 @@ impl MessageCache {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::gossipsub::types::RawMessage;
|
||||
use crate::{IdentTopic as Topic, TopicHash};
|
||||
use libp2p::identity::PeerId;
|
||||
use crate::IdentTopic as Topic;
|
||||
|
||||
fn gen_testm(x: u64, topic: TopicHash) -> (MessageId, RawMessage) {
|
||||
let default_id = |message: &RawMessage| {
|
||||
|
||||
@@ -102,7 +102,7 @@ impl PeerStats {
|
||||
topic_hash: TopicHash,
|
||||
params: &PeerScoreParams,
|
||||
) -> Option<&mut TopicStats> {
|
||||
if params.topics.get(&topic_hash).is_some() {
|
||||
if params.topics.contains_key(&topic_hash) {
|
||||
Some(self.topics.entry(topic_hash).or_default())
|
||||
} else {
|
||||
self.topics.get_mut(&topic_hash)
|
||||
@@ -310,7 +310,7 @@ impl PeerScore {
|
||||
|
||||
// P6: IP collocation factor
|
||||
for ip in peer_stats.known_ips.iter() {
|
||||
if self.params.ip_colocation_factor_whitelist.get(ip).is_some() {
|
||||
if self.params.ip_colocation_factor_whitelist.contains(ip) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -705,7 +705,7 @@ impl PeerScore {
|
||||
) {
|
||||
let record = self.deliveries.entry(msg_id.clone()).or_default();
|
||||
|
||||
if record.peers.get(from).is_some() {
|
||||
if record.peers.contains(from) {
|
||||
// we have already seen this duplicate!
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ use super::ValidationError;
|
||||
use asynchronous_codec::{Decoder, Encoder, Framed};
|
||||
use byteorder::{BigEndian, ByteOrder};
|
||||
use bytes::BytesMut;
|
||||
use futures::future;
|
||||
use futures::prelude::*;
|
||||
use libp2p::core::{InboundUpgrade, OutboundUpgrade, UpgradeInfo};
|
||||
use libp2p::identity::{PeerId, PublicKey};
|
||||
@@ -508,10 +507,8 @@ impl Decoder for GossipsubCodec {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::gossipsub::config::Config;
|
||||
use crate::gossipsub::protocol::{BytesMut, GossipsubCodec, HandlerEvent};
|
||||
use crate::gossipsub::IdentTopic as Topic;
|
||||
use crate::gossipsub::*;
|
||||
use crate::gossipsub::{IdentTopic as Topic, Version};
|
||||
use libp2p::identity::Keypair;
|
||||
use quickcheck::*;
|
||||
|
||||
|
||||
@@ -212,7 +212,6 @@ impl TopicSubscriptionFilter for RegexSubscriptionFilter {
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::gossipsub::types::SubscriptionAction::*;
|
||||
use std::iter::FromIterator;
|
||||
|
||||
#[test]
|
||||
fn test_filter_incoming_allow_all_with_duplicates() {
|
||||
|
||||
@@ -1251,7 +1251,6 @@ impl BannedPeersCount {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use libp2p::core::multiaddr::Protocol;
|
||||
use libp2p::core::Multiaddr;
|
||||
use slog::{o, Drain};
|
||||
use std::net::{Ipv4Addr, Ipv6Addr};
|
||||
use types::MinimalEthSpec;
|
||||
|
||||
@@ -3,7 +3,7 @@ use crate::rpc::{
|
||||
codec::base::OutboundCodec,
|
||||
protocol::{Encoding, ProtocolId, RPCError, SupportedProtocol, ERROR_TYPE_MAX, ERROR_TYPE_MIN},
|
||||
};
|
||||
use crate::rpc::{InboundRequest, OutboundRequest, RPCCodedResponse, RPCResponse};
|
||||
use crate::rpc::{InboundRequest, OutboundRequest};
|
||||
use libp2p::bytes::BytesMut;
|
||||
use snap::read::FrameDecoder;
|
||||
use snap::write::FrameEncoder;
|
||||
@@ -676,22 +676,13 @@ fn context_bytes_to_fork_name(
|
||||
mod tests {
|
||||
|
||||
use super::*;
|
||||
use crate::rpc::{protocol::*, MetaData};
|
||||
use crate::{
|
||||
rpc::{methods::StatusMessage, Ping, RPCResponseErrorCode},
|
||||
types::{EnrAttestationBitfield, EnrSyncCommitteeBitfield},
|
||||
};
|
||||
use std::sync::Arc;
|
||||
use crate::rpc::protocol::*;
|
||||
use crate::types::{EnrAttestationBitfield, EnrSyncCommitteeBitfield};
|
||||
use types::{
|
||||
blob_sidecar::BlobIdentifier, BeaconBlock, BeaconBlockAltair, BeaconBlockBase,
|
||||
BeaconBlockMerge, ChainSpec, EmptyBlock, Epoch, ForkContext, FullPayload, Hash256,
|
||||
Signature, SignedBeaconBlock, Slot,
|
||||
BeaconBlockMerge, EmptyBlock, Epoch, FullPayload, Signature, Slot,
|
||||
};
|
||||
|
||||
use snap::write::FrameEncoder;
|
||||
use ssz::Encode;
|
||||
use std::io::Write;
|
||||
|
||||
type Spec = types::MainnetEthSpec;
|
||||
|
||||
fn fork_context(fork_name: ForkName) -> ForkContext {
|
||||
|
||||
@@ -9,7 +9,7 @@ use crate::rpc::outbound::{OutboundFramed, OutboundRequest};
|
||||
use crate::rpc::protocol::InboundFramed;
|
||||
use fnv::FnvHashMap;
|
||||
use futures::prelude::*;
|
||||
use futures::{Sink, SinkExt};
|
||||
use futures::SinkExt;
|
||||
use libp2p::swarm::handler::{
|
||||
ConnectionEvent, ConnectionHandler, ConnectionHandlerEvent, DialUpgradeError,
|
||||
FullyNegotiatedInbound, FullyNegotiatedOutbound, StreamUpgradeError, SubstreamProtocol,
|
||||
|
||||
@@ -6,6 +6,7 @@ use serde::Serialize;
|
||||
use ssz::Encode;
|
||||
use ssz_derive::{Decode, Encode};
|
||||
use ssz_types::{typenum::U256, VariableList};
|
||||
use std::fmt::Display;
|
||||
use std::marker::PhantomData;
|
||||
use std::ops::Deref;
|
||||
use std::sync::Arc;
|
||||
@@ -44,11 +45,13 @@ impl Deref for ErrorType {
|
||||
}
|
||||
}
|
||||
|
||||
impl ToString for ErrorType {
|
||||
fn to_string(&self) -> String {
|
||||
impl Display for ErrorType {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
#[allow(clippy::invalid_regex)]
|
||||
let re = Regex::new("\\p{C}").expect("Regex is valid");
|
||||
String::from_utf8_lossy(&re.replace_all(self.0.deref(), &b""[..])).to_string()
|
||||
let error_type_str =
|
||||
String::from_utf8_lossy(&re.replace_all(self.0.deref(), &b""[..])).to_string();
|
||||
write!(f, "{}", error_type_str)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -580,7 +583,7 @@ impl<T: EthSpec> std::fmt::Display for RPCCodedResponse<T> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
RPCCodedResponse::Success(res) => write!(f, "{}", res),
|
||||
RPCCodedResponse::Error(code, err) => write!(f, "{}: {}", code, err.to_string()),
|
||||
RPCCodedResponse::Error(code, err) => write!(f, "{}: {}", code, err),
|
||||
RPCCodedResponse::StreamTermination(_) => write!(f, "Stream Termination"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,10 @@ use super::methods::*;
|
||||
use super::protocol::ProtocolId;
|
||||
use super::protocol::SupportedProtocol;
|
||||
use super::RPCError;
|
||||
use crate::rpc::protocol::Encoding;
|
||||
use crate::rpc::{
|
||||
codec::{base::BaseOutboundCodec, ssz_snappy::SSZSnappyOutboundCodec, OutboundCodec},
|
||||
methods::ResponseTermination,
|
||||
use crate::rpc::codec::{
|
||||
base::BaseOutboundCodec, ssz_snappy::SSZSnappyOutboundCodec, OutboundCodec,
|
||||
};
|
||||
use crate::rpc::protocol::Encoding;
|
||||
use futures::future::BoxFuture;
|
||||
use futures::prelude::{AsyncRead, AsyncWrite};
|
||||
use futures::{FutureExt, SinkExt};
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
use super::methods::*;
|
||||
use crate::rpc::{
|
||||
codec::{base::BaseInboundCodec, ssz_snappy::SSZSnappyInboundCodec, InboundCodec},
|
||||
methods::{MaxErrorLen, ResponseTermination, MAX_ERROR_LEN},
|
||||
};
|
||||
use crate::rpc::codec::{base::BaseInboundCodec, ssz_snappy::SSZSnappyInboundCodec, InboundCodec};
|
||||
use futures::future::BoxFuture;
|
||||
use futures::prelude::{AsyncRead, AsyncWrite};
|
||||
use futures::{FutureExt, StreamExt};
|
||||
|
||||
@@ -3,7 +3,6 @@ use crate::rpc::Protocol;
|
||||
use fnv::FnvHashMap;
|
||||
use libp2p::PeerId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::convert::TryInto;
|
||||
use std::future::Future;
|
||||
use std::hash::Hash;
|
||||
use std::pin::Pin;
|
||||
|
||||
@@ -268,8 +268,6 @@ impl futures::stream::Stream for GossipCache {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::types::GossipKind;
|
||||
|
||||
use super::*;
|
||||
use futures::stream::StreamExt;
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ use crate::types::{GossipEncoding, GossipKind, GossipTopic};
|
||||
use crate::TopicHash;
|
||||
use snap::raw::{decompress_len, Decoder, Encoder};
|
||||
use ssz::{Decode, Encode};
|
||||
use std::boxed::Box;
|
||||
use std::io::{Error, ErrorKind};
|
||||
use std::sync::Arc;
|
||||
use types::{
|
||||
|
||||
@@ -6,7 +6,6 @@ use beacon_chain::{BeaconChainError, BeaconChainTypes, HistoricalBlockError, Whe
|
||||
use beacon_processor::SendOnDrop;
|
||||
use itertools::process_results;
|
||||
use lighthouse_network::rpc::methods::{BlobsByRangeRequest, BlobsByRootRequest};
|
||||
use lighthouse_network::rpc::StatusMessage;
|
||||
use lighthouse_network::rpc::*;
|
||||
use lighthouse_network::{PeerId, PeerRequestId, ReportSource, Response, SyncInfo};
|
||||
use slog::{debug, error, warn};
|
||||
|
||||
@@ -60,11 +60,10 @@ impl StoreItem for PersistedDht {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use lighthouse_network::Enr;
|
||||
use sloggers::{null::NullLoggerBuilder, Build};
|
||||
use std::str::FromStr;
|
||||
use store::config::StoreConfig;
|
||||
use store::{HotColdDB, MemoryStore};
|
||||
use store::MemoryStore;
|
||||
use types::{ChainSpec, MinimalEthSpec};
|
||||
#[test]
|
||||
fn test_persisted_dht() {
|
||||
|
||||
@@ -519,7 +519,6 @@ impl slog::Value for SingleLookupRequestState {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::sync::block_lookups::common::LookupType;
|
||||
use crate::sync::block_lookups::common::{Lookup, RequestState};
|
||||
use beacon_chain::builder::Witness;
|
||||
use beacon_chain::eth1_chain::CachingEth1Backend;
|
||||
use sloggers::null::NullLoggerBuilder;
|
||||
@@ -529,7 +528,7 @@ mod tests {
|
||||
use store::{HotColdDB, MemoryStore, StoreConfig};
|
||||
use types::{
|
||||
test_utils::{SeedableRng, TestRandom, XorShiftRng},
|
||||
ChainSpec, EthSpec, MinimalEthSpec as E, SignedBeaconBlock, Slot,
|
||||
ChainSpec, MinimalEthSpec as E, SignedBeaconBlock, Slot,
|
||||
};
|
||||
|
||||
fn rand_block() -> SignedBeaconBlock<E> {
|
||||
|
||||
@@ -1154,9 +1154,7 @@ fn test_same_chain_race_condition() {
|
||||
|
||||
mod deneb_only {
|
||||
use super::*;
|
||||
use crate::sync::block_lookups::common::ResponseType;
|
||||
use beacon_chain::data_availability_checker::AvailabilityCheckError;
|
||||
use beacon_chain::test_utils::NumBlobs;
|
||||
use ssz_types::VariableList;
|
||||
use std::ops::IndexMut;
|
||||
use std::str::FromStr;
|
||||
|
||||
@@ -57,7 +57,6 @@ use lighthouse_network::types::{NetworkGlobals, SyncState};
|
||||
use lighthouse_network::SyncInfo;
|
||||
use lighthouse_network::{PeerAction, PeerId};
|
||||
use slog::{crit, debug, error, info, trace, warn, Logger};
|
||||
use std::boxed::Box;
|
||||
use std::ops::IndexMut;
|
||||
use std::ops::Sub;
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -395,10 +395,9 @@ mod tests {
|
||||
use slog::{o, Drain};
|
||||
use slot_clock::TestingSlotClock;
|
||||
use std::collections::HashSet;
|
||||
use std::sync::Arc;
|
||||
use store::MemoryStore;
|
||||
use tokio::sync::mpsc;
|
||||
use types::{ForkName, Hash256, MinimalEthSpec as E};
|
||||
use types::{ForkName, MinimalEthSpec as E};
|
||||
|
||||
#[derive(Debug)]
|
||||
struct FakeStorage {
|
||||
|
||||
@@ -118,7 +118,6 @@ where
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use std::iter::FromIterator;
|
||||
use std::{collections::HashSet, hash::Hash};
|
||||
|
||||
impl<T> MaxCover for HashSet<T>
|
||||
|
||||
@@ -345,7 +345,9 @@ pub fn get_config<E: EthSpec>(
|
||||
clap_utils::parse_optional(cli_args, "suggested-fee-recipient")?;
|
||||
el_config.jwt_id = clap_utils::parse_optional(cli_args, "execution-jwt-id")?;
|
||||
el_config.jwt_version = clap_utils::parse_optional(cli_args, "execution-jwt-version")?;
|
||||
el_config.default_datadir = client_config.data_dir().clone();
|
||||
el_config
|
||||
.default_datadir
|
||||
.clone_from(client_config.data_dir());
|
||||
let execution_timeout_multiplier =
|
||||
clap_utils::parse_required(cli_args, "execution-timeout-multiplier")?;
|
||||
el_config.execution_timeout_multiplier = Some(execution_timeout_multiplier);
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
use self::UpdatePattern::*;
|
||||
use crate::*;
|
||||
use ssz::{Decode, Encode};
|
||||
use typenum::Unsigned;
|
||||
use types::historical_summary::HistoricalSummary;
|
||||
|
||||
/// Description of how a `BeaconState` field is updated during state processing.
|
||||
|
||||
@@ -33,13 +33,11 @@ use state_processing::{
|
||||
BlockProcessingError, BlockReplayer, SlotProcessingError, StateProcessingStrategy,
|
||||
};
|
||||
use std::cmp::min;
|
||||
use std::convert::TryInto;
|
||||
use std::marker::PhantomData;
|
||||
use std::num::NonZeroUsize;
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use types::blob_sidecar::BlobSidecarList;
|
||||
use types::*;
|
||||
|
||||
/// On-disk database that stores finalized states efficiently.
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
use crate::*;
|
||||
use ssz::{DecodeError, Encode};
|
||||
use ssz_derive::Encode;
|
||||
use std::convert::TryInto;
|
||||
use types::beacon_state::{CloneConfig, CommitteeCache, CACHED_EPOCHS};
|
||||
|
||||
pub fn store_full_state<E: EthSpec>(
|
||||
state_root: &Hash256,
|
||||
|
||||
@@ -381,7 +381,6 @@ fn slot_of_prev_restore_point<E: EthSpec>(current_slot: Slot) -> Slot {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::HotColdDB;
|
||||
use crate::StoreConfig as Config;
|
||||
use beacon_chain::test_utils::BeaconChainHarness;
|
||||
use beacon_chain::types::{ChainSpec, MainnetEthSpec};
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use super::*;
|
||||
use crate::hot_cold_store::HotColdDBError;
|
||||
use crate::metrics;
|
||||
use leveldb::compaction::Compaction;
|
||||
use leveldb::database::batch::{Batch, Writebatch};
|
||||
use leveldb::database::kv::KV;
|
||||
@@ -8,7 +7,7 @@ use leveldb::database::Database;
|
||||
use leveldb::error::Error as LevelDBError;
|
||||
use leveldb::iterator::{Iterable, KeyIterator, LevelDBIterator};
|
||||
use leveldb::options::{Options, ReadOptions, WriteOptions};
|
||||
use parking_lot::{Mutex, MutexGuard};
|
||||
use parking_lot::Mutex;
|
||||
use std::marker::PhantomData;
|
||||
use std::path::Path;
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ use crate::chunked_vector::{
|
||||
use crate::{get_key_for_col, DBColumn, Error, KeyValueStore, KeyValueStoreOp};
|
||||
use ssz::{Decode, DecodeError, Encode};
|
||||
use ssz_derive::{Decode, Encode};
|
||||
use std::convert::TryInto;
|
||||
use std::sync::Arc;
|
||||
use types::historical_summary::HistoricalSummary;
|
||||
use types::superstruct;
|
||||
|
||||
Reference in New Issue
Block a user