Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Maddiaa0 committed May 13, 2024
1 parent 43d106d commit d29c561
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 20 deletions.
2 changes: 1 addition & 1 deletion asm_to_pil/src/vm_to_constrained.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ fn witness_column<S: Into<String>, T>(
start: usize,
name: S,
def: Option<FunctionDefinition<T>>,
is_public: bool
is_public: bool,
) -> PilStatement<T> {
PilStatement::PolynomialCommitDeclaration(
start,
Expand Down
7 changes: 6 additions & 1 deletion ast/src/parsed/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ pub enum PilStatement<T> {
),
PolynomialConstantDeclaration(usize, Vec<PolynomialName<T>>),
PolynomialConstantDefinition(usize, String, FunctionDefinition<T>),
PolynomialCommitDeclaration(usize, Vec<PolynomialName<T>>, Option<FunctionDefinition<T>>, /*public=*/ bool),
PolynomialCommitDeclaration(
usize,
Vec<PolynomialName<T>>,
Option<FunctionDefinition<T>>,
/*public=*/ bool,
),
PolynomialIdentity(usize, Option<String>, Expression<T>),
PlookupIdentity(
usize,
Expand Down
7 changes: 3 additions & 4 deletions bberg/src/circuit_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl CircuitBuilder for BBFiles {
)
};

// When we are running natively, we want check circuit to run as futures; however, futures are not supported in wasm, so we must provide an
// When we are running natively, we want check circuit to run as futures; however, futures are not supported in wasm, so we must provide an
// alternative codepath that will execute the closures in serial
let emplace_future_transformation = |relation_name: &String| {
format!(
Expand All @@ -131,11 +131,11 @@ impl CircuitBuilder for BBFiles {
map_with_newline(relations, check_circuit_transformation);
let check_circuit_for_each_lookup =
map_with_newline(permutations, check_lookup_transformation);

// With futures
let emplace_future_relations = map_with_newline(relations, emplace_future_transformation);
let emplace_future_lookups = map_with_newline(permutations, emplace_future_transformation);

// With threads
let serial_relations = map_with_newline(relations, execute_serial_transformation);
let serial_lookups = map_with_newline(permutations, execute_serial_transformation);
Expand All @@ -151,7 +151,6 @@ impl CircuitBuilder for BBFiles {
"".to_owned()
};


let circuit_hpp = format!("
{includes}
Expand Down
7 changes: 2 additions & 5 deletions bberg/src/vm_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,10 @@ fn get_all_col_names<F: FieldElement>(
/// The compiler automatically suffixes the public input columns with "__is_public"
/// This function removes the suffix and collects the columns into their own container
pub fn extract_public_input_columns(witness_columns: Vec<String>) -> (Vec<String>, Vec<String>) {
let witness_names: Vec<String> = witness_columns
.clone();
let witness_names: Vec<String> = witness_columns.clone();
let public_input_column_names: Vec<String> = witness_columns
.into_iter()
.filter(|name|
name.ends_with("__is_public")
)
.filter(|name| name.ends_with("__is_public"))
.collect();

assert!(
Expand Down
34 changes: 25 additions & 9 deletions pil_analyzer/src/statement_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,13 @@ where
PilStatement::PublicDeclaration(start, name, polynomial, array_index, index) => {
self.handle_public_declaration(start, name, polynomial, array_index, index)
}
PilStatement::PolynomialConstantDeclaration(start, polynomials) => {
self.handle_polynomial_declarations(start, polynomials, PolynomialType::Constant, false)
}
PilStatement::PolynomialConstantDeclaration(start, polynomials) => self
.handle_polynomial_declarations(
start,
polynomials,
PolynomialType::Constant,
false,
),
PilStatement::PolynomialConstantDefinition(start, name, definition) => self
.handle_symbol_definition(
start,
Expand All @@ -120,10 +124,19 @@ where
SymbolKind::Poly(PolynomialType::Constant),
Some(definition),
),
PilStatement::PolynomialCommitDeclaration(start, polynomials, None, is_public) => {
self.handle_polynomial_declarations(start, polynomials, PolynomialType::Committed, is_public)
}
PilStatement::PolynomialCommitDeclaration(start, mut polynomials, Some(definition), _) => {
PilStatement::PolynomialCommitDeclaration(start, polynomials, None, is_public) => self
.handle_polynomial_declarations(
start,
polynomials,
PolynomialType::Committed,
is_public,
),
PilStatement::PolynomialCommitDeclaration(
start,
mut polynomials,
Some(definition),
_,
) => {
assert!(polynomials.len() == 1);
let name = polynomials.pop().unwrap();
self.handle_symbol_definition(
Expand Down Expand Up @@ -272,9 +285,12 @@ where
polynomials
.into_iter()
.flat_map(|PolynomialName { name, array_size }| {

// hack(https://github.com/AztecProtocol/aztec-packages/issues/6359): add an is_public modifier to the end of a committed polynomial
let name = if is_public { format!("{name}__is_public")} else {name};
let name = if is_public {
format!("{name}__is_public")
} else {
name
};

self.handle_symbol_definition(
start,
Expand Down

0 comments on commit d29c561

Please sign in to comment.