mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 18:21:45 +00:00
Add PendingAttestationInElectra
This commit is contained in:
@@ -89,6 +89,7 @@ pub enum BlockProcessingError {
|
|||||||
found: Hash256,
|
found: Hash256,
|
||||||
},
|
},
|
||||||
WithdrawalCredentialsInvalid,
|
WithdrawalCredentialsInvalid,
|
||||||
|
PendingAttestationInElectra,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<BeaconStateError> for BlockProcessingError {
|
impl From<BeaconStateError> for BlockProcessingError {
|
||||||
|
|||||||
@@ -76,33 +76,30 @@ pub mod base {
|
|||||||
)
|
)
|
||||||
.map_err(|e| e.into_with_index(i))?;
|
.map_err(|e| e.into_with_index(i))?;
|
||||||
|
|
||||||
match attestation {
|
let AttestationRef::Base(attestation) = attestation else {
|
||||||
AttestationRef::Base(att) => {
|
// Pending attestations have been deprecated in a altair, this branch should
|
||||||
let pending_attestation = PendingAttestation {
|
// never happen
|
||||||
aggregation_bits: att.aggregation_bits.clone(),
|
return Err(BlockProcessingError::PendingAttestationInElectra);
|
||||||
data: att.data.clone(),
|
|
||||||
inclusion_delay: state.slot().safe_sub(att.data.slot)?.as_u64(),
|
|
||||||
proposer_index,
|
|
||||||
};
|
|
||||||
|
|
||||||
if attestation.data().target.epoch == state.current_epoch() {
|
|
||||||
state
|
|
||||||
.as_base_mut()?
|
|
||||||
.current_epoch_attestations
|
|
||||||
.push(pending_attestation)?;
|
|
||||||
} else {
|
|
||||||
state
|
|
||||||
.as_base_mut()?
|
|
||||||
.previous_epoch_attestations
|
|
||||||
.push(pending_attestation)?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
AttestationRef::Electra(_) => {
|
|
||||||
// TODO(electra) pending attestations are only phase 0
|
|
||||||
// so we should just raise a relevant error here
|
|
||||||
todo!()
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let pending_attestation = PendingAttestation {
|
||||||
|
aggregation_bits: attestation.aggregation_bits.clone(),
|
||||||
|
data: attestation.data.clone(),
|
||||||
|
inclusion_delay: state.slot().safe_sub(attestation.data.slot)?.as_u64(),
|
||||||
|
proposer_index,
|
||||||
|
};
|
||||||
|
|
||||||
|
if attestation.data.target.epoch == state.current_epoch() {
|
||||||
|
state
|
||||||
|
.as_base_mut()?
|
||||||
|
.current_epoch_attestations
|
||||||
|
.push(pending_attestation)?;
|
||||||
|
} else {
|
||||||
|
state
|
||||||
|
.as_base_mut()?
|
||||||
|
.previous_epoch_attestations
|
||||||
|
.push(pending_attestation)?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Reference in New Issue
Block a user