Skip to content

Commit

Permalink
added signatures after b58 conversion and back to data_gen and tezos_…
Browse files Browse the repository at this point in the history
…test_data
  • Loading branch information
InfiniteSwerve committed Dec 14, 2022
1 parent b16013e commit 45f69df
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
32 changes: 32 additions & 0 deletions deku-p/src/core/crypto/tests/data_for_tests/data_gen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,35 @@ 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
in
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
Expand Down Expand Up @@ -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
10 changes: 10 additions & 0 deletions deku-p/src/core/crypto/tests/tezos_test_data.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 45f69df

Please sign in to comment.