Make to_electra not fallible

This commit is contained in:
dapplion
2024-06-17 18:18:44 +02:00
parent 1d0e3f4d30
commit 5acc0523df
5 changed files with 25 additions and 63 deletions

View File

@@ -116,11 +116,13 @@ impl<E: EthSpec> IndexedAttestation<E> {
}
}
pub fn to_electra(self) -> Result<IndexedAttestationElectra<E>, ssz_types::Error> {
Ok(match self {
pub fn to_electra(self) -> IndexedAttestationElectra<E> {
match self {
Self::Base(att) => {
let extended_attesting_indices: VariableList<u64, E::MaxValidatorsPerSlot> =
VariableList::new(att.attesting_indices.to_vec())?;
VariableList::new(att.attesting_indices.to_vec())
.expect("MaxValidatorsPerSlot must be >= MaxValidatorsPerCommittee");
// TODO: Add test after unstable rebase https://github.com/sigp/lighthouse/blob/474c1b44863927c588dd05ab2ac0f934298398e1/consensus/types/src/eth_spec.rs#L541
IndexedAttestationElectra {
attesting_indices: extended_attesting_indices,
@@ -129,7 +131,7 @@ impl<E: EthSpec> IndexedAttestation<E> {
}
}
Self::Electra(att) => att,
})
}
}
}