mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 19:02:42 +00:00
superstruct the AttesterSlashing (#5636)
* `superstruct` Attester Fork Variants * Push a little further * Deal with Encode / Decode of AttesterSlashing * not so sure about this.. * Stop Encode/Decode Bounds from Propagating Out * Tons of Changes.. * More Conversions to AttestationRef * Add AsReference trait (#15) * Add AsReference trait * Fix some snafus * Got it Compiling! :D * Got Tests Building * Get beacon chain tests compiling --------- Co-authored-by: Michael Sproul <micsproul@gmail.com>
This commit is contained in:
@@ -25,14 +25,14 @@ pub fn get_attesting_indices<E: EthSpec>(
|
||||
/// Shortcut for getting the attesting indices while fetching the committee from the state's cache.
|
||||
pub fn get_attesting_indices_from_state<E: EthSpec>(
|
||||
state: &BeaconState<E>,
|
||||
att: &Attestation<E>,
|
||||
att: AttestationRef<E>,
|
||||
) -> Result<Vec<u64>, BeaconStateError> {
|
||||
let committee = state.get_beacon_committee(att.data().slot, att.data().index)?;
|
||||
match att {
|
||||
Attestation::Base(att) => {
|
||||
AttestationRef::Base(att) => {
|
||||
get_attesting_indices::<E>(committee.committee, &att.aggregation_bits)
|
||||
}
|
||||
// TODO(electra) implement get_attesting_indices for electra
|
||||
Attestation::Electra(_) => todo!(),
|
||||
AttestationRef::Electra(_) => todo!(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,12 +9,12 @@ type Result<T> = std::result::Result<T, BlockOperationError<Invalid>>;
|
||||
/// Spec v0.12.1
|
||||
pub fn get_indexed_attestation<E: EthSpec>(
|
||||
committee: &[usize],
|
||||
attestation: &Attestation<E>,
|
||||
attestation: AttestationRef<E>,
|
||||
) -> Result<IndexedAttestation<E>> {
|
||||
let attesting_indices = match attestation {
|
||||
Attestation::Base(att) => get_attesting_indices::<E>(committee, &att.aggregation_bits)?,
|
||||
AttestationRef::Base(att) => get_attesting_indices::<E>(committee, &att.aggregation_bits)?,
|
||||
// TODO(electra) implement get_attesting_indices for electra
|
||||
Attestation::Electra(_) => todo!(),
|
||||
AttestationRef::Electra(_) => todo!(),
|
||||
};
|
||||
|
||||
Ok(IndexedAttestation::Base(IndexedAttestationBase {
|
||||
|
||||
Reference in New Issue
Block a user