From b4a41eb243a328cccc207657a945771416733549 Mon Sep 17 00:00:00 2001 From: InfiniteSwerve Date: Mon, 31 Oct 2022 16:08:56 -0700 Subject: [PATCH] added signature test, test fails --- .../src/core/crypto/tests/alg_intf_tests.ml | 20 +++++++++++++++++++ deku-p/src/core/crypto/tests/test_ed25519.ml | 6 +++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/deku-p/src/core/crypto/tests/alg_intf_tests.ml b/deku-p/src/core/crypto/tests/alg_intf_tests.ml index 7c513f9a47..560c2c4179 100644 --- a/deku-p/src/core/crypto/tests/alg_intf_tests.ml +++ b/deku-p/src/core/crypto/tests/alg_intf_tests.ml @@ -45,6 +45,12 @@ struct let to_sign = List.map (fun string -> Deku_crypto.BLAKE2b.hash string) to_hash + + let signatures = + List.map + (fun sk -> + List.map (fun hash -> (Signature.sign sk hash, hash)) to_sign) + secret_keys end module Test_secret_key_data = struct @@ -125,5 +131,19 @@ struct Alcotest.(check' string) ~msg:"presigned hashes are equal" ~expected:Tezos_data.to_sign ~actual:to_sign + + let signatures () = + let signatures = + let out = + List.map + (fun sig_list -> + List.map (fun (sg, _) -> helper_string_signatures sg) sig_list) + Signature_data.signatures + in + String.concat "" (List.flatten out) + in + Alcotest.(check' string) + ~msg:"signatures are equal" ~expected:Tezos_data.signatures + ~actual:signatures end end diff --git a/deku-p/src/core/crypto/tests/test_ed25519.ml b/deku-p/src/core/crypto/tests/test_ed25519.ml index 3778b7add8..9ed84fdc9a 100644 --- a/deku-p/src/core/crypto/tests/test_ed25519.ml +++ b/deku-p/src/core/crypto/tests/test_ed25519.ml @@ -98,5 +98,9 @@ let run () = test_case "compare" `Quick Test_key_hash_data.compare; test_case "equality" `Quick Test_key_hash_data.equality; ] ); - ("Signatures", [ test_case "to_sign" `Quick Test_signature_data.to_sign ]); + ( "Signatures", + [ + test_case "to sign" `Quick Test_signature_data.to_sign; + test_case "signatures" `Quick Test_signature_data.signatures; + ] ); ]