mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-11 18:04:18 +00:00
Fix Rust 1.61 clippy lints (#3192)
## Issue Addressed This fixes the low-hanging Clippy lints introduced in Rust 1.61 (due any hour now). It _ignores_ one lint, because fixing it requires a structural refactor of the validator client that needs to be done delicately. I've started on that refactor and will create another PR that can be reviewed in more depth in the coming days. I think we should merge this PR in the meantime to unblock CI.
This commit is contained in:
@@ -199,7 +199,8 @@ impl<T: SlotClock + 'static, E: EthSpec> PreparationService<T, E> {
|
||||
.map_err(|e| {
|
||||
error!(
|
||||
log,
|
||||
"{}", format!("Error loading fee-recipient file: {:?}", e);
|
||||
"Error loading fee-recipient file";
|
||||
"error" => ?e
|
||||
);
|
||||
})
|
||||
.unwrap_or(());
|
||||
@@ -213,44 +214,39 @@ impl<T: SlotClock + 'static, E: EthSpec> PreparationService<T, E> {
|
||||
all_pubkeys
|
||||
.into_iter()
|
||||
.filter_map(|pubkey| {
|
||||
let validator_index = self.validator_store.validator_index(&pubkey);
|
||||
if let Some(validator_index) = validator_index {
|
||||
let fee_recipient = if let Some(from_validator_defs) =
|
||||
self.validator_store.suggested_fee_recipient(&pubkey)
|
||||
{
|
||||
// If there is a `suggested_fee_recipient` in the validator definitions yaml
|
||||
// file, use that value.
|
||||
Some(from_validator_defs)
|
||||
} else {
|
||||
// If there's nothing in the validator defs file, check the fee recipient
|
||||
// file.
|
||||
fee_recipient_file
|
||||
.as_ref()
|
||||
.and_then(|f| match f.get_fee_recipient(&pubkey) {
|
||||
Ok(f) => f,
|
||||
Err(_e) => None,
|
||||
})
|
||||
// If there's nothing in the file, try the process-level default value.
|
||||
.or(self.fee_recipient)
|
||||
};
|
||||
// Ignore fee recipients for keys without indices, they are inactive.
|
||||
let validator_index = self.validator_store.validator_index(&pubkey)?;
|
||||
|
||||
if let Some(fee_recipient) = fee_recipient {
|
||||
Some(ProposerPreparationData {
|
||||
validator_index,
|
||||
fee_recipient,
|
||||
})
|
||||
} else {
|
||||
if spec.bellatrix_fork_epoch.is_some() {
|
||||
error!(
|
||||
log,
|
||||
"Validator is missing fee recipient";
|
||||
"msg" => "update validator_definitions.yml",
|
||||
"pubkey" => ?pubkey
|
||||
);
|
||||
}
|
||||
None
|
||||
}
|
||||
// If there is a `suggested_fee_recipient` in the validator definitions yaml
|
||||
// file, use that value.
|
||||
let fee_recipient = self
|
||||
.validator_store
|
||||
.suggested_fee_recipient(&pubkey)
|
||||
.or_else(|| {
|
||||
// If there's nothing in the validator defs file, check the fee
|
||||
// recipient file.
|
||||
fee_recipient_file
|
||||
.as_ref()?
|
||||
.get_fee_recipient(&pubkey)
|
||||
.ok()?
|
||||
})
|
||||
// If there's nothing in the file, try the process-level default value.
|
||||
.or(self.fee_recipient);
|
||||
|
||||
if let Some(fee_recipient) = fee_recipient {
|
||||
Some(ProposerPreparationData {
|
||||
validator_index,
|
||||
fee_recipient,
|
||||
})
|
||||
} else {
|
||||
if spec.bellatrix_fork_epoch.is_some() {
|
||||
error!(
|
||||
log,
|
||||
"Validator is missing fee recipient";
|
||||
"msg" => "update validator_definitions.yml",
|
||||
"pubkey" => ?pubkey
|
||||
);
|
||||
}
|
||||
None
|
||||
}
|
||||
})
|
||||
|
||||
@@ -171,6 +171,8 @@ impl<T: SlotClock + 'static, E: EthSpec> ValidatorStore<T, E> {
|
||||
/// - Adding the validator definition to the YAML file, saving it to the filesystem.
|
||||
/// - Enabling the validator with the slashing protection database.
|
||||
/// - If `enable == true`, starting to perform duties for the validator.
|
||||
// FIXME: ignore this clippy lint until the validator store is refactored to use async locks
|
||||
#[allow(clippy::await_holding_lock)]
|
||||
pub async fn add_validator(
|
||||
&self,
|
||||
validator_def: ValidatorDefinition,
|
||||
|
||||
Reference in New Issue
Block a user