Fix tests and block rewards API

This commit is contained in:
Michael Sproul
2022-07-07 16:18:34 +10:00
parent ebbf196745
commit 4f98609bee
7 changed files with 162 additions and 98 deletions

View File

@@ -1,8 +1,6 @@
use types::*;
/// Returns validator indices which participated in the attestation, sorted by increasing index.
///
/// Spec v0.12.1
pub fn get_attesting_indices<T: EthSpec>(
committee: &[usize],
bitlist: &BitList<T::MaxValidatorsPerCommittee>,
@@ -23,3 +21,12 @@ pub fn get_attesting_indices<T: EthSpec>(
Ok(indices)
}
/// Shortcut for getting the attesting indices while fetching the committee from the state's cache.
pub fn get_attesting_indices_from_state<T: EthSpec>(
state: &BeaconState<T>,
att: &Attestation<T>,
) -> Result<Vec<u64>, BeaconStateError> {
let committee = state.get_beacon_committee(att.data.slot, att.data.index)?;
get_attesting_indices::<T>(&committee.committee, &att.aggregation_bits)
}

View File

@@ -10,7 +10,7 @@ pub mod base;
pub use deposit_data_tree::DepositDataTree;
pub use get_attestation_participation::get_attestation_participation_flag_indices;
pub use get_attesting_indices::get_attesting_indices;
pub use get_attesting_indices::{get_attesting_indices, get_attesting_indices_from_state};
pub use get_indexed_attestation::get_indexed_attestation;
pub use initiate_validator_exit::initiate_validator_exit;
pub use slash_validator::slash_validator;