Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Oct 1, 2024
1 parent 222b150 commit 6ce30c5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/aztec/src/macros/mod.nr
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ comptime fn generate_compute_note_hash_and_optionally_a_nullifier() -> Quoted {

comptime fn generate_note_exports() -> Quoted {
let notes = NOTES.values();
// Second value in each tuple is `note_serialized_len` and that is ignored because it's only used when
// Second value in each tuple is `note_serialized_len` and that is ignored here because it's only used when
// generating the `compute_note_hash_and_optionally_a_nullifier` function.
notes.map(
| (s, _, note_type_id, fields): (StructDefinition, u32, Field, [(Quoted, u32, bool)]) | {
Expand Down
11 changes: 6 additions & 5 deletions noir-projects/aztec-nr/aztec/src/macros/notes/mod.nr
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ use crate::note::{note_header::NoteHeader, note_getter_options::PropertySelector

comptime global NOTE_HEADER_TYPE = type_of(NoteHeader::empty());

// A map from note type to (note_struct_definition, serialized_note_length, note_type_id, fixed_fields, nullable_fields).
// The fixed and nullable fields contain the name of the struct member and the index of where it starts in
// the serialized note.
// A map from note type to (note_struct_definition, serialized_note_length, note_type_id, fields).
// `fields` is an array of tuples where each tuple contains the name of the field/struct member (e.g. `amount`
// in `TokenNote`), the index of where the serialized member starts in the serialized note and a flag indicating
// whether the field is nullable or not.
comptime mut global NOTES: UHashMap<Type, (StructDefinition, u32, Field, [(Quoted, u32, bool)]), BuildHasherDefault<Poseidon2Hasher>> = UHashMap::default();

comptime fn compute_note_type_id(name: Quoted) -> Field {
Expand Down Expand Up @@ -147,8 +148,8 @@ comptime fn generate_note_properties(s: StructDefinition) -> Quoted {
}
}

/// Generates note export for a given note struct. The export is a global variable that contains the note type id,
/// the note name and information about note fields.
/// Generates note export for a given note struct. The export is a global variable that contains note type id,
/// note name and information about note fields (field name, index and whether the field is nullable or not).
pub(crate) comptime fn generate_note_export(
s: StructDefinition,
note_type_id: Field,
Expand Down
1 change: 1 addition & 0 deletions noir-projects/aztec-nr/aztec/src/note/note_field.nr
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Used by macros when generating note export.
pub struct NoteField {
index: u32,
nullable: bool
Expand Down

0 comments on commit 6ce30c5

Please sign in to comment.