Skip to content

Commit ee79bc1

Browse files
committed
wip(aggregator): better support of some errors in signature processor
1 parent dc195dc commit ee79bc1

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

mithril-aggregator/src/services/signature_processor.rs

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::{sync::Arc, time::Duration};
22

33
use anyhow::anyhow;
4-
use slog::{Logger, error, trace, warn};
4+
use slog::{Logger, debug, error, trace, warn};
55

66
use mithril_common::{
77
StdResult,
@@ -10,7 +10,7 @@ use mithril_common::{
1010
};
1111
use tokio::{select, sync::watch::Receiver};
1212

13-
use crate::MetricsService;
13+
use crate::{MetricsService, services::CertifierServiceError};
1414

1515
use super::{CertifierService, SignatureConsumer};
1616

@@ -90,13 +90,24 @@ impl SignatureProcessor for SequentialSignatureProcessor {
9090
.get_signature_registration_total_successful_since_startup()
9191
.increment(&[&origin_network]);
9292
}
93-
Err(e) => {
94-
total_import_errors += 1;
95-
error!(
96-
self.logger, "Error dispatching single signature";
97-
"full_payload" => #?signature, "error" => ?e
98-
);
99-
}
93+
Err(err) => match err.downcast_ref::<CertifierServiceError>() {
94+
Some(CertifierServiceError::AlreadyCertified(signed_entity_type)) => {
95+
debug!(self.logger, "process_signatures::open_message_already_certified"; "signed_entity_type" => ?signed_entity_type, "party_id" => &signature.party_id);
96+
}
97+
Some(CertifierServiceError::Expired(signed_entity_type)) => {
98+
debug!(self.logger, "process_signatures::open_message_expired"; "signed_entity_type" => ?signed_entity_type, "party_id" => &signature.party_id);
99+
}
100+
Some(CertifierServiceError::NotFound(signed_entity_type)) => {
101+
debug!(self.logger, "process_signatures::not_found"; "signed_entity_type" => ?signed_entity_type, "party_id" => &signature.party_id);
102+
}
103+
Some(_) | None => {
104+
total_import_errors += 1;
105+
error!(
106+
self.logger, "Error dispatching single signature";
107+
"full_payload" => #?signature, "error" => ?err
108+
);
109+
}
110+
},
100111
}
101112
}
102113
}

0 commit comments

Comments
 (0)