Skip to content

Commit

Permalink
improved logging for key generation
Browse files Browse the repository at this point in the history
  • Loading branch information
SurfingNerd committed Oct 1, 2024
1 parent ca61bf7 commit 68acf28
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
16 changes: 12 additions & 4 deletions crates/ethcore/src/engines/hbbft/contracts/keygen_history.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use client::traits::EngineClient;
use crypto::{self, publickey::Public};
use crypto::{
self,
publickey::{ec_math_utils::public_add, Public},
};
use engines::{
hbbft::{
contracts::validator_set::{get_validator_pubkeys, ValidatorType},
Expand Down Expand Up @@ -46,9 +49,14 @@ pub fn engine_signer_to_synckeygen<'a>(
inner: signer.clone(),
};
let public = match signer.read().as_ref() {
Some(signer) => signer
.public()
.expect("Signer's public key must be available!"),
Some(signer) => {
if let Some(this_public) = signer.public() {
this_public
} else {
error!(target: "engine", "Signer's public key must be available for address {:?}", signer.address());
return Err(hbbft::sync_key_gen::Error::UnknownSender);
}
}
None => Public::from(H512::from_low_u64_be(0)),
};
let mut rng = rand::thread_rng();
Expand Down
14 changes: 11 additions & 3 deletions crates/ethcore/src/engines/hbbft/hbbft_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1161,14 +1161,22 @@ impl HoneyBadgerBFT {
{
if all_available {
let null_signer = Arc::new(RwLock::new(None));
if let Ok(synckeygen) = initialize_synckeygen(
match initialize_synckeygen(
&*client,
&null_signer,
BlockId::Latest,
ValidatorType::Pending,
) {
if synckeygen.is_ready() {
return true;
Ok(synckeygen) => {
if synckeygen.is_ready() {
return true;
}
}
Err(e) => {
error!(target: "consensus", "Error initializing synckeygen: {:?}", e);
}
Err(_) => {
error!(target: "consensus", "Error initializing synckeygen: unknown Error");
}
}
}
Expand Down

0 comments on commit 68acf28

Please sign in to comment.