[][src]Struct types::beacon_state::CommitteeCache

pub struct CommitteeCache { /* fields omitted */ }

Computes and stores the shuffling for an epoch. Provides various getters to allow callers to read the committees for the given epoch.

Methods

impl CommitteeCache[src]

pub fn initialized<T: EthSpec>(
    state: &BeaconState<T>,
    epoch: Epoch,
    spec: &ChainSpec
) -> Result<CommitteeCache, Error>
[src]

Return a new, fully initialized cache.

Spec v0.8.1

pub fn compute_start_shard<T: EthSpec>(
    state: &BeaconState<T>,
    relative_epoch: RelativeEpoch,
    active_validator_count: usize,
    spec: &ChainSpec
) -> u64
[src]

Compute the shard which must be attested to first in a given relative epoch.

The active_validator_count must be the number of validators active at relative_epoch.

Spec v0.8.1

pub fn is_initialized_at(&self, epoch: Epoch) -> bool[src]

Returns true if the cache has been initialized at the supplied epoch.

An non-initialized cache does not provide any useful information.

Important traits for &'_ mut [u8]
pub fn active_validator_indices(&self) -> &[usize][src]

Returns the shuffled list of active validator indices for the initialized epoch.

These indices are not in ascending order.

Always returns &[] for a non-initialized epoch.

Spec v0.8.1

Important traits for &'_ mut [u8]
pub fn shuffling(&self) -> &[usize][src]

Returns the shuffled list of active validator indices for the initialized epoch.

Always returns &[] for a non-initialized epoch.

Spec v0.8.1

Return Some(CrosslinkCommittee) if the given shard has a committee during the given epoch.

Always returns None for a non-initialized epoch.

Spec v0.8.1

pub fn get_attestation_duties(
    &self,
    validator_index: usize
) -> Option<AttestationDuty>
[src]

Returns the AttestationDuty for the given validator_index.

Returns None if the validator_index does not exist, does not have duties or Self is non-initialized.

pub fn active_validator_count(&self) -> usize[src]

Returns the number of active validators in the initialized epoch.

Always returns usize::default() for a non-initialized epoch.

Spec v0.8.1

pub fn epoch_committee_count(&self) -> usize[src]

Returns the total number of committees in the initialized epoch.

Always returns usize::default() for a non-initialized epoch.

Spec v0.8.1

pub fn epoch_start_shard(&self) -> u64[src]

Returns the shard assigned to the first committee in the initialized epoch.

Always returns u64::default() for a non-initialized epoch.

Returns all crosslink committees, if any, for the given slot in the initialized epoch.

Returns None if slot is not in the initialized epoch, or if Self is not initialized.

Spec v0.8.1

pub fn first_committee_at_slot(&self, slot: Slot) -> Option<&[usize]>[src]

Returns the first committee of the first slot of the initialized epoch.

Always returns None for a non-initialized epoch.

Spec v0.8.1

Trait Implementations

impl Default for CommitteeCache[src]

impl Clone for CommitteeCache[src]

impl PartialEq<CommitteeCache> for CommitteeCache[src]

impl Debug for CommitteeCache[src]

impl Serialize for CommitteeCache[src]

impl<'de> Deserialize<'de> for CommitteeCache[src]

impl Decode for CommitteeCache[src]

impl Encode for CommitteeCache[src]

Auto Trait Implementations

impl Send for CommitteeCache

impl Unpin for CommitteeCache

impl Sync for CommitteeCache

impl UnwindSafe for CommitteeCache

impl RefUnwindSafe for CommitteeCache

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized