mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 02:42:38 +00:00
Address clippy lints in tree-states (#4414)
* Address some clippy lints * Box errors to fix error size lint * Add Default impl for Validator * Address more clippy lints * Re-implement `check_state_diff` * Fix misc test compile errors
This commit is contained in:
@@ -329,9 +329,11 @@ pub enum AttestationInvalid {
|
||||
///
|
||||
/// `is_current` is `true` if the attestation was compared to the
|
||||
/// `state.current_justified_checkpoint`, `false` if compared to `state.previous_justified_checkpoint`.
|
||||
///
|
||||
/// Checkpoints have been boxed to keep the error size down and prevent clippy failures.
|
||||
WrongJustifiedCheckpoint {
|
||||
state: Checkpoint,
|
||||
attestation: Checkpoint,
|
||||
state: Box<Checkpoint>,
|
||||
attestation: Box<Checkpoint>,
|
||||
is_current: bool,
|
||||
},
|
||||
/// The aggregation bitfield length is not the smallest possible size to represent the committee.
|
||||
|
||||
@@ -451,8 +451,8 @@ async fn invalid_attestation_wrong_justified_checkpoint() {
|
||||
Err(BlockProcessingError::AttestationInvalid {
|
||||
index: 0,
|
||||
reason: AttestationInvalid::WrongJustifiedCheckpoint {
|
||||
state: old_justified_checkpoint,
|
||||
attestation: new_justified_checkpoint,
|
||||
state: Box::new(old_justified_checkpoint),
|
||||
attestation: Box::new(new_justified_checkpoint),
|
||||
is_current: true,
|
||||
}
|
||||
})
|
||||
|
||||
@@ -93,8 +93,8 @@ fn verify_casper_ffg_vote<T: EthSpec>(
|
||||
verify!(
|
||||
data.source == state.current_justified_checkpoint(),
|
||||
Invalid::WrongJustifiedCheckpoint {
|
||||
state: state.current_justified_checkpoint(),
|
||||
attestation: data.source,
|
||||
state: Box::new(state.current_justified_checkpoint()),
|
||||
attestation: Box::new(data.source),
|
||||
is_current: true,
|
||||
}
|
||||
);
|
||||
@@ -103,8 +103,8 @@ fn verify_casper_ffg_vote<T: EthSpec>(
|
||||
verify!(
|
||||
data.source == state.previous_justified_checkpoint(),
|
||||
Invalid::WrongJustifiedCheckpoint {
|
||||
state: state.previous_justified_checkpoint(),
|
||||
attestation: data.source,
|
||||
state: Box::new(state.previous_justified_checkpoint()),
|
||||
attestation: Box::new(data.source),
|
||||
is_current: false,
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user