From ac98f8e30420fd6d5545643289c88ef8a14d3ef4 Mon Sep 17 00:00:00 2001 From: Timothy Edison Date: Wed, 3 Apr 2024 18:15:59 +0200 Subject: [PATCH] Address PR comments --- src/math/src/ed25519.cairo | 7 +++---- src/math/src/tests/ed25519_test.cairo | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/math/src/ed25519.cairo b/src/math/src/ed25519.cairo index 31575504..46dade6c 100644 --- a/src/math/src/ed25519.cairo +++ b/src/math/src/ed25519.cairo @@ -90,7 +90,7 @@ impl PartialEqExtendedHomogeneousPoint of PartialEq { } impl SpanU8IntoU256 of Into, u256> { - // Decode as little endian + /// Decode as little endian fn into(self: Span) -> u256 { if (self.len() > 32) { return 0; @@ -187,10 +187,9 @@ impl U256TryIntoPoint of TryInto { let mut y_le_span: Span = y_span.reverse().span(); let last_byte = *y_le_span[31]; - let mut normed = y_le_span.clone(); - let _ = normed.pop_back(); - let mut normed_array: Array = normed.dedup(); + let _ = y_le_span.pop_back(); + let mut normed_array: Array = y_le_span.dedup(); normed_array.append(last_byte & ~0x80); let x_0: u256 = (last_byte.into() / 128) & 1; // bitshift of 255 diff --git a/src/math/src/tests/ed25519_test.cairo b/src/math/src/tests/ed25519_test.cairo index f2f95fd7..7b471b57 100644 --- a/src/math/src/tests/ed25519_test.cairo +++ b/src/math/src/tests/ed25519_test.cairo @@ -69,5 +69,5 @@ fn verify_signature_invalid() { let s_sign: u256 = 0x68e015fa8775659d1f40a01e1f69b8af4409046f4dc8ff02cdb04fdc3585eb01; let signature = array![r_sign, s_sign]; - assert!(verify_signature(msg, signature.span(), pub_key) == false, "Invalid signature"); + assert!(!verify_signature(msg, signature.span(), pub_key), "Invalid signature"); }