Skip to content

Commit ff0627a

Browse files
added signatures after b58 conversion and back to data_gen and tezos_test_data
1 parent bd51c05 commit ff0627a

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
@@ -107,13 +107,35 @@ struct
107107
(fun sk -> List.map (fun hash -> (sign sk hash, hash)) byte_data)
108108
secret_keys
109109

110+
let signatures_to_b58 =
111+
List.map
112+
(fun sig_list ->
113+
List.map
114+
(fun (signature, hash) -> (to_b58check signature, hash))
115+
sig_list)
116+
signatures
117+
118+
let b58_to_signatures =
119+
List.map
120+
(fun sig_list ->
121+
List.map (fun (b58, hash) -> (of_b58check_exn b58, hash)) sig_list)
122+
signatures_to_b58
123+
110124
let verified_normal =
111125
let check_sig pk signatures =
112126
List.map (fun (signature, hash) -> check pk signature hash) signatures
113127
in
114128
List.map2
115129
(fun key signatures -> check_sig key signatures)
116130
public_keys signatures
131+
132+
let verified_after_conversion =
133+
let check_sig pk signatures =
134+
List.map (fun (signature, hash) -> check pk signature hash) signatures
135+
in
136+
List.map2
137+
(fun key signatures -> check_sig key signatures)
138+
public_keys b58_to_signatures
117139
end
118140

119141
module Print_secret_key = struct
@@ -206,5 +228,15 @@ struct
206228
Format.printf "];\n%!")
207229
Sig.verified_normal;
208230
Format.printf "]\n%!"
231+
232+
let print_verified_after_conversion () =
233+
Format.printf "let verified_after_conversion = [\n%!";
234+
List.iter
235+
(fun sig_list ->
236+
Format.printf "[\n%!";
237+
List.iter (Format.printf "%b;\n%!") sig_list;
238+
Format.printf "];\n%!")
239+
Sig.verified_after_conversion;
240+
Format.printf "]\n%!"
209241
end
210242
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)