Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
brech1 committed Apr 22, 2024
1 parent b29b037 commit 896fc25
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 22 deletions.
16 changes: 1 addition & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,7 @@ cargo build --release
cargo run
```

## Configuration

The CLI provides options to specify both input and output file paths, allowing flexibility in how you manage your circom program files and the resulting arithmetic circuits.

### Command Line Arguments

- `--output`: Specifies the path to the output directory where the generated arithmetic circuit files will be stored. By default, it's saved in the `./output` directory.

#### Example

To run the program with specific input file path and output directory path, use the following command format:

```bash
./target/release/circom --output ./output-path/
```
The compiled circuit and circuit report can be found in the `./output` directory.

## ZK/MPC/FHE backends:

Expand Down
7 changes: 4 additions & 3 deletions src/circom/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub struct Input {
pub link_libraries : Vec<PathBuf>
}

#[allow(dead_code)]
const R1CS: &str = "r1cs";
const WAT: &str = "wat";
const WASM: &str = "wasm";
Expand All @@ -46,7 +47,7 @@ const SYM: &str = "sym";
const JSON: &str = "json";

impl Input {
pub fn new(input: PathBuf) -> Result<Input, ()> {
pub fn new(input: PathBuf, output: PathBuf) -> Result<Input, ()> {
let matches = input_processing::view();
let mut file_name = input.file_stem().unwrap().to_str().unwrap().to_string();
let output_path = input_processing::get_output_path(&matches)?;
Expand All @@ -64,7 +65,7 @@ impl Input {
Result::Ok(Input {
//field: P_BN128,
input_program: input,
out_r1cs: Input::build_output(&output_path, &file_name, R1CS),
out_r1cs: output,
out_wat_code: Input::build_output(&output_js_path, &file_name, WAT),
out_wasm_code: Input::build_output(&output_js_path, &file_name, WASM),
out_js_folder: output_js_path.clone(),
Expand Down Expand Up @@ -513,4 +514,4 @@ pub mod input_processing {
}
link_libraries
}
}
}
2 changes: 1 addition & 1 deletion src/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ impl ArithmeticCircuit {
.try_fold(HashMap::new(), |mut acc, signal| {
let input = builder
.add_input::<u32>(signal.names[0].to_string())
.map_err(|e| CircuitError::MPZCircuitError(e))?;
.map_err(CircuitError::MPZCircuitError)?;
acc.insert(signal.id, input.repr);
Ok::<_, CircuitError>(acc)
})?;
Expand Down
5 changes: 3 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ fn main() -> Result<(), ProgramError> {

let output_path = PathBuf::from(view().value_of("output").unwrap());

fs::create_dir_all(output_path).map_err(|_| ProgramError::OutputDirectoryCreationError)?;
fs::create_dir_all(output_path.clone())
.map_err(|_| ProgramError::OutputDirectoryCreationError)?;

let input = Input::new(PathBuf::from("./src/assets/circuit.circom"))
let input = Input::new(PathBuf::from("./src/assets/circuit.circom"), output_path)
.map_err(|_| ProgramError::InputInitializationError)?;
let output_dir = input
.out_r1cs
Expand Down
4 changes: 3 additions & 1 deletion tests/mat_elem_mul.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use circom_2_arithc::{circom::input::Input, program::build_circuit};

const TEST_FILE_PATH: &str = "./tests/circuits/matElemMul.circom";

#[test]
fn matrix_element_multiplication() {
let input = Input::new("./tests/circuits/matElemMul.circom".into()).unwrap();
let input = Input::new(TEST_FILE_PATH.into(), "./".into()).unwrap();
let circuit = build_circuit(&input).unwrap();
let report = circuit.generate_circuit_report().unwrap();
let mpz_circuit = circuit.build_mpz_circuit(&report).unwrap();
Expand Down

0 comments on commit 896fc25

Please sign in to comment.