fix attestation verification

This commit is contained in:
realbigsean
2024-05-08 14:11:22 -04:00
parent 721e73fd82
commit 7abb7621d5

View File

@@ -68,10 +68,20 @@ pub fn verify_attestation_for_state<'ctxt, E: EthSpec>(
) -> Result<IndexedAttestationRef<'ctxt, E>> { ) -> Result<IndexedAttestationRef<'ctxt, E>> {
let data = attestation.data(); let data = attestation.data();
verify!( // TODO(electra) choosing a validation based on the attestation's fork
data.index < state.get_committee_count_at_slot(data.slot)?, // rather than the state's fork makes this simple, but technically the spec
Invalid::BadCommitteeIndex // defines this verification based on the state's fork.
); match attestation {
AttestationRef::Base(_) => {
verify!(
data.index < state.get_committee_count_at_slot(data.slot)?,
Invalid::BadCommitteeIndex
);
}
AttestationRef::Electra(_) => {
verify!(data.index == 0, Invalid::BadCommitteeIndex);
}
}
// Verify the Casper FFG vote. // Verify the Casper FFG vote.
verify_casper_ffg_vote(attestation, state)?; verify_casper_ffg_vote(attestation, state)?;