Fix slasher tests (#5906)

* Fix electra tests

* Add electra attestations to double vote tests
This commit is contained in:
Pawan Dhananjay
2024-06-13 19:27:36 -07:00
committed by GitHub
parent b21b1086f1
commit 35e07eb0a9
3 changed files with 201 additions and 111 deletions

View File

@@ -63,7 +63,6 @@ pub fn att_slashing(
attestation_1: &IndexedAttestation<E>,
attestation_2: &IndexedAttestation<E>,
) -> AttesterSlashing<E> {
// TODO(electra): fix this one we superstruct IndexedAttestation (return the correct type)
match (attestation_1, attestation_2) {
(IndexedAttestation::Base(att1), IndexedAttestation::Base(att2)) => {
AttesterSlashing::Base(AttesterSlashingBase {
@@ -71,13 +70,11 @@ pub fn att_slashing(
attestation_2: att2.clone(),
})
}
(IndexedAttestation::Electra(att1), IndexedAttestation::Electra(att2)) => {
AttesterSlashing::Electra(AttesterSlashingElectra {
attestation_1: att1.clone(),
attestation_2: att2.clone(),
})
}
_ => panic!("attestations must be of the same type"),
// A slashing involving an electra attestation type must return an electra AttesterSlashing type
(_, _) => AttesterSlashing::Electra(AttesterSlashingElectra {
attestation_1: attestation_1.clone().to_electra().unwrap(),
attestation_2: attestation_2.clone().to_electra().unwrap(),
}),
}
}