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

@@ -336,17 +336,17 @@ mod custom_tests {
fn assert_exited(state: &BeaconState<E>, validator_index: usize) {
let spec = E::default_spec();
let validator = &state.validators()[validator_index];
let validator = &state.validators().get(validator_index).unwrap();
assert_eq!(
validator.exit_epoch,
validator.exit_epoch(),
// This is correct until we exceed the churn limit. If that happens, we
// need to introduce more complex logic.
state.current_epoch() + 1 + spec.max_seed_lookahead,
"exit epoch"
);
assert_eq!(
validator.withdrawable_epoch,
validator.exit_epoch + E::default_spec().min_validator_withdrawability_delay,
validator.withdrawable_epoch(),
validator.exit_epoch() + E::default_spec().min_validator_withdrawability_delay,
"withdrawable epoch"
);
}