@@ -52,6 +52,22 @@ struct
5252 List. map (fun hash -> (Signature. sign sk hash, hash)) to_sign)
5353 secret_keys
5454
55+ let signatures_to_b58 =
56+ List. map
57+ (fun sig_list ->
58+ List. map
59+ (fun (signature , hash ) -> (Signature. to_b58 signature, hash))
60+ sig_list)
61+ signatures
62+
63+ let b58_to_signatures =
64+ List. map
65+ (fun sig_list ->
66+ List. map
67+ (fun (b58 , hash ) -> (Option. get @@ Signature. of_b58 b58, hash))
68+ sig_list)
69+ signatures_to_b58
70+
5571 let verified_normal_signatures =
5672 let check_sig pk signatures =
5773 List. map
@@ -61,6 +77,16 @@ struct
6177 List. map2
6278 (fun key signatures -> check_sig key signatures)
6379 public_keys signatures
80+
81+ let verified_after_conversion =
82+ let check_sig pk signatures =
83+ List. map
84+ (fun (signature , hash ) -> Signature. verify pk signature hash)
85+ signatures
86+ in
87+ List. map2
88+ (fun key signatures -> check_sig key signatures)
89+ public_keys b58_to_signatures
6490 end
6591
6692 module Test_secret_key_data = struct
@@ -161,5 +187,12 @@ struct
161187 ~msg: " verified normal signatures are equal"
162188 ~expected: Tezos_data. verified_normal_signatures
163189 ~actual: Signature_data. verified_normal_signatures
190+
191+ (* We convert the signatures to b58 and back to ensure no data is lost *)
192+ let verified_after_conversion () =
193+ Alcotest. (check' (list (list bool )))
194+ ~msg: " verified post conversion signatures are equal"
195+ ~expected: Tezos_data. verified_after_conversion
196+ ~actual: Signature_data. verified_after_conversion
164197 end
165198end
0 commit comments