pub struct BlockProducerVrfEvaluatorState {
pub status: BlockProducerVrfEvaluatorStatus,
pub won_slots: BTreeMap<u32, VrfWonSlotWithHash>,
pub latest_evaluated_slot: u32,
pub genesis_timestamp: Timestamp,
last_evaluated_epoch: Option<u32>,
pending_evaluation: Option<PendingEvaluation>,
epoch_context: EpochContext,
}Expand description
Vrf evaluator sub-state
Fields§
§status: BlockProducerVrfEvaluatorStatus§won_slots: BTreeMap<u32, VrfWonSlotWithHash>§latest_evaluated_slot: u32§genesis_timestamp: Timestamp§last_evaluated_epoch: Option<u32>§pending_evaluation: Option<PendingEvaluation>§epoch_context: EpochContextImplementations§
Source§impl BlockProducerVrfEvaluatorState
impl BlockProducerVrfEvaluatorState
pub fn new(now: Timestamp) -> Self
Sourcepub fn evaluate_epoch_bounds(global_slot: &u32) -> SlotPositionInEpoch
pub fn evaluate_epoch_bounds(global_slot: &u32) -> SlotPositionInEpoch
Determines the position of a slot within an epoch (at the beginning, end, or within the epoch).
This function calculates the position based on the global_slot and a predefined number of slots per epoch.
Arguments:
global_slot: A reference to a 32-bit unsigned integer representing the global slot number.
Returns:
SlotPositionInEpoch: An enum indicating the slot’s position (Beginning, End, or Within).
Sourcepub fn next_won_slot(
&self,
cur_global_slot: u32,
best_tip: &ArcBlockWithHash,
) -> Option<BlockProducerWonSlot>
pub fn next_won_slot( &self, cur_global_slot: u32, best_tip: &ArcBlockWithHash, ) -> Option<BlockProducerWonSlot>
Fetches the next slot that has been won based on the current global slot and the best tip information.
If there are no future won slots, returns None.
Arguments:
cur_global_slot: The current global slot as a 32-bit unsigned integer.best_tip: A reference to theArcBlockWithHashrepresenting the current best tip.
Returns:
Option<BlockProducerWonSlot>: The next won slot, if any, as aBlockProducerWonSlotorNoneif there are no more slots won in the future.
Sourcepub fn epoch_context(&self) -> &EpochContext
pub fn epoch_context(&self) -> &EpochContext
Retrieves the current epoch context.
Returns:
&EpochContext: A reference to theEpochContext
Sourcepub fn set_epoch_context(&mut self)
pub fn set_epoch_context(&mut self)
Sets the epoch context based on the current evaluation status and the available data.
This method updates the epoch_context field in the ReadinessCheck state
pub fn is_idle(&self) -> bool
pub fn is_initialized(&self) -> bool
Sourcepub fn is_epoch_evaluated(&self, epoch_number: u32) -> bool
pub fn is_epoch_evaluated(&self, epoch_number: u32) -> bool
Determines if a given epoch number has already been evaluated.
Arguments:
epoch_number: The epoch number as a 32-bit unsigned integer to check.
Returns:
bool:trueif the epoch has already been evaluated, otherwisefalse.
Sourcepub fn last_evaluated_epoch(&self) -> Option<u32>
pub fn last_evaluated_epoch(&self) -> Option<u32>
Retrieves the number of the last evaluated epoch, if any.
Returns:
Option<u32>: The epoch number of the last evaluated epoch, orNoneif no epoch has been evaluated yet.
Sourcepub fn latest_evaluated_global_slot(&self) -> u32
pub fn latest_evaluated_global_slot(&self) -> u32
TODO: remove, not needed anymore
Sourcepub fn is_readiness_check(&self) -> bool
pub fn is_readiness_check(&self) -> bool
Returns true if the evaluator is in the ReadinessCheck state, otherwise false.
Sourcepub fn is_epoch_bound_evaluated(&self) -> bool
pub fn is_epoch_bound_evaluated(&self) -> bool
Returns true if the evaluator is in the EpochBoundsCheck state, otherwise false.
Sourcepub fn can_check_next_evaluation(&self) -> bool
pub fn can_check_next_evaluation(&self) -> bool
Returns true if the evaluator is in a state that can perform a ReadinessCheck``, otherwise false`.
Sourcepub fn can_construct_delegator_table(&self) -> bool
pub fn can_construct_delegator_table(&self) -> bool
Returns true if the evaluator is in the ReadyToEvaluate state, otherwise false.
Sourcepub fn is_delegator_table_requested(&self) -> bool
pub fn is_delegator_table_requested(&self) -> bool
Returns true if the evaluator is in the EpochDelegatorTablePending state, otherwise false.
Sourcepub fn is_delegator_table_constructed(&self) -> bool
pub fn is_delegator_table_constructed(&self) -> bool
Returns true if the evaluator is in the EpochDelegatorTableSuccess state, otherwise false.
Sourcepub fn can_start_epoch_evaluation(&self) -> bool
pub fn can_start_epoch_evaluation(&self) -> bool
TODO: redundant fn, remove?
Sourcepub fn is_evaluating(&self) -> bool
pub fn is_evaluating(&self) -> bool
Returns true if the evaluator is in any of the following states: SlotEvaluationPending,
SlotEvaluationReceived, EpochEvaluationPending, EpochBoundsCheck, otherwise false .
pub fn is_evaluation_pending(&self) -> bool
Sourcepub fn is_slot_selection(&self) -> bool
pub fn is_slot_selection(&self) -> bool
Returns true if the evaluator is in the InitialSlotSelection state, otherwise false.
Sourcepub fn is_slot_requested(&self) -> bool
pub fn is_slot_requested(&self) -> bool
Returns true if the evaluator is in the SlotEvaluationPending state, otherwise false.
Sourcepub fn is_slot_evaluated(&self) -> bool
pub fn is_slot_evaluated(&self) -> bool
Returns true if the evaluator is in the SlotEvaluationReceived state, otherwise false.
pub fn set_latest_evaluated_global_slot(&mut self, global_slot: &u32)
pub fn initialize_evaluator(&mut self, _epoch: u32, _last_height: u32)
pub fn set_last_evaluated_epoch(&mut self, epoch_number: u32)
pub fn initial_slot(&self) -> Option<u32>
pub fn get_epoch_bound_from_check(&self) -> Option<SlotPositionInEpoch>
pub fn set_pending_evaluation(&mut self, pending_evaluation: PendingEvaluation)
pub fn unset_pending_evaluation(&mut self)
pub fn current_evaluation(&self) -> Option<PendingEvaluation>
pub fn currently_evaluated_epoch(&self) -> Option<u32>
pub fn construct_vrf_input(&self) -> Option<VrfEvaluatorInput>
pub fn retention_slot(&self, current_epoch_number: &u32) -> u32
pub fn cleanup_old_won_slots(&mut self, current_epoch_number: &u32)
Sourcepub fn vrf_delegator_table_inputs(
&self,
) -> Option<(&LedgerHash, &AccountPublicKey)>
pub fn vrf_delegator_table_inputs( &self, ) -> Option<(&LedgerHash, &AccountPublicKey)>
If we need to construct delegator table, get it’s inputs.
Source§impl BlockProducerVrfEvaluatorState
impl BlockProducerVrfEvaluatorState
pub fn reducer( state_context: Substate<'_, Self>, action: BlockProducerVrfEvaluatorActionWithMetaRef<'_>, )
Trait Implementations§
Source§impl Clone for BlockProducerVrfEvaluatorState
impl Clone for BlockProducerVrfEvaluatorState
Source§fn clone(&self) -> BlockProducerVrfEvaluatorState
fn clone(&self) -> BlockProducerVrfEvaluatorState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'de> Deserialize<'de> for BlockProducerVrfEvaluatorState
impl<'de> Deserialize<'de> for BlockProducerVrfEvaluatorState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl SubstateAccess<BlockProducerVrfEvaluatorState> for State
impl SubstateAccess<BlockProducerVrfEvaluatorState> for State
Source§fn substate(&self) -> SubstateResult<&BlockProducerVrfEvaluatorState>
fn substate(&self) -> SubstateResult<&BlockProducerVrfEvaluatorState>
Source§fn substate_mut(
&mut self,
) -> SubstateResult<&mut BlockProducerVrfEvaluatorState>
fn substate_mut( &mut self, ) -> SubstateResult<&mut BlockProducerVrfEvaluatorState>
Auto Trait Implementations§
impl Freeze for BlockProducerVrfEvaluatorState
impl RefUnwindSafe for BlockProducerVrfEvaluatorState
impl Send for BlockProducerVrfEvaluatorState
impl Sync for BlockProducerVrfEvaluatorState
impl Unpin for BlockProducerVrfEvaluatorState
impl UnsafeUnpin for BlockProducerVrfEvaluatorState
impl UnwindSafe for BlockProducerVrfEvaluatorState
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for 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,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§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> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§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 more§fn 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 more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
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) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
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)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn 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.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.