Prechádzať zdrojové kódy

chore(apps/quorum): add recovered addr on sig error (#3196)

Ali Behjati 1 týždeň pred
rodič
commit
d09e47e97b
3 zmenil súbory, kde vykonal 10 pridanie a 6 odobranie
  1. 1 1
      Cargo.lock
  2. 1 1
      apps/quorum/Cargo.toml
  3. 8 4
      apps/quorum/src/api.rs

+ 1 - 1
Cargo.lock

@@ -6008,7 +6008,7 @@ dependencies = [
 
 [[package]]
 name = "quorum"
-version = "0.2.2"
+version = "0.2.3"
 dependencies = [
  "anyhow",
  "axum 0.8.4",

+ 1 - 1
apps/quorum/Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 name = "quorum"
-version = "0.2.2"
+version = "0.2.3"
 edition = "2021"
 
 [dependencies]

+ 8 - 4
apps/quorum/src/api.rs

@@ -110,7 +110,8 @@ fn verify_observation(
         .iter()
         .position(|addr| *addr == GuardianAddress(address))
         .ok_or(anyhow::anyhow!(
-            "Signature does not match any guardian address"
+            "Signature does not match any guardian address, recovered address: {:}",
+            hex::encode(address)
         ))
 }
 
@@ -365,16 +366,19 @@ mod test {
     #[test]
     fn test_verify_observation_invalid_signature() {
         let (guardian_set, _) = get_guardian_sets(10);
-        let random_key = get_new_keypair().0;
+        let (key, address) = get_new_keypair();
         let body = get_sample_body(-(OBSERVERATION_LIFETIME as i64 - 1));
         let observation = Observation {
-            signature: sign(&body, &random_key),
+            signature: sign(&body, &key),
             body: serde_wormhole::to_vec(&body).unwrap(),
         };
         let result = verify_observation(&observation, guardian_set.clone(), OBSERVERATION_LIFETIME);
         assert_eq!(
             result.unwrap_err().to_string(),
-            "Signature does not match any guardian address"
+            format!(
+                "Signature does not match any guardian address, recovered address: {}",
+                hex::encode(address)
+            )
         );
     }