Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
Merge branch 'debug/benchmark-interval' of github.com:topos-protocol/…
Browse files Browse the repository at this point in the history
…topos into debug/benchmark-interval
  • Loading branch information
gruberb committed Apr 17, 2024
2 parents f050355 + f9b0ba7 commit e05d1d0
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions crates/topos-tce-broadcast/src/double_echo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ use topos_tce_storage::types::CertificateDeliveredWithPositions;
use topos_tce_storage::validator::ValidatorStore;
use tracing::{debug, error, info, warn};

lazy_static::lazy_static! {
pub static ref TOPOS_CHECK_MESSAGE_SIGNATURE: bool =
std::env::var("TOPOS_CHECK_MESSAGE_SIGNATURE")
.map(|v| v.to_lowercase() == "true")
.ok()
.unwrap_or(true);
}

pub mod broadcast_state;

pub struct DoubleEcho {
Expand Down Expand Up @@ -157,9 +165,11 @@ impl DoubleEcho {
payload.extend_from_slice(certificate_id.as_array());
payload.extend_from_slice(validator_id.as_bytes());

if let Err(e) = self.message_signer.verify_signature(signature, &payload, validator_id.address()) {
debug!("ECHO message signature cannot be verified from: {}", e);
continue;
if *TOPOS_CHECK_MESSAGE_SIGNATURE {
if let Err(e) = self.message_signer.verify_signature(signature, &payload, validator_id.address()) {
debug!("ECHO message signature cannot be verified from: {}", e);
continue;
}
}

if let Some(cert_id) = self.delivered_certificates.lock().await.get(&certificate_id) {
Expand All @@ -179,9 +189,11 @@ impl DoubleEcho {
payload.extend_from_slice(certificate_id.as_array());
payload.extend_from_slice(validator_id.as_bytes());

if let Err(e) = self.message_signer.verify_signature(signature, &payload, validator_id.address()) {
debug!("READY message signature cannot be verified from: {}", e);
continue;
if *TOPOS_CHECK_MESSAGE_SIGNATURE {
if let Err(e) = self.message_signer.verify_signature(signature, &payload, validator_id.address()) {
debug!("READY message signature cannot be verified from: {}", e);
continue;
}
}
if let Some(cert_id) = self.delivered_certificates.lock().await.get(&certificate_id) {
debug!("READY message received for already delivered certificate: {}", cert_id);
Expand Down

0 comments on commit e05d1d0

Please sign in to comment.