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

Fix libsnark build script #1084

Merged
merged 8 commits into from
Jan 12, 2022
Merged
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
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
command: cargo generate-lockfile
- restore_cache:
keys:
- v4-cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
- cargo-cache-{{ .Environment.CACHE_VERSION }}-{{ arch }}-{{ checksum "Cargo.lock" }}
Schaeff marked this conversation as resolved.
Show resolved Hide resolved
- run:
name: Build
command: WITH_LIBSNARK=1 RUSTFLAGS="-D warnings" ./build.sh
Expand All @@ -33,7 +33,7 @@ jobs:
- target/debug/.fingerprint
- target/debug/build
- target/debug/deps
key: v4-cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
key: cargo-cache-{{ .Environment.CACHE_VERSION }}-{{ arch }}-{{ checksum "Cargo.lock" }}
test:
docker:
- image: zokrates/env:latest
Expand All @@ -48,7 +48,7 @@ jobs:
command: cargo generate-lockfile
- restore_cache:
keys:
- v4-cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
- cargo-cache-{{ .Environment.CACHE_VERSION }}-{{ arch }}-{{ checksum "Cargo.lock" }}
- run:
name: Check format
command: cargo fmt --all -- --check
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
command: cargo generate-lockfile
- restore_cache:
keys:
- v4-cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
- cargo-cache-{{ .Environment.CACHE_VERSION }}-{{ arch }}-{{ checksum "Cargo.lock" }}
- run:
name: Test on firefox
command: |
Expand All @@ -103,7 +103,7 @@ jobs:
command: cargo generate-lockfile
- restore_cache:
keys:
- v4-cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
- cargo-cache-{{ .Environment.CACHE_VERSION }}-{{ arch }}-{{ checksum "Cargo.lock" }}
- run:
name: Run integration tests
no_output_timeout: "30m"
Expand Down
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion zokrates_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ zokrates_fs_resolver = { version = "0.5", path = "../zokrates_fs_resolver"}
[build-dependencies]
cc = { version = "1.0", features = ["parallel"], optional = true }
cmake = { version = "=0.1.45", optional = true }
git2 = { version = "0.13.1", optional = true }
git2 = { version = "0.13.25", optional = true }
16 changes: 11 additions & 5 deletions zokrates_core/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ extern crate git2;
fn main() {
#[cfg(feature = "libsnark")]
{
use git2::{Oid, Repository, ResetType};
use git2::Repository;
use std::env;
use std::fs::remove_dir;
use std::path::PathBuf;
Expand All @@ -25,11 +25,17 @@ fn main() {
Repository::clone(LIBSNARK_URL, libsnark_source_path).unwrap()
});

let commit = Oid::from_str(LIBSNARK_COMMIT).unwrap();
let commit = repo.find_commit(commit).unwrap();
// Unencrypted `git://` protocol is no longer supported on GitHub
// so we replace all submodule urls to use `https://`
let gitmodules_path = libsnark_source_path.join(".gitmodules");
let gitmodules = std::fs::read_to_string(&gitmodules_path)
.unwrap()
.replace("git://", "https://");
Schaeff marked this conversation as resolved.
Show resolved Hide resolved

repo.reset(&commit.as_object(), ResetType::Hard, None)
.unwrap();
std::fs::write(&gitmodules_path, gitmodules).unwrap();

let object = repo.revparse_single(LIBSNARK_COMMIT).unwrap();
repo.checkout_tree(&object, None).unwrap();

for mut s in repo.submodules().unwrap() {
s.update(true, None).unwrap();
Expand Down