-
Notifications
You must be signed in to change notification settings - Fork 200
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: Refactor Logging to use Brillig foreign calls #1917
Conversation
Fixes #1925 |
Co-authored-by: jfecher <jake@aztecprotocol.com>
Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
@TomAFrench I also need the AbiType though in order to convert an This PR is blocking for these issues: #1925 and #1953 that are caused by coverting arrays of structs to structs of arrays. Perhaps we can merge this in and revisit moving the Display to InputValue? |
If this is blocking for another issue, but the Display issue with this PR is blocking this one, we can split out the relevant change and merge only that. I'll leave the call to @TomAFrench whether Display is blocking this PR or not but it doesn't sound too major to me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My issues are all solved. I still think passing along the json type data as an extra argument is a bit hacky but I suppose we can remove this once we add traits in Noir.
As far as updating the docs that result from this change, is it just that we are now able to log structs in addition to Fields, integers and arrays? |
Seems like so, @vezenovm could you confirm? |
@critesjosh yes you can now log structs, but also expressions now (such as |
Description
Reimplement logging in a more generic way uses Brillig foreign calls and AbiType for de/serialization
Problem*
Resolves #1615, #1910, #1925 and partial work towards #1911
Summary*
There is now a new logging function
As this matches the println used by the old SSA, some logic had to be adding to filter for the correct println function in the stdlib depending on whether the experimental ssa is activated.
During monomorphization of a function call we check whether we have an oracle for
println
. We then serialize the AbiType to a string literal and attach it as the latest argument of the function.nargo
who is executing the println oracles then know how to interpret these compiler attached arguments.The example program under
crates/nargo_cli/tests/test_data_ssa_refactor/debug_logs/src/main.nr
will give this output:The
enable_slices
flag was renamed toexperimental_ssa
as it is needed in this PR.In order to avoid the struct serialization set by
aos_to_soa
in monomorphization I also added checks of theexperimental_ssa
flag to monomorphization to avoid usingaos_to_soa
when we are compiling down to the new SSA pass.Documentation
This PR requires documentation updates when merged.
Additional Context
PR Checklist*
cargo fmt
on default settings.