diff --git a/src/proto_alpha/lib_protocol/test/helpers/dal_helpers.ml b/src/proto_alpha/lib_protocol/test/helpers/dal_helpers.ml index 68b5d35714144db48a3b2c1f8efad6ad60512839..d833c46adca50483d24332a022701f64033d15e1 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/dal_helpers.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/dal_helpers.ml @@ -56,6 +56,15 @@ let mk_cryptobox dal_params = | Ok dal -> return dal | Error (`Fail s) -> fail [Test_failure s] +let derive_dal_parameters (reference : Cryptobox.parameters) ~redundancy_factor + ~constants_divider = + { + Hist.redundancy_factor; + page_size = reference.page_size / constants_divider; + slot_size = reference.slot_size / constants_divider; + number_of_shards = reference.number_of_shards / constants_divider; + } + module Make (Parameters : sig val dal_parameters : Alpha_context.Constants.Parametric.dal diff --git a/src/proto_alpha/lib_protocol/test/helpers/dal_helpers.mli b/src/proto_alpha/lib_protocol/test/helpers/dal_helpers.mli index 770ed1203f2ad7f9945a3d55b5097492101117d1..20c6454aebc5969d9b0eda688cc8a34fe57841bd 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/dal_helpers.mli +++ b/src/proto_alpha/lib_protocol/test/helpers/dal_helpers.mli @@ -28,6 +28,16 @@ open Protocol (** Returns an object of type {!Cryptobox.t} from the given DAL paramters. *) val mk_cryptobox : Cryptobox.parameters -> Cryptobox.t tzresult +(** Derive new DAL parameters from the given ones by: + - setting the given redundancy factor ; + - dividing the other fields by the given factor. +*) +val derive_dal_parameters : + Cryptobox.parameters -> + redundancy_factor:int -> + constants_divider:int -> + Cryptobox.parameters + module Make (P : sig val dal_parameters : Alpha_context.Constants.Parametric.dal diff --git a/src/proto_alpha/lib_protocol/test/pbt/test_dal_slot_proof.ml b/src/proto_alpha/lib_protocol/test/pbt/test_dal_slot_proof.ml index 34b05e7b2091329fb650f78493e29e936a84e877..4e22bd172699a06c1bcd5d2aa021bfde225891c0 100644 --- a/src/proto_alpha/lib_protocol/test/pbt/test_dal_slot_proof.ml +++ b/src/proto_alpha/lib_protocol/test/pbt/test_dal_slot_proof.ml @@ -228,5 +228,24 @@ let () = let dal_parameters = constants_mainnet.dal end) in - let tests = Sandbox.tests @ Test.tests @ Mainnet.tests in + let module Custom = Make (struct + let name = "custom" + + let count = 5 + + let dal_parameters = + let dal_mainnet = constants_mainnet.dal in + { + dal_mainnet with + cryptobox_parameters = + Dal_helpers.derive_dal_parameters + dal_mainnet.cryptobox_parameters + ~redundancy_factor:4 + ~constants_divider:64; + } + end) in + (* TODO/DAL: Enable these tests to cover more protocol parameters if we manage + to run DAL crypto part faster. *) + ignore @@ Sandbox.tests @ Test.tests @ Mainnet.tests ; + let tests = Custom.tests in Alcotest_lwt.run "Refutation_game" tests |> Lwt_main.run diff --git a/src/proto_alpha/lib_protocol/test/unit/test_dal_slot_proof.ml b/src/proto_alpha/lib_protocol/test/unit/test_dal_slot_proof.ml index a481d5d2d3727f27002d072fdbc33f0b7c7279fd..fff2e8efbe5f26f24f2a4b79cd7da36c352d8d9f 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_dal_slot_proof.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_dal_slot_proof.ml @@ -318,7 +318,7 @@ struct Tztest.tztest (mk_title title) `Quick test_function in let qcheck2 title gen test = - Tztest.tztest_qcheck2 ~name:(mk_title title) ~count:1 gen test + Tztest.tztest_qcheck2 ~name:(mk_title title) ~count:2 gen test in let bool = QCheck2.Gen.bool in let ordering_tests = @@ -399,4 +399,21 @@ let tests = let dal_parameters = constants_mainnet.dal end) in - Sandbox.tests @ Test.tests @ Mainnet.tests + let module Custom = Make (struct + let name = "custom" + + let dal_parameters = + let dal_mainnet = constants_mainnet.dal in + { + dal_mainnet with + cryptobox_parameters = + Dal_helpers.derive_dal_parameters + dal_mainnet.cryptobox_parameters + ~redundancy_factor:4 + ~constants_divider:64; + } + end) in + (* TODO/DAL: Enable these tests to cover more protocol parameters if we manage + to run DAL crypto part faster. *) + ignore @@ Sandbox.tests @ Test.tests @ Mainnet.tests ; + Custom.tests