Skip to content

Commit d09e47e

Browse files
authored
chore(apps/quorum): add recovered addr on sig error (#3196)
1 parent f3f6da5 commit d09e47e

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/quorum/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "quorum"
3-
version = "0.2.2"
3+
version = "0.2.3"
44
edition = "2021"
55

66
[dependencies]

apps/quorum/src/api.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ fn verify_observation(
110110
.iter()
111111
.position(|addr| *addr == GuardianAddress(address))
112112
.ok_or(anyhow::anyhow!(
113-
"Signature does not match any guardian address"
113+
"Signature does not match any guardian address, recovered address: {:}",
114+
hex::encode(address)
114115
))
115116
}
116117

@@ -365,16 +366,19 @@ mod test {
365366
#[test]
366367
fn test_verify_observation_invalid_signature() {
367368
let (guardian_set, _) = get_guardian_sets(10);
368-
let random_key = get_new_keypair().0;
369+
let (key, address) = get_new_keypair();
369370
let body = get_sample_body(-(OBSERVERATION_LIFETIME as i64 - 1));
370371
let observation = Observation {
371-
signature: sign(&body, &random_key),
372+
signature: sign(&body, &key),
372373
body: serde_wormhole::to_vec(&body).unwrap(),
373374
};
374375
let result = verify_observation(&observation, guardian_set.clone(), OBSERVERATION_LIFETIME);
375376
assert_eq!(
376377
result.unwrap_err().to_string(),
377-
"Signature does not match any guardian address"
378+
format!(
379+
"Signature does not match any guardian address, recovered address: {}",
380+
hex::encode(address)
381+
)
378382
);
379383
}
380384

0 commit comments

Comments
 (0)