Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

signer: Capture signer rejections and report them #483

Merged
merged 1 commit into from
Jul 18, 2024
Merged
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: 13 additions & 4 deletions libs/gl-client/src/signer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ impl Signer {
}

// Currently we only use a 0 unique_id and a pubkey field to allow
// for delegation in the future but we could also set the public
// for delegation in the future but we could also set the public
// key as the unique_id in the future and add a method that allows
// to create new empty runes.
let unique_id = rune.get_id();
Expand Down Expand Up @@ -527,7 +527,7 @@ impl Signer {
log::trace!("State updated");

// Match over root and client handler.
let response = match req.context {
let response = match req.context.clone() {
Some(HsmRequestContext { dbid: 0, .. }) | None => {
// This is the main daemon talking to us.
root_handler.handle(msg)
Expand All @@ -539,15 +539,24 @@ impl Signer {
.for_new_client(1 as u64, pk, c.dbid)
.handle(msg)
}
};

if let Err(e) = response {
report::Reporter::report(crate::pb::scheduler::SignerRejection {
msg: format!("{:?}", e),
request: Some(req.clone()),
git_version: GITHASH.to_string(),
})
.await;
return Err(Error::Other(anyhow!("processing request: {e:?}")));
}
.map_err(|e| Error::Other(anyhow!("processing request: {e:?}")))?;

let response = response.unwrap();
cdecker marked this conversation as resolved.
Show resolved Hide resolved
let signer_state: Vec<crate::pb::SignerStateEntry> = {
debug!("Serializing state changes to report to node");
let state = self.state.lock().unwrap();
state.clone().into()
};

Ok(HsmResponse {
raw: response.0.as_vec(),
request_id: req.request_id,
Expand Down
Loading