Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add signature zero test #976

Open
wants to merge 2 commits into
base: crypto-test-hold-13
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions deku-p/src/core/crypto/tests/alg_intf_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ struct
List.for_all
(fun (signature, _) -> Signature.equal signature signature)
(List.flatten signatures)

let zero = Signature.(to_b58 zero)
end

module Test_secret_key_data = struct
Expand Down Expand Up @@ -217,5 +219,10 @@ struct
Alcotest.(check' bool)
~msg:"signature equality works" ~expected:Tezos_data.equality_signatures
~actual:Signature_data.equality_signatures

let zero () =
Alcotest.(check' string)
~msg:"zeros are equal" ~expected:Tezos_data.zero
~actual:Signature_data.zero
end
end
6 changes: 6 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 @@ -152,6 +152,9 @@ struct
List.for_all
(fun (signature, _) -> equal signature signature)
(List.flatten signatures)

let zero = to_b58check zero
let size = Signature.size
end

module Print_secret_key = struct
Expand Down Expand Up @@ -262,5 +265,8 @@ struct

let print_equality_signatures () =
Format.printf "let equality_signatures = %b\n%!" Sig.equality_signatures

let print_zero () = Format.printf "let size = %s\n%!" Sig.zero
let print_size () = Format.printf "let size = %d\n%!" Sig.size
end
end
1 change: 1 addition & 0 deletions deku-p/src/core/crypto/tests/test_ed25519.ml
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,6 @@ let run () =
Test_signature_data.verified_after_conversion;
test_case "compare" `Quick Test_signature_data.compare;
test_case "equality" `Quick Test_signature_data.equality;
test_case "zero" `Quick Test_signature_data.zero;
] );
]
7 changes: 7 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 @@ -12,6 +12,8 @@ module type Tezos_data = sig
val verified_after_conversion : bool list list
val compare_signatures : string
val equality_signatures : bool
val zero : string
val size : int
end

module Ed25519_data : Tezos_data = struct
Expand Down Expand Up @@ -85,4 +87,9 @@ module Ed25519_data : Tezos_data = struct
"91081191031691771406248755413517719868942512392481441632319412010666151141106451551101241942249971174175182242212251649245136305224924457148320716512414112166188161618190194214219818013081233222801413320111118411617224175182697921413520019617124319212224281575910110314298902061291292362082351062261611109622029451142202472498122112828315411214215471082222729123871735036826813621811319581522823924522014218815718322611124147618451202231202222241125131214241501291192181951141832152991781842408712281731501424122371978512858881034311216038137212222221701994853165206153192065917210814639481615812041192252331121887779321462221402352471622372311222419183228233252711752494627158132117237521831261901421461485713632187712111831888518153178162081072381711341312056321241202152911914613236164154672325214125126641391315222910617026622611023619623237163202165210167195112025420270145177601410455152100204982202025018985195451024720916413551227233221127212227138415130471601087018580897313485383982099117189167222331842521313212095144117181661332451758462121252132181263415321022381209015196154491568518813348222016710840741682502172392115321317418380721936988615517815114717922117084259619815528250992395598166781281214815497104907822813961756420119814520959797961436722040186138124195165871412074379820676221431153718424622398155194223613450117101197824118422216520944615915379247196942071241421305076205243853614278816518458182137105586319317121525322312967129212227584115116140811121701752267764410311641882301382081069964522973023564211195207148967151174216244402241622225113721163122271031791912249975680128247139414214813200116312233146135224112620761168159418321222145236712046797228177596873940182125213190137226911039417317693114191676220091407724623814212624973918412673228222130151232211444910221229194100197169239891202179112148125144871451185819420724217413234511461742461287612461148758915816421610110714134341307288251765248902276497721303441294615713624017125124116814525301202279107223196312131101120232832101392458921021483219192253220134215204240951381602001043919911812032281402031152031220922915521421179455140359513595661841882501774190551548198541841041557711150211322322017475219184961561411321462512362302331185499242122237872961281946823618911184157169527723380605140861281322433941261133235241481712012241621282323325113206361171821889425263912406417012255203196279151931761401471351832361501611516226211204795010458249912431211149148562336015158208745811841055521515211924422196144124121351903974391791409824221154216302392209011320799164101602079040191814324314323825162208148349271216815951427590883010013115725211423817976255811022091765012919610016891122042513815525158910032319416918956610710103335639118438821793233701104114424823420815102816868146784036103186204101231234296723818159158201881636620910223210569464232216117107110245201911169123691277721715599195253871662111989610117413622018519683126111841701942591951357222315115710810165232170160114156145361422052912521121794191175921792387944393211991742131181831625511318228241501953146218148576335124233174129145131993113822031156233989615779164682199380202165177108164172192139178253951601631684424723918990141881491421019310169128631901161222092501921379171891696121814414093133322011689319191561601852062201531761221999321512910244122810374401512453373133188180699251139152129511601581791732317822723267901231411421042451971141661711203822284221124411887153152885824510324019522814649371211634918721110039125160182220618521510914719711120317639244621182074611921180206146552341801865112495202218103851222532124710862418217777129261571488394110122145240237526824312513738321817510622786413018018401311711386272190158155414224622695207891815816929129188198422021412514169196242431851003250544623853192203212168182174638624379104462402937731462457920812721614625017419810516722549949513228154254920420892061981181451254210511151449337179112522189221214991541452216888792178033151539180191152191121985857411124514910786174659174254141942222424441521642449902171675896229397510078691449332371363"

let equality_signatures = true

let zero =
"edsigtXomBKi5CTRf5cjATJWSyaRvhfYNHqSUGrn4SdbYRcGwQrUGjzEfQDTuqHhuA8b2d8NarZjz8TRf65WkpQmo423BtomS8Q"

let size = 64
end