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:
Paul Hauner
2023-06-20 11:47:52 +10:00
committed by GitHub
parent 23db089a7a
commit d56cec83fc
26 changed files with 94 additions and 73 deletions

View File

@@ -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.

View File

@@ -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,
}
})

View File

@@ -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,
}
);