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

refactor(AztecMacro): Make max note len error a compile time error #5670

Closed
Tracked by #5077
rahul-kothari opened this issue Apr 10, 2024 · 3 comments
Closed
Tracked by #5077

Comments

@rahul-kothari
Copy link
Contributor

Ayush ran into the following error.

note_processor WARN Could not process note because of "Error: The note being processed has 27 fields, while "compute_note_hash_and_nullifier" can only handle a maximum of 20 fields. Please consider increasing the allowed field size to accommodate all notes generated from the contract.". Discarding note...

Comes from here

Can this error be a compile-time error? We have seemed to arrive 20 through this:

 maxNoteFields = (artifact.parameters[artifact.parameters.length - 1].type as ArrayType).length;

where artifact is the compute_note_hash_and_nullifier function artifact. Think we can extrapolate/reimplement in Noir and throw an error in the [#aztec(note)] macro

@LHerskind
Copy link
Contributor

The value 20 was just because it needed a fixed size upper limit. We could likely crank it up to ensure it is not an issue for more cases, then not really needing the improved compile time error.

@nventuro had the intention of making the value be defined from the largest note in the contract, but as we were limited by the macros at that point we just used 20 as that value was already used somewhere else 🤷

@LHerskind LHerskind changed the title Make max note len error a compile time error refactor(AztecMacro): Make max note len error a compile time error Apr 15, 2024
@nventuro
Copy link
Contributor

Yes, that's tracked on this issue. Recall this comment however:

Note that we're making the array be as large as MAX_NOTE_FIELDS_LENGTH (a limit on the return size of the view data oracle), so we're not really imposing any new constraints on note size by hardcoding the limit.

Thunkar added a commit that referenced this issue Apr 22, 2024
…NoteProcessor` warnings (#5838)

Closes #5669,
#5670,
#4649

Correctly determines the signature of the autogenerated
`compute_note_hash_and_nullifier` by looking up the serialized content
size of notes used in the contract. Furthermore, that langth is compared
against MAX_NOTE_FIELDS_LEN and a compile time error is emited if the
user attempts to use a note that is bigger than currently supported.
Finally changed the `NoteProcessor` warns to be errors (even thought
this particular one shouldn't get that far anymore!)
@Thunkar
Copy link
Contributor

Thunkar commented Apr 22, 2024

Closed in #5838

@Thunkar Thunkar closed this as completed Apr 22, 2024
AztecBot added a commit to noir-lang/noir that referenced this issue Apr 22, 2024
…NoteProcessor` warnings (AztecProtocol/aztec-packages#5838)

Closes AztecProtocol/aztec-packages#5669,
AztecProtocol/aztec-packages#5670,
AztecProtocol/aztec-packages#4649

Correctly determines the signature of the autogenerated
`compute_note_hash_and_nullifier` by looking up the serialized content
size of notes used in the contract. Furthermore, that langth is compared
against MAX_NOTE_FIELDS_LEN and a compile time error is emited if the
user attempts to use a note that is bigger than currently supported.
Finally changed the `NoteProcessor` warns to be errors (even thought
this particular one shouldn't get that far anymore!)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

4 participants