Skip to content

feat: merge-train/fairies#23584

Merged
nchamo merged 4 commits into
nextfrom
merge-train/fairies
May 27, 2026
Merged

feat: merge-train/fairies#23584
nchamo merged 4 commits into
nextfrom
merge-train/fairies

Conversation

@AztecBot

@AztecBot AztecBot commented May 27, 2026

Copy link
Copy Markdown
Collaborator

BEGIN_COMMIT_OVERRIDE
chore(aztec-nr): extract per-signature calldata unpack helpers to shrink public_dispatch (#23464)
refactor: move public_checks caller helpers into aztec-nr (prep for public_checks demotion) (#23215)
refactor(pxe): introduce typed oracle registry for serialization (#23516)
END_COMMIT_OVERRIDE

…ink public_dispatch (#23464)

## Summary

Additional work towards resolving
AztecProtocol/aztec-nr#35

- In `generate_public_dispatch`, count parameter-type signatures across
the contract public functions. When at least `EXTRACTION_THRESHOLD` (4)
functions share a signature, emit one `#[inline_never]`
`__aztec_nr_internals__unpack_arguments_<N>` helper that does the
`calldata_copy` + per-parameter `stream_deserialize` once, and rewrite
those dispatch arms to call it.
- Signatures below the threshold keep the previous inline shape, so we
do not pay CALL/RET overhead on call sites that would not recoup it.
- Follows the same pattern as
#23161, but targets
the calldata-deserialization boilerplate the dispatch macro inlines into
every arm rather than user-written helpers.

## Bytecode impact

Measured via `nargo compile --inliner-aggressiveness 0` + `bb
aztec_process`, reading `public_dispatch` packed bytecode:

| Contract | Baseline | Post | Δ |

|---------------------------------------|----------|--------|----------------|
| `public_fns_with_emit_repro_contract` | 4,601 | 4,227 | -374 (-8.1%) |
| `avm_test_contract` | 51,333 | 51,048 | -285 (-0.55%) |

The 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

- The threshold is a single share-count knob for now. The real
break-even depends on per-site `stream_deserialize` size (one `Field`
arg 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.
- Follow-up:
[F-675](https://linear.app/aztec-labs/issue/F-675/centralize-validation-for-aztec-nr-macro-generated-internal-function)
tracks centralizing validation for aztec-nr macro-generated internal
names. The generated-name collision class predates this PR, and the new
unpack helper names are one specific instance.
dbanks12 and others added 2 commits May 27, 2026 16:31
…ublic_checks demotion) (#23215)

Moves PublicChecks caller helpers from
public_checks_contract/src/utils.nr into
aztec-nr/aztec/src/public_checks.nr. Consumer contracts
(app_subscription, crowdfunding) now import from aztec-nr.

Stacked on #23214.

@ludamad ludamad left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Auto-approved

@AztecBot AztecBot added this pull request to the merge queue May 27, 2026
@AztecBot

Copy link
Copy Markdown
Collaborator Author

🤖 Auto-merge enabled after 4 hours of inactivity. This PR will be merged automatically once all checks pass.

@nchamo nchamo removed this pull request from the merge queue due to a manual request May 27, 2026
@nchamo nchamo enabled auto-merge May 27, 2026 20:01
@nchamo nchamo added this pull request to the merge queue May 27, 2026
Merged via the queue into next with commit 2fa2623 May 27, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants