-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Evaluation of dynamic assert messages (#4101)
# Description ## Problem\* Resolves #3113 ## Summary\* The first major change is a new MacroProcessor that generates an oracle and the respective unconstrained oracle wrapper for resolving assert message expressions. This was done as to prevent exposing the resolve assert message funcs in the stdlib directly. Before an assertion with a dynamic assert message we perform a foreign call out to the user with the format-string and the values to be formatted. The user must then return what the assert message should look like. This is then cached on by nargo when executing the ACVM and should the next opcode fail to execute then this error message will be returned to the user. We now require end-users (people running ACVM) to format their own assert messages. Example output for `assert_msg_runtime` test: <img width="737" alt="Screenshot 2024-01-23 at 4 07 18 PM" src="https://github.com/noir-lang/noir/assets/43554004/96879ab1-5192-4b01-b798-4a63631bd270"> Assert message still work in the stdlib as expected: <img width="780" alt="Screenshot 2024-01-23 at 4 43 47 PM" src="https://github.com/noir-lang/noir/assets/43554004/1ad0c00b-7d5f-4a3f-94d8-955589f487c2"> Output for debug logs when putting `assert(x == y, struct_string);` on line 48 immediately following `std::println(struct_string);`: <img width="1040" alt="Screenshot 2024-01-23 at 4 47 55 PM" src="https://github.com/noir-lang/noir/assets/43554004/6a8220b8-dd19-4e1b-b360-976a6952a36f"> ## Additional Context ## Documentation\* Check one: - [ ] No documentation needed. - [x] Documentation included in this PR. - [ ] **[Exceptional Case]** Documentation to be submitted in a separate PR. # PR Checklist\* - [x] I have tested the changes locally. - [x] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings. --------- Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com> Co-authored-by: Tom French <tom@tomfren.ch>
- Loading branch information
1 parent
0e2a552
commit c284e01
Showing
48 changed files
with
701 additions
and
162 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.