Skip to content

Commit

Permalink
Merge branch 'develop' into steven-berkeley-terraform-repair
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenplatt authored Nov 29, 2023
2 parents b17d48a + 03644c5 commit a5483db
Show file tree
Hide file tree
Showing 27 changed files with 728 additions and 533 deletions.
36 changes: 0 additions & 36 deletions buildkite/src/Command/TestExecutive.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -28,41 +28,5 @@ in
key = "integration-test-${testName}",
target = Size.Integration,
depends_on = dependsOn
},

buildJs = \(duneProfile : Text) ->
Command.build
Command.Config::{
commands =
-- Build js test archive
RunInToolchain.runInToolchainBuster ([] : List Text) "./buildkite/scripts/build-js-tests.sh"

#

[
-- Cache js test archive
Cmd.run "artifact-cache-helper.sh snarkyjs_test.tar.gz --upload"
],
label = "Build JS integration tests",
key = "build-js-tests",
target = Size.XLarge
},

executeWithJs = \(testName : Text) -> \(dependsOn : List Command.TaggedKey.Type) ->
Command.build
Command.Config::{
commands =
[
Cmd.run "artifact-cache-helper.sh snarkyjs_test.tar.gz && tar -xzf snarkyjs_test.tar.gz",

-- Execute test based on BUILD image
Cmd.run "MINA_DEB_CODENAME=bullseye ; source ./buildkite/scripts/export-git-env-vars.sh && ./buildkite/scripts/run-test-executive.sh ${testName}"
],
artifact_paths = [SelectFiles.exactly "." "${testName}.test.log"],
label = "${testName} integration test",
key = "integration-test-${testName}",
target = Size.Integration,
depends_on = dependsOn,
soft_fail = Some (B/SoftFail.Boolean True)
}
}
9 changes: 1 addition & 8 deletions buildkite/src/Jobs/Test/TestnetIntegrationTests.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ let Dockers = ../../Constants/DockerVersions.dhall
let dependsOn =
Dockers.dependsOn Dockers.Type.Bullseye Profiles.Type.Standard "daemon-berkeley"
# Dockers.dependsOn Dockers.Type.Bullseye Profiles.Type.Standard "archive"
in

let dependsOnJs = [{ name = "TestnetIntegrationTests", key = "build-js-tests" }]
# Dockers.dependsOn Dockers.Type.Bullseye Profiles.Type.Standard "daemon-berkeley"
# Dockers.dependsOn Dockers.Type.Bullseye Profiles.Type.Standard "archive"

in Pipeline.build Pipeline.Config::{
spec =
Expand All @@ -35,7 +30,6 @@ in Pipeline.build Pipeline.Config::{
mode = PipelineMode.Type.Stable
},
steps = [
TestExecutive.buildJs "integration_tests",
TestExecutive.execute "peers-reliability" dependsOn,
TestExecutive.execute "chain-reliability" dependsOn,
TestExecutive.execute "payment" dependsOn,
Expand All @@ -46,7 +40,6 @@ in Pipeline.build Pipeline.Config::{
TestExecutive.execute "zkapps" dependsOn,
TestExecutive.execute "zkapps-timing" dependsOn,
TestExecutive.execute "zkapps-nonce" dependsOn,
TestExecutive.execute "verification-key" dependsOn,
TestExecutive.executeWithJs "snarkyjs" dependsOnJs
TestExecutive.execute "verification-key" dependsOn
]
}
70 changes: 0 additions & 70 deletions src/app/test_executive/snarkyjs.ml

This file was deleted.

1 change: 0 additions & 1 deletion src/app/test_executive/test_executive.ml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ let tests : test list =
, (module Verification_key_update.Make : Intf.Test.Functor_intf) )
; ( "block-prod-prio"
, (module Block_production_priority.Make : Intf.Test.Functor_intf) )
; ("snarkyjs", (module Snarkyjs.Make : Intf.Test.Functor_intf))
; ("block-reward", (module Block_reward_test.Make : Intf.Test.Functor_intf))
; ("hard-fork", (module Hard_fork.Make : Intf.Test.Functor_intf))
]
Expand Down
27 changes: 0 additions & 27 deletions src/lib/pickles/impls.ml
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,6 @@ module Step = struct
in
values |> List.filter_map ~f )

