From 34fb6e82d80ac463c053da2ff6a06eaf07efeb3d Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Wed, 15 Apr 2026 03:37:35 +0000 Subject: [PATCH] fmt: apply cargo fmt to crypto.rs Co-Authored-By: Claude Haiku 4.5 --- src/commands/test/labeler/crypto.rs | 41 ++++++++++++++++------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/src/commands/test/labeler/crypto.rs b/src/commands/test/labeler/crypto.rs index f877cbb..ef56da1 100644 --- a/src/commands/test/labeler/crypto.rs +++ b/src/commands/test/labeler/crypto.rs @@ -377,7 +377,8 @@ pub async fn run( results.push(CheckResult { id: SIGNATURE_BYTES_UNPARSEABLE, stage: Stage::Crypto, - status: crate::commands::test::labeler::report::CheckStatus::SpecViolation, + status: + crate::commands::test::labeler::report::CheckStatus::SpecViolation, summary: Cow::Borrowed("Signature bytes are unparseable"), diagnostic: None, skipped_reason: None, @@ -389,10 +390,10 @@ pub async fn run( } Ok(signature) => { // Try to verify against the current key. - match identity.signing_key.verify_prehash( - &canonical.prehash, - &signature, - ) { + match identity + .signing_key + .verify_prehash(&canonical.prehash, &signature) + { Ok(()) => { verified_with_current += 1; } @@ -472,7 +473,8 @@ pub async fn run( results.push(CheckResult { id: LABEL_VERIFICATION_FAILED, stage: Stage::Crypto, - status: crate::commands::test::labeler::report::CheckStatus::SpecViolation, + status: + crate::commands::test::labeler::report::CheckStatus::SpecViolation, summary: Cow::Borrowed("Label signature verification failed"), diagnostic: None, skipped_reason: None, @@ -524,17 +526,17 @@ pub async fn run( } // Re-canonicalize for verification. - if let Ok(canonical) = canonicalize_label_for_signing(&failed.label) + if let Ok(canonical) = + canonicalize_label_for_signing(&failed.label) { // Parse signature for the historic key's curve. - if let Ok(signature) = parse_signature(&canonical.signature_bytes, &parsed.verifying_key) - { + if let Ok(signature) = parse_signature( + &canonical.signature_bytes, + &parsed.verifying_key, + ) { if parsed .verifying_key - .verify_prehash( - &canonical.prehash, - &signature, - ) + .verify_prehash(&canonical.prehash, &signature) .is_ok() { newly_verified.push(i); @@ -573,7 +575,9 @@ pub async fn run( id: ROLLUP, stage: Stage::Crypto, status: crate::commands::test::labeler::report::CheckStatus::Pass, - summary: Cow::Borrowed("All labels verified with current or historic keys"), + summary: Cow::Borrowed( + "All labels verified with current or historic keys", + ), diagnostic: None, skipped_reason: None, }); @@ -708,7 +712,6 @@ mod tests { /// cryptographic primitive path that the crypto stage relies on for AC5.1 and AC5.2. #[test] fn sign_and_verify_label_roundtrip_k256() { - // Deterministic seed so the test is bisect-stable. let seed: [u8; 32] = [7u8; 32]; let signing_key = K256SigningKey::from_slice(&seed).expect("valid secret scalar"); @@ -830,8 +833,8 @@ mod tests { let placeholder: Label = label_data.clone().into(); // Canonicalize and extract prehash. - let canonical = canonicalize_label_for_signing(&placeholder) - .expect("canonicalize placeholder label"); + let canonical = + canonicalize_label_for_signing(&placeholder).expect("canonicalize placeholder label"); // Sign the prehash using the deterministic key. let sig: k256::ecdsa::Signature = signing_key @@ -844,8 +847,8 @@ mod tests { let signed_label: Label = signed_data.into(); // Canonicalize the signed label (should produce identical prehash to placeholder). - let signed_canonical = canonicalize_label_for_signing(&signed_label) - .expect("canonicalize signed label"); + let signed_canonical = + canonicalize_label_for_signing(&signed_label).expect("canonicalize signed label"); // Verify the prehashes match (sig field should not affect canonicalization). assert_eq!( -- 2.51.2