From ac7b7284e2b3ddf5bddf7420f5310d878f62abf1 Mon Sep 17 00:00:00 2001 From: Volker Mische Date: Wed, 21 Dec 2022 13:08:57 +0100 Subject: [PATCH 1/3] chore: add instructio on how to checkout the submodule --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 60908a51d6..dc196c22ce 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,11 @@ Lurk backend integration is still immature, so current performance is not repres ## Submodules Lurk source files used in tests are in the [lurk-lib](https://github.com/lurk-lang/lurk-lib) submodule. You must -initialize and update submodules before test will pass. +initialize and update submodules before test will pass: + +``` +git submodule update --init --recursive +``` ## Repl From 93fb8ac3b87f7fb55649b990a7e79629a692cd25 Mon Sep 17 00:00:00 2001 From: Volker Mische Date: Wed, 21 Dec 2022 13:14:09 +0100 Subject: [PATCH 2/3] refactor: remove level of indirection Call `groth16::create_random_proof` directly instead of having a helper method. This reduces one level of indirection and 10 lines of code. --- src/proof/groth16.rs | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/proof/groth16.rs b/src/proof/groth16.rs index 9f8f35c646..9d0030d564 100644 --- a/src/proof/groth16.rs +++ b/src/proof/groth16.rs @@ -104,17 +104,7 @@ impl Groth16Prover { params: &groth16::Parameters, mut rng: R, ) -> Result, SynthesisError> { - self.generate_groth16_proof(multi_frame, params, &mut rng) - } - - fn generate_groth16_proof( - &self, - multiframe: MultiFrame<'_, Scalar, IO, Witness>, - groth_params: &groth16::Parameters, - rng: &mut R, - ) -> Result, SynthesisError> { - let create_proof = |p| groth16::create_random_proof(multiframe, p, rng); - create_proof(groth_params) + groth16::create_random_proof(multi_frame, params, &mut rng) } #[allow(clippy::too_many_arguments)] @@ -146,9 +136,7 @@ impl Groth16Prover { let last_multiframe = multiframes.last().unwrap().clone(); for multiframe in multiframes.into_iter() { statements.push(multiframe.public_inputs()); - let proof = self - .generate_groth16_proof(multiframe.clone(), params, &mut rng) - .unwrap(); + let proof = self.prove(multiframe.clone(), params, &mut rng).unwrap(); proofs.push(proof.clone()); multiframe_proofs.push((multiframe, proof)); @@ -162,7 +150,7 @@ impl Groth16Prover { ); let dummy_proof = self - .generate_groth16_proof(dummy_multiframe.clone(), params, &mut rng) + .prove(dummy_multiframe.clone(), params, &mut rng) .unwrap(); let dummy_statement = dummy_multiframe.public_inputs(); From 787055035f8d024c00f3e45f407c7d2dd2718ed1 Mon Sep 17 00:00:00 2001 From: Volker Mische Date: Thu, 22 Dec 2022 10:31:52 +0100 Subject: [PATCH 3/3] chore: unify cache story There are cache keys that aren't actually used and an instanceo of a manually written cache key, which is error prone. This commit cleans things a bit up. --- .circleci/config.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 61ac8f7ed7..d1cb4b75b2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -46,7 +46,7 @@ commands: steps: - save_cache: name: "Save rustup cache" - key: cargo-v2-{{ checksum "rust-toolchain" }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }}-{{arch}} + key: cargo-v2-{{ checksum "rust-toolchain" }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }}-{{ arch }} paths: - "~/.cargo" - "~/.rustup" @@ -56,7 +56,6 @@ commands: - restore_cache: keys: - cargo-v2-{{ checksum "rust-toolchain" }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }}-{{ arch }} - - repo-source-{{ .Branch }}-{{ .Revision }} install_gpu_deps: steps: @@ -79,9 +78,7 @@ jobs: - run: name: Calculate dependencies command: cargo generate-lockfile - - restore_cache: - keys: - - cargo-v2-{{ checksum "rust-toolchain" }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }}-{{ arch }} + - restore_rustup_cache - run: cargo update - run: cargo fetch - run: rm -rf .git