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

@@ -211,20 +211,20 @@ pub async fn get_validators(bn: &BeaconNodeHttpClient) -> Result<HashSet<WatchVa
for val in validators {
// Only store `activation_epoch` if it not the `FAR_FUTURE_EPOCH`.
let activation_epoch = if val.validator.activation_epoch.as_u64() == FAR_FUTURE_EPOCH {
let activation_epoch = if val.validator.activation_epoch().as_u64() == FAR_FUTURE_EPOCH {
None
} else {
Some(val.validator.activation_epoch.as_u64() as i32)
Some(val.validator.activation_epoch().as_u64() as i32)
};
// Only store `exit_epoch` if it is not the `FAR_FUTURE_EPOCH`.
let exit_epoch = if val.validator.exit_epoch.as_u64() == FAR_FUTURE_EPOCH {
let exit_epoch = if val.validator.exit_epoch().as_u64() == FAR_FUTURE_EPOCH {
None
} else {
Some(val.validator.exit_epoch.as_u64() as i32)
Some(val.validator.exit_epoch().as_u64() as i32)
};
validator_map.insert(WatchValidator {
index: val.index as i32,
public_key: WatchPK::from_pubkey(val.validator.pubkey),
public_key: WatchPK::from_pubkey(*val.validator.pubkey),
status: val.status.to_string(),
activation_epoch,
exit_epoch,