chore(aztec-nr): extract per-signature calldata unpack helpers to shrink public_dispatch#23464
Open
vezenovm wants to merge 1 commit into
Open
chore(aztec-nr): extract per-signature calldata unpack helpers to shrink public_dispatch#23464vezenovm wants to merge 1 commit into
vezenovm wants to merge 1 commit into
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Additional work towards resolving AztecProtocol/aztec-nr#35
generate_public_dispatch, count parameter-type signatures across the contract public functions. When at leastEXTRACTION_THRESHOLD(4) functions share a signature, emit one#[inline_never]__aztec_nr_internals__unpack_arguments_<N>helper that does thecalldata_copy+ per-parameterstream_deserializeonce, and rewrite those dispatch arms to call it.Bytecode impact
Measured via
nargo compile --inliner-aggressiveness 0+bb aztec_process, readingpublic_dispatchpacked bytecode:public_fns_with_emit_repro_contractavm_test_contractThe repro contract is the same one used in #23161, so the delta stacks on top of that one. Real contracts with many public functions sharing parameter shapes is where we see savings from this change.
Additional Context
stream_deserializesize (oneFieldarg vs. e.g.(AztecAddress, U128, PartialUintNote)), but a single threshold keeps the macro readable; we can size helpers against per-site savings later if needed.