mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-20 21:34:46 +00:00
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:
@@ -124,18 +124,40 @@ impl<E: EthSpec> EarlyAttesterCache<E> {
|
||||
.get_committee_length::<E>(request_slot, request_index, spec)?;
|
||||
|
||||
// TODO(electra) make fork-agnostic
|
||||
let attestation = Attestation::Base(AttestationBase {
|
||||
aggregation_bits: BitList::with_capacity(committee_len)
|
||||
.map_err(BeaconStateError::from)?,
|
||||
data: AttestationData {
|
||||
slot: request_slot,
|
||||
index: request_index,
|
||||
beacon_block_root: item.beacon_block_root,
|
||||
source: item.source,
|
||||
target: item.target,
|
||||
},
|
||||
signature: AggregateSignature::empty(),
|
||||
});
|
||||
let attestation = if spec.fork_name_at_slot::<E>(request_slot) >= ForkName::Electra {
|
||||
let mut committee_bits = BitVector::default();
|
||||
if committee_len > 0 {
|
||||
committee_bits
|
||||
.set(request_index as usize, true)
|
||||
.map_err(BeaconStateError::from)?;
|
||||
}
|
||||
Attestation::Electra(AttestationElectra {
|
||||
aggregation_bits: BitList::with_capacity(committee_len)
|
||||
.map_err(BeaconStateError::from)?,
|
||||
committee_bits,
|
||||
data: AttestationData {
|
||||
slot: request_slot,
|
||||
index: 0u64,
|
||||
beacon_block_root: item.beacon_block_root,
|
||||
source: item.source,
|
||||
target: item.target,
|
||||
},
|
||||
signature: AggregateSignature::empty(),
|
||||
})
|
||||
} else {
|
||||
Attestation::Base(AttestationBase {
|
||||
aggregation_bits: BitList::with_capacity(committee_len)
|
||||
.map_err(BeaconStateError::from)?,
|
||||
data: AttestationData {
|
||||
slot: request_slot,
|
||||
index: request_index,
|
||||
beacon_block_root: item.beacon_block_root,
|
||||
source: item.source,
|
||||
target: item.target,
|
||||
},
|
||||
signature: AggregateSignature::empty(),
|
||||
})
|
||||
};
|
||||
|
||||
metrics::inc_counter(&metrics::BEACON_EARLY_ATTESTER_CACHE_HITS);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user