diff --git a/beacon_chain/types/src/readers/block_reader.rs b/beacon_chain/types/src/readers/block_reader.rs index 1698a0380..91a2852ac 100644 --- a/beacon_chain/types/src/readers/block_reader.rs +++ b/beacon_chain/types/src/readers/block_reader.rs @@ -1,6 +1,15 @@ use crate::{BeaconBlock, Hash256}; +use std::fmt::Debug; -pub trait BeaconBlockReader { +/// The `BeaconBlockReader` provides interfaces for reading a subset of fields of a `BeaconBlock`. +/// +/// The purpose of this trait is to allow reading from either; +/// - a standard `BeaconBlock` struct, or +/// - a SSZ serialized byte array. +/// +/// Note: presently, direct SSZ reading has not been implemented so this trait is being used for +/// "future proofing". +pub trait BeaconBlockReader: Debug + PartialEq { fn slot(&self) -> u64; fn parent_root(&self) -> Hash256; fn state_root(&self) -> Hash256; diff --git a/beacon_chain/types/src/readers/state_reader.rs b/beacon_chain/types/src/readers/state_reader.rs index cbbf0854c..47266bd36 100644 --- a/beacon_chain/types/src/readers/state_reader.rs +++ b/beacon_chain/types/src/readers/state_reader.rs @@ -1,6 +1,15 @@ use crate::{BeaconState, Hash256}; +use std::fmt::Debug; -pub trait BeaconStateReader { +/// The `BeaconStateReader` provides interfaces for reading a subset of fields of a `BeaconState`. +/// +/// The purpose of this trait is to allow reading from either; +/// - a standard `BeaconState` struct, or +/// - a SSZ serialized byte array. +/// +/// Note: presently, direct SSZ reading has not been implemented so this trait is being used for +/// "future proofing". +pub trait BeaconStateReader: Debug + PartialEq { fn slot(&self) -> u64; fn canonical_root(&self) -> Hash256; fn into_beacon_state(self) -> Option;