Skip to content

Commit

Permalink
use option to support mainnet
Browse files Browse the repository at this point in the history
  • Loading branch information
jianlinjiang authored and mlbones666 committed Nov 20, 2024
1 parent 56c27a3 commit 781bc69
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
32 changes: 18 additions & 14 deletions src/node/dvfcore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ pub struct DvfDutyCheckMessage {
pub data: Vec<u8>,
#[serde(skip_serializing_if = "Option::is_none")]
pub sign_hex: Option<String>,
pub pubkey: Vec<u8>
pub pubkey: Option<Vec<u8>>
}

impl DvfDutyCheckMessage {
Expand Down Expand Up @@ -417,16 +417,22 @@ impl<E: EthSpec> MessageHandler for DvfDutyCheckHandler<E> {
}
};
let fee_recipient = block.body().execution_payload().unwrap().fee_recipient();
info!("block proposal full block, va pubic key {}, fee recipient {}", hex::encode(check_msg.pubkey.clone()), format!("{0:0x}", fee_recipient));
if !self.db.check_validator_fee_recipient(check_msg.pubkey, fee_recipient).await.unwrap() {
reply(
writer,
DutySafety::Invalid,
format!("fee recipient is not consistent"),
)
.await;
error!("fee recipient is not consistent");
return Ok(());

match check_msg.pubkey {
Some(pubkey) => {
info!("block proposal full block, va pubic key {}, fee recipient {}", hex::encode(&pubkey), format!("{0:0x}", fee_recipient));
if !self.db.check_validator_fee_recipient(pubkey, fee_recipient).await.unwrap() {
reply(
writer,
DutySafety::Invalid,
format!("fee recipient is not consistent"),
)
.await;
error!("fee recipient is not consistent");
return Ok(());
}
}
None => {}
}
self.sign_block(writer, block, check_msg.domain_hash).await;
}
Expand All @@ -445,8 +451,6 @@ impl<E: EthSpec> MessageHandler for DvfDutyCheckHandler<E> {
return Ok(());
}
};
let fee_recipient = block.body().execution_payload().unwrap().fee_recipient();
info!("block proposal blinded block, va pubic key {}, fee recipient {}", hex::encode(check_msg.pubkey.clone()), format!("{0:0x}", fee_recipient));
self.sign_block(writer, block, check_msg.domain_hash).await;
}
};
Expand Down Expand Up @@ -609,7 +613,7 @@ impl DvfSigner {
check_type,
data: data.to_vec(),
sign_hex: None,
pubkey: self.validator_public_key().serialize().to_vec()
pubkey: Some(self.validator_public_key().serialize().to_vec())
};
match msg.sign_digest(&self.node_secret) {
Ok(sign_hex) => msg.sign_hex = Some(sign_hex),
Expand Down
2 changes: 1 addition & 1 deletion src/node/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ pub async fn start_initiator<T: EthSpec>(
secp256k1::SecretKey::from_slice(&secret.0).expect("Unable to load secret key");
let node_public_key = secp256k1::PublicKey::from_secret_key(&secp, &node_secret_key);
if operator_addrs.iter().any(|x| x.is_none()) {
sleep(Duration::from_secs(10)).await;
sleep(Duration::from_secs(5)).await;
return Err("StartInitiator: Insufficient operators discovered for DKG".to_string());
}
let operator_addrs: Vec<SocketAddr> = operator_addrs.iter().map(|x| x.unwrap()).collect();
Expand Down

0 comments on commit 781bc69

Please sign in to comment.