Fix NixOS vendoring issue (#409)
This commit is contained in:
parent
43a13f37ee
commit
f345b66f53
|
@ -21,3 +21,5 @@ build/
|
||||||
|
|
||||||
# ccls cache dir
|
# ccls cache dir
|
||||||
.ccls-cache/
|
.ccls-cache/
|
||||||
|
|
||||||
|
target
|
||||||
|
|
|
@ -6,6 +6,11 @@ license = "Apache-2.0"
|
||||||
links = "ckzg"
|
links = "ckzg"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
include = ["src", "inc", "bindings/rust/src", "bindings/rust/build.rs", "blst/bindings/*.h"]
|
||||||
|
build = "bindings/rust/build.rs"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
path = "bindings/rust/src/lib.rs"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std", "portable"]
|
default = ["std", "portable"]
|
||||||
|
@ -36,8 +41,8 @@ criterion = "0.5.1"
|
||||||
glob = "0.3.1"
|
glob = "0.3.1"
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_yaml = "0.9.17"
|
|
||||||
serde_json = "1.0.105"
|
serde_json = "1.0.105"
|
||||||
|
serde_yaml = "0.9.17"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
bindgen = { version = "0.69", optional = true }
|
bindgen = { version = "0.69", optional = true }
|
||||||
|
@ -47,5 +52,6 @@ cc = "1.0"
|
||||||
glob = "0.3"
|
glob = "0.3"
|
||||||
|
|
||||||
[[bench]]
|
[[bench]]
|
||||||
|
path = "bindings/rust/benches/kzg_benches.rs"
|
||||||
name = "kzg_benches"
|
name = "kzg_benches"
|
||||||
harness = false
|
harness = false
|
|
@ -1 +0,0 @@
|
||||||
target/
|
|
|
@ -25,7 +25,7 @@ fn generate_random_blob(rng: &mut ThreadRng) -> Blob {
|
||||||
pub fn criterion_benchmark(c: &mut Criterion) {
|
pub fn criterion_benchmark(c: &mut Criterion) {
|
||||||
let max_count: usize = 64;
|
let max_count: usize = 64;
|
||||||
let mut rng = rand::thread_rng();
|
let mut rng = rand::thread_rng();
|
||||||
let trusted_setup_file = Path::new("../../src/trusted_setup.txt");
|
let trusted_setup_file = Path::new("src/trusted_setup.txt");
|
||||||
assert!(trusted_setup_file.exists());
|
assert!(trusted_setup_file.exists());
|
||||||
let kzg_settings = Arc::new(KzgSettings::load_trusted_setup_file(trusted_setup_file).unwrap());
|
let kzg_settings = Arc::new(KzgSettings::load_trusted_setup_file(trusted_setup_file).unwrap());
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,7 @@
|
||||||
use std::env;
|
use std::{env, path::PathBuf};
|
||||||
use std::path::PathBuf;
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let cargo_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
|
let root_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
|
||||||
let root_dir = cargo_dir
|
|
||||||
.parent()
|
|
||||||
.expect("rust dir is nested")
|
|
||||||
.parent()
|
|
||||||
.expect("bindings dir is nested");
|
|
||||||
|
|
||||||
// Obtain the header files of blst
|
// Obtain the header files of blst
|
||||||
let blst_base_dir = root_dir.join("blst");
|
let blst_base_dir = root_dir.join("blst");
|
||||||
|
@ -37,7 +31,10 @@ fn main() {
|
||||||
#[cfg(feature = "generate-bindings")]
|
#[cfg(feature = "generate-bindings")]
|
||||||
{
|
{
|
||||||
let header_path = c_src_dir.join("c_kzg_4844.h");
|
let header_path = c_src_dir.join("c_kzg_4844.h");
|
||||||
let bindings_out_path = concat!(env!("CARGO_MANIFEST_DIR"), "/src/bindings/generated.rs");
|
let bindings_out_path = concat!(
|
||||||
|
env!("CARGO_MANIFEST_DIR"),
|
||||||
|
"/bindings/rust/src/bindings/generated.rs"
|
||||||
|
);
|
||||||
make_bindings(
|
make_bindings(
|
||||||
header_path.to_str().expect("valid header path"),
|
header_path.to_str().expect("valid header path"),
|
||||||
blst_headers_dir.to_str().expect("valid blst header path"),
|
blst_headers_dir.to_str().expect("valid blst header path"),
|
||||||
|
|
|
@ -648,20 +648,20 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_end_to_end() {
|
fn test_end_to_end() {
|
||||||
let trusted_setup_file = Path::new("../../src/trusted_setup.txt");
|
let trusted_setup_file = Path::new("src/trusted_setup.txt");
|
||||||
test_simple(trusted_setup_file);
|
test_simple(trusted_setup_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
const BLOB_TO_KZG_COMMITMENT_TESTS: &str = "../../tests/blob_to_kzg_commitment/*/*/*";
|
const BLOB_TO_KZG_COMMITMENT_TESTS: &str = "tests/blob_to_kzg_commitment/*/*/*";
|
||||||
const COMPUTE_KZG_PROOF_TESTS: &str = "../../tests/compute_kzg_proof/*/*/*";
|
const COMPUTE_KZG_PROOF_TESTS: &str = "tests/compute_kzg_proof/*/*/*";
|
||||||
const COMPUTE_BLOB_KZG_PROOF_TESTS: &str = "../../tests/compute_blob_kzg_proof/*/*/*";
|
const COMPUTE_BLOB_KZG_PROOF_TESTS: &str = "tests/compute_blob_kzg_proof/*/*/*";
|
||||||
const VERIFY_KZG_PROOF_TESTS: &str = "../../tests/verify_kzg_proof/*/*/*";
|
const VERIFY_KZG_PROOF_TESTS: &str = "tests/verify_kzg_proof/*/*/*";
|
||||||
const VERIFY_BLOB_KZG_PROOF_TESTS: &str = "../../tests/verify_blob_kzg_proof/*/*/*";
|
const VERIFY_BLOB_KZG_PROOF_TESTS: &str = "tests/verify_blob_kzg_proof/*/*/*";
|
||||||
const VERIFY_BLOB_KZG_PROOF_BATCH_TESTS: &str = "../../tests/verify_blob_kzg_proof_batch/*/*/*";
|
const VERIFY_BLOB_KZG_PROOF_BATCH_TESTS: &str = "tests/verify_blob_kzg_proof_batch/*/*/*";
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_blob_to_kzg_commitment() {
|
fn test_blob_to_kzg_commitment() {
|
||||||
let trusted_setup_file = Path::new("../../src/trusted_setup.txt");
|
let trusted_setup_file = Path::new("src/trusted_setup.txt");
|
||||||
assert!(trusted_setup_file.exists());
|
assert!(trusted_setup_file.exists());
|
||||||
let kzg_settings = KZGSettings::load_trusted_setup_file(trusted_setup_file).unwrap();
|
let kzg_settings = KZGSettings::load_trusted_setup_file(trusted_setup_file).unwrap();
|
||||||
let test_files: Vec<PathBuf> = glob::glob(BLOB_TO_KZG_COMMITMENT_TESTS)
|
let test_files: Vec<PathBuf> = glob::glob(BLOB_TO_KZG_COMMITMENT_TESTS)
|
||||||
|
@ -687,7 +687,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_compute_kzg_proof() {
|
fn test_compute_kzg_proof() {
|
||||||
let trusted_setup_file = Path::new("../../src/trusted_setup.txt");
|
let trusted_setup_file = Path::new("src/trusted_setup.txt");
|
||||||
assert!(trusted_setup_file.exists());
|
assert!(trusted_setup_file.exists());
|
||||||
let kzg_settings = KZGSettings::load_trusted_setup_file(trusted_setup_file).unwrap();
|
let kzg_settings = KZGSettings::load_trusted_setup_file(trusted_setup_file).unwrap();
|
||||||
let test_files: Vec<PathBuf> = glob::glob(COMPUTE_KZG_PROOF_TESTS)
|
let test_files: Vec<PathBuf> = glob::glob(COMPUTE_KZG_PROOF_TESTS)
|
||||||
|
@ -716,7 +716,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_compute_blob_kzg_proof() {
|
fn test_compute_blob_kzg_proof() {
|
||||||
let trusted_setup_file = Path::new("../../src/trusted_setup.txt");
|
let trusted_setup_file = Path::new("src/trusted_setup.txt");
|
||||||
assert!(trusted_setup_file.exists());
|
assert!(trusted_setup_file.exists());
|
||||||
let kzg_settings = KZGSettings::load_trusted_setup_file(trusted_setup_file).unwrap();
|
let kzg_settings = KZGSettings::load_trusted_setup_file(trusted_setup_file).unwrap();
|
||||||
let test_files: Vec<PathBuf> = glob::glob(COMPUTE_BLOB_KZG_PROOF_TESTS)
|
let test_files: Vec<PathBuf> = glob::glob(COMPUTE_BLOB_KZG_PROOF_TESTS)
|
||||||
|
@ -743,7 +743,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_verify_kzg_proof() {
|
fn test_verify_kzg_proof() {
|
||||||
let trusted_setup_file = Path::new("../../src/trusted_setup.txt");
|
let trusted_setup_file = Path::new("src/trusted_setup.txt");
|
||||||
assert!(trusted_setup_file.exists());
|
assert!(trusted_setup_file.exists());
|
||||||
let kzg_settings = KZGSettings::load_trusted_setup_file(trusted_setup_file).unwrap();
|
let kzg_settings = KZGSettings::load_trusted_setup_file(trusted_setup_file).unwrap();
|
||||||
let test_files: Vec<PathBuf> = glob::glob(VERIFY_KZG_PROOF_TESTS)
|
let test_files: Vec<PathBuf> = glob::glob(VERIFY_KZG_PROOF_TESTS)
|
||||||
|
@ -774,7 +774,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_verify_blob_kzg_proof() {
|
fn test_verify_blob_kzg_proof() {
|
||||||
let trusted_setup_file = Path::new("../../src/trusted_setup.txt");
|
let trusted_setup_file = Path::new("src/trusted_setup.txt");
|
||||||
assert!(trusted_setup_file.exists());
|
assert!(trusted_setup_file.exists());
|
||||||
let kzg_settings = KZGSettings::load_trusted_setup_file(trusted_setup_file).unwrap();
|
let kzg_settings = KZGSettings::load_trusted_setup_file(trusted_setup_file).unwrap();
|
||||||
let test_files: Vec<PathBuf> = glob::glob(VERIFY_BLOB_KZG_PROOF_TESTS)
|
let test_files: Vec<PathBuf> = glob::glob(VERIFY_BLOB_KZG_PROOF_TESTS)
|
||||||
|
@ -804,7 +804,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_verify_blob_kzg_proof_batch() {
|
fn test_verify_blob_kzg_proof_batch() {
|
||||||
let trusted_setup_file = Path::new("../../src/trusted_setup.txt");
|
let trusted_setup_file = Path::new("src/trusted_setup.txt");
|
||||||
assert!(trusted_setup_file.exists());
|
assert!(trusted_setup_file.exists());
|
||||||
let kzg_settings = KZGSettings::load_trusted_setup_file(trusted_setup_file).unwrap();
|
let kzg_settings = KZGSettings::load_trusted_setup_file(trusted_setup_file).unwrap();
|
||||||
let test_files: Vec<PathBuf> = glob::glob(VERIFY_BLOB_KZG_PROOF_BATCH_TESTS)
|
let test_files: Vec<PathBuf> = glob::glob(VERIFY_BLOB_KZG_PROOF_BATCH_TESTS)
|
||||||
|
|
Loading…
Reference in New Issue