Skip to content

Commit

Permalink
Merge branch 'master' into ahmed/file-clone
Browse files Browse the repository at this point in the history
  • Loading branch information
clararod9 authored Jan 12, 2024
2 parents e648d79 + 74afb97 commit ccf10a3
Show file tree
Hide file tree
Showing 41 changed files with 204 additions and 116 deletions.
20 changes: 10 additions & 10 deletions Cargo.lock

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

20 changes: 19 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Release notes

## Dec 15, 2023 circom 2.1.7

#### Extensions
- Fixing typos and improving documentation.
- Improving error messages: missing tags in inputs and use of operator ++x.
- Adding info of number of private inputs in witness in R1CS message and removing message of circom safe.

#### Fixed Bugs
- Fixing a panic produced when the two branches of an if instruction are not compatible.
- Fixing C++ code generated: input counter decrease inside assert => Moved outside the assert.
- Fixing c++ code generated for macos with clang 14.0.0.
- Fixing a bug in parallel definition at component level not working as expected.
- Fixing a bug in parallel components not working as expected when considering assignments of the inputs given by names (A()(in_1 <== x, in_2 <== y)).
- Fixing a bug in c++ code generation produced when the last assigned input has size 0.
- Fixing a panic: handling case array of components with different signals (signals defined inside blocks ifs).
- Fixing a panic: error when processing sizes of arrays of variables in functions, panic in merger when processing complex expressions.


## June 22, 2023 circom 2.1.6

#### Extensions
Expand All @@ -9,7 +27,7 @@
- Updating the documentation.
- Added check on the name of the circom file when --C is used to avoid clashes with reserved names. When the file is called main.circom, fr.circom or calcwit.circom it is changed to main_c, fr_c and calcwit_c respectively.

#### Bugs
#### Fixed Bugs
- Fixing a bug while parsing anonymous components.
- Fixing a problem in calls to anonymous components with signal names.
- Fixing a bug in wasm witness generation that happened when doing a call inside an array index.
Expand Down
2 changes: 1 addition & 1 deletion circom/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "circom"
version = "2.1.6"
version = "2.1.7"
authors = ["Costa Group UCM","iden3"]
edition = "2018"

Expand Down
2 changes: 2 additions & 0 deletions circom/src/execution_user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub struct ExecutionConfig {
pub r1cs: String,
pub sym: String,
pub json_constraints: String,
pub json_substitutions: String,
pub no_rounds: usize,
pub flag_s: bool,
pub flag_f: bool,
Expand All @@ -32,6 +33,7 @@ pub fn execute_project(
let build_config = BuildConfig {
no_rounds: config.no_rounds,
flag_json_sub: config.json_substitution_flag,
json_substitutions: config.json_substitutions,
flag_s: config.flag_s,
flag_f: config.flag_f,
flag_p: config.flag_p,
Expand Down
14 changes: 11 additions & 3 deletions circom/src/input_user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pub struct Input {
pub input_program: PathBuf,
pub out_r1cs: PathBuf,
pub out_json_constraints: PathBuf,
pub out_json_substitutions: PathBuf,
pub out_wat_code: PathBuf,
pub out_wasm_code: PathBuf,
pub out_wasm_name: String,
Expand Down Expand Up @@ -82,6 +83,11 @@ impl Input {
&format!("{}_constraints", file_name),
JSON,
),
out_json_substitutions: Input::build_output(
&output_path,
&format!("{}_substitutions", file_name),
JSON,
),
wat_flag:input_processing::get_wat(&matches),
wasm_flag: input_processing::get_wasm(&matches),
c_flag: c_flag,
Expand Down Expand Up @@ -158,6 +164,9 @@ impl Input {
pub fn json_constraints_file(&self) -> &str {
self.out_json_constraints.to_str().unwrap()
}
pub fn json_substitutions_file(&self) -> &str {
self.out_json_substitutions.to_str().unwrap()
}
pub fn wasm_flag(&self) -> bool {
self.wasm_flag
}
Expand Down Expand Up @@ -410,10 +419,9 @@ mod input_processing {
)
.arg(
Arg::with_name("print_json_sub")
.long("jsons")
.long("simplification_substitution")
.takes_value(false)
.hidden(true)
.display_order(100)
.display_order(980)
.help("Outputs the substitution in json format"),
)
.arg(
Expand Down
3 changes: 2 additions & 1 deletion circom/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fn main() {
eprintln!("{}", Colour::Red.paint("previous errors were found"));
std::process::exit(1);
} else {
println!("{}", Colour::Green.paint("Everything went okay, circom safe"));
println!("{}", Colour::Green.paint("Everything went okay"));
//std::process::exit(0);
}
}
Expand All @@ -42,6 +42,7 @@ fn start() -> Result<(), ()> {
sym: user_input.sym_file().to_string(),
r1cs: user_input.r1cs_file().to_string(),
json_constraints: user_input.json_constraints_file().to_string(),
json_substitutions: user_input.json_substitutions_file().to_string(),
prime: user_input.prime(),
};
let circuit = execution_user::execute_project(program_archive, config)?;
Expand Down
2 changes: 1 addition & 1 deletion code_producers/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "code_producers"
version = "2.1.6"
version = "2.1.7"
authors = ["Costa Group UCM","iden3"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion code_producers/src/wasm_elements/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ impl WASMProducer {
let mut n = 0;
for (_c, v) in &self.io_map {
for s in v {
// since we take offset and all lenghts but last one
// since we take offset and all lengths but last one
if s.lengths.len() == 0 {
n += 1;
} else {
Expand Down
2 changes: 1 addition & 1 deletion compiler/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "compiler"
version = "2.1.6"
version = "2.1.7"
authors = ["Costa Group UCM","iden3"]
edition = "2018"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ impl WriteC for CreateCmpBucket {
// if the array is complete traverse all its positions
if complete_array {
instructions.push(format!("for (uint i = 0; i < {}; i++) {{", self.number_of_cmp));
// update the value of the the paralel status if it is not uniform parallel using the array aux_parallel
// update the value of the the parallel status if it is not uniform parallel using the array aux_parallel
if self.uniform_parallel.is_none(){
instructions.push(format!("bool status_parallel = aux_parallel[i];"));
}
Expand All @@ -237,7 +237,7 @@ impl WriteC for CreateCmpBucket {
instructions.push(format!("uint aux_positions [{}]= {};", self.defined_positions.len(), set_list(self.defined_positions.iter().map(|(x, _y)| *x).collect())));
instructions.push(format!("for (uint i_aux = 0; i_aux < {}; i_aux++) {{", self.defined_positions.len()));
instructions.push(format!("uint i = aux_positions[i_aux];"));
// update the value of the the paralel status if it is not uniform parallel using the array aux_parallel
// update the value of the the parallel status if it is not uniform parallel using the array aux_parallel
if self.uniform_parallel.is_none(){
instructions.push(format!("bool status_parallel = aux_parallel[i_aux];"));
}
Expand Down
8 changes: 4 additions & 4 deletions compiler/src/ir_processing/build_inputs_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ pub fn visit_list(
inside_loop: bool
)-> bool {
let len_instructions = instructions.len();
let mut found_unkown_aux = found_unknown_address;
let mut found_unknown_aux = found_unknown_address;
for i in 0..instructions.len(){
found_unkown_aux = visit_instruction(
found_unknown_aux = visit_instruction(
&mut instructions[len_instructions - 1 - i],
known_last_component,
unknown_last_component,
found_unkown_aux,
found_unknown_aux,
inside_loop
);
}
found_unkown_aux
found_unknown_aux
}

pub fn visit_instruction(
Expand Down
2 changes: 1 addition & 1 deletion constraint_generation/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "constraint_generation"
version = "2.1.6"
version = "2.1.7"
authors = ["Costa Group UCM","iden3"]
edition = "2018"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ impl ComponentRepresentation {

// We copy tags in any case, complete or incomplete assignment
// The values of the tags must be the same than the ones stored before
if !component.is_preinitialized() {
return Result::Err(MemoryError::AssignmentError(TypeAssignmentError::NoInitializedComponent));
}

if !component.inputs_tags.contains_key(signal_name){
return Result::Err(MemoryError::AssignmentError(TypeAssignmentError::AssignmentOutput));
}
Expand Down Expand Up @@ -286,6 +290,10 @@ impl ComponentRepresentation {
slice_route: &[SliceCapacity],
tags: TagInfo,
) -> Result<(), MemoryError> {

if !component.is_preinitialized() {
return Result::Err(MemoryError::AssignmentError(TypeAssignmentError::NoInitializedComponent));
}

if !component.inputs.contains_key(signal_name){
return Result::Err(MemoryError::AssignmentError(TypeAssignmentError::AssignmentOutput));
Expand Down
8 changes: 8 additions & 0 deletions constraint_generation/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2214,6 +2214,10 @@ fn treat_result_with_memory_error_void(
Report::error("Exception caused by invalid assignment: trying to assign a value to an output signal of a component".to_string(),
RuntimeError)
},
TypeAssignmentError::NoInitializedComponent =>{
Report::error("Exception caused by invalid assignment: trying to assign a value to a signal of a component that has not been initialized".to_string(),
RuntimeError)
}
}
},
MemoryError::OutOfBoundsError => {
Expand Down Expand Up @@ -2313,6 +2317,10 @@ fn treat_result_with_memory_error<C>(
Report::error("Exception caused by invalid assignment: trying to assign a value to an output signal of a component".to_string(),
RuntimeError)
},
TypeAssignmentError::NoInitializedComponent =>{
Report::error("Exception caused by invalid assignment: trying to assign a value to a signal of a component that has not been initialized".to_string(),
RuntimeError)
}
}
},
MemoryError::AssignmentMissingTags(signal, tag) => Report::error(
Expand Down
2 changes: 2 additions & 0 deletions constraint_generation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use std::rc::Rc;
pub struct BuildConfig {
pub no_rounds: usize,
pub flag_json_sub: bool,
pub json_substitutions: String,
pub flag_s: bool,
pub flag_f: bool,
pub flag_p: bool,
Expand Down Expand Up @@ -97,6 +98,7 @@ fn simplification_process(vcp: &mut VCP, dag: DAG, config: &BuildConfig) -> Cons
flag_s: config.flag_s,
parallel_flag: config.flag_p,
port_substitution: config.flag_json_sub,
json_substitutions: config.json_substitutions.clone(),
no_rounds: config.no_rounds,
flag_old_heuristics: config.flag_old_heuristics,
prime : config.prime.clone(),
Expand Down
2 changes: 1 addition & 1 deletion constraint_list/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "constraint_list"
version = "2.1.5"
version = "2.1.7"
authors = ["Costa Group UCM","iden3"]
edition = "2018"

Expand Down
Loading

0 comments on commit ccf10a3

Please sign in to comment.