Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions rs/consensus/idkg/src/complaints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use ic_interfaces::{
idkg::{IDkgChangeAction, IDkgChangeSet, IDkgPool},
};
use ic_interfaces_state_manager::{CertifiedStateSnapshot, StateReader};
use ic_logger::{ReplicaLogger, debug, warn};
use ic_logger::{ReplicaLogger, warn};
use ic_metrics::MetricsRegistry;
use ic_replicated_state::ReplicatedState;
use ic_types::{
Expand Down Expand Up @@ -399,7 +399,8 @@ impl IDkgComplaintHandlerImpl {
));
} else {
// Defer in case of transient errors
debug!(
warn!(
every_n_seconds => 10,
self.log,
"Complaint signature validation(transient error): {}, error = {:?}",
signed_complaint,
Expand Down Expand Up @@ -427,7 +428,8 @@ impl IDkgComplaintHandlerImpl {
))
}
Err(error) => {
debug!(
warn!(
every_n_seconds => 10,
self.log,
"Complaint validation(transient error): {}, error = {:?}",
signed_complaint,
Expand Down Expand Up @@ -523,7 +525,8 @@ impl IDkgComplaintHandlerImpl {
),
));
} else {
debug!(
warn!(
every_n_seconds => 10,
self.log,
"Opening signature validation(transient error): {}, error = {:?}",
signed_opening,
Expand Down Expand Up @@ -553,7 +556,8 @@ impl IDkgComplaintHandlerImpl {
))
}
Err(error) => {
debug!(
warn!(
every_n_seconds => 10,
self.log,
"Opening validation(transient error): {}, error = {:?}", signed_opening, error
);
Expand Down Expand Up @@ -686,6 +690,7 @@ impl IDkgComplaintHandlerImpl {
}
Err(error) => {
warn!(
every_n_seconds => 10,
self.log,
"Failed to resolve complaint ref: reason = {}, \
transcript_ref = {:?}, error = {:?}",
Expand Down Expand Up @@ -886,6 +891,7 @@ impl IDkgTranscriptLoader for IDkgComplaintHandlerImpl {
}
Err(err) => {
warn!(
every_n_seconds => 10,
self.log,
"Failed to load transcript: transcript_id: {:?}, error = {:?}",
transcript.transcript_id,
Expand Down Expand Up @@ -936,6 +942,7 @@ impl IDkgTranscriptLoader for IDkgComplaintHandlerImpl {
}
Err(err) => {
warn!(
every_n_seconds => 10,
self.log,
"Failed to load transcript with openings: transcript_id: {:?}, error = {:?}",
transcript.transcript_id,
Expand Down
8 changes: 6 additions & 2 deletions rs/consensus/idkg/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,9 @@ impl IDkgImpl {
Ok(transcripts) => transcripts,
Err(err) => {
warn!(
every_n_seconds => 10,
self.logger,
"purge_inactive_transcripts(): abort due to: {}", err,
"purge_inactive_transcripts(): abort due to: {}", err
);
return;
}
Expand All @@ -337,6 +338,7 @@ impl IDkgImpl {
match IDkgProtocol::retain_active_transcripts(&*self.crypto, &active_transcripts) {
Err(IDkgRetainKeysError::TransientInternalError { internal_error }) => {
warn!(
every_n_seconds => 10,
self.logger,
"purge_inactive_transcripts(): failed due to transient error: {}",
internal_error
Expand All @@ -348,6 +350,7 @@ impl IDkgImpl {
}
Err(error) => {
error!(
every_n_seconds => 10,
self.logger,
"{}: failed with error = {:?}",
CRITICAL_ERROR_IDKG_RETAIN_ACTIVE_TRANSCRIPTS,
Expand Down Expand Up @@ -387,11 +390,12 @@ fn get_active_transcripts(
}
Err(error) => {
warn!(
every_n_seconds => 10,
logger,
"purge_inactive_transcripts(): failed to resolve transcript ref: err = {:?}, \
{:?}",
error,
transcript_ref,
transcript_ref
);
metrics
.client_errors
Expand Down
12 changes: 12 additions & 0 deletions rs/consensus/idkg/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,18 @@ impl IDkgPayloadMetrics {
}
}

pub(crate) trait IDkgPayloadMetricsOptionExt {
fn payload_errors_inc(self, label: &str);
}

impl IDkgPayloadMetricsOptionExt for Option<&IDkgPayloadMetrics> {
fn payload_errors_inc(self, label: &str) {
if let Some(metrics) = self {
metrics.payload_errors_inc(label);
}
}
}

pub fn timed_call<F, R>(label: &str, call_fn: F, metric: &HistogramVec) -> R
where
F: FnOnce() -> R,
Expand Down
19 changes: 19 additions & 0 deletions rs/consensus/idkg/src/payload_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ pub fn make_bootstrap_summary_with_initial_dealings(
None => {
// Leave the feature disabled if the initial dealings are incorrect.
warn!(
every_n_seconds => 10,
log,
"make_idkg_genesis_summary(): failed to unpack initial dealings"
);
Expand Down Expand Up @@ -536,6 +537,7 @@ pub fn create_data_payload(
&transcript_builder,
state_manager,
registry_client,
Some(idkg_payload_metrics),
log,
)?;

Expand Down Expand Up @@ -575,6 +577,7 @@ pub(crate) fn create_data_payload_helper(
transcript_builder: &dyn IDkgTranscriptBuilder,
state_manager: &dyn StateManager<State = ReplicatedState>,
registry_client: &dyn RegistryClient,
idkg_payload_metrics: Option<&IDkgPayloadMetrics>,
log: &ReplicaLogger,
) -> Result<Option<IDkgPayload>, IDkgPayloadError> {
let height = parent_block.height().increment();
Expand Down Expand Up @@ -615,6 +618,7 @@ pub(crate) fn create_data_payload_helper(
total_pre_signatures,
block_reader,
transcript_builder,
idkg_payload_metrics,
log,
)?;

Expand All @@ -632,6 +636,7 @@ pub(crate) fn create_data_payload_helper_2(
total_pre_signatures: BTreeMap<IDkgMasterPublicKeyId, usize>,
block_reader: &dyn IDkgBlockReader,
transcript_builder: &dyn IDkgTranscriptBuilder,
idkg_payload_metrics: Option<&IDkgPayloadMetrics>,
log: &ReplicaLogger,
) -> Result<(), IDkgPayloadError> {
// Check if we are creating a new key, if so, start using it immediately.
Expand All @@ -656,6 +661,7 @@ pub(crate) fn create_data_payload_helper_2(
idkg_payload,
transcript_builder,
height,
idkg_payload_metrics,
log,
)?,
key_transcript::update_next_key_transcripts(
Expand Down Expand Up @@ -693,6 +699,7 @@ pub(crate) fn create_data_payload_helper_2(
idkg_dealings_contexts,
block_reader,
transcript_builder,
idkg_payload_metrics,
log,
);
resharing::initiate_reshare_requests(
Expand All @@ -701,6 +708,8 @@ pub(crate) fn create_data_payload_helper_2(
idkg_dealings_contexts,
validation_context_registry_version,
),
idkg_payload_metrics,
log,
);
Ok(())
}
Expand Down Expand Up @@ -878,6 +887,7 @@ mod tests {
BTreeMap::from([(key_id.clone(), 2)]),
&TestIDkgBlockReader::new(),
&TestIDkgTranscriptBuilder::new(),
None,
&ic_logger::replica_logger::no_op_logger(),
)
.unwrap();
Expand Down Expand Up @@ -1025,6 +1035,7 @@ mod tests {
&mut idkg_payload,
&transcript_builder,
parent_block_height,
None,
&no_op_logger(),
)
.unwrap();
Expand Down Expand Up @@ -1284,6 +1295,7 @@ mod tests {
&mut idkg_payload,
&transcript_builder,
parent_block_height,
None,
&no_op_logger(),
)
.unwrap();
Expand Down Expand Up @@ -1887,6 +1899,7 @@ mod tests {
BTreeMap::default(),
&block_reader,
&transcript_builder,
None,
&no_op_logger(),
)
.unwrap();
Expand All @@ -1911,6 +1924,7 @@ mod tests {
BTreeMap::default(),
&block_reader,
&transcript_builder,
None,
&no_op_logger(),
)
.unwrap();
Expand Down Expand Up @@ -1994,6 +2008,7 @@ mod tests {
BTreeMap::default(),
&block_reader,
&transcript_builder,
None,
&no_op_logger(),
);
assert!(result.is_ok());
Expand Down Expand Up @@ -2102,6 +2117,7 @@ mod tests {
BTreeMap::default(),
&block_reader,
&transcript_builder,
None,
&no_op_logger(),
)
.unwrap();
Expand Down Expand Up @@ -2219,6 +2235,7 @@ mod tests {
BTreeMap::default(),
&block_reader,
&transcript_builder,
None,
&no_op_logger(),
);
assert!(result.is_ok());
Expand All @@ -2244,6 +2261,7 @@ mod tests {
BTreeMap::default(),
&block_reader,
&transcript_builder,
None,
&no_op_logger(),
);
assert!(result.is_ok());
Expand All @@ -2267,6 +2285,7 @@ mod tests {
BTreeMap::default(),
&block_reader,
&transcript_builder,
None,
&no_op_logger(),
);
assert!(result.is_ok());
Expand Down
Loading
Loading