Skip to content

Commit

Permalink
test: add parity test (#1889)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Jan 4, 2025
1 parent 6a5f72b commit 9360051
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crates/signer-local/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,4 +289,15 @@ mod test {
let expected_error = alloy_signer::Error::TransactionChainIdMismatch { signer: 1, tx: 2 };
assert_eq!(error.to_string(), expected_error.to_string());
}

// <https://github.com/alloy-rs/core/issues/705>
#[test]
fn test_parity() {
let signer = PrivateKeySigner::random();
let message = b"hello";
let signature = signer.sign_message_sync(message).unwrap();
let value = signature.as_bytes().to_vec();
let recovered_signature: Signature = value.as_slice().try_into().unwrap();
assert_eq!(signature, recovered_signature);
}
}

0 comments on commit 9360051

Please sign in to comment.