chore: v4 update and rename to immutables#19
Merged
zkfrov merged 4 commits intoFeb 17, 2026
Conversation
| /// 4. Make available as `self.constants` | ||
| /// 1. Add a `HAS_IMMUTABLES` comptime registry (similar to storage detection) | ||
| /// 2. Modify `#[external]`/`#[internal]` function macros to check for immutables | ||
| /// 3. Auto-inject `let immutables =Immutables::init(context);` |
Contributor
There was a problem hiding this comment.
Suggested change
| /// 3. Auto-inject `let immutables =Immutables::init(context);` | |
| /// 3. Auto-inject `let immutables = Immutables::init(context);` |
|
|
||
| // CONSTANTS_SLOT: 0x257f7fa8d0b607b4f584f2aa6480ae86716203481e2802444cf05a289cc85b3a | ||
| let CONSTANTS_SLOT: Field = aztec::protocol::hash::poseidon2_hash_bytes("CONSTANTS_SLOT".as_bytes()); | ||
| // TODO: compute and document the IMMUTABLES_SLOT hash value |
Collaborator
Author
There was a problem hiding this comment.
|
|
||
| // CONSTANTS_SLOT: 0x257f7fa8d0b607b4f584f2aa6480ae86716203481e2802444cf05a289cc85b3a | ||
| let CONSTANTS_SLOT: Field = aztec::protocol::hash::poseidon2_hash_bytes("CONSTANTS_SLOT".as_bytes()); | ||
| // TODO: compute and document the IMMUTABLES_SLOT hash value |
Collaborator
Author
There was a problem hiding this comment.
| import { Fr } from "@aztec/aztec.js/fields"; | ||
|
|
||
| // IMMUTABLES_SLOT must match the Noir macro's slot | ||
| const IMMUTABLES_SLOT = new Fr(/* poseidon2_hash_bytes("IMMUTABLES_SLOT") */); |
Contributor
There was a problem hiding this comment.
Why is poseidon2_hash_bytes between comments? IMO there's no need
Collaborator
Author
There was a problem hiding this comment.
part of computing it, now yes feat: add slot value
Comment on lines
+110
to
+113
| const capsule = new Capsule(contractAddress, IMMUTABLES_SLOT, [ | ||
| actualSalt, | ||
| ...serializedImmutables, | ||
| ]); |
Contributor
There was a problem hiding this comment.
Do we have utils to handle this? just to know. Like, how does serializedImmutables usually get coded?
Co-authored-by: Paperclip Minimizer <minim@wonderland.xyz> Signed-off-by: frov <frov@wonderland.xyz>
Merged
zkfrov
added a commit
that referenced
this pull request
Mar 6, 2026
# 🤖 Linear Closes AZT-XXX # Description This branch introduces the **`#[immutables]` macro pattern** for Aztec Noir contracts — a mechanism that allows contracts to store immutable values committed via the contract's salt, eliminating the need for an initializer transaction. It includes the Noir library, example contracts, a full TypeScript SDK, tests, benchmarks, and CI infrastructure. ## Noir Library & Contracts (PRs #8, #16, #19, #27) - **`#[immutables]` comptime macro** (`src/nr/immutables/src/macro.nr`) that generates: - `Serialize` / `Deserialize` implementations - `Immutables::init(context)` — loads from capsule and verifies against `instance.salt` - `Immutables::init_unconstrained(context)` — unconstrained load without verification - Salt derivation: `salt = poseidon2_hash([actual_salt, ...serialized_immutables])` - **`immutables_contract`** — Demo contract with both immutables and mutable storage (mixed usage) - **`schnorr_initializerless_account_contract`** — Account contract using the initializerless pattern (signing key committed via salt, no initializer needed) - **`schnorr_account_contract`** — Standard Schnorr account with initializer-based key storage (baseline for comparison) - Noir TXE test scaffolding (most tests disabled pending [aztec-packages#16656](AztecProtocol/aztec-packages#16656) — TXE doesn't support custom salt) - Upgraded to Aztec `v4.0.0-devnet.1-patch.0` ## TypeScript SDK (PR #9) - **`src/ts/immutables/`** — Generic utilities for deploying any contract using `#[immutables]`: - `computeContractSalt(actualSalt, serializedImmutables)` - `createImmutablesCapsule(address, actualSalt, fields)` - `deployWithImmutables(wallet, artifact, fields, options?)` - Supports both published (on-chain) and unpublished (PXE-only) deployment - **`src/ts/schnorr-initializerless-account/`** — Account contract integration: - `SchnorrInitializerlessAccountContract` (implements `AccountContract` interface) - `SchnorrInitializerlessAuthWitnessProvider` (Schnorr signature creation) - `registerInitializerlessAccount(wallet, options?)` — one-call deployment + wallet registration - `computeSchnorrAccountAddress(signingKey, options?)` — pre-compute address before deployment ## Tests & Benchmarks (PR #9) | File | Description | |------|-------------| | `schnorr-initializerless-account.test.ts` | 12 tests: deploy + read key, different keys/salts → different addresses, wrong capsule/actualSalt rejection, published + unpublished variants | | `immutables-contract.test.ts` | Published/unpublished deploy, wrong capsule rejection, mixed usage with initializer | | `e2e.test.ts` | End-to-end with Dripper FPC: initializerless account receives private tokens, transfers, balance checks vs standard SchnorrAccount | | `account.benchmark.ts` | Benchmark suite for account contract operations | ## Documentation & CI (PRs #16, #19) - Full README rewrite with usage guide, how-it-works explanation, capsule documentation, and project structure - CI workflows for PR checks, pre-release publishing, and baseline tracking <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Immutables macro and initializerless immutables deployment workflow; Schnorr account variants; TypeScript SDK for artifact introspection, serialization, address precomputation, and deploy helpers; new account benchmarks. * **Documentation** * README rewritten around immutables pattern, deployment/verification guides and examples. * **Tests** * Comprehensive end-to-end test suites for immutables and Schnorr account flows. * **Chores** * Removed legacy counter examples; CI/workflow reorganization; package rebranding; updated pre-commit formatter and expanded .gitignore. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: frov <frov@wonderland.xyz> Co-authored-by: Paperclip Minimizer <minim@wonderland.xyz> Co-authored-by: Weißer Hase <84595958+wei3erHase@users.noreply.github.com> Co-authored-by: Weißer Hase <wei3erHase@protonmail.com>
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.
Description