mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-10 12:11:59 +00:00
Rename BeaconStateTypes to EthSpec
This commit is contained in:
@@ -9,15 +9,15 @@ use protos::services_grpc::AttestationService;
|
||||
use slog::{error, info, trace, warn};
|
||||
use ssz::{ssz_encode, Decodable};
|
||||
use std::sync::Arc;
|
||||
use types::{Attestation, BeaconStateTypes};
|
||||
use types::{Attestation, EthSpec};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct AttestationServiceInstance<B: BeaconStateTypes> {
|
||||
pub struct AttestationServiceInstance<B: EthSpec> {
|
||||
pub chain: Arc<BeaconChain<B>>,
|
||||
pub log: slog::Logger,
|
||||
}
|
||||
|
||||
impl<B: BeaconStateTypes> AttestationService for AttestationServiceInstance<B> {
|
||||
impl<B: EthSpec> AttestationService for AttestationServiceInstance<B> {
|
||||
/// Produce the `AttestationData` for signing by a validator.
|
||||
fn produce_attestation_data(
|
||||
&mut self,
|
||||
|
||||
@@ -13,16 +13,16 @@ use slog::Logger;
|
||||
use slog::{error, info, trace, warn};
|
||||
use ssz::{ssz_encode, Decodable};
|
||||
use std::sync::Arc;
|
||||
use types::{BeaconBlock, BeaconStateTypes, Signature, Slot};
|
||||
use types::{BeaconBlock, EthSpec, Signature, Slot};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct BeaconBlockServiceInstance<B: BeaconStateTypes> {
|
||||
pub struct BeaconBlockServiceInstance<B: EthSpec> {
|
||||
pub chain: Arc<BeaconChain<B>>,
|
||||
pub network_chan: crossbeam_channel::Sender<NetworkMessage>,
|
||||
pub log: Logger,
|
||||
}
|
||||
|
||||
impl<B: BeaconStateTypes> BeaconBlockService for BeaconBlockServiceInstance<B> {
|
||||
impl<B: EthSpec> BeaconBlockService for BeaconBlockServiceInstance<B> {
|
||||
/// Produce a `BeaconBlock` for signing by a validator.
|
||||
fn produce_beacon_block(
|
||||
&mut self,
|
||||
|
||||
@@ -8,10 +8,10 @@ use beacon_chain::{
|
||||
AttestationValidationError, BlockProductionError,
|
||||
};
|
||||
pub use beacon_chain::{BeaconChainError, BlockProcessingOutcome};
|
||||
use types::{Attestation, AttestationData, BeaconBlock, BeaconStateTypes};
|
||||
use types::{Attestation, AttestationData, BeaconBlock, EthSpec};
|
||||
|
||||
/// The RPC's API to the beacon chain.
|
||||
pub trait BeaconChain<B: BeaconStateTypes>: Send + Sync {
|
||||
pub trait BeaconChain<B: EthSpec>: Send + Sync {
|
||||
fn get_spec(&self) -> &ChainSpec;
|
||||
|
||||
fn get_state(&self) -> RwLockReadGuard<BeaconState<B>>;
|
||||
@@ -39,7 +39,7 @@ where
|
||||
T: ClientDB + Sized,
|
||||
U: SlotClock,
|
||||
F: ForkChoice,
|
||||
B: BeaconStateTypes,
|
||||
B: EthSpec,
|
||||
{
|
||||
fn get_spec(&self) -> &ChainSpec {
|
||||
&self.spec
|
||||
|
||||
@@ -5,15 +5,15 @@ use protos::services::{Empty, Fork, NodeInfoResponse};
|
||||
use protos::services_grpc::BeaconNodeService;
|
||||
use slog::{trace, warn};
|
||||
use std::sync::Arc;
|
||||
use types::BeaconStateTypes;
|
||||
use types::EthSpec;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct BeaconNodeServiceInstance<B: BeaconStateTypes> {
|
||||
pub struct BeaconNodeServiceInstance<B: EthSpec> {
|
||||
pub chain: Arc<BeaconChain<B>>,
|
||||
pub log: slog::Logger,
|
||||
}
|
||||
|
||||
impl<B: BeaconStateTypes> BeaconNodeService for BeaconNodeServiceInstance<B> {
|
||||
impl<B: EthSpec> BeaconNodeService for BeaconNodeServiceInstance<B> {
|
||||
/// Provides basic node information.
|
||||
fn info(&mut self, ctx: RpcContext, _req: Empty, sink: UnarySink<NodeInfoResponse>) {
|
||||
trace!(self.log, "Node info requested via RPC");
|
||||
|
||||
@@ -21,9 +21,9 @@ use protos::services_grpc::{
|
||||
use slog::{info, o, warn};
|
||||
use std::sync::Arc;
|
||||
use tokio::runtime::TaskExecutor;
|
||||
use types::BeaconStateTypes;
|
||||
use types::EthSpec;
|
||||
|
||||
pub fn start_server<B: BeaconStateTypes>(
|
||||
pub fn start_server<B: EthSpec>(
|
||||
config: &RPCConfig,
|
||||
executor: &TaskExecutor,
|
||||
network_chan: crossbeam_channel::Sender<NetworkMessage>,
|
||||
|
||||
@@ -7,16 +7,16 @@ use protos::services_grpc::ValidatorService;
|
||||
use slog::{trace, warn};
|
||||
use ssz::decode;
|
||||
use std::sync::Arc;
|
||||
use types::{BeaconStateTypes, Epoch, RelativeEpoch};
|
||||
use types::{Epoch, EthSpec, RelativeEpoch};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ValidatorServiceInstance<B: BeaconStateTypes> {
|
||||
pub struct ValidatorServiceInstance<B: EthSpec> {
|
||||
pub chain: Arc<BeaconChain<B>>,
|
||||
pub log: slog::Logger,
|
||||
}
|
||||
//TODO: Refactor Errors
|
||||
|
||||
impl<B: BeaconStateTypes> ValidatorService for ValidatorServiceInstance<B> {
|
||||
impl<B: EthSpec> ValidatorService for ValidatorServiceInstance<B> {
|
||||
/// For a list of validator public keys, this function returns the slot at which each
|
||||
/// validator must propose a block, attest to a shard, their shard committee and the shard they
|
||||
/// need to attest to.
|
||||
|
||||
Reference in New Issue
Block a user