mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-17 21:08:32 +00:00
Fix clippy lints
This commit is contained in:
@@ -191,7 +191,6 @@ where
|
||||
count: usize,
|
||||
skip: usize,
|
||||
) -> Result<Vec<Hash256>, Error> {
|
||||
let spec = &self.spec;
|
||||
let step_by = Slot::from(skip + 1);
|
||||
|
||||
let mut roots: Vec<Hash256> = vec![];
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
use crate::ClientConfig;
|
||||
use crate::{ArcBeaconChain, ClientConfig};
|
||||
use beacon_chain::{
|
||||
db::{ClientDB, DiskDB, MemoryDB},
|
||||
fork_choice::BitwiseLMDGhost,
|
||||
initialise,
|
||||
slot_clock::{SlotClock, SystemTimeSlotClock},
|
||||
BeaconChain,
|
||||
};
|
||||
use fork_choice::ForkChoice;
|
||||
use types::{BeaconStateTypes, FewValidatorsStateTypes, FoundationStateTypes};
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
pub trait ClientTypes {
|
||||
type DB: ClientDB + 'static;
|
||||
type SlotClock: SlotClock + 'static;
|
||||
@@ -19,7 +16,7 @@ pub trait ClientTypes {
|
||||
|
||||
fn initialise_beacon_chain(
|
||||
config: &ClientConfig,
|
||||
) -> Arc<BeaconChain<Self::DB, Self::SlotClock, Self::ForkChoice, Self::BeaconStateTypes>>;
|
||||
) -> ArcBeaconChain<Self::DB, Self::SlotClock, Self::ForkChoice, Self::BeaconStateTypes>;
|
||||
}
|
||||
|
||||
pub struct StandardClientType;
|
||||
@@ -32,7 +29,7 @@ impl ClientTypes for StandardClientType {
|
||||
|
||||
fn initialise_beacon_chain(
|
||||
config: &ClientConfig,
|
||||
) -> Arc<BeaconChain<Self::DB, Self::SlotClock, Self::ForkChoice, Self::BeaconStateTypes>> {
|
||||
) -> ArcBeaconChain<Self::DB, Self::SlotClock, Self::ForkChoice, Self::BeaconStateTypes> {
|
||||
initialise::initialise_beacon_chain(&config.spec, Some(&config.db_name))
|
||||
}
|
||||
}
|
||||
@@ -47,7 +44,7 @@ impl ClientTypes for TestingClientType {
|
||||
|
||||
fn initialise_beacon_chain(
|
||||
config: &ClientConfig,
|
||||
) -> Arc<BeaconChain<Self::DB, Self::SlotClock, Self::ForkChoice, Self::BeaconStateTypes>> {
|
||||
) -> ArcBeaconChain<Self::DB, Self::SlotClock, Self::ForkChoice, Self::BeaconStateTypes> {
|
||||
initialise::initialise_test_beacon_chain(&config.spec, None)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,13 +22,15 @@ use tokio::runtime::TaskExecutor;
|
||||
use tokio::timer::Interval;
|
||||
use types::BeaconStateTypes;
|
||||
|
||||
type ArcBeaconChain<D, S, F, B> = Arc<BeaconChain<D, S, F, B>>;
|
||||
|
||||
/// Main beacon node client service. This provides the connection and initialisation of the clients
|
||||
/// sub-services in multiple threads.
|
||||
pub struct Client<T: ClientTypes> {
|
||||
/// Configuration for the lighthouse client.
|
||||
_config: ClientConfig,
|
||||
/// The beacon chain for the running client.
|
||||
_beacon_chain: Arc<BeaconChain<T::DB, T::SlotClock, T::ForkChoice, T::BeaconStateTypes>>,
|
||||
_beacon_chain: ArcBeaconChain<T::DB, T::SlotClock, T::ForkChoice, T::BeaconStateTypes>,
|
||||
/// Reference to the network service.
|
||||
pub network: Arc<NetworkService<T::BeaconStateTypes>>,
|
||||
/// Signal to terminate the RPC server.
|
||||
|
||||
@@ -97,7 +97,7 @@ impl ClientDB for DiskDB {
|
||||
None => Err(DBError {
|
||||
message: "Unknown column".to_string(),
|
||||
}),
|
||||
Some(handle) => self.db.put_cf(handle, key, val).map_err(|e| e.into()),
|
||||
Some(handle) => self.db.put_cf(handle, key, val).map_err(Into::into),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ use super::STATES_DB_COLUMN as DB_COLUMN;
|
||||
use super::{ClientDB, DBError};
|
||||
use ssz::decode;
|
||||
use std::sync::Arc;
|
||||
use types::{BeaconState, BeaconStateTypes, FoundationBeaconState, Hash256};
|
||||
use types::{BeaconState, BeaconStateTypes, Hash256};
|
||||
|
||||
pub struct BeaconStateStore<T>
|
||||
where
|
||||
@@ -43,7 +43,7 @@ mod tests {
|
||||
use ssz::ssz_encode;
|
||||
use std::sync::Arc;
|
||||
use types::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
||||
use types::Hash256;
|
||||
use types::{FoundationBeaconState, Hash256};
|
||||
|
||||
test_crud_for_store!(BeaconStateStore, DB_COLUMN);
|
||||
|
||||
|
||||
@@ -300,7 +300,7 @@ impl NetworkContext {
|
||||
let next_id = self
|
||||
.outgoing_request_ids
|
||||
.entry(peer_id.clone())
|
||||
.and_modify(|id| id.increment())
|
||||
.and_modify(RequestId::increment)
|
||||
.or_insert_with(|| RequestId::from(1));
|
||||
|
||||
next_id.previous()
|
||||
|
||||
Reference in New Issue
Block a user