feat: merge-train/fairies#21691
Merged
Merged
Conversation
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
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
Collaborator
Author
|
🤖 Auto-merge enabled after 4 hours of inactivity. This PR will be merged automatically once all checks pass. |
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.
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