Skip to content

Commit

Permalink
fix(circom): fixed CI test
Browse files Browse the repository at this point in the history
- Removed deleted keccak mod
- Fixed clippy warning
  • Loading branch information
tchataigner committed Dec 21, 2023
1 parent 224004d commit 791034e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
3 changes: 0 additions & 3 deletions src/circuit/gadgets/circom/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//! # Usage of circom coprocessors.
//!
//! See `examples/circom.rs` for a quick example of how to declare a circom coprocessor.

pub mod keccak;

use crate::{
field::LurkField,
lem::{pointers::Ptr, store::Store},
Expand Down
2 changes: 1 addition & 1 deletion src/cli/circom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pub(crate) fn create_circom_gadget(circom_folder: &Utf8PathBuf, reference: &str)

// We expect a format <AUTHOR>/<NAME> for the name.
// TODO: should we switch to check regex: ^[a-zA-Z0-9]+([_-]?[a-zA-Z0-9]+)*\/[a-zA-Z0-9]+([_-]?[a-zA-Z0-9]+)*$ ?
let reference_split: Vec<&str> = reference.split("/").collect();
let reference_split: Vec<&str> = reference.split('/').collect();
if reference_split.len() != 2 {
bail!("Expected a reference of format \"<AUTHOR>/<NAME>\", got \"{reference}\"");
}
Expand Down
23 changes: 11 additions & 12 deletions src/coprocessor/circom/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ pub mod non_wasm {

let r1cs = circom_dir()
.join(gadget.reference())
.join(gadget.reference().split("/").collect::<Vec<&str>>()[1])
.join(gadget.reference().split('/').collect::<Vec<&str>>()[1])
.with_extension("r1cs");
let wasm = circom_dir()
.join(gadget.reference())
.join(gadget.reference().split("/").collect::<Vec<&str>>()[1])
.join(gadget.reference().split('/').collect::<Vec<&str>>()[1])
.with_extension("wasm");

if r1cs.exists() && wasm.exists() {
Expand All @@ -69,7 +69,7 @@ pub mod non_wasm {
fn get_remote_gadget<F: LurkField, C: CircomGadget<F>>(
gadget: &C,
) -> Result<Option<(Utf8PathBuf, Utf8PathBuf)>, CircomCoprocessorError> {
let name = gadget.reference().split("/").collect::<Vec<&str>>()[1];
let name = gadget.reference().split('/').collect::<Vec<&str>>()[1];

// Check that we have a proper version for a remote release. If not, look if gadget repo exist
// and return error accordingly.
Expand All @@ -89,12 +89,12 @@ pub mod non_wasm {
return Err(CircomCoprocessorError::GadgetNotFound {
reference: ref_as_string.clone(),
name: String::from(name),
prelude: prelude.into(),
prelude,
});
}

return Err(CircomCoprocessorError::MissingGadgetVersion {
prelude: prelude.into(),
prelude,
reference: ref_as_string.clone(),
});
}
Expand All @@ -109,7 +109,7 @@ pub mod non_wasm {
})?;
}

let name = gadget.reference().split("/").collect::<Vec<&str>>()[1];
let name = gadget.reference().split('/').collect::<Vec<&str>>()[1];
let r1cs = circom_dir()
.join(gadget.reference())
.join(name)
Expand All @@ -131,7 +131,7 @@ pub mod non_wasm {
release: &str,
extension: &str,
) -> Result<(), CircomCoprocessorError> {
let name = repository.split("/").collect::<Vec<&str>>()[1];
let name = repository.split('/').collect::<Vec<&str>>()[1];
let asset_url = format!(
"https://github.com/{repository}/releases/download/{release}/{name}.{extension}"
);
Expand All @@ -150,13 +150,12 @@ pub mod non_wasm {
trace: format!("{}", err),
})?;

let mut out = fs::File::create(&path).map_err(|err| {
CircomCoprocessorError::AssetCreationFailure {
let mut out =
fs::File::create(path).map_err(|err| CircomCoprocessorError::AssetCreationFailure {
prelude: error_prelude(),
reference: String::from(repository),
trace: format!("{}", err),
}
})?;
})?;

let response_byte =
&response
Expand Down Expand Up @@ -190,7 +189,7 @@ pub mod non_wasm {
Some(paths) => Ok(paths),
None => Err(CircomCoprocessorError::GadgetNotFound {
reference: String::from(gadget.reference()),
name: String::from(gadget.reference().split("/").collect::<Vec<&str>>()[1]),
name: String::from(gadget.reference().split('/').collect::<Vec<&str>>()[1]),
prelude: error_prelude(),
}),
},
Expand Down

0 comments on commit 791034e

Please sign in to comment.