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:
parent
4449627c7c
commit
01ec42e75a
@ -72,7 +72,7 @@ use crate::{
|
|||||||
kzg_utils, metrics, AvailabilityPendingExecutedBlock, BeaconChainError, BeaconForkChoiceStore,
|
kzg_utils, metrics, AvailabilityPendingExecutedBlock, BeaconChainError, BeaconForkChoiceStore,
|
||||||
BeaconSnapshot, CachedHead,
|
BeaconSnapshot, CachedHead,
|
||||||
};
|
};
|
||||||
use eth2::types::{EventKind, SseBlobSidecar, SseBlock, SseExtendedPayloadAttributes, SyncDuty};
|
use eth2::types::{EventKind, SseBlobSidecar, SseBlock, SseExtendedPayloadAttributes};
|
||||||
use execution_layer::{
|
use execution_layer::{
|
||||||
BlockProposalContents, BlockProposalContentsType, BuilderParams, ChainHealth, ExecutionLayer,
|
BlockProposalContents, BlockProposalContentsType, BuilderParams, ChainHealth, ExecutionLayer,
|
||||||
FailedCondition, PayloadAttributes, PayloadStatus,
|
FailedCondition, PayloadAttributes, PayloadStatus,
|
||||||
@ -120,8 +120,7 @@ use store::{
|
|||||||
use task_executor::{ShutdownReason, TaskExecutor};
|
use task_executor::{ShutdownReason, TaskExecutor};
|
||||||
use tokio_stream::Stream;
|
use tokio_stream::Stream;
|
||||||
use tree_hash::TreeHash;
|
use tree_hash::TreeHash;
|
||||||
use types::beacon_state::CloneConfig;
|
use types::blob_sidecar::FixedBlobSidecarList;
|
||||||
use types::blob_sidecar::{BlobSidecarList, FixedBlobSidecarList};
|
|
||||||
use types::payload::BlockProductionVersion;
|
use types::payload::BlockProductionVersion;
|
||||||
use types::*;
|
use types::*;
|
||||||
|
|
||||||
|
@ -780,7 +780,7 @@ mod test {
|
|||||||
use store::{HotColdDB, ItemStore, LevelDB, StoreConfig};
|
use store::{HotColdDB, ItemStore, LevelDB, StoreConfig};
|
||||||
use tempfile::{tempdir, TempDir};
|
use tempfile::{tempdir, TempDir};
|
||||||
use types::non_zero_usize::new_non_zero_usize;
|
use types::non_zero_usize::new_non_zero_usize;
|
||||||
use types::{ChainSpec, ExecPayload, MinimalEthSpec};
|
use types::{ExecPayload, MinimalEthSpec};
|
||||||
|
|
||||||
const LOW_VALIDATOR_COUNT: usize = 32;
|
const LOW_VALIDATOR_COUNT: usize = 32;
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ use crate::{
|
|||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use proto_array::Block as ProtoBlock;
|
use proto_array::Block as ProtoBlock;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use types::blob_sidecar::BlobSidecarList;
|
|
||||||
use types::*;
|
use types::*;
|
||||||
|
|
||||||
pub struct CacheItem<E: EthSpec> {
|
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 state_processing::per_block_processing::get_new_eth1_data;
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::iter::DoubleEndedIterator;
|
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
use std::time::{SystemTime, UNIX_EPOCH};
|
||||||
use store::{DBColumn, Error as StoreError, StoreItem};
|
use store::{DBColumn, Error as StoreError, StoreItem};
|
||||||
@ -736,7 +735,7 @@ mod test {
|
|||||||
mod eth1_chain_json_backend {
|
mod eth1_chain_json_backend {
|
||||||
use super::*;
|
use super::*;
|
||||||
use eth1::DepositLog;
|
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> {
|
fn get_eth1_chain() -> Eth1Chain<CachingEth1Backend<E>, E> {
|
||||||
let eth1_config = Eth1Config {
|
let eth1_config = Eth1Config {
|
||||||
|
@ -111,7 +111,7 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use bls::Hash256;
|
use bls::Hash256;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use types::{BlobSidecar, MainnetEthSpec};
|
use types::MainnetEthSpec;
|
||||||
|
|
||||||
type E = MainnetEthSpec;
|
type E = MainnetEthSpec;
|
||||||
|
|
||||||
|
@ -367,10 +367,7 @@ impl<T: EthSpec> SnapshotCache<T> {
|
|||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test_utils::{BeaconChainHarness, EphemeralHarnessType};
|
use crate::test_utils::{BeaconChainHarness, EphemeralHarnessType};
|
||||||
use types::{
|
use types::{test_utils::generate_deterministic_keypair, BeaconBlock, MainnetEthSpec};
|
||||||
test_utils::generate_deterministic_keypair, BeaconBlock, Epoch, MainnetEthSpec,
|
|
||||||
SignedBeaconBlock, Slot,
|
|
||||||
};
|
|
||||||
|
|
||||||
fn get_harness() -> BeaconChainHarness<EphemeralHarnessType<MainnetEthSpec>> {
|
fn get_harness() -> BeaconChainHarness<EphemeralHarnessType<MainnetEthSpec>> {
|
||||||
let harness = BeaconChainHarness::builder(MainnetEthSpec)
|
let harness = BeaconChainHarness::builder(MainnetEthSpec)
|
||||||
|
@ -61,7 +61,6 @@ use task_executor::TaskExecutor;
|
|||||||
use task_executor::{test_utils::TestRuntime, ShutdownReason};
|
use task_executor::{test_utils::TestRuntime, ShutdownReason};
|
||||||
use tree_hash::TreeHash;
|
use tree_hash::TreeHash;
|
||||||
use types::payload::BlockProductionVersion;
|
use types::payload::BlockProductionVersion;
|
||||||
use types::sync_selection_proof::SyncSelectionProof;
|
|
||||||
pub use types::test_utils::generate_deterministic_keypairs;
|
pub use types::test_utils::generate_deterministic_keypairs;
|
||||||
use types::test_utils::TestRandom;
|
use types::test_utils::TestRandom;
|
||||||
use types::{typenum::U4294967296, *};
|
use types::{typenum::U4294967296, *};
|
||||||
|
@ -15,7 +15,6 @@ use state_processing::per_epoch_processing::{
|
|||||||
errors::EpochProcessingError, EpochProcessingSummary,
|
errors::EpochProcessingError, EpochProcessingSummary,
|
||||||
};
|
};
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
use std::convert::TryFrom;
|
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::str::Utf8Error;
|
use std::str::Utf8Error;
|
||||||
|
@ -2,7 +2,6 @@ use crate::errors::BeaconChainError;
|
|||||||
use crate::{BeaconChainTypes, BeaconStore};
|
use crate::{BeaconChainTypes, BeaconStore};
|
||||||
use ssz::{Decode, Encode};
|
use ssz::{Decode, Encode};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::convert::TryInto;
|
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use store::{DBColumn, Error as StoreError, StoreItem, StoreOp};
|
use store::{DBColumn, Error as StoreError, StoreItem, StoreOp};
|
||||||
use types::{BeaconState, Hash256, PublicKey, PublicKeyBytes};
|
use types::{BeaconState, Hash256, PublicKey, PublicKeyBytes};
|
||||||
@ -195,7 +194,7 @@ mod test {
|
|||||||
use logging::test_logger;
|
use logging::test_logger;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use store::HotColdDB;
|
use store::HotColdDB;
|
||||||
use types::{BeaconState, EthSpec, Keypair, MainnetEthSpec};
|
use types::{EthSpec, Keypair, MainnetEthSpec};
|
||||||
|
|
||||||
type E = MainnetEthSpec;
|
type E = MainnetEthSpec;
|
||||||
type T = EphemeralHarnessType<E>;
|
type T = EphemeralHarnessType<E>;
|
||||||
|
@ -964,7 +964,6 @@ impl<S: SlotClock> ReprocessQueue<S> {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use slot_clock::TestingSlotClock;
|
use slot_clock::TestingSlotClock;
|
||||||
use types::Slot;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn backfill_processing_schedule_calculation() {
|
fn backfill_processing_schedule_calculation() {
|
||||||
|
@ -118,7 +118,7 @@ impl Default for Config {
|
|||||||
impl Config {
|
impl Config {
|
||||||
/// Updates the data directory for the Client.
|
/// Updates the data directory for the Client.
|
||||||
pub fn set_data_dir(&mut self, data_dir: PathBuf) {
|
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;
|
self.http_api.data_dir = data_dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +196,6 @@ impl BlockCache {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use types::Hash256;
|
|
||||||
|
|
||||||
fn get_block(i: u64, interval_secs: u64) -> Eth1Block {
|
fn get_block(i: u64, interval_secs: u64) -> Eth1Block {
|
||||||
Eth1Block {
|
Eth1Block {
|
||||||
|
@ -99,7 +99,6 @@ async fn new_anvil_instance() -> Result<AnvilEth1Instance, String> {
|
|||||||
|
|
||||||
mod eth1_cache {
|
mod eth1_cache {
|
||||||
use super::*;
|
use super::*;
|
||||||
use types::{EthSpec, MainnetEthSpec};
|
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn simple_scenario() {
|
async fn simple_scenario() {
|
||||||
|
@ -17,7 +17,6 @@ pub use json_structures::{JsonWithdrawal, TransitionConfigurationV1};
|
|||||||
use pretty_reqwest_error::PrettyReqwestError;
|
use pretty_reqwest_error::PrettyReqwestError;
|
||||||
use reqwest::StatusCode;
|
use reqwest::StatusCode;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::convert::TryFrom;
|
|
||||||
use strum::IntoStaticStr;
|
use strum::IntoStaticStr;
|
||||||
use superstruct::superstruct;
|
use superstruct::superstruct;
|
||||||
pub use types::{
|
pub use types::{
|
||||||
|
@ -11,7 +11,6 @@ use std::collections::HashSet;
|
|||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
|
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
use types::EthSpec;
|
|
||||||
|
|
||||||
pub use deposit_log::{DepositLog, Log};
|
pub use deposit_log::{DepositLog, Log};
|
||||||
pub use reqwest::Client;
|
pub use reqwest::Client;
|
||||||
@ -1191,7 +1190,7 @@ mod test {
|
|||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use types::{ExecutionPayloadMerge, MainnetEthSpec, Transactions, Unsigned, VariableList};
|
use types::{MainnetEthSpec, Unsigned};
|
||||||
|
|
||||||
struct Tester {
|
struct Tester {
|
||||||
server: MockServer<MainnetEthSpec>,
|
server: MockServer<MainnetEthSpec>,
|
||||||
|
@ -4,10 +4,7 @@ use strum::EnumString;
|
|||||||
use superstruct::superstruct;
|
use superstruct::superstruct;
|
||||||
use types::beacon_block_body::KzgCommitments;
|
use types::beacon_block_body::KzgCommitments;
|
||||||
use types::blob_sidecar::BlobsList;
|
use types::blob_sidecar::BlobsList;
|
||||||
use types::{
|
use types::{FixedVector, Unsigned};
|
||||||
EthSpec, ExecutionBlockHash, ExecutionPayload, ExecutionPayloadCapella, ExecutionPayloadDeneb,
|
|
||||||
ExecutionPayloadMerge, FixedVector, Transactions, Unsigned, VariableList, Withdrawal,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[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::{de::DeserializeOwned, Deserialize};
|
||||||
use serde_json::Value as JsonValue;
|
use serde_json::Value as JsonValue;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use types::{EthSpec, ForkName};
|
|
||||||
|
|
||||||
pub const GENERIC_ERROR_CODE: i64 = -1234;
|
pub const GENERIC_ERROR_CODE: i64 = -1234;
|
||||||
pub const BAD_PARAMS_ERROR_CODE: i64 = -32602;
|
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 set_withdrawals_root(&mut self, withdrawals_root: Hash256);
|
||||||
|
|
||||||
fn sign_builder_message(&mut self, sk: &SecretKey, spec: &ChainSpec) -> Signature;
|
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> {
|
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);
|
let message = self.signing_root(domain);
|
||||||
sk.sign(message)
|
sk.sign(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn to_signed_bid(self, signature: Signature) -> SignedBuilderBid<E> {
|
|
||||||
SignedBuilderBid {
|
|
||||||
message: self,
|
|
||||||
signature,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
@ -2,14 +2,12 @@ use crate::{
|
|||||||
test_utils::{
|
test_utils::{
|
||||||
MockServer, DEFAULT_JWT_SECRET, DEFAULT_TERMINAL_BLOCK, DEFAULT_TERMINAL_DIFFICULTY,
|
MockServer, DEFAULT_JWT_SECRET, DEFAULT_TERMINAL_BLOCK, DEFAULT_TERMINAL_DIFFICULTY,
|
||||||
},
|
},
|
||||||
Config, *,
|
*,
|
||||||
};
|
};
|
||||||
use keccak_hash::H256;
|
use keccak_hash::H256;
|
||||||
use kzg::Kzg;
|
use kzg::Kzg;
|
||||||
use sensitive_url::SensitiveUrl;
|
|
||||||
use task_executor::TaskExecutor;
|
|
||||||
use tempfile::NamedTempFile;
|
use tempfile::NamedTempFile;
|
||||||
use types::{Address, ChainSpec, Epoch, EthSpec, Hash256, MainnetEthSpec};
|
use types::MainnetEthSpec;
|
||||||
|
|
||||||
pub struct MockExecutionLayer<T: EthSpec> {
|
pub struct MockExecutionLayer<T: EthSpec> {
|
||||||
pub server: MockServer<T>,
|
pub server: MockServer<T>,
|
||||||
|
@ -137,7 +137,7 @@ pub fn interop_genesis_state_with_withdrawal_credentials<T: EthSpec>(
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use types::{test_utils::generate_deterministic_keypairs, EthSpec, MinimalEthSpec};
|
use types::{test_utils::generate_deterministic_keypairs, MinimalEthSpec};
|
||||||
|
|
||||||
type TestEthSpec = MinimalEthSpec;
|
type TestEthSpec = MinimalEthSpec;
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ impl<T: EthSpec> PackingEfficiencyHandler<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove duplicate attestations as these yield no reward.
|
// 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
|
self.included_attestations
|
||||||
.extend(attestations_in_block.clone());
|
.extend(attestations_in_block.clone());
|
||||||
|
|
||||||
@ -179,8 +179,9 @@ impl<T: EthSpec> PackingEfficiencyHandler<T> {
|
|||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
};
|
};
|
||||||
|
|
||||||
self.committee_store.previous_epoch_committees =
|
self.committee_store
|
||||||
self.committee_store.current_epoch_committees.clone();
|
.previous_epoch_committees
|
||||||
|
.clone_from(&self.committee_store.current_epoch_committees);
|
||||||
|
|
||||||
self.committee_store.current_epoch_committees = new_committees;
|
self.committee_store.current_epoch_committees = new_committees;
|
||||||
|
|
||||||
|
@ -525,7 +525,7 @@ where
|
|||||||
return Err(SubscriptionError::NotAllowed);
|
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");
|
tracing::debug!(%topic, "Topic is already in the mesh");
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
}
|
}
|
||||||
@ -551,7 +551,7 @@ where
|
|||||||
tracing::debug!(%topic, "Unsubscribing from topic");
|
tracing::debug!(%topic, "Unsubscribing from topic");
|
||||||
let topic_hash = topic.hash();
|
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");
|
tracing::debug!(topic=%topic_hash, "Already unsubscribed from topic");
|
||||||
// we are not subscribed
|
// we are not subscribed
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
|
@ -22,18 +22,13 @@
|
|||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::gossipsub::subscription_filter::WhitelistSubscriptionFilter;
|
use crate::gossipsub::subscription_filter::WhitelistSubscriptionFilter;
|
||||||
use crate::gossipsub::transform::{DataTransform, IdentityTransform};
|
use crate::gossipsub::types::RpcReceiver;
|
||||||
use crate::gossipsub::types::{RpcOut, RpcReceiver};
|
use crate::gossipsub::{config::ConfigBuilder, types::Rpc, IdentTopic as Topic};
|
||||||
use crate::gossipsub::ValidationError;
|
|
||||||
use crate::gossipsub::{
|
|
||||||
config::Config, config::ConfigBuilder, types::Rpc, IdentTopic as Topic, TopicScoreParams,
|
|
||||||
};
|
|
||||||
use async_std::net::Ipv4Addr;
|
use async_std::net::Ipv4Addr;
|
||||||
use byteorder::{BigEndian, ByteOrder};
|
use byteorder::{BigEndian, ByteOrder};
|
||||||
use libp2p::core::{ConnectedPoint, Endpoint};
|
use libp2p::core::ConnectedPoint;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use std::thread::sleep;
|
use std::thread::sleep;
|
||||||
use std::time::Duration;
|
|
||||||
|
|
||||||
#[derive(Default, Debug)]
|
#[derive(Default, Debug)]
|
||||||
struct InjectNodes<D, F>
|
struct InjectNodes<D, F>
|
||||||
@ -427,7 +422,7 @@ fn test_subscribe() {
|
|||||||
.create_network();
|
.create_network();
|
||||||
|
|
||||||
assert!(
|
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"
|
"Subscribe should add a new entry to the mesh[topic] hashmap"
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -477,7 +472,7 @@ fn test_unsubscribe() {
|
|||||||
"Topic_peers contain a topic entry"
|
"Topic_peers contain a topic entry"
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
gs.mesh.get(topic_hash).is_some(),
|
gs.mesh.contains_key(topic_hash),
|
||||||
"mesh should contain a topic entry"
|
"mesh should contain a topic entry"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -511,7 +506,7 @@ fn test_unsubscribe() {
|
|||||||
// check we clean up internal structures
|
// check we clean up internal structures
|
||||||
for topic_hash in &topic_hashes {
|
for topic_hash in &topic_hashes {
|
||||||
assert!(
|
assert!(
|
||||||
gs.mesh.get(topic_hash).is_none(),
|
!gs.mesh.contains_key(topic_hash),
|
||||||
"All topics should have been removed from the mesh"
|
"All topics should have been removed from the mesh"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -694,7 +689,7 @@ fn test_publish_without_flood_publishing() {
|
|||||||
.create_network();
|
.create_network();
|
||||||
|
|
||||||
assert!(
|
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"
|
"Subscribe should add a new entry to the mesh[topic] hashmap"
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -774,7 +769,7 @@ fn test_fanout() {
|
|||||||
.create_network();
|
.create_network();
|
||||||
|
|
||||||
assert!(
|
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"
|
"Subscribe should add a new entry to the mesh[topic] hashmap"
|
||||||
);
|
);
|
||||||
// Unsubscribe from topic
|
// Unsubscribe from topic
|
||||||
@ -946,7 +941,7 @@ fn test_handle_received_subscriptions() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
assert!(
|
assert!(
|
||||||
gs.connected_peers.get(&unknown_peer).is_none(),
|
!gs.connected_peers.contains_key(&unknown_peer),
|
||||||
"Unknown peer should not have been added"
|
"Unknown peer should not have been added"
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1347,7 +1342,7 @@ fn test_handle_graft_multiple_topics() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert!(
|
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"
|
"Expected the second topic to not be in the mesh"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -5228,7 +5223,7 @@ fn test_graft_without_subscribe() {
|
|||||||
.create_network();
|
.create_network();
|
||||||
|
|
||||||
assert!(
|
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"
|
"Subscribe should add a new entry to the mesh[topic] hashmap"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -903,10 +903,8 @@ impl std::fmt::Debug for Config {
|
|||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::gossipsub::topic::IdentityHash;
|
use crate::gossipsub::topic::IdentityHash;
|
||||||
use crate::gossipsub::types::PeerKind;
|
|
||||||
use crate::gossipsub::Topic;
|
use crate::gossipsub::Topic;
|
||||||
use libp2p::core::UpgradeInfo;
|
use libp2p::core::UpgradeInfo;
|
||||||
use libp2p::swarm::StreamProtocol;
|
|
||||||
use std::collections::hash_map::DefaultHasher;
|
use std::collections::hash_map::DefaultHasher;
|
||||||
use std::hash::{Hash, Hasher};
|
use std::hash::{Hash, Hasher};
|
||||||
|
|
||||||
|
@ -221,9 +221,7 @@ impl MessageCache {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::gossipsub::types::RawMessage;
|
use crate::IdentTopic as Topic;
|
||||||
use crate::{IdentTopic as Topic, TopicHash};
|
|
||||||
use libp2p::identity::PeerId;
|
|
||||||
|
|
||||||
fn gen_testm(x: u64, topic: TopicHash) -> (MessageId, RawMessage) {
|
fn gen_testm(x: u64, topic: TopicHash) -> (MessageId, RawMessage) {
|
||||||
let default_id = |message: &RawMessage| {
|
let default_id = |message: &RawMessage| {
|
||||||
|
@ -102,7 +102,7 @@ impl PeerStats {
|
|||||||
topic_hash: TopicHash,
|
topic_hash: TopicHash,
|
||||||
params: &PeerScoreParams,
|
params: &PeerScoreParams,
|
||||||
) -> Option<&mut TopicStats> {
|
) -> 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())
|
Some(self.topics.entry(topic_hash).or_default())
|
||||||
} else {
|
} else {
|
||||||
self.topics.get_mut(&topic_hash)
|
self.topics.get_mut(&topic_hash)
|
||||||
@ -310,7 +310,7 @@ impl PeerScore {
|
|||||||
|
|
||||||
// P6: IP collocation factor
|
// P6: IP collocation factor
|
||||||
for ip in peer_stats.known_ips.iter() {
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -705,7 +705,7 @@ impl PeerScore {
|
|||||||
) {
|
) {
|
||||||
let record = self.deliveries.entry(msg_id.clone()).or_default();
|
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!
|
// we have already seen this duplicate!
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,6 @@ use super::ValidationError;
|
|||||||
use asynchronous_codec::{Decoder, Encoder, Framed};
|
use asynchronous_codec::{Decoder, Encoder, Framed};
|
||||||
use byteorder::{BigEndian, ByteOrder};
|
use byteorder::{BigEndian, ByteOrder};
|
||||||
use bytes::BytesMut;
|
use bytes::BytesMut;
|
||||||
use futures::future;
|
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
use libp2p::core::{InboundUpgrade, OutboundUpgrade, UpgradeInfo};
|
use libp2p::core::{InboundUpgrade, OutboundUpgrade, UpgradeInfo};
|
||||||
use libp2p::identity::{PeerId, PublicKey};
|
use libp2p::identity::{PeerId, PublicKey};
|
||||||
@ -508,10 +507,8 @@ impl Decoder for GossipsubCodec {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::gossipsub::config::Config;
|
use crate::gossipsub::IdentTopic as Topic;
|
||||||
use crate::gossipsub::protocol::{BytesMut, GossipsubCodec, HandlerEvent};
|
|
||||||
use crate::gossipsub::*;
|
use crate::gossipsub::*;
|
||||||
use crate::gossipsub::{IdentTopic as Topic, Version};
|
|
||||||
use libp2p::identity::Keypair;
|
use libp2p::identity::Keypair;
|
||||||
use quickcheck::*;
|
use quickcheck::*;
|
||||||
|
|
||||||
|
@ -212,7 +212,6 @@ impl TopicSubscriptionFilter for RegexSubscriptionFilter {
|
|||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::gossipsub::types::SubscriptionAction::*;
|
use crate::gossipsub::types::SubscriptionAction::*;
|
||||||
use std::iter::FromIterator;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_filter_incoming_allow_all_with_duplicates() {
|
fn test_filter_incoming_allow_all_with_duplicates() {
|
||||||
|
@ -1251,7 +1251,6 @@ impl BannedPeersCount {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use libp2p::core::multiaddr::Protocol;
|
use libp2p::core::multiaddr::Protocol;
|
||||||
use libp2p::core::Multiaddr;
|
|
||||||
use slog::{o, Drain};
|
use slog::{o, Drain};
|
||||||
use std::net::{Ipv4Addr, Ipv6Addr};
|
use std::net::{Ipv4Addr, Ipv6Addr};
|
||||||
use types::MinimalEthSpec;
|
use types::MinimalEthSpec;
|
||||||
|
@ -3,7 +3,7 @@ use crate::rpc::{
|
|||||||
codec::base::OutboundCodec,
|
codec::base::OutboundCodec,
|
||||||
protocol::{Encoding, ProtocolId, RPCError, SupportedProtocol, ERROR_TYPE_MAX, ERROR_TYPE_MIN},
|
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 libp2p::bytes::BytesMut;
|
||||||
use snap::read::FrameDecoder;
|
use snap::read::FrameDecoder;
|
||||||
use snap::write::FrameEncoder;
|
use snap::write::FrameEncoder;
|
||||||
@ -676,22 +676,13 @@ fn context_bytes_to_fork_name(
|
|||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::rpc::{protocol::*, MetaData};
|
use crate::rpc::protocol::*;
|
||||||
use crate::{
|
use crate::types::{EnrAttestationBitfield, EnrSyncCommitteeBitfield};
|
||||||
rpc::{methods::StatusMessage, Ping, RPCResponseErrorCode},
|
|
||||||
types::{EnrAttestationBitfield, EnrSyncCommitteeBitfield},
|
|
||||||
};
|
|
||||||
use std::sync::Arc;
|
|
||||||
use types::{
|
use types::{
|
||||||
blob_sidecar::BlobIdentifier, BeaconBlock, BeaconBlockAltair, BeaconBlockBase,
|
blob_sidecar::BlobIdentifier, BeaconBlock, BeaconBlockAltair, BeaconBlockBase,
|
||||||
BeaconBlockMerge, ChainSpec, EmptyBlock, Epoch, ForkContext, FullPayload, Hash256,
|
BeaconBlockMerge, EmptyBlock, Epoch, FullPayload, Signature, Slot,
|
||||||
Signature, SignedBeaconBlock, Slot,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use snap::write::FrameEncoder;
|
|
||||||
use ssz::Encode;
|
|
||||||
use std::io::Write;
|
|
||||||
|
|
||||||
type Spec = types::MainnetEthSpec;
|
type Spec = types::MainnetEthSpec;
|
||||||
|
|
||||||
fn fork_context(fork_name: ForkName) -> ForkContext {
|
fn fork_context(fork_name: ForkName) -> ForkContext {
|
||||||
|
@ -9,7 +9,7 @@ use crate::rpc::outbound::{OutboundFramed, OutboundRequest};
|
|||||||
use crate::rpc::protocol::InboundFramed;
|
use crate::rpc::protocol::InboundFramed;
|
||||||
use fnv::FnvHashMap;
|
use fnv::FnvHashMap;
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
use futures::{Sink, SinkExt};
|
use futures::SinkExt;
|
||||||
use libp2p::swarm::handler::{
|
use libp2p::swarm::handler::{
|
||||||
ConnectionEvent, ConnectionHandler, ConnectionHandlerEvent, DialUpgradeError,
|
ConnectionEvent, ConnectionHandler, ConnectionHandlerEvent, DialUpgradeError,
|
||||||
FullyNegotiatedInbound, FullyNegotiatedOutbound, StreamUpgradeError, SubstreamProtocol,
|
FullyNegotiatedInbound, FullyNegotiatedOutbound, StreamUpgradeError, SubstreamProtocol,
|
||||||
|
@ -6,6 +6,7 @@ use serde::Serialize;
|
|||||||
use ssz::Encode;
|
use ssz::Encode;
|
||||||
use ssz_derive::{Decode, Encode};
|
use ssz_derive::{Decode, Encode};
|
||||||
use ssz_types::{typenum::U256, VariableList};
|
use ssz_types::{typenum::U256, VariableList};
|
||||||
|
use std::fmt::Display;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
@ -44,11 +45,13 @@ impl Deref for ErrorType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToString for ErrorType {
|
impl Display for ErrorType {
|
||||||
fn to_string(&self) -> String {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
#[allow(clippy::invalid_regex)]
|
#[allow(clippy::invalid_regex)]
|
||||||
let re = Regex::new("\\p{C}").expect("Regex is valid");
|
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 {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
RPCCodedResponse::Success(res) => write!(f, "{}", res),
|
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"),
|
RPCCodedResponse::StreamTermination(_) => write!(f, "Stream Termination"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,10 @@ use super::methods::*;
|
|||||||
use super::protocol::ProtocolId;
|
use super::protocol::ProtocolId;
|
||||||
use super::protocol::SupportedProtocol;
|
use super::protocol::SupportedProtocol;
|
||||||
use super::RPCError;
|
use super::RPCError;
|
||||||
use crate::rpc::protocol::Encoding;
|
use crate::rpc::codec::{
|
||||||
use crate::rpc::{
|
base::BaseOutboundCodec, ssz_snappy::SSZSnappyOutboundCodec, OutboundCodec,
|
||||||
codec::{base::BaseOutboundCodec, ssz_snappy::SSZSnappyOutboundCodec, OutboundCodec},
|
|
||||||
methods::ResponseTermination,
|
|
||||||
};
|
};
|
||||||
|
use crate::rpc::protocol::Encoding;
|
||||||
use futures::future::BoxFuture;
|
use futures::future::BoxFuture;
|
||||||
use futures::prelude::{AsyncRead, AsyncWrite};
|
use futures::prelude::{AsyncRead, AsyncWrite};
|
||||||
use futures::{FutureExt, SinkExt};
|
use futures::{FutureExt, SinkExt};
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
use super::methods::*;
|
use super::methods::*;
|
||||||
use crate::rpc::{
|
use crate::rpc::codec::{base::BaseInboundCodec, ssz_snappy::SSZSnappyInboundCodec, InboundCodec};
|
||||||
codec::{base::BaseInboundCodec, ssz_snappy::SSZSnappyInboundCodec, InboundCodec},
|
|
||||||
methods::{MaxErrorLen, ResponseTermination, MAX_ERROR_LEN},
|
|
||||||
};
|
|
||||||
use futures::future::BoxFuture;
|
use futures::future::BoxFuture;
|
||||||
use futures::prelude::{AsyncRead, AsyncWrite};
|
use futures::prelude::{AsyncRead, AsyncWrite};
|
||||||
use futures::{FutureExt, StreamExt};
|
use futures::{FutureExt, StreamExt};
|
||||||
|
@ -3,7 +3,6 @@ use crate::rpc::Protocol;
|
|||||||
use fnv::FnvHashMap;
|
use fnv::FnvHashMap;
|
||||||
use libp2p::PeerId;
|
use libp2p::PeerId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::convert::TryInto;
|
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
|
@ -268,8 +268,6 @@ impl futures::stream::Stream for GossipCache {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::types::GossipKind;
|
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use futures::stream::StreamExt;
|
use futures::stream::StreamExt;
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ use crate::types::{GossipEncoding, GossipKind, GossipTopic};
|
|||||||
use crate::TopicHash;
|
use crate::TopicHash;
|
||||||
use snap::raw::{decompress_len, Decoder, Encoder};
|
use snap::raw::{decompress_len, Decoder, Encoder};
|
||||||
use ssz::{Decode, Encode};
|
use ssz::{Decode, Encode};
|
||||||
use std::boxed::Box;
|
|
||||||
use std::io::{Error, ErrorKind};
|
use std::io::{Error, ErrorKind};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use types::{
|
use types::{
|
||||||
|
@ -6,7 +6,6 @@ use beacon_chain::{BeaconChainError, BeaconChainTypes, HistoricalBlockError, Whe
|
|||||||
use beacon_processor::SendOnDrop;
|
use beacon_processor::SendOnDrop;
|
||||||
use itertools::process_results;
|
use itertools::process_results;
|
||||||
use lighthouse_network::rpc::methods::{BlobsByRangeRequest, BlobsByRootRequest};
|
use lighthouse_network::rpc::methods::{BlobsByRangeRequest, BlobsByRootRequest};
|
||||||
use lighthouse_network::rpc::StatusMessage;
|
|
||||||
use lighthouse_network::rpc::*;
|
use lighthouse_network::rpc::*;
|
||||||
use lighthouse_network::{PeerId, PeerRequestId, ReportSource, Response, SyncInfo};
|
use lighthouse_network::{PeerId, PeerRequestId, ReportSource, Response, SyncInfo};
|
||||||
use slog::{debug, error, warn};
|
use slog::{debug, error, warn};
|
||||||
|
@ -60,11 +60,10 @@ impl StoreItem for PersistedDht {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use lighthouse_network::Enr;
|
|
||||||
use sloggers::{null::NullLoggerBuilder, Build};
|
use sloggers::{null::NullLoggerBuilder, Build};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use store::config::StoreConfig;
|
use store::config::StoreConfig;
|
||||||
use store::{HotColdDB, MemoryStore};
|
use store::MemoryStore;
|
||||||
use types::{ChainSpec, MinimalEthSpec};
|
use types::{ChainSpec, MinimalEthSpec};
|
||||||
#[test]
|
#[test]
|
||||||
fn test_persisted_dht() {
|
fn test_persisted_dht() {
|
||||||
|
@ -519,7 +519,6 @@ impl slog::Value for SingleLookupRequestState {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::sync::block_lookups::common::LookupType;
|
use crate::sync::block_lookups::common::LookupType;
|
||||||
use crate::sync::block_lookups::common::{Lookup, RequestState};
|
|
||||||
use beacon_chain::builder::Witness;
|
use beacon_chain::builder::Witness;
|
||||||
use beacon_chain::eth1_chain::CachingEth1Backend;
|
use beacon_chain::eth1_chain::CachingEth1Backend;
|
||||||
use sloggers::null::NullLoggerBuilder;
|
use sloggers::null::NullLoggerBuilder;
|
||||||
@ -529,7 +528,7 @@ mod tests {
|
|||||||
use store::{HotColdDB, MemoryStore, StoreConfig};
|
use store::{HotColdDB, MemoryStore, StoreConfig};
|
||||||
use types::{
|
use types::{
|
||||||
test_utils::{SeedableRng, TestRandom, XorShiftRng},
|
test_utils::{SeedableRng, TestRandom, XorShiftRng},
|
||||||
ChainSpec, EthSpec, MinimalEthSpec as E, SignedBeaconBlock, Slot,
|
ChainSpec, MinimalEthSpec as E, SignedBeaconBlock, Slot,
|
||||||
};
|
};
|
||||||
|
|
||||||
fn rand_block() -> SignedBeaconBlock<E> {
|
fn rand_block() -> SignedBeaconBlock<E> {
|
||||||
|
@ -1154,9 +1154,7 @@ fn test_same_chain_race_condition() {
|
|||||||
|
|
||||||
mod deneb_only {
|
mod deneb_only {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::sync::block_lookups::common::ResponseType;
|
|
||||||
use beacon_chain::data_availability_checker::AvailabilityCheckError;
|
use beacon_chain::data_availability_checker::AvailabilityCheckError;
|
||||||
use beacon_chain::test_utils::NumBlobs;
|
|
||||||
use ssz_types::VariableList;
|
use ssz_types::VariableList;
|
||||||
use std::ops::IndexMut;
|
use std::ops::IndexMut;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
@ -57,7 +57,6 @@ use lighthouse_network::types::{NetworkGlobals, SyncState};
|
|||||||
use lighthouse_network::SyncInfo;
|
use lighthouse_network::SyncInfo;
|
||||||
use lighthouse_network::{PeerAction, PeerId};
|
use lighthouse_network::{PeerAction, PeerId};
|
||||||
use slog::{crit, debug, error, info, trace, warn, Logger};
|
use slog::{crit, debug, error, info, trace, warn, Logger};
|
||||||
use std::boxed::Box;
|
|
||||||
use std::ops::IndexMut;
|
use std::ops::IndexMut;
|
||||||
use std::ops::Sub;
|
use std::ops::Sub;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
@ -395,10 +395,9 @@ mod tests {
|
|||||||
use slog::{o, Drain};
|
use slog::{o, Drain};
|
||||||
use slot_clock::TestingSlotClock;
|
use slot_clock::TestingSlotClock;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::sync::Arc;
|
|
||||||
use store::MemoryStore;
|
use store::MemoryStore;
|
||||||
use tokio::sync::mpsc;
|
use tokio::sync::mpsc;
|
||||||
use types::{ForkName, Hash256, MinimalEthSpec as E};
|
use types::{ForkName, MinimalEthSpec as E};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct FakeStorage {
|
struct FakeStorage {
|
||||||
|
@ -118,7 +118,6 @@ where
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use std::iter::FromIterator;
|
|
||||||
use std::{collections::HashSet, hash::Hash};
|
use std::{collections::HashSet, hash::Hash};
|
||||||
|
|
||||||
impl<T> MaxCover for HashSet<T>
|
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")?;
|
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_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.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 =
|
let execution_timeout_multiplier =
|
||||||
clap_utils::parse_required(cli_args, "execution-timeout-multiplier")?;
|
clap_utils::parse_required(cli_args, "execution-timeout-multiplier")?;
|
||||||
el_config.execution_timeout_multiplier = Some(execution_timeout_multiplier);
|
el_config.execution_timeout_multiplier = Some(execution_timeout_multiplier);
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
use self::UpdatePattern::*;
|
use self::UpdatePattern::*;
|
||||||
use crate::*;
|
use crate::*;
|
||||||
use ssz::{Decode, Encode};
|
use ssz::{Decode, Encode};
|
||||||
use typenum::Unsigned;
|
|
||||||
use types::historical_summary::HistoricalSummary;
|
use types::historical_summary::HistoricalSummary;
|
||||||
|
|
||||||
/// Description of how a `BeaconState` field is updated during state processing.
|
/// Description of how a `BeaconState` field is updated during state processing.
|
||||||
|
@ -33,13 +33,11 @@ use state_processing::{
|
|||||||
BlockProcessingError, BlockReplayer, SlotProcessingError, StateProcessingStrategy,
|
BlockProcessingError, BlockReplayer, SlotProcessingError, StateProcessingStrategy,
|
||||||
};
|
};
|
||||||
use std::cmp::min;
|
use std::cmp::min;
|
||||||
use std::convert::TryInto;
|
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::num::NonZeroUsize;
|
use std::num::NonZeroUsize;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use types::blob_sidecar::BlobSidecarList;
|
|
||||||
use types::*;
|
use types::*;
|
||||||
|
|
||||||
/// On-disk database that stores finalized states efficiently.
|
/// On-disk database that stores finalized states efficiently.
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
use crate::*;
|
use crate::*;
|
||||||
use ssz::{DecodeError, Encode};
|
use ssz::{DecodeError, Encode};
|
||||||
use ssz_derive::Encode;
|
use ssz_derive::Encode;
|
||||||
use std::convert::TryInto;
|
|
||||||
use types::beacon_state::{CloneConfig, CommitteeCache, CACHED_EPOCHS};
|
|
||||||
|
|
||||||
pub fn store_full_state<E: EthSpec>(
|
pub fn store_full_state<E: EthSpec>(
|
||||||
state_root: &Hash256,
|
state_root: &Hash256,
|
||||||
|
@ -381,7 +381,6 @@ fn slot_of_prev_restore_point<E: EthSpec>(current_slot: Slot) -> Slot {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::HotColdDB;
|
|
||||||
use crate::StoreConfig as Config;
|
use crate::StoreConfig as Config;
|
||||||
use beacon_chain::test_utils::BeaconChainHarness;
|
use beacon_chain::test_utils::BeaconChainHarness;
|
||||||
use beacon_chain::types::{ChainSpec, MainnetEthSpec};
|
use beacon_chain::types::{ChainSpec, MainnetEthSpec};
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
use crate::hot_cold_store::HotColdDBError;
|
use crate::hot_cold_store::HotColdDBError;
|
||||||
use crate::metrics;
|
|
||||||
use leveldb::compaction::Compaction;
|
use leveldb::compaction::Compaction;
|
||||||
use leveldb::database::batch::{Batch, Writebatch};
|
use leveldb::database::batch::{Batch, Writebatch};
|
||||||
use leveldb::database::kv::KV;
|
use leveldb::database::kv::KV;
|
||||||
@ -8,7 +7,7 @@ use leveldb::database::Database;
|
|||||||
use leveldb::error::Error as LevelDBError;
|
use leveldb::error::Error as LevelDBError;
|
||||||
use leveldb::iterator::{Iterable, KeyIterator, LevelDBIterator};
|
use leveldb::iterator::{Iterable, KeyIterator, LevelDBIterator};
|
||||||
use leveldb::options::{Options, ReadOptions, WriteOptions};
|
use leveldb::options::{Options, ReadOptions, WriteOptions};
|
||||||
use parking_lot::{Mutex, MutexGuard};
|
use parking_lot::Mutex;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ use crate::chunked_vector::{
|
|||||||
use crate::{get_key_for_col, DBColumn, Error, KeyValueStore, KeyValueStoreOp};
|
use crate::{get_key_for_col, DBColumn, Error, KeyValueStore, KeyValueStoreOp};
|
||||||
use ssz::{Decode, DecodeError, Encode};
|
use ssz::{Decode, DecodeError, Encode};
|
||||||
use ssz_derive::{Decode, Encode};
|
use ssz_derive::{Decode, Encode};
|
||||||
use std::convert::TryInto;
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use types::historical_summary::HistoricalSummary;
|
use types::historical_summary::HistoricalSummary;
|
||||||
use types::superstruct;
|
use types::superstruct;
|
||||||
|
@ -86,8 +86,8 @@ pub fn decode_eth1_tx_data(
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use types::{
|
use types::{
|
||||||
test_utils::generate_deterministic_keypair, ChainSpec, EthSpec, Hash256, Keypair,
|
test_utils::generate_deterministic_keypair, ChainSpec, EthSpec, Keypair, MinimalEthSpec,
|
||||||
MinimalEthSpec, Signature,
|
Signature,
|
||||||
};
|
};
|
||||||
|
|
||||||
type E = MinimalEthSpec;
|
type E = MinimalEthSpec;
|
||||||
|
@ -29,10 +29,8 @@ pub use reqwest::{StatusCode, Url};
|
|||||||
pub use sensitive_url::{SensitiveError, SensitiveUrl};
|
pub use sensitive_url::{SensitiveError, SensitiveUrl};
|
||||||
use serde::{de::DeserializeOwned, Serialize};
|
use serde::{de::DeserializeOwned, Serialize};
|
||||||
use ssz::Encode;
|
use ssz::Encode;
|
||||||
use std::convert::TryFrom;
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::iter::Iterator;
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use store::fork_versioned_response::ExecutionOptimisticFinalizedForkVersionedResponse;
|
use store::fork_versioned_response::ExecutionOptimisticFinalizedForkVersionedResponse;
|
||||||
|
@ -12,7 +12,6 @@ use serde::{Deserialize, Deserializer, Serialize};
|
|||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
use ssz::{Decode, DecodeError};
|
use ssz::{Decode, DecodeError};
|
||||||
use ssz_derive::{Decode, Encode};
|
use ssz_derive::{Decode, Encode};
|
||||||
use std::convert::TryFrom;
|
|
||||||
use std::fmt::{self, Display};
|
use std::fmt::{self, Display};
|
||||||
use std::str::{from_utf8, FromStr};
|
use std::str::{from_utf8, FromStr};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
@ -23,7 +23,6 @@ use bls::{Keypair, PublicKey, SecretKey};
|
|||||||
use ethereum_hashing::hash;
|
use ethereum_hashing::hash;
|
||||||
use num_bigint::BigUint;
|
use num_bigint::BigUint;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::convert::TryInto;
|
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
@ -462,7 +462,7 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use ssz::Encode;
|
use ssz::Encode;
|
||||||
use tempfile::Builder as TempBuilder;
|
use tempfile::Builder as TempBuilder;
|
||||||
use types::{Config, Eth1Data, GnosisEthSpec, Hash256, MainnetEthSpec};
|
use types::{Eth1Data, GnosisEthSpec, MainnetEthSpec};
|
||||||
|
|
||||||
type E = MainnetEthSpec;
|
type E = MainnetEthSpec;
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
use super::SlotClock;
|
use super::SlotClock;
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use std::convert::TryInto;
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use types::Slot;
|
use types::Slot;
|
||||||
|
@ -50,7 +50,7 @@ impl TreeHashCache {
|
|||||||
pub fn recalculate_merkle_root(
|
pub fn recalculate_merkle_root(
|
||||||
&mut self,
|
&mut self,
|
||||||
arena: &mut CacheArena,
|
arena: &mut CacheArena,
|
||||||
leaves: impl Iterator<Item = [u8; BYTES_PER_CHUNK]> + ExactSizeIterator,
|
leaves: impl ExactSizeIterator<Item = [u8; BYTES_PER_CHUNK]>,
|
||||||
) -> Result<Hash256, Error> {
|
) -> Result<Hash256, Error> {
|
||||||
let dirty_indices = self.update_leaves(arena, leaves)?;
|
let dirty_indices = self.update_leaves(arena, leaves)?;
|
||||||
self.update_merkle_root(arena, dirty_indices)
|
self.update_merkle_root(arena, dirty_indices)
|
||||||
@ -60,7 +60,7 @@ impl TreeHashCache {
|
|||||||
pub fn update_leaves(
|
pub fn update_leaves(
|
||||||
&mut self,
|
&mut self,
|
||||||
arena: &mut CacheArena,
|
arena: &mut CacheArena,
|
||||||
mut leaves: impl Iterator<Item = [u8; BYTES_PER_CHUNK]> + ExactSizeIterator,
|
mut leaves: impl ExactSizeIterator<Item = [u8; BYTES_PER_CHUNK]>,
|
||||||
) -> Result<SmallVec8<usize>, Error> {
|
) -> Result<SmallVec8<usize>, Error> {
|
||||||
let new_leaf_count = leaves.len();
|
let new_leaf_count = leaves.len();
|
||||||
|
|
||||||
|
@ -1655,7 +1655,7 @@ pub struct PersistedForkChoice {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use types::{EthSpec, MainnetEthSpec};
|
use types::MainnetEthSpec;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ use crate::{
|
|||||||
use ssz::{four_byte_option_impl, Encode};
|
use ssz::{four_byte_option_impl, Encode};
|
||||||
use ssz_derive::{Decode, Encode};
|
use ssz_derive::{Decode, Encode};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::convert::TryFrom;
|
|
||||||
use superstruct::superstruct;
|
use superstruct::superstruct;
|
||||||
use types::{Checkpoint, Hash256};
|
use types::{Checkpoint, Hash256};
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ use crate::upgrade::{
|
|||||||
};
|
};
|
||||||
use safe_arith::{ArithError, SafeArith};
|
use safe_arith::{ArithError, SafeArith};
|
||||||
use tree_hash::TreeHash;
|
use tree_hash::TreeHash;
|
||||||
use types::DEPOSIT_TREE_DEPTH;
|
|
||||||
use types::*;
|
use types::*;
|
||||||
|
|
||||||
/// Initialize a `BeaconState` from genesis data.
|
/// Initialize a `BeaconState` from genesis data.
|
||||||
|
@ -6,7 +6,6 @@ use crate::common::{
|
|||||||
};
|
};
|
||||||
use crate::per_block_processing::errors::{BlockProcessingError, IntoWithIndex};
|
use crate::per_block_processing::errors::{BlockProcessingError, IntoWithIndex};
|
||||||
use crate::VerifySignatures;
|
use crate::VerifySignatures;
|
||||||
use safe_arith::SafeArith;
|
|
||||||
use types::consts::altair::{PARTICIPATION_FLAG_WEIGHTS, PROPOSER_WEIGHT, WEIGHT_DENOMINATOR};
|
use types::consts::altair::{PARTICIPATION_FLAG_WEIGHTS, PROPOSER_WEIGHT, WEIGHT_DENOMINATOR};
|
||||||
|
|
||||||
pub fn process_operations<T: EthSpec, Payload: AbstractExecPayload<T>>(
|
pub fn process_operations<T: EthSpec, Payload: AbstractExecPayload<T>>(
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
use super::ParticipationCache;
|
use super::ParticipationCache;
|
||||||
use crate::EpochProcessingError;
|
use crate::EpochProcessingError;
|
||||||
use core::result::Result;
|
|
||||||
use core::result::Result::Ok;
|
|
||||||
use safe_arith::SafeArith;
|
use safe_arith::SafeArith;
|
||||||
use std::cmp::min;
|
use std::cmp::min;
|
||||||
use types::beacon_state::BeaconState;
|
use types::beacon_state::BeaconState;
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
use crate::EpochProcessingError;
|
use crate::EpochProcessingError;
|
||||||
use core::result::Result;
|
|
||||||
use core::result::Result::Ok;
|
|
||||||
use types::beacon_state::BeaconState;
|
use types::beacon_state::BeaconState;
|
||||||
use types::eth_spec::EthSpec;
|
use types::eth_spec::EthSpec;
|
||||||
use types::participation_flags::ParticipationFlags;
|
use types::participation_flags::ParticipationFlags;
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
use super::errors::EpochProcessingError;
|
use super::errors::EpochProcessingError;
|
||||||
use core::result::Result;
|
|
||||||
use core::result::Result::Ok;
|
|
||||||
use safe_arith::SafeArith;
|
use safe_arith::SafeArith;
|
||||||
use tree_hash::TreeHash;
|
use tree_hash::TreeHash;
|
||||||
use types::beacon_state::BeaconState;
|
use types::beacon_state::BeaconState;
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
use super::errors::EpochProcessingError;
|
use super::errors::EpochProcessingError;
|
||||||
use core::result::Result;
|
|
||||||
use core::result::Result::Ok;
|
|
||||||
use safe_arith::SafeArith;
|
use safe_arith::SafeArith;
|
||||||
use types::beacon_state::BeaconState;
|
use types::beacon_state::BeaconState;
|
||||||
use types::eth_spec::EthSpec;
|
use types::eth_spec::EthSpec;
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
use crate::beacon_block_body::{
|
|
||||||
BeaconBlockBodyAltair, BeaconBlockBodyBase, BeaconBlockBodyDeneb, BeaconBlockBodyMerge,
|
|
||||||
BeaconBlockBodyRef, BeaconBlockBodyRefMut,
|
|
||||||
};
|
|
||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use crate::*;
|
use crate::*;
|
||||||
use bls::Signature;
|
|
||||||
use derivative::Derivative;
|
use derivative::Derivative;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use ssz::{Decode, DecodeError};
|
use ssz::{Decode, DecodeError};
|
||||||
@ -762,8 +757,7 @@ impl<T: EthSpec, Payload: AbstractExecPayload<T>> ForkVersionDeserialize
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test_utils::{test_ssz_tree_hash_pair_with, SeedableRng, TestRandom, XorShiftRng};
|
use crate::test_utils::{test_ssz_tree_hash_pair_with, SeedableRng, XorShiftRng};
|
||||||
use crate::{ForkName, MainnetEthSpec};
|
|
||||||
use ssz::Encode;
|
use ssz::Encode;
|
||||||
|
|
||||||
type BeaconBlock = super::BeaconBlock<MainnetEthSpec>;
|
type BeaconBlock = super::BeaconBlock<MainnetEthSpec>;
|
||||||
|
@ -4,7 +4,6 @@ use derivative::Derivative;
|
|||||||
use merkle_proof::{MerkleTree, MerkleTreeError};
|
use merkle_proof::{MerkleTree, MerkleTreeError};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use ssz_derive::{Decode, Encode};
|
use ssz_derive::{Decode, Encode};
|
||||||
use ssz_types::VariableList;
|
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use superstruct::superstruct;
|
use superstruct::superstruct;
|
||||||
use test_random_derive::TestRandom;
|
use test_random_derive::TestRandom;
|
||||||
|
@ -12,8 +12,6 @@ use safe_arith::{ArithError, SafeArith};
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use ssz::{ssz_encode, Decode, DecodeError, Encode};
|
use ssz::{ssz_encode, Decode, DecodeError, Encode};
|
||||||
use ssz_derive::{Decode, Encode};
|
use ssz_derive::{Decode, Encode};
|
||||||
use ssz_types::{typenum::Unsigned, BitVector, FixedVector};
|
|
||||||
use std::convert::TryInto;
|
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use std::{fmt, mem, sync::Arc};
|
use std::{fmt, mem, sync::Arc};
|
||||||
use superstruct::superstruct;
|
use superstruct::superstruct;
|
||||||
@ -1767,7 +1765,8 @@ impl<T: EthSpec> BeaconState<T> {
|
|||||||
BeaconState::Deneb(inner) => BeaconState::Deneb(inner.clone()),
|
BeaconState::Deneb(inner) => BeaconState::Deneb(inner.clone()),
|
||||||
};
|
};
|
||||||
if config.committee_caches {
|
if config.committee_caches {
|
||||||
*res.committee_caches_mut() = self.committee_caches().clone();
|
res.committee_caches_mut()
|
||||||
|
.clone_from(self.committee_caches());
|
||||||
*res.total_active_balance_mut() = *self.total_active_balance();
|
*res.total_active_balance_mut() = *self.total_active_balance();
|
||||||
}
|
}
|
||||||
if config.pubkey_cache {
|
if config.pubkey_cache {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#![allow(clippy::arithmetic_side_effects)]
|
#![allow(clippy::arithmetic_side_effects)]
|
||||||
|
|
||||||
use super::BeaconState;
|
|
||||||
use crate::*;
|
use crate::*;
|
||||||
use core::num::NonZeroUsize;
|
use core::num::NonZeroUsize;
|
||||||
use safe_arith::SafeArith;
|
use safe_arith::SafeArith;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#![cfg(test)]
|
#![cfg(test)]
|
||||||
use crate::test_utils::*;
|
use crate::test_utils::*;
|
||||||
use crate::test_utils::{SeedableRng, XorShiftRng};
|
|
||||||
use beacon_chain::test_utils::{
|
use beacon_chain::test_utils::{
|
||||||
interop_genesis_state_with_eth1, test_spec, BeaconChainHarness, EphemeralHarnessType,
|
interop_genesis_state_with_eth1, test_spec, BeaconChainHarness, EphemeralHarnessType,
|
||||||
DEFAULT_ETH1_BLOCK_HASH,
|
DEFAULT_ETH1_BLOCK_HASH,
|
||||||
|
@ -10,7 +10,6 @@ use rayon::prelude::*;
|
|||||||
use ssz_derive::{Decode, Encode};
|
use ssz_derive::{Decode, Encode};
|
||||||
use ssz_types::VariableList;
|
use ssz_types::VariableList;
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
use std::iter::ExactSizeIterator;
|
|
||||||
use tree_hash::{mix_in_length, MerkleHasher, TreeHash};
|
use tree_hash::{mix_in_length, MerkleHasher, TreeHash};
|
||||||
|
|
||||||
/// The number of leaves (including padding) on the `BeaconState` Merkle tree.
|
/// The number of leaves (including padding) on the `BeaconState` Merkle tree.
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use crate::*;
|
use crate::*;
|
||||||
use bls::PublicKeyBytes;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use ssz_derive::{Decode, Encode};
|
use ssz_derive::{Decode, Encode};
|
||||||
use test_random_derive::TestRandom;
|
use test_random_derive::TestRandom;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
||||||
use bls::{PublicKeyBytes, SignatureBytes};
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use ssz_derive::{Decode, Encode};
|
use ssz_derive::{Decode, Encode};
|
||||||
use test_random_derive::TestRandom;
|
use test_random_derive::TestRandom;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
||||||
use bls::PublicKeyBytes;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use ssz_derive::{Decode, Encode};
|
use ssz_derive::{Decode, Encode};
|
||||||
use test_random_derive::TestRandom;
|
use test_random_derive::TestRandom;
|
||||||
|
@ -5,7 +5,6 @@ use serde::{Deserialize, Serialize};
|
|||||||
use ssz_derive::{Decode, Encode};
|
use ssz_derive::{Decode, Encode};
|
||||||
use test_random_derive::TestRandom;
|
use test_random_derive::TestRandom;
|
||||||
use test_utils::TestRandom;
|
use test_utils::TestRandom;
|
||||||
use DEPOSIT_TREE_DEPTH;
|
|
||||||
|
|
||||||
#[derive(Encode, Decode, Deserialize, Serialize, Clone, Debug, PartialEq, TestRandom)]
|
#[derive(Encode, Decode, Deserialize, Serialize, Clone, Debug, PartialEq, TestRandom)]
|
||||||
pub struct FinalizedExecutionBlock {
|
pub struct FinalizedExecutionBlock {
|
||||||
|
@ -3,8 +3,8 @@ use crate::*;
|
|||||||
use safe_arith::SafeArith;
|
use safe_arith::SafeArith;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use ssz_types::typenum::{
|
use ssz_types::typenum::{
|
||||||
bit::B0, UInt, Unsigned, U0, U1024, U1048576, U1073741824, U1099511627776, U128, U131072, U16,
|
bit::B0, UInt, U0, U1024, U1048576, U1073741824, U1099511627776, U128, U131072, U16, U16777216,
|
||||||
U16777216, U2, U2048, U256, U32, U4, U4096, U512, U6, U625, U64, U65536, U8, U8192,
|
U2, U2048, U256, U32, U4, U4096, U512, U6, U625, U64, U65536, U8, U8192,
|
||||||
};
|
};
|
||||||
use ssz_types::typenum::{U17, U9};
|
use ssz_types::typenum::{U17, U9};
|
||||||
use std::fmt::{self, Debug};
|
use std::fmt::{self, Debug};
|
||||||
|
@ -6,7 +6,6 @@ use ssz_derive::{Decode, Encode};
|
|||||||
use test_random_derive::TestRandom;
|
use test_random_derive::TestRandom;
|
||||||
use tree_hash::TreeHash;
|
use tree_hash::TreeHash;
|
||||||
use tree_hash_derive::TreeHash;
|
use tree_hash_derive::TreeHash;
|
||||||
use BeaconStateError;
|
|
||||||
|
|
||||||
#[superstruct(
|
#[superstruct(
|
||||||
variants(Merge, Capella, Deneb),
|
variants(Merge, Capella, Deneb),
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
use crate::{ChainSpec, Epoch};
|
use crate::{ChainSpec, Epoch};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use ssz_derive::{Decode, Encode};
|
use ssz_derive::{Decode, Encode};
|
||||||
use std::convert::TryFrom;
|
|
||||||
use std::fmt::{self, Display, Formatter};
|
use std::fmt::{self, Display, Formatter};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ use crate::*;
|
|||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use ssz_derive::{Decode, Encode};
|
use ssz_derive::{Decode, Encode};
|
||||||
use ssz_types::FixedVector;
|
|
||||||
use test_random_derive::TestRandom;
|
use test_random_derive::TestRandom;
|
||||||
use tree_hash_derive::TreeHash;
|
use tree_hash_derive::TreeHash;
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ mod quoted_variable_list_u64 {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::slot_epoch::Epoch;
|
use crate::slot_epoch::Epoch;
|
||||||
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
use crate::test_utils::{SeedableRng, XorShiftRng};
|
||||||
use crate::MainnetEthSpec;
|
use crate::MainnetEthSpec;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -5,7 +5,6 @@ use serde::{Deserialize, Serialize};
|
|||||||
use ssz::{Decode, Encode};
|
use ssz::{Decode, Encode};
|
||||||
use ssz_derive::{Decode, Encode};
|
use ssz_derive::{Decode, Encode};
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::convert::TryFrom;
|
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use test_random_derive::TestRandom;
|
use test_random_derive::TestRandom;
|
||||||
|
@ -5,7 +5,6 @@ use ethereum_hashing::hash;
|
|||||||
use safe_arith::{ArithError, SafeArith};
|
use safe_arith::{ArithError, SafeArith};
|
||||||
use ssz::Encode;
|
use ssz::Encode;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::convert::TryInto;
|
|
||||||
|
|
||||||
#[derive(arbitrary::Arbitrary, PartialEq, Debug, Clone)]
|
#[derive(arbitrary::Arbitrary, PartialEq, Debug, Clone)]
|
||||||
pub struct SelectionProof(Signature);
|
pub struct SelectionProof(Signature);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
use crate::beacon_block_body::format_kzg_commitments;
|
use crate::beacon_block_body::format_kzg_commitments;
|
||||||
use crate::*;
|
use crate::*;
|
||||||
use bls::Signature;
|
|
||||||
use derivative::Derivative;
|
use derivative::Derivative;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use ssz_derive::{Decode, Encode};
|
use ssz_derive::{Decode, Encode};
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use crate::*;
|
use crate::*;
|
||||||
use bls::Signature;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use ssz_derive::{Decode, Encode};
|
use ssz_derive::{Decode, Encode};
|
||||||
use test_random_derive::TestRandom;
|
use test_random_derive::TestRandom;
|
||||||
|
@ -19,7 +19,6 @@ use serde::{Deserialize, Serialize};
|
|||||||
use ssz::{Decode, DecodeError, Encode};
|
use ssz::{Decode, DecodeError, Encode};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use std::iter::Iterator;
|
|
||||||
|
|
||||||
#[cfg(feature = "legacy-arith")]
|
#[cfg(feature = "legacy-arith")]
|
||||||
use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Rem, Sub, SubAssign};
|
use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Rem, Sub, SubAssign};
|
||||||
|
@ -4,7 +4,6 @@ use rusqlite::{
|
|||||||
types::{FromSql, FromSqlError, ToSql, ToSqlOutput, ValueRef},
|
types::{FromSql, FromSqlError, ToSql, ToSqlOutput, ValueRef},
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
use std::convert::TryFrom;
|
|
||||||
|
|
||||||
macro_rules! impl_to_from_sql {
|
macro_rules! impl_to_from_sql {
|
||||||
($type:ty) => {
|
($type:ty) => {
|
||||||
|
@ -10,7 +10,6 @@ use safe_arith::{ArithError, SafeArith};
|
|||||||
use ssz::Encode;
|
use ssz::Encode;
|
||||||
use ssz_types::typenum::Unsigned;
|
use ssz_types::typenum::Unsigned;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::convert::TryInto;
|
|
||||||
|
|
||||||
#[derive(arbitrary::Arbitrary, PartialEq, Debug, Clone)]
|
#[derive(arbitrary::Arbitrary, PartialEq, Debug, Clone)]
|
||||||
pub struct SyncSelectionProof(Signature);
|
pub struct SyncSelectionProof(Signature);
|
||||||
|
@ -2,7 +2,6 @@ use crate::*;
|
|||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
use rand::SeedableRng;
|
use rand::SeedableRng;
|
||||||
use rand_xorshift::XorShiftRng;
|
use rand_xorshift::XorShiftRng;
|
||||||
use ssz_types::typenum::Unsigned;
|
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
use crate::Address;
|
|
||||||
|
|
||||||
impl TestRandom for Address {
|
impl TestRandom for Address {
|
||||||
fn random_for_test(rng: &mut impl RngCore) -> Self {
|
fn random_for_test(rng: &mut impl RngCore) -> Self {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
use bls::{AggregateSignature, Signature};
|
|
||||||
|
|
||||||
impl TestRandom for AggregateSignature {
|
impl TestRandom for AggregateSignature {
|
||||||
fn random_for_test(rng: &mut impl RngCore) -> Self {
|
fn random_for_test(rng: &mut impl RngCore) -> Self {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
use crate::{BitList, BitVector, Unsigned};
|
|
||||||
use smallvec::smallvec;
|
use smallvec::smallvec;
|
||||||
|
|
||||||
impl<N: Unsigned + Clone> TestRandom for BitList<N> {
|
impl<N: Unsigned + Clone> TestRandom for BitList<N> {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
use crate::Hash256;
|
|
||||||
|
|
||||||
impl TestRandom for Hash256 {
|
impl TestRandom for Hash256 {
|
||||||
fn random_for_test(rng: &mut impl RngCore) -> Self {
|
fn random_for_test(rng: &mut impl RngCore) -> Self {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
use kzg::{KzgProof, BYTES_PER_COMMITMENT};
|
use kzg::BYTES_PER_COMMITMENT;
|
||||||
|
|
||||||
impl TestRandom for KzgProof {
|
impl TestRandom for KzgProof {
|
||||||
fn random_for_test(rng: &mut impl RngCore) -> Self {
|
fn random_for_test(rng: &mut impl RngCore) -> Self {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
use bls::{PublicKey, SecretKey};
|
|
||||||
|
|
||||||
impl TestRandom for PublicKey {
|
impl TestRandom for PublicKey {
|
||||||
fn random_for_test(rng: &mut impl RngCore) -> Self {
|
fn random_for_test(rng: &mut impl RngCore) -> Self {
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
use std::convert::From;
|
use bls::PUBLIC_KEY_BYTES_LEN;
|
||||||
|
|
||||||
use bls::{PublicKeyBytes, PUBLIC_KEY_BYTES_LEN};
|
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
use bls::SecretKey;
|
|
||||||
|
|
||||||
impl TestRandom for SecretKey {
|
impl TestRandom for SecretKey {
|
||||||
fn random_for_test(_rng: &mut impl RngCore) -> Self {
|
fn random_for_test(_rng: &mut impl RngCore) -> Self {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
use bls::{SecretKey, Signature};
|
|
||||||
|
|
||||||
impl TestRandom for Signature {
|
impl TestRandom for Signature {
|
||||||
fn random_for_test(rng: &mut impl RngCore) -> Self {
|
fn random_for_test(rng: &mut impl RngCore) -> Self {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
use bls::{SignatureBytes, SIGNATURE_BYTES_LEN};
|
use bls::SIGNATURE_BYTES_LEN;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use std::convert::From;
|
|
||||||
|
|
||||||
impl TestRandom for SignatureBytes {
|
impl TestRandom for SignatureBytes {
|
||||||
fn random_for_test(rng: &mut impl RngCore) -> Self {
|
fn random_for_test(rng: &mut impl RngCore) -> Self {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
use crate::Uint256;
|
|
||||||
|
|
||||||
impl TestRandom for Uint256 {
|
impl TestRandom for Uint256 {
|
||||||
fn random_for_test(rng: &mut impl RngCore) -> Self {
|
fn random_for_test(rng: &mut impl RngCore) -> Self {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user