Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Sync from aztec-packages #5408

Merged
merged 2 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .aztec-sync-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2ae17f2177380244f695575c169cc591496cf3ad
10076d9663dcf40ac712df69e3a71a1bb54866e2
26 changes: 23 additions & 3 deletions aztec_macros/src/transforms/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,19 @@ fn generate_trait_impl_serialize(
event_len: u32,
event_fields: &[(String, String)],
) -> Result<NoirTraitImpl, AztecMacroError> {
let field_names =
event_fields.iter().map(|field| format!("self.{}", field.0)).collect::<Vec<String>>();
let field_names = event_fields
.iter()
.map(|field| {
let field_type = field.1.as_str();
match field_type {
"Field" => format!("self.{}", field.0),
"bool" | "u8" | "u32" | "u64" | "i8" | "i32" | "i64" => {
format!("self.{} as Field", field.0)
}
_ => format!("self.{}.to_field()", field.0),
}
})
.collect::<Vec<String>>();
let field_input = field_names.join(",");

let trait_impl_source = format!(
Expand Down Expand Up @@ -154,7 +165,16 @@ fn generate_trait_impl_deserialize(
let field_names: Vec<String> = event_fields
.iter()
.enumerate()
.map(|(index, field)| format!("{}: fields[{}]", field.0, index))
.map(|(index, field)| {
let field_type = field.1.as_str();
match field_type {
"Field" => format!("{}: fields[{}]", field.0, index),
"bool" | "u8" | "u32" | "u64" | "i8" | "i32" | "i64" => {
format!("{}: fields[{}] as {}", field.0, index, field_type)
}
_ => format!("{}: {}::from_field(fields[{}])", field.0, field.1, index),
}
})
.collect::<Vec<String>>();
let field_input = field_names.join(",");

Expand Down
3 changes: 2 additions & 1 deletion tooling/profiler/src/flamegraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::{collections::BTreeMap, io::BufWriter};
use acir::circuit::{Opcode, OpcodeLocation};
use color_eyre::eyre::{self};
use fm::codespan_files::Files;
use inferno::flamegraph::{from_lines, Options};
use inferno::flamegraph::{from_lines, Options, TextTruncateDirection};
use noirc_errors::debug_info::DebugInfo;
use noirc_errors::reporter::line_and_column_from_span;
use noirc_errors::Location;
Expand Down Expand Up @@ -60,6 +60,7 @@ impl FlamegraphGenerator for InfernoFlamegraphGenerator {
options.color_diffusion = true;
options.min_width = 0.0;
options.count_name = self.count_name.clone();
options.text_truncate_direction = TextTruncateDirection::Right;

from_lines(
&mut options,
Expand Down
Loading