mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
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:
@@ -2,7 +2,7 @@
|
||||
|
||||
use crate::test_utils::*;
|
||||
use crate::*;
|
||||
use types::{AttestationData, Checkpoint, Epoch, Hash256, Slot};
|
||||
use types::{AttestationData, Checkpoint, Epoch, Slot};
|
||||
|
||||
pub fn build_checkpoint(epoch_num: u64) -> Checkpoint {
|
||||
Checkpoint {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
use super::*;
|
||||
use crate::test_utils::*;
|
||||
use types::{BeaconBlockHeader, Hash256, Slot};
|
||||
use types::{BeaconBlockHeader, Slot};
|
||||
|
||||
pub fn block(slot: u64) -> BeaconBlockHeader {
|
||||
BeaconBlockHeader {
|
||||
|
||||
@@ -17,8 +17,8 @@ pub use crate::slashing_database::{
|
||||
SUPPORTED_INTERCHANGE_FORMAT_VERSION,
|
||||
};
|
||||
use rusqlite::Error as SQLError;
|
||||
use std::fmt::Display;
|
||||
use std::io::{Error as IOError, ErrorKind};
|
||||
use std::string::ToString;
|
||||
use types::{Hash256, PublicKeyBytes};
|
||||
|
||||
/// The filename within the `validators` directory that contains the slashing protection DB.
|
||||
@@ -122,9 +122,9 @@ impl From<r2d2::Error> for NotSafe {
|
||||
}
|
||||
}
|
||||
|
||||
impl ToString for NotSafe {
|
||||
fn to_string(&self) -> String {
|
||||
format!("{:?}", self)
|
||||
impl Display for NotSafe {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{:?}", self)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
use crate::*;
|
||||
use tempfile::{tempdir, TempDir};
|
||||
use types::{
|
||||
test_utils::generate_deterministic_keypair, AttestationData, BeaconBlockHeader, Hash256,
|
||||
PublicKeyBytes,
|
||||
};
|
||||
use types::{test_utils::generate_deterministic_keypair, AttestationData, BeaconBlockHeader};
|
||||
|
||||
pub const DEFAULT_VALIDATOR_INDEX: usize = 0;
|
||||
pub const DEFAULT_DOMAIN: Hash256 = Hash256::zero();
|
||||
|
||||
@@ -690,7 +690,6 @@ mod test {
|
||||
use environment::null_logger;
|
||||
use futures::executor::block_on;
|
||||
use slot_clock::TestingSlotClock;
|
||||
use std::collections::HashSet;
|
||||
use std::future;
|
||||
use std::time::Duration;
|
||||
use types::{
|
||||
|
||||
@@ -12,7 +12,6 @@ use slashing_protection::{
|
||||
};
|
||||
use slog::{crit, error, info, warn, Logger};
|
||||
use slot_clock::SlotClock;
|
||||
use std::iter::FromIterator;
|
||||
use std::marker::PhantomData;
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
@@ -20,13 +19,12 @@ use task_executor::TaskExecutor;
|
||||
use types::{
|
||||
attestation::Error as AttestationError, graffiti::GraffitiString, AbstractExecPayload, Address,
|
||||
AggregateAndProof, Attestation, BeaconBlock, BlindedPayload, ChainSpec, ContributionAndProof,
|
||||
Domain, Epoch, EthSpec, Fork, ForkName, Graffiti, Hash256, Keypair, PublicKeyBytes,
|
||||
SelectionProof, Signature, SignedAggregateAndProof, SignedBeaconBlock,
|
||||
SignedContributionAndProof, SignedRoot, SignedValidatorRegistrationData, SignedVoluntaryExit,
|
||||
Slot, SyncAggregatorSelectionData, SyncCommitteeContribution, SyncCommitteeMessage,
|
||||
SyncSelectionProof, SyncSubnetId, ValidatorRegistrationData, VoluntaryExit,
|
||||
Domain, Epoch, EthSpec, Fork, ForkName, Graffiti, Hash256, PublicKeyBytes, SelectionProof,
|
||||
Signature, SignedAggregateAndProof, SignedBeaconBlock, SignedContributionAndProof, SignedRoot,
|
||||
SignedValidatorRegistrationData, SignedVoluntaryExit, Slot, SyncAggregatorSelectionData,
|
||||
SyncCommitteeContribution, SyncCommitteeMessage, SyncSelectionProof, SyncSubnetId,
|
||||
ValidatorRegistrationData, VoluntaryExit,
|
||||
};
|
||||
use validator_dir::ValidatorDir;
|
||||
|
||||
pub use crate::doppelganger_service::DoppelgangerStatus;
|
||||
use crate::preparation_service::ProposalData;
|
||||
@@ -60,31 +58,6 @@ const SLASHING_PROTECTION_HISTORY_EPOCHS: u64 = 512;
|
||||
/// https://github.com/ethereum/builder-specs/issues/17
|
||||
pub const DEFAULT_GAS_LIMIT: u64 = 30_000_000;
|
||||
|
||||
struct LocalValidator {
|
||||
validator_dir: ValidatorDir,
|
||||
voting_keypair: Keypair,
|
||||
}
|
||||
|
||||
/// We derive our own `PartialEq` to avoid doing equality checks between secret keys.
|
||||
///
|
||||
/// It's nice to avoid secret key comparisons from a security perspective, but it's also a little
|
||||
/// risky when it comes to `HashMap` integrity (that's why we need `PartialEq`).
|
||||
///
|
||||
/// Currently, we obtain keypairs from keystores where we derive the `PublicKey` from a `SecretKey`
|
||||
/// via a hash function. In order to have two equal `PublicKey` with different `SecretKey` we would
|
||||
/// need to have either:
|
||||
///
|
||||
/// - A serious upstream integrity error.
|
||||
/// - A hash collision.
|
||||
///
|
||||
/// It seems reasonable to make these two assumptions in order to avoid the equality checks.
|
||||
impl PartialEq for LocalValidator {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.validator_dir == other.validator_dir
|
||||
&& self.voting_keypair.pk == other.voting_keypair.pk
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ValidatorStore<T, E: EthSpec> {
|
||||
validators: Arc<RwLock<InitializedValidators>>,
|
||||
slashing_protection: SlashingDatabase,
|
||||
|
||||
Reference in New Issue
Block a user