Skip to content

Commit

Permalink
feat: Sync from aztec-packages (#5408)
Browse files Browse the repository at this point in the history
Automated pull of Noir development from
[aztec-packages](https://github.com/AztecProtocol/aztec-packages).
BEGIN_COMMIT_OVERRIDE
feat: Sync from noir
(AztecProtocol/aztec-packages#7332)
fix: Truncate flamegraph text to the right
(AztecProtocol/aztec-packages#7333)
feat: add support for fieldable in events
(AztecProtocol/aztec-packages#7310)
END_COMMIT_OVERRIDE

Co-authored-by: Tom French <[email protected]>
  • Loading branch information
AztecBot and TomAFrench authored Jul 4, 2024
1 parent 70ebf60 commit 3f71169
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
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

0 comments on commit 3f71169

Please sign in to comment.