From 29584ca08784fd8c4621cb15e5bd358f9f9ddc26 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Tue, 3 Sep 2019 15:56:11 +1000 Subject: [PATCH] Add docs to Eth1Chain --- beacon_node/beacon_chain/src/eth1_chain.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/beacon_node/beacon_chain/src/eth1_chain.rs b/beacon_node/beacon_chain/src/eth1_chain.rs index 3ea37c21d..8e578ea9a 100644 --- a/beacon_node/beacon_chain/src/eth1_chain.rs +++ b/beacon_node/beacon_chain/src/eth1_chain.rs @@ -1,10 +1,11 @@ use crate::BeaconChainTypes; use eth2_hashing::hash; use std::marker::PhantomData; -use types::{BeaconState, Deposit, DepositData, Eth1Data, EthSpec, Hash256}; +use types::{BeaconState, Deposit, Eth1Data, EthSpec, Hash256}; type Result = std::result::Result; +/// Holds an `Eth1ChainBackend` and serves requests from the `BeaconChain`. pub struct Eth1Chain { backend: T::Eth1Chain, } @@ -14,6 +15,8 @@ impl Eth1Chain { Self { backend } } + /// Returns the `Eth1Data` that should be included in a block being produced for the given + /// `state`. pub fn eth1_data_for_block_production( &self, state: &BeaconState, @@ -21,6 +24,10 @@ impl Eth1Chain { self.backend.eth1_data(state) } + /// Returns a list of `Deposits` that may be included in a block. + /// + /// Including all of the returned `Deposits` in a block should _not_ cause it to become + /// invalid. pub fn deposits_for_block_inclusion( &self, state: &BeaconState, @@ -76,7 +83,7 @@ impl Eth1ChainBackend for InteropEth1ChainBackend { }) } - fn queued_deposits(&self, beacon_state: &BeaconState) -> Result> { + fn queued_deposits(&self, _: &BeaconState) -> Result> { Ok(vec![]) } }