Skip to content

Commit 45f69df

Browse files
added signatures after b58 conversion and back to data_gen and tezos_test_data
1 parent b16013e commit 45f69df

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

deku-p/src/core/crypto/tests/data_for_tests/data_gen.ml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,35 @@ struct
114114
(fun sk -> List.map (fun hash -> (sign sk hash, hash)) byte_data)
115115
secret_keys
116116

117+
let signatures_to_b58 =
118+
List.map
119+
(fun sig_list ->
120+
List.map
121+
(fun (signature, hash) -> (to_b58check signature, hash))
122+
sig_list)
123+
signatures
124+
125+
let b58_to_signatures =
126+
List.map
127+
(fun sig_list ->
128+
List.map (fun (b58, hash) -> (of_b58check_exn b58, hash)) sig_list)
129+
signatures_to_b58
130+
117131
let verified_normal =
118132
let check_sig pk signatures =
119133
List.map (fun (signature, hash) -> check pk signature hash) signatures
120134
in
121135
List.map2
122136
(fun key signatures -> check_sig key signatures)
123137
public_keys signatures
138+
139+
let verified_after_conversion =
140+
let check_sig pk signatures =
141+
List.map (fun (signature, hash) -> check pk signature hash) signatures
142+
in
143+
List.map2
144+
(fun key signatures -> check_sig key signatures)
145+
public_keys b58_to_signatures
124146
end
125147

126148
module Print_secret_key = struct
@@ -213,5 +235,15 @@ struct
213235
Format.printf "];\n%!")
214236
Sig.verified_normal;
215237
Format.printf "]\n%!"
238+
239+
let print_verified_after_conversion () =
240+
Format.printf "let verified_after_conversion = [\n%!";
241+
List.iter
242+
(fun sig_list ->
243+
Format.printf "[\n%!";
244+
List.iter (Format.printf "%b;\n%!") sig_list;
245+
Format.printf "];\n%!")
246+
Sig.verified_after_conversion;
247+
Format.printf "]\n%!"
216248
end
217249
end

deku-p/src/core/crypto/tests/tezos_test_data.ml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module type Tezos_data = sig
99
val to_sign : string
1010
val signatures : string
1111
val verified_normal_signatures : bool list list
12+
val verified_after_conversion : bool list list
1213
end
1314

1415
module Ed25519_data : Tezos_data = struct
@@ -68,4 +69,13 @@ module Ed25519_data : Tezos_data = struct
6869
[ true; true; true; true; true ];
6970
[ true; true; true; true; true ];
7071
]
72+
73+
let verified_after_conversion =
74+
[
75+
[ true; true; true; true; true ];
76+
[ true; true; true; true; true ];
77+
[ true; true; true; true; true ];
78+
[ true; true; true; true; true ];
79+
[ true; true; true; true; true ];
80+
]
7181
end

0 commit comments

Comments
 (0)