Skip to content

Commit

Permalink
fix(legacy jor sig check): chain crypto sig check
Browse files Browse the repository at this point in the history
  • Loading branch information
cong-or committed May 4, 2024
1 parent 0b2574f commit 75cf894
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
4 changes: 2 additions & 2 deletions catalyst-gateway/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion catalyst-gateway/bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ anyhow = { workspace = true }
handlebars = { workspace = true }
cddl = { workspace = true }
ciborium = { workspace = true }
chain-crypto = { git = "https://github.com/input-output-hk/chain-libs.git" }
chain-crypto = { git = "https://github.com/input-output-hk/chain-libs.git", branch="stable-dalek" }
14 changes: 5 additions & 9 deletions catalyst-gateway/bin/src/cardano/cip36_registration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use pallas::ledger::{
traverse::MultiEraMeta,
};
use serde::{Deserialize, Serialize};
use tracing::info;

use super::util::hash;

Expand Down Expand Up @@ -166,10 +167,9 @@ impl Cip36Metadata {
};

if let Some(raw_61284) = raw_61284 {
let _ =
validate_signature(&raw_61284, &registration.clone(), &signature).map_err(|err| {
errors_report.push(format!("{err}"));
});
let _ = if validate_signature(&raw_61284, &registration.clone(), &signature).is_ok() {
info!("sig ok");
};
}

Some(Self {
Expand Down Expand Up @@ -208,11 +208,7 @@ pub fn validate_signature(
&hash_bytes,
) {
Verification::Success => Ok(()),
Verification::Failed => {
Err(anyhow::anyhow!(
"Cannot decode cbor object from bytes, err: "
))
},
Verification::Failed => Err(anyhow::anyhow!("Invalid signature")),
}
}

Expand Down

0 comments on commit 75cf894

Please sign in to comment.