Skip to content

feat: merge-train/fairies#21691

Merged
AztecBot merged 6 commits into
nextfrom
merge-train/fairies
Mar 18, 2026
Merged

feat: merge-train/fairies#21691
AztecBot merged 6 commits into
nextfrom
merge-train/fairies

Conversation

@AztecBot

@AztecBot AztecBot commented Mar 17, 2026

Copy link
Copy Markdown
Collaborator

BEGIN_COMMIT_OVERRIDE
fix(stdlib): accept null return_type for void Noir functions (#21647)
feat!: make AES128 decrypt oracle return Option (#21696)
fix(aztec-nr): fix OOB index with nonzero offset (#21613)
feat!: include init_hash in private initialization nullifier to prevent privacy leak (#21427)
END_COMMIT_OVERRIDE

Fixing issue reproted by @just-mitch on
[slack](https://aztecprotocol.slack.com/archives/C04PUD9AA4W/p1773715408859609).

## AI Summary

Fixes a TypeScript compilation error when running `aztec-builder
codegen` on contracts where every function is void (most notably, a
blank `#[aztec] contract Main {}`).

The `#[aztec]` macro injects lifecycle functions like `process_message`
and `sync_state` into every contract. These are void, so the Noir
compiler outputs `"return_type": null` for them. Our `NoirFunctionAbi`
type only accepted a non-null object for `return_type`, which caused a
type error on the `as NoirCompiledContract` cast in the generated TS.

For contracts with at least one non-void function, TypeScript infers the
JSON array element type as a union (`null | { abi_type, visibility }`),
which has enough overlap with the expected type for the `as` cast to
succeed. But when *every* function is void, the inferred type is just
`null` — zero overlap — so the cast fails.

The runtime code in `contract_artifact.ts` already handled the `null`
case correctly. Only the type definition was out of sync with the
compiler's actual output.

Repro: https://github.com/just-mitch/mytoken

## Test plan

- Verified `yarn build` passes with no new type errors
- Cloned the repro, confirmed the TS error, patched
`node_modules/@aztec/stdlib` with the fix, confirmed clean compilation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
## Summary

- Rename AES128 decrypt oracle from `aztec_utl_aes128Decrypt` to
`aztec_utl_tryAes128Decrypt`, returning `Option<BoundedVec<u8, N>>`
instead of `BoundedVec<u8, N>`
- Wrap TS decrypt calls (PXE + TXE) in try/catch so Barretenberg
exceptions on malformed input return `Option::none()` instead of
crashing the process
- Update legacy `utilityAes128Decrypt` mapping to strip the Option
wrapper and re-throw on failure (preserving old error semantics for
pinned contracts)

Fixes F-452
@nventuro nventuro self-requested a review as a code owner March 17, 2026 19:40
nchamo and others added 3 commits March 17, 2026 16:40
I simply asked Claude to go through our code and find bugs, and it found
this

## Summary
- Fixes an out-of-bounds array access in
`extract_property_value_from_selector` when `PropertySelector.offset >
0`. The formula `31 + offset - i` produces index >= 32 at `i = 0`;
corrected to `31 - offset - i`.
- Adds a regression test exercising a nonzero offset.

## Note
The bug was dormant -- every `PropertySelector` in the codebase uses
`offset: 0` (the macro hardcodes it). But anyone trying to use sub-field
byte selection would hit a runtime panic.
…nt privacy leak (#21427)

## Problem

The private initialization nullifier was computed as just
`address.to_field()`. Anyone who knows a contract's address can compute
this nullifier and check for its existence in the nullifier tree,
revealing whether the contract has been initialized. This is a privacy
leak for fully private contracts.

## Fix

The private initialization nullifier is now computed as
`poseidon2_hash(address, init_hash)` with a dedicated domain separator
(`DOM_SEP__PRIVATE_INITIALIZATION_NULLIFIER`). Since `init_hash` is not
publicly available for fully private contracts, address knowledge alone
is no longer sufficient to determine initialization status.

Fixes F-194
Fixes #17128
@nventuro nventuro requested a review from LeilaWang as a code owner March 17, 2026 21:11

@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 Mar 18, 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.

Merged via the queue into next with commit aa3ea66 Mar 18, 2026
21 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.

4 participants