mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 01:05:47 +00:00
Resolve some FIXMEs
This commit is contained in:
@@ -32,6 +32,7 @@ pub enum Error {
|
|||||||
BeaconState(BeaconStateError),
|
BeaconState(BeaconStateError),
|
||||||
Arith(ArithError),
|
Arith(ArithError),
|
||||||
InvalidValidatorIndex(usize),
|
InvalidValidatorIndex(usize),
|
||||||
|
InconsistentTotalActiveBalance { cached: u64, computed: u64 },
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<BeaconStateError> for Error {
|
impl From<BeaconStateError> for Error {
|
||||||
@@ -103,21 +104,18 @@ impl SingleEpochParticipationCache {
|
|||||||
.ok_or(Error::InvalidFlagIndex(flag_index))
|
.ok_or(Error::InvalidFlagIndex(flag_index))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Process an **active** validator, reading from the `state` with respect to the
|
/// Process an **active** validator, reading from the `epoch_participation` with respect to the
|
||||||
/// `relative_epoch`.
|
/// `relative_epoch`.
|
||||||
///
|
///
|
||||||
/// ## Errors
|
/// ## Errors
|
||||||
///
|
///
|
||||||
/// - The provided `state` **must** be Altair. An error will be returned otherwise.
|
|
||||||
/// - An error will be returned if the `val_index` validator is inactive at the given
|
/// - An error will be returned if the `val_index` validator is inactive at the given
|
||||||
/// `relative_epoch`.
|
/// `relative_epoch`.
|
||||||
fn process_active_validator<T: EthSpec>(
|
fn process_active_validator(
|
||||||
&mut self,
|
&mut self,
|
||||||
val_index: usize,
|
val_index: usize,
|
||||||
validator: &Validator,
|
validator: &Validator,
|
||||||
epoch_participation: &ParticipationFlags,
|
epoch_participation: &ParticipationFlags,
|
||||||
// FIXME(sproul): remove state argument
|
|
||||||
_state: &BeaconState<T>,
|
|
||||||
current_epoch: Epoch,
|
current_epoch: Epoch,
|
||||||
relative_epoch: RelativeEpoch,
|
relative_epoch: RelativeEpoch,
|
||||||
) -> Result<(), BeaconStateError> {
|
) -> Result<(), BeaconStateError> {
|
||||||
@@ -269,7 +267,6 @@ impl ParticipationCache {
|
|||||||
val_index,
|
val_index,
|
||||||
val,
|
val,
|
||||||
curr_epoch_flags,
|
curr_epoch_flags,
|
||||||
state,
|
|
||||||
current_epoch,
|
current_epoch,
|
||||||
RelativeEpoch::Current,
|
RelativeEpoch::Current,
|
||||||
)?;
|
)?;
|
||||||
@@ -282,7 +279,6 @@ impl ParticipationCache {
|
|||||||
val_index,
|
val_index,
|
||||||
val,
|
val,
|
||||||
prev_epoch_flags,
|
prev_epoch_flags,
|
||||||
state,
|
|
||||||
current_epoch,
|
current_epoch,
|
||||||
RelativeEpoch::Previous,
|
RelativeEpoch::Previous,
|
||||||
)?;
|
)?;
|
||||||
@@ -341,11 +337,14 @@ impl ParticipationCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sanity check total active balance.
|
// Sanity check total active balance.
|
||||||
// FIXME(sproul): assert
|
if current_epoch_participation.total_active_balance.get()
|
||||||
assert_eq!(
|
!= current_epoch_total_active_balance
|
||||||
current_epoch_participation.total_active_balance.get(),
|
{
|
||||||
current_epoch_total_active_balance
|
return Err(Error::InconsistentTotalActiveBalance {
|
||||||
);
|
cached: current_epoch_total_active_balance,
|
||||||
|
computed: current_epoch_participation.total_active_balance.get(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
current_epoch,
|
current_epoch,
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ pub struct BeaconStateDiff<T: EthSpec> {
|
|||||||
slashings: VectorDiff<u64, T::EpochsPerSlashingsVector>,
|
slashings: VectorDiff<u64, T::EpochsPerSlashingsVector>,
|
||||||
|
|
||||||
// Attestations (genesis fork only)
|
// Attestations (genesis fork only)
|
||||||
// FIXME(sproul): do some clever diffing of prev against former current
|
|
||||||
previous_epoch_attestations:
|
previous_epoch_attestations:
|
||||||
Maybe<ResetListDiff<PendingAttestation<T>, T::MaxPendingAttestations>>,
|
Maybe<ResetListDiff<PendingAttestation<T>, T::MaxPendingAttestations>>,
|
||||||
current_epoch_attestations:
|
current_epoch_attestations:
|
||||||
|
|||||||
Reference in New Issue
Block a user