Closed LHerskind closed 2 months ago
This stack of pull requests is managed by Graphite. Learn more about stacking.
Join @LHerskind and the rest of your teammates on Graphite
Metrics with a significant change:
I'm splitting this into a couple smaller PRs since there's quite a few things going on at the same time. We''ll still do this, but I want to keep the unrelated changes separate if at all possible. Created https://github.com/AztecProtocol/aztec-packages/pull/7621 for zero note retrieval (which by itself has a bunch of repercussions).
Fixes #7142 and #7362.
Instead of doing direct recursion on the
transfer
I have altered thebalances_map
slightly to include a newsub
function that allow a reduction of notes WITHOUT inserting the change note. We can then recurse over this new sub function to spend notes until we get what we need and then insert a change note after that.Notice that the transfer is consuming at most 2 notes, but that the
_accumulate
might consume up to 8!The reason for this is fairly simple, the
transfer
would be inserting notes that are instantly consumed but spend plenty of juice on constraining the encryption first. Instead we can just spend a lot of notes with_accumulate
without creating any new notes, and then return a final change value for the transfer to add for thefrom
.Since there are less "overhead" and we are just consuming notes in
_accumulate
we can spend the same number of constraints just consuming notes as we usually spend on consuming, encrypting and updating state.During the testing figured something interesting, that might be an issue with compiler optimisation.
note_getter
that asserts the length of the bounded vec is non-zero. Since that allow us for more meaningful error messages.