From 45f69df6601c58e858dd80dfe0ac495a90135d8b Mon Sep 17 00:00:00 2001 From: InfiniteSwerve Date: Mon, 31 Oct 2022 20:53:44 -0700 Subject: [PATCH] added signatures after b58 conversion and back to data_gen and tezos_test_data --- .../crypto/tests/data_for_tests/data_gen.ml | 32 +++++++++++++++++++ .../src/core/crypto/tests/tezos_test_data.ml | 10 ++++++ 2 files changed, 42 insertions(+) diff --git a/deku-p/src/core/crypto/tests/data_for_tests/data_gen.ml b/deku-p/src/core/crypto/tests/data_for_tests/data_gen.ml index 26f85b461b..d7d88e6aad 100644 --- a/deku-p/src/core/crypto/tests/data_for_tests/data_gen.ml +++ b/deku-p/src/core/crypto/tests/data_for_tests/data_gen.ml @@ -114,6 +114,20 @@ struct (fun sk -> List.map (fun hash -> (sign sk hash, hash)) byte_data) secret_keys + let signatures_to_b58 = + List.map + (fun sig_list -> + List.map + (fun (signature, hash) -> (to_b58check signature, hash)) + sig_list) + signatures + + let b58_to_signatures = + List.map + (fun sig_list -> + List.map (fun (b58, hash) -> (of_b58check_exn b58, hash)) sig_list) + signatures_to_b58 + let verified_normal = let check_sig pk signatures = List.map (fun (signature, hash) -> check pk signature hash) signatures @@ -121,6 +135,14 @@ struct List.map2 (fun key signatures -> check_sig key signatures) public_keys signatures + + let verified_after_conversion = + let check_sig pk signatures = + List.map (fun (signature, hash) -> check pk signature hash) signatures + in + List.map2 + (fun key signatures -> check_sig key signatures) + public_keys b58_to_signatures end module Print_secret_key = struct @@ -213,5 +235,15 @@ struct Format.printf "];\n%!") Sig.verified_normal; Format.printf "]\n%!" + + let print_verified_after_conversion () = + Format.printf "let verified_after_conversion = [\n%!"; + List.iter + (fun sig_list -> + Format.printf "[\n%!"; + List.iter (Format.printf "%b;\n%!") sig_list; + Format.printf "];\n%!") + Sig.verified_after_conversion; + Format.printf "]\n%!" end end diff --git a/deku-p/src/core/crypto/tests/tezos_test_data.ml b/deku-p/src/core/crypto/tests/tezos_test_data.ml index bc266b92e7..3dcf592d29 100644 --- a/deku-p/src/core/crypto/tests/tezos_test_data.ml +++ b/deku-p/src/core/crypto/tests/tezos_test_data.ml @@ -9,6 +9,7 @@ module type Tezos_data = sig val to_sign : string val signatures : string val verified_normal_signatures : bool list list + val verified_after_conversion : bool list list end module Ed25519_data : Tezos_data = struct @@ -68,4 +69,13 @@ module Ed25519_data : Tezos_data = struct [ true; true; true; true; true ]; [ true; true; true; true; true ]; ] + + let verified_after_conversion = + [ + [ true; true; true; true; true ]; + [ true; true; true; true; true ]; + [ true; true; true; true; true ]; + [ true; true; true; true; true ]; + [ true; true; true; true; true ]; + ] end