let%test_unit "preserve circuit behavior for Step" =
let expected_list =
[ ("45560315531506369815346746415080538112", false)
; ("45560315531506369815346746415080538113", false)
; ( "14474011154664524427946373126085988481727088556502330059655218120611762012161"
, true )
; ( "14474011154664524427946373126085988481727088556502330059655218120611762012161"
, true )
]
in
let str_list =
List.map (Lazy.force forbidden_shifted_values) ~f:(fun (a, b) ->
(Tick.Field.to_string a, b) )
in
assert ([%equal: (string * bool) list] str_list expected_list)

let typ_unchecked : (t, Constant.t) Typ.t =
Typ.transport
(Typ.tuple2 Field.typ Boolean.typ)
Expand Down Expand Up @@ -187,17 +171,6 @@ module Wrap = struct
in
values |> List.filter_map ~f )

let%test_unit "preserve circuit behavior for Wrap" =
let expected_list =
[ "91120631062839412180561524743370440705"
; "91120631062839412180561524743370440706"
]
in
let str_list =
List.map (Lazy.force forbidden_shifted_values) ~f:Wrap_field.to_string
in
assert ([%equal: string list] str_list expected_list)

let typ_unchecked, check =
(* Tick -> Tock *)
let (Typ t0 as typ_unchecked) =
Expand Down
4 changes: 4 additions & 0 deletions src/lib/pickles/impls.mli
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ module Step : sig

module Constant = Backend.Tock.Field

val forbidden_shifted_values : (Impl.field * bool) list lazy_t

val typ_unchecked : (t, Constant.t) Typ.t

val typ : (t, Constant.t, Internal_Basic.field) Snarky_backendless.Typ.t
Expand Down Expand Up @@ -119,6 +121,8 @@ module Wrap : sig

module Constant = Backend.Tick.Field

val forbidden_shifted_values : Impl.field list lazy_t

val typ_unchecked : (Impl.Field.t, Backend.Tick.Field.t) Impl.Typ.t

val typ :
Expand Down
71 changes: 0 additions & 71 deletions src/lib/pickles/opt_sponge.ml
Original file line number Diff line number Diff line change
Expand Up @@ -285,75 +285,4 @@ struct
}
| _, _ ->
failwith "Incompatible states"

let%test_module "opt_sponge" =
( module struct
module S = Sponge.Make_sponge (P)

let%test_unit "correctness" =
let params : _ Sponge.Params.t =
let a () =
Array.init 3 ~f:(fun _ -> Field.(constant (Constant.random ())))
in
{ mds = Array.init 3 ~f:(fun _ -> a ())
; round_constants = Array.init 40 ~f:(fun _ -> a ())
}
in
let gen =
let open Quickcheck.Generator.Let_syntax in
let%bind n = Quickcheck.Generator.small_positive_int
and n_pre = Quickcheck.Generator.small_positive_int in
let%map xs = List.gen_with_length n Field.Constant.gen
and bs = List.gen_with_length n Bool.quickcheck_generator
and pre = List.gen_with_length n_pre Field.Constant.gen in
(pre, List.zip_exn bs xs)
in
Quickcheck.test gen ~trials:10 ~f:(fun (pre, ps) ->
let filtered =
List.filter_map ps ~f:(fun (b, x) -> if b then Some x else None)
in
let init () =
let pre =
exists
(Typ.list ~length:(List.length pre) Field.typ)
~compute:(fun () -> pre)
in
let s = S.create params in
List.iter pre ~f:(S.absorb s) ;
s
in
let filtered_res =
let n = List.length filtered in
Impl.Internal_Basic.Test.checked_to_unchecked
(Typ.list ~length:n Field.typ)
Field.typ
(fun xs ->
make_checked (fun () ->
let s = init () in
List.iter xs ~f:(S.absorb s) ;
S.squeeze s ) )
filtered
in
let opt_res =
let n = List.length ps in
Impl.Internal_Basic.Test.checked_to_unchecked
(Typ.list ~length:n (Typ.tuple2 Boolean.typ Field.typ))
Field.typ
(fun xs ->
make_checked (fun () ->
let s =
if List.length pre = 0 then create params
else of_sponge (init ())
in
List.iter xs ~f:(absorb s) ;
squeeze s ) )
ps
in
if not (Field.Constant.equal filtered_res opt_res) then
failwithf
!"hash(%{sexp:Field.Constant.t list}) = %{sexp:Field.Constant.t}\n\
hash(%{sexp:(bool * Field.Constant.t) list}) = \
%{sexp:Field.Constant.t}"
filtered filtered_res ps opt_res () )
end )
end
77 changes: 0 additions & 77 deletions src/lib/pickles/plonk_curve_ops.ml
Original file line number Diff line number Diff line change
Expand Up @@ -293,81 +293,4 @@ struct
~num_bits

let scale_fast a b = with_label __LOC__ (fun () -> scale_fast a b)

let%test_module "curve_ops" =
( module struct
module T = Internal_Basic

let random_point =
let rec pt x =
let y2 = G.Params.(T.Field.(b + (x * (a + (x * x))))) in
if T.Field.is_square y2 then (x, T.Field.sqrt y2)
else pt T.Field.(x + one)
in
G.Constant.of_affine (pt (T.Field.of_int 0))

let n = Field.size_in_bits

let%test_unit "scale fast 2" =
Quickcheck.test ~trials:5 Field.Constant.gen ~f:(fun s ->
let input =
let s_odd = T.Bigint.test_bit (T.Bigint.of_field s) 0 in
Field.Constant.((if s_odd then s - one else s) / of_int 2, s_odd)
in
T.Test.test_equal ~equal:G.Constant.equal
~sexp_of_t:G.Constant.sexp_of_t
(Typ.tuple2 G.typ (Typ.tuple2 Field.typ Boolean.typ))
G.typ
(fun (g, s) ->
make_checked (fun () ->
scale_fast2 ~num_bits:n g
(Pickles_types.Shifted_value.Type2.Shifted_value s) ) )
(fun (g, _) ->
let x =
let chunks_needed = chunks_needed ~num_bits:(n - 1) in
let actual_bits_used = chunks_needed * bits_per_chunk in
Pickles_types.Pcs_batch.pow ~one:G.Constant.Scalar.one
~mul:G.Constant.Scalar.( * )
G.Constant.Scalar.(of_int 2)
actual_bits_used
|> G.Constant.Scalar.( + )
(G.Constant.Scalar.project (Field.Constant.unpack s))
in
G.Constant.scale g x )
(random_point, input) )

let%test_unit "scale fast" =
let open Pickles_types in
let shift =
Shifted_value.Type1.Shift.create (module G.Constant.Scalar)
in
Quickcheck.test ~trials:10
Quickcheck.Generator.(
map (list_with_length n Bool.quickcheck_generator) ~f:(fun bs ->
Field.Constant.project bs |> Field.Constant.unpack ))
~f:(fun xs ->
try
T.Test.test_equal ~equal:G.Constant.equal
~sexp_of_t:G.Constant.sexp_of_t
(Typ.tuple2 G.typ (Typ.list ~length:n Boolean.typ))
G.typ
(fun (g, s) ->
make_checked (fun () ->
scale_fast ~num_bits:n g
(Pickles_types.Shifted_value.Type1.Shifted_value
(Field.project s) ) ) )
(fun (g, s) ->
let open G.Constant.Scalar in
let s = project s in
let x =
Shifted_value.Type1.to_field
(module G.Constant.Scalar)
~shift (Pickles_types.Shifted_value.Type1.Shifted_value s)
in
G.Constant.scale g x )
(random_point, xs)
with e ->
eprintf !"Input %{sexp: bool list}\n%!" xs ;
raise e )
end )
end
Loading

0 comments on commit a5483db

Please sign in to comment.