Skip to content

Commit

Permalink
feat(halo2_proofs): add tachyon halo2 rust binding
Browse files Browse the repository at this point in the history
  • Loading branch information
chokobole committed Jul 22, 2024
1 parent e497ec5 commit 2cdcc42
Show file tree
Hide file tree
Showing 37 changed files with 3,614 additions and 19 deletions.
126 changes: 107 additions & 19 deletions Cargo.lock

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

5 changes: 5 additions & 0 deletions halo2_proofs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ log = "0.4.17"
# timer
ark-std = { version = "0.3.0" }

# binding
cxx = "1.0"

# Legacy circuit compatibility
halo2_legacy_pdqsort = { version = "0.1.0", optional = true }
Expand All @@ -87,6 +89,9 @@ gumdrop = "0.8"
proptest = "1"
rand_core = { version = "0.6", default-features = false, features = ["getrandom"] }

[build-dependencies]
cxx-build = "1.0"

[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dev-dependencies]
getrandom = { version = "0.2", features = ["js"] }

Expand Down
48 changes: 48 additions & 0 deletions halo2_proofs/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
fn main() {
let src_files = [
"src/bn254_blake2b_writer.cc",
"src/bn254_evals.cc",
"src/bn254_poly.cc",
"src/bn254_poseidon_writer.cc",
"src/bn254_prover.cc",
"src/bn254_proving_key.cc",
"src/bn254_rational_evals.cc",
"src/bn254_rational_evals_view.cc",
"src/bn254_sha256_writer.cc",
"src/bn254_snark_verifier_poseidon_writer.cc",
"src/cha_cha20_rng.cc",
"src/xor_shift_rng.cc",
];
cxx_build::bridges([
"src/bn254.rs",
"src/cha_cha20_rng.rs",
"src/xor_shift_rng.rs",
])
.files(src_files)
.flag_if_supported("-std=c++17")
.compile("halo2_proofs");

let mut dep_files = vec![
"include/bn254_blake2b_writer.h",
"include/bn254_evals.h",
"include/bn254_poly.h",
"include/bn254_poseidon_writer.h",
"include/bn254_prover.h",
"include/bn254_proving_key.h",
"include/bn254_rational_evals.h",
"include/bn254_rational_evals_view.h",
"include/bn254_sha256_writer.h",
"include/bn254_snark_verifier_poseidon_writer.h",
"include/cha_cha20_rng.h",
"include/xor_shift_rng.h",
"src/bn254.rs",
"src/rust_vec.h",
"src/xor_shift_rng.rs",
];
dep_files.extend_from_slice(&src_files);
for file in dep_files {
println!("cargo:rerun-if-changed={file}");
}

println!("cargo:rustc-link-lib=dylib=tachyon");
}
Loading

0 comments on commit 2cdcc42

Please sign in to comment.