EIP7549 get_attestation_indices (#5657)

* get attesting indices electra impl

* fmt

* get tests to pass

* fmt

* fix some beacon chain tests

* fmt

* fix slasher test

* fmt got me again

* fix more tests

* fix tests
This commit is contained in:
Eitan Seri-Levi
2024-05-08 09:32:44 -07:00
committed by GitHub
parent 2c2e44c4ed
commit 90179d4a88
33 changed files with 844 additions and 319 deletions

View File

@@ -132,9 +132,24 @@ impl<E: EthSpec> PackingEfficiencyHandler<E> {
}
}
}
// TODO(electra) implement electra variant
AttestationRef::Electra(_) => {
todo!()
AttestationRef::Electra(attn) => {
for (position, voted) in attn.aggregation_bits.iter().enumerate() {
if voted {
let unique_attestation = UniqueAttestation {
slot: attn.data.slot,
committee_index: attn.data.index,
committee_position: position,
};
let inclusion_distance: u64 = block
.slot()
.as_u64()
.checked_sub(attn.data.slot.as_u64())
.ok_or(PackingEfficiencyError::InvalidAttestationError)?;
self.available_attestations.remove(&unique_attestation);
attestations_in_block.insert(unique_attestation, inclusion_distance);
}
}
}
}
}