Skip to content

Commit

Permalink
Merge pull request #66 from worldcoin/0xkitsune/ci
Browse files Browse the repository at this point in the history
fix(ci): Update Rust version and fix CI
  • Loading branch information
0xKitsune authored Mar 12, 2024
2 parents a887811 + 8f7e676 commit 0af6b37
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Build and Test
on: push

env:
RUST_VERSION: 1.70.0
NIGHTLY_VERSION: nightly-2023-05-31
RUST_VERSION: 1.76.0
NIGHTLY_VERSION: nightly-2024-02-04
CARGO_VET_VERSION: 0.7.0
CARGO_VET_REPO: https://github.com/mozilla/cargo-vet

Expand Down
4 changes: 2 additions & 2 deletions crates/semaphore-depth-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ impl VisitMut for IdentReplacer {
}
}
syn::Expr::Macro(mcr) => {
let Ok(mut args) = mcr.mac.parse_body::<MacroArgs>() else {
return;
let Ok(mut args) = mcr.mac.parse_body::<MacroArgs>() else {
return;
};
for arg in &mut args.args {
self.visit_expr_mut(arg);
Expand Down
2 changes: 1 addition & 1 deletion src/lazy_merkle_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,7 @@ impl<H: Hasher> MmapMutWrapper<H> {
};

file.set_len(file_size).expect("cannot set file size");
if file.write_all(&buf).is_err() {
if file.write_all(buf).is_err() {
return Err(DenseMMapError::FileCannotWriteBytes);
}

Expand Down
13 changes: 8 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,11 @@ mod test {
#[cfg(feature = "bench")]
pub mod bench {
use crate::{
hash_to_field, identity::Identity, poseidon_tree::LazyPoseidonTree,
protocol::{generate_proof, generate_witness}, Field,
hash_to_field,
identity::Identity,
poseidon_tree::LazyPoseidonTree,
protocol::{generate_proof, generate_witness},
Field,
};
use criterion::Criterion;
use semaphore_depth_config::get_supported_depths;
Expand Down Expand Up @@ -182,18 +185,18 @@ pub mod bench {

fn bench_witness(criterion: &mut Criterion, depth: usize) {
let leaf = Field::from(0);

// Create tree
let mut hello = *b"hello";
let id = Identity::from_secret(&mut hello, None);
let mut tree = LazyPoseidonTree::new(depth, leaf).derived();
tree = tree.update(0, &id.commitment());
let merkle_proof = tree.proof(0);

// change signal and external_nullifier here
let signal_hash = hash_to_field(b"xxx");
let external_nullifier_hash = hash_to_field(b"appId");

criterion.bench_function(&format!("witness_{depth}"), move |b| {
b.iter(|| {
generate_witness(&id, &merkle_proof, external_nullifier_hash, signal_hash).unwrap();
Expand Down

0 comments on commit 0af6b37

Please sign in to comment.