Skip to content

Commit bfdd88e

Browse files
added signature zero test
1 parent dcee2b8 commit bfdd88e

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ struct
9696
List.for_all
9797
(fun (signature, _) -> Signature.equal signature signature)
9898
(List.flatten signatures)
99+
100+
let zero = Signature.(to_b58 zero)
99101
end
100102

101103
module Test_secret_key_data = struct
@@ -217,5 +219,10 @@ struct
217219
Alcotest.(check' bool)
218220
~msg:"signature equality works" ~expected:Tezos_data.equality_signatures
219221
~actual:Signature_data.equality_signatures
222+
223+
let zero () =
224+
Alcotest.(check' string)
225+
~msg:"zeros are equal" ~expected:Tezos_data.zero
226+
~actual:Signature_data.zero
220227
end
221228
end

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ struct
154154
(List.flatten signatures)
155155

156156
let zero = to_b58check zero
157+
let size = Signature.size
157158
end
158159

159160
module Print_secret_key = struct
@@ -266,5 +267,6 @@ struct
266267
Format.printf "let equality_signatures = %b\n%!" Sig.equality_signatures
267268

268269
let print_zero () = Format.printf "let size = %s\n%!" Sig.zero
270+
let print_size () = Format.printf "let size = %d\n%!" Sig.size
269271
end
270272
end

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,6 @@ let run () =
108108
Test_signature_data.verified_after_conversion;
109109
test_case "compare" `Quick Test_signature_data.compare;
110110
test_case "equality" `Quick Test_signature_data.equality;
111+
test_case "zero" `Quick Test_signature_data.zero;
111112
] );
112113
]

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ module type Tezos_data = sig
1313
val compare_signatures : string
1414
val equality_signatures : bool
1515
val zero : string
16+
val size : int
1617
end
1718

1819
module Ed25519_data : Tezos_data = struct
@@ -89,4 +90,6 @@ module Ed25519_data : Tezos_data = struct
8990

9091
let zero =
9192
"edsigtXomBKi5CTRf5cjATJWSyaRvhfYNHqSUGrn4SdbYRcGwQrUGjzEfQDTuqHhuA8b2d8NarZjz8TRf65WkpQmo423BtomS8Q"
93+
94+
let size = 64
9295
end

0 commit comments

Comments
 (0)