Skip to content

Commit

Permalink
Delete the fork service
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsproul committed Jul 29, 2021
1 parent e63b5de commit d0e2153
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 312 deletions.
6 changes: 3 additions & 3 deletions validator_client/src/attestation_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use types::{
/// Builds an `AttestationService`.
pub struct AttestationServiceBuilder<T, E: EthSpec> {
duties_service: Option<Arc<DutiesService<T, E>>>,
validator_store: Option<ValidatorStore<T, E>>,
validator_store: Option<ValidatorStore<E>>,
slot_clock: Option<T>,
beacon_nodes: Option<Arc<BeaconNodeFallback<T, E>>>,
context: Option<RuntimeContext<E>>,
Expand All @@ -42,7 +42,7 @@ impl<T: SlotClock + 'static, E: EthSpec> AttestationServiceBuilder<T, E> {
self
}

pub fn validator_store(mut self, store: ValidatorStore<T, E>) -> Self {
pub fn validator_store(mut self, store: ValidatorStore<E>) -> Self {
self.validator_store = Some(store);
self
}
Expand Down Expand Up @@ -88,7 +88,7 @@ impl<T: SlotClock + 'static, E: EthSpec> AttestationServiceBuilder<T, E> {
/// Helper to minimise `Arc` usage.
pub struct Inner<T, E: EthSpec> {
duties_service: Arc<DutiesService<T, E>>,
validator_store: ValidatorStore<T, E>,
validator_store: ValidatorStore<E>,
slot_clock: T,
beacon_nodes: Arc<BeaconNodeFallback<T, E>>,
context: RuntimeContext<E>,
Expand Down
6 changes: 3 additions & 3 deletions validator_client/src/block_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use types::{EthSpec, PublicKeyBytes, Slot};

/// Builds a `BlockService`.
pub struct BlockServiceBuilder<T, E: EthSpec> {
validator_store: Option<ValidatorStore<T, E>>,
validator_store: Option<ValidatorStore<E>>,
slot_clock: Option<Arc<T>>,
beacon_nodes: Option<Arc<BeaconNodeFallback<T, E>>>,
context: Option<RuntimeContext<E>>,
Expand All @@ -35,7 +35,7 @@ impl<T: SlotClock + 'static, E: EthSpec> BlockServiceBuilder<T, E> {
}
}

pub fn validator_store(mut self, store: ValidatorStore<T, E>) -> Self {
pub fn validator_store(mut self, store: ValidatorStore<E>) -> Self {
self.validator_store = Some(store);
self
}
Expand Down Expand Up @@ -89,7 +89,7 @@ impl<T: SlotClock + 'static, E: EthSpec> BlockServiceBuilder<T, E> {

/// Helper to minimise `Arc` usage.
pub struct Inner<T, E: EthSpec> {
validator_store: ValidatorStore<T, E>,
validator_store: ValidatorStore<E>,
slot_clock: Arc<T>,
beacon_nodes: Arc<BeaconNodeFallback<T, E>>,
context: RuntimeContext<E>,
Expand Down
6 changes: 3 additions & 3 deletions validator_client/src/duties_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ pub struct DutyAndProof {

impl DutyAndProof {
/// Instantiate `Self`, computing the selection proof as well.
pub fn new<T: SlotClock + 'static, E: EthSpec>(
pub fn new<E: EthSpec>(
duty: AttesterData,
validator_store: &ValidatorStore<T, E>,
validator_store: &ValidatorStore<E>,
spec: &ChainSpec,
) -> Result<Self, Error> {
let selection_proof = validator_store
Expand Down Expand Up @@ -110,7 +110,7 @@ pub struct DutiesService<T, E: EthSpec> {
/// up-to-date.
pub indices: RwLock<IndicesMap>,
/// Provides the canonical list of locally-managed validators.
pub validator_store: ValidatorStore<T, E>,
pub validator_store: ValidatorStore<E>,
/// Tracks the current slot.
pub slot_clock: T,
/// Provides HTTP access to remote beacon nodes.
Expand Down
212 changes: 0 additions & 212 deletions validator_client/src/fork_service.rs

This file was deleted.

5 changes: 2 additions & 3 deletions validator_client/src/http_api/create_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use account_utils::{
random_mnemonic, random_password, ZeroizeString,
};
use eth2::lighthouse_vc::types::{self as api_types};
use slot_clock::SlotClock;
use std::path::Path;
use types::ChainSpec;
use types::EthSpec;
Expand All @@ -21,12 +20,12 @@ use validator_dir::Builder as ValidatorDirBuilder;
///
/// If `key_derivation_path_offset` is supplied then the EIP-2334 validator index will start at
/// this point.
pub async fn create_validators<P: AsRef<Path>, T: 'static + SlotClock, E: EthSpec>(
pub async fn create_validators<P: AsRef<Path>, E: EthSpec>(
mnemonic_opt: Option<Mnemonic>,
key_derivation_path_offset: Option<u32>,
validator_requests: &[api_types::ValidatorRequest],
validator_dir: P,
validator_store: &ValidatorStore<T, E>,
validator_store: &ValidatorStore<E>,
spec: &ChainSpec,
) -> Result<(Vec<api_types::CreatedValidator>, Mnemonic), warp::Rejection> {
let mnemonic = mnemonic_opt.unwrap_or_else(random_mnemonic);
Expand Down
21 changes: 10 additions & 11 deletions validator_client/src/http_api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use eth2::lighthouse_vc::types::{self as api_types, PublicKey, PublicKeyBytes};
use lighthouse_version::version_with_platform;
use serde::{Deserialize, Serialize};
use slog::{crit, info, Logger};
use slot_clock::SlotClock;
use std::future::Future;
use std::marker::PhantomData;
use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4};
Expand Down Expand Up @@ -50,10 +49,10 @@ impl From<String> for Error {
/// A wrapper around all the items required to spawn the HTTP server.
///
/// The server will gracefully handle the case where any fields are `None`.
pub struct Context<T: Clone, E: EthSpec> {
pub struct Context<E: EthSpec> {
pub runtime: Weak<Runtime>,
pub api_secret: ApiSecret,
pub validator_store: Option<ValidatorStore<T, E>>,
pub validator_store: Option<ValidatorStore<E>>,
pub validator_dir: Option<PathBuf>,
pub spec: ChainSpec,
pub config: Config,
Expand Down Expand Up @@ -96,8 +95,8 @@ impl Default for Config {
///
/// Returns an error if the server is unable to bind or there is another error during
/// configuration.
pub fn serve<T: 'static + SlotClock + Clone, E: EthSpec>(
ctx: Arc<Context<T, E>>,
pub fn serve<E: EthSpec>(
ctx: Arc<Context<E>>,
shutdown: impl Future<Output = ()> + Send + Sync + 'static,
) -> Result<(SocketAddr, impl Future<Output = ()>), Error> {
let config = &ctx.config;
Expand Down Expand Up @@ -203,7 +202,7 @@ pub fn serve<T: 'static + SlotClock + Clone, E: EthSpec>(
.and(warp::path::end())
.and(validator_store_filter.clone())
.and(signer.clone())
.and_then(|validator_store: ValidatorStore<T, E>, signer| {
.and_then(|validator_store: ValidatorStore<E>, signer| {
blocking_signed_json_task(signer, move || {
let validators = validator_store
.initialized_validators()
Expand All @@ -229,7 +228,7 @@ pub fn serve<T: 'static + SlotClock + Clone, E: EthSpec>(
.and(validator_store_filter.clone())
.and(signer.clone())
.and_then(
|validator_pubkey: PublicKey, validator_store: ValidatorStore<T, E>, signer| {
|validator_pubkey: PublicKey, validator_store: ValidatorStore<E>, signer| {
blocking_signed_json_task(signer, move || {
let validator = validator_store
.initialized_validators()
Expand Down Expand Up @@ -267,7 +266,7 @@ pub fn serve<T: 'static + SlotClock + Clone, E: EthSpec>(
.and_then(
|body: Vec<api_types::ValidatorRequest>,
validator_dir: PathBuf,
validator_store: ValidatorStore<T, E>,
validator_store: ValidatorStore<E>,
spec: Arc<ChainSpec>,
signer,
runtime: Weak<Runtime>| {
Expand Down Expand Up @@ -309,7 +308,7 @@ pub fn serve<T: 'static + SlotClock + Clone, E: EthSpec>(
.and_then(
|body: api_types::CreateValidatorsMnemonicRequest,
validator_dir: PathBuf,
validator_store: ValidatorStore<T, E>,
validator_store: ValidatorStore<E>,
spec: Arc<ChainSpec>,
signer,
runtime: Weak<Runtime>| {
Expand Down Expand Up @@ -353,7 +352,7 @@ pub fn serve<T: 'static + SlotClock + Clone, E: EthSpec>(
.and_then(
|body: api_types::KeystoreValidatorsPostRequest,
validator_dir: PathBuf,
validator_store: ValidatorStore<T, E>,
validator_store: ValidatorStore<E>,
signer,
runtime: Weak<Runtime>| {
blocking_signed_json_task(signer, move || {
Expand Down Expand Up @@ -428,7 +427,7 @@ pub fn serve<T: 'static + SlotClock + Clone, E: EthSpec>(
.and_then(
|validator_pubkey: PublicKey,
body: api_types::ValidatorPatchRequest,
validator_store: ValidatorStore<T, E>,
validator_store: ValidatorStore<E>,
signer,
runtime: Weak<Runtime>| {
blocking_signed_json_task(signer, move || {
Expand Down
Loading

0 comments on commit d0e2153

Please sign in to comment.