Skip to content

Commit

Permalink
Merge pull request #48 from AztecProtocol/jm/snake_case_perm_lookup_f…
Browse files Browse the repository at this point in the history
…ilename

Generated permutation and lookup filenames are lower-cased
  • Loading branch information
jeanmon authored Mar 11, 2024
2 parents 9063b8a + bbe149c commit b92e670
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
5 changes: 3 additions & 2 deletions bberg/src/circuit_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ impl CircuitBuilder for BBFiles {
)
};
let check_lookup_transformation = |lookup_name: &String| {
let lookup_name_upper = lookup_name.to_uppercase();
format!(
"if (!evaluate_logderivative.template operator()<{lookup_name}_relation<FF>>(\"{lookup_name}\")) {{
"if (!evaluate_logderivative.template operator()<{lookup_name}_relation<FF>>(\"{lookup_name_upper}\")) {{
return false;
}}"
)
Expand Down Expand Up @@ -218,7 +219,7 @@ fn get_lookup_check_closure() -> String {
}
for (auto r : lookup_result) {
if (r != 0) {
info(\"Lookup \", lookup_name, \" failed.\");
throw_or_abort(format(\"Lookup \", lookup_name, \" failed.\"));
return false;
}
}
Expand Down
7 changes: 5 additions & 2 deletions bberg/src/lookup_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,11 @@ impl LookupBuilder for BBFiles {
let new_lookups = lookups
.iter()
.map(|lookup| Lookup {
attribute: lookup.attribute.clone(),
counts_poly: format!("{}_counts", lookup.attribute.clone().unwrap()),
attribute: lookup.attribute.clone().map(|att| att.to_lowercase()),
counts_poly: format!(
"{}_counts",
lookup.attribute.clone().unwrap().to_lowercase()
),
left: get_lookup_side(&lookup.left),
right: get_lookup_side(&lookup.right),
})
Expand Down
14 changes: 11 additions & 3 deletions bberg/src/permutation_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl PermutationBuilder for BBFiles {
let new_perms = perms
.iter()
.map(|perm| Permutation {
attribute: perm.attribute.clone(),
attribute: perm.attribute.clone().map(|att| att.to_lowercase()),
left: get_perm_side(&perm.left),
right: get_perm_side(&perm.right),
})
Expand Down Expand Up @@ -129,9 +129,17 @@ fn create_permutation_settings_file(permutation: &Permutation) -> String {
.expect("Inverse column name must be provided using attribute syntax");

// This also will need to work for both sides of this !
let lhs_selector = permutation.left.selector.clone().expect("At least one selector must be provided");
let lhs_selector = permutation
.left
.selector
.clone()
.expect("At least one selector must be provided");
// If a rhs selector is not present, then we use the rhs selector -- TODO(md): maybe we want the default to be always on?
let rhs_selector = permutation.right.selector.clone().unwrap_or(lhs_selector.clone());
let rhs_selector = permutation
.right
.selector
.clone()
.unwrap_or(lhs_selector.clone());

let lhs_cols = permutation.left.cols.clone();
let rhs_cols = permutation.right.cols.clone();
Expand Down

0 comments on commit b92e670

Please sign in to comment.