Struct mina_consensus::common::ProtocolStateChain
source · [−]pub struct ProtocolStateChain<T>(pub Vec<T>)
where
T: ProtocolStateHeader;
Expand description
A chain of ProtocolState
Tuple Fields
0: Vec<T>
Implementations
sourceimpl<T> ProtocolStateChain<T>where
T: ProtocolStateHeader,
impl<T> ProtocolStateChain<T>where
T: ProtocolStateHeader,
sourcepub fn push(&mut self, new: T) -> Result<(), ConsensusError>
pub fn push(&mut self, new: T) -> Result<(), ConsensusError>
Pushes an item into the chain
sourcepub fn top(&self) -> Option<&T>
pub fn top(&self) -> Option<&T>
This function returns the last block of a given chain. The input is a chain C and the output is last block of C (i.e. the block with greatest height).
sourcepub fn consensus_state(&self) -> Option<&ConsensusState>
pub fn consensus_state(&self) -> Option<&ConsensusState>
he function returns the consensus state of a block or chain. The input is a block or chain X and the output is the consensus state.
sourcepub fn genesis_block(&self) -> Option<&T>
pub fn genesis_block(&self) -> Option<&T>
Gets ProtocolState of the genesis block
sourcepub fn global_slot(&self) -> Option<&GlobalSlot>
pub fn global_slot(&self) -> Option<&GlobalSlot>
The function returns the global slot number of a chain or block. The input X is either a chain or block and the output is the global slot number.
sourcepub fn epoch_slot(&self) -> Option<u32>
pub fn epoch_slot(&self) -> Option<u32>
The function computes the epoch slot number of a block. The output is the epoch slot number in [0, slots_per_epoch].
sourcepub fn length(&self) -> usize
pub fn length(&self) -> usize
The function the length of a chain. The output is the length of the chain in blocks.
sourcepub fn last_vrf_hash_digest(&self) -> Result<String, ConsensusError>
pub fn last_vrf_hash_digest(&self) -> Result<String, ConsensusError>
This function returns the hex digest of the hash of the last VRF output of a given chain. The input is a chain C and the output is the hash digest.
sourcepub fn state_hash(&self) -> Option<Fp>
pub fn state_hash(&self) -> Option<Fp>
This function returns hash of the top block’s protocol state for a given chain. The input is a chain C and the output is the hash.
Trait Implementations
sourceimpl<T> ChainSelection for ProtocolStateChain<T>where
T: ProtocolStateHeader,
impl<T> ChainSelection for ProtocolStateChain<T>where
T: ProtocolStateHeader,
sourcefn relative_min_window_density(
&self,
chain_b: &Self
) -> Result<u32, ConsensusError>
fn relative_min_window_density(
&self,
chain_b: &Self
) -> Result<u32, ConsensusError>
Computes the relative minimum window density of the given chains. The minimum density value is used in the case of a long range fork and the chain with the higher relative minimum window density is chosen as the canonical chain. The need for relative density is explained here: https://github.com/MinaProtocol/mina/blob/02dfc3ff0160ba3c1bbc732baa07502fe4312b04/docs/specs/consensus/README.md#5412-relative-minimum-window-density
sourcefn select_secure_chain(
&mut self,
candidates: Vec<Self>
) -> Result<(), ConsensusError>
fn select_secure_chain(
&mut self,
candidates: Vec<Self>
) -> Result<(), ConsensusError>
sourcefn select_longer_chain(&mut self, candidate: Self) -> Result<(), ConsensusError>
fn select_longer_chain(&mut self, candidate: Self) -> Result<(), ConsensusError>
sourcefn is_short_range(&self, candidate: &Self) -> Result<bool, ConsensusError>
fn is_short_range(&self, candidate: &Self) -> Result<bool, ConsensusError>
sourcefn config(&self) -> ConsensusConstants
fn config(&self) -> ConsensusConstants
sourceimpl<T: Clone> Clone for ProtocolStateChain<T>where
T: ProtocolStateHeader,
impl<T: Clone> Clone for ProtocolStateChain<T>where
T: ProtocolStateHeader,
sourcefn clone(&self) -> ProtocolStateChain<T>
fn clone(&self) -> ProtocolStateChain<T>
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl<T: Debug> Debug for ProtocolStateChain<T>where
T: ProtocolStateHeader,
impl<T: Debug> Debug for ProtocolStateChain<T>where
T: ProtocolStateHeader,
sourceimpl<T: Default> Default for ProtocolStateChain<T>where
T: ProtocolStateHeader,
impl<T: Default> Default for ProtocolStateChain<T>where
T: ProtocolStateHeader,
sourcefn default() -> ProtocolStateChain<T>
fn default() -> ProtocolStateChain<T>
sourceimpl<T: PartialEq> PartialEq<ProtocolStateChain<T>> for ProtocolStateChain<T>where
T: ProtocolStateHeader,
impl<T: PartialEq> PartialEq<ProtocolStateChain<T>> for ProtocolStateChain<T>where
T: ProtocolStateHeader,
sourcefn eq(&self, other: &ProtocolStateChain<T>) -> bool
fn eq(&self, other: &ProtocolStateChain<T>) -> bool
impl<T: Eq> Eq for ProtocolStateChain<T>where
T: ProtocolStateHeader,
impl<T> StructuralEq for ProtocolStateChain<T>where
T: ProtocolStateHeader,
impl<T> StructuralPartialEq for ProtocolStateChain<T>where
T: ProtocolStateHeader,
Auto Trait Implementations
impl<T> RefUnwindSafe for ProtocolStateChain<T>where
T: RefUnwindSafe,
impl<T> Send for ProtocolStateChain<T>where
T: Send,
impl<T> Sync for ProtocolStateChain<T>where
T: Sync,
impl<T> Unpin for ProtocolStateChain<T>where
T: Unpin,
impl<T> UnwindSafe for ProtocolStateChain<T>where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> FmtForward for T
impl<T> FmtForward for T
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read morefn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read morefn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
self
, then passes self.as_ref()
into the pipe function.fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> Rwhere
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> Rwhere
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
self
, then passes self.deref()
into the pipe function.impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Tap for T
impl<T> Tap for T
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
Borrow<B>
of a value. Read morefn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
BorrowMut<B>
of a value. Read morefn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
AsRef<R>
view of a value. Read morefn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
AsMut<R>
view of a value. Read morefn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
Deref::Target
of a value. Read morefn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
Deref::Target
of a value. Read morefn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds. Read morefn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
.tap_borrow()
only in debug builds, and is erased in release
builds. Read morefn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
.tap_borrow_mut()
only in debug builds, and is erased in release
builds. Read morefn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
.tap_ref()
only in debug builds, and is erased in release
builds. Read morefn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
.tap_ref_mut()
only in debug builds, and is erased in release
builds. Read more