mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-16 12:28:24 +00:00
Merge branch 'unstable' into validator-manager
This commit is contained in:
@@ -60,7 +60,7 @@ impl ApiSecret {
|
||||
// Create and write the secret key to file with appropriate permissions
|
||||
create_with_600_perms(
|
||||
&sk_path,
|
||||
eth2_serde_utils::hex::encode(&sk.serialize()).as_bytes(),
|
||||
eth2_serde_utils::hex::encode(sk.serialize()).as_bytes(),
|
||||
)
|
||||
.map_err(|e| {
|
||||
format!(
|
||||
|
||||
@@ -174,39 +174,40 @@ impl<T: SlotClock + 'static, E: EthSpec> SyncCommitteeService<T, E> {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
// Fetch `block_root` and `execution_optimistic` for `SyncCommitteeContribution`.
|
||||
// Fetch `block_root` with non optimistic execution for `SyncCommitteeContribution`.
|
||||
let response = self
|
||||
.beacon_nodes
|
||||
.first_success(RequireSynced::Yes, OfflineOnFailure::Yes,|beacon_node| async move {
|
||||
beacon_node.get_beacon_blocks_root(BlockId::Head).await
|
||||
})
|
||||
.await
|
||||
.map_err(|e| e.to_string())?
|
||||
.ok_or_else(|| format!("No block root found for slot {}", slot))?;
|
||||
.first_success(
|
||||
RequireSynced::Yes,
|
||||
OfflineOnFailure::Yes,
|
||||
|beacon_node| async move {
|
||||
match beacon_node.get_beacon_blocks_root(BlockId::Head).await {
|
||||
Ok(Some(block)) if block.execution_optimistic == Some(false) => {
|
||||
Ok(block)
|
||||
}
|
||||
Ok(Some(_)) => {
|
||||
Err(format!("To sign sync committee messages for slot {slot} a non-optimistic head block is required"))
|
||||
}
|
||||
Ok(None) => Err(format!("No block root found for slot {}", slot)),
|
||||
Err(e) => Err(e.to_string()),
|
||||
}
|
||||
},
|
||||
)
|
||||
.await;
|
||||
|
||||
let block_root = response.data.root;
|
||||
if let Some(execution_optimistic) = response.execution_optimistic {
|
||||
if execution_optimistic {
|
||||
let block_root = match response {
|
||||
Ok(block) => block.data.root,
|
||||
Err(errs) => {
|
||||
warn!(
|
||||
log,
|
||||
"Refusing to sign sync committee messages for optimistic head block";
|
||||
"Refusing to sign sync committee messages for an optimistic head block or \
|
||||
a block head with unknown optimistic status";
|
||||
"errors" => errs.to_string(),
|
||||
"slot" => slot,
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
} else if let Some(bellatrix_fork_epoch) = self.duties_service.spec.bellatrix_fork_epoch {
|
||||
// If the slot is post Bellatrix, do not sign messages when we cannot verify the
|
||||
// optimistic status of the head block.
|
||||
if slot.epoch(E::slots_per_epoch()) > bellatrix_fork_epoch {
|
||||
warn!(
|
||||
log,
|
||||
"Refusing to sign sync committee messages for a head block with an unknown \
|
||||
optimistic status";
|
||||
"slot" => slot,
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Spawn one task to publish all of the sync committee signatures.
|
||||
let validator_duties = slot_duties.duties;
|
||||
|
||||
Reference in New Issue
Block a user