docs: add docs and renaming#16
Merged
Merged
Conversation
Merged
Signed-off-by: frov <frov@wonderland.xyz>
wei3erHase
approved these changes
Feb 11, 2026
| ## Overview | ||
|
|
||
| ## Features | ||
| On Aztec, contracts that need immutable values — such as an account contract's signing public key — must currently use an initializer function that writes to private storage (e.g. `SinglePrivateImmutable`). This requires a constructor transaction, note delivery for setup, and initialization checks on subsequent function calls. |
Contributor
There was a problem hiding this comment.
Suggested change
| On Aztec, contracts that need immutable values — such as an account contract's signing public key — must currently use an initializer function that writes to private storage (e.g. `SinglePrivateImmutable`). This requires a constructor transaction, note delivery for setup, and initialization checks on subsequent function calls. | |
| On Aztec, contracts that need immutable values — such as an account contract's signing public key — must currently use an initializer function that writes to private storage (e.g. `SinglePrivateImmutable`). This requires an initialization transaction, note delivery for setup, and initialization checks on subsequent function calls. |
| <dl> | ||
| <dt>Sample Noir contract</dt> | ||
| <dd>Basic Counter contract demonstrating private-to-public execution patterns and owner access control.</dd> | ||
| The `#[constants]` macro offers a different approach: constants are encoded into the contract's `salt`, which is part of the address derivation. At runtime, constants are loaded from capsule storage and verified against the salt committed in the contract address. The constants are cryptographically fixed to the contract address. |
Contributor
There was a problem hiding this comment.
Suggested change
| The `#[constants]` macro offers a different approach: constants are encoded into the contract's `salt`, which is part of the address derivation. At runtime, constants are loaded from capsule storage and verified against the salt committed in the contract address. The constants are cryptographically fixed to the contract address. | |
| The `#[constants]` macro offers a different approach: constants are committed-to in the contract's address. At runtime, constants are loaded from capsule storage and verified against their commitment in the address. |
Contributor
There was a problem hiding this comment.
I don't think an overview should go into implementation details
|
|
||
| <dt>Aztec development setup</dt> | ||
| <dd>Pre-configured Aztec workspace with Noir contract compilation and TypeScript artifact generation.</dd> | ||
| The first use case is an **initializerless Schnorr account contract** that stores its signing public key as a constant, removing the need for an initializer entirely. |
Contributor
There was a problem hiding this comment.
Suggested change
| The first use case is an **initializerless Schnorr account contract** that stores its signing public key as a constant, removing the need for an initializer entirely. | |
| This repo includes an **initializerless Schnorr account contract** as an example use case. |
|
|
||
| **Option 1: Automatic** | ||
| Just run the tests and the sandbox will be handled automatically: | ||
| **Verification (Noir):** |
Contributor
There was a problem hiding this comment.
Suggested change
| **Verification (Noir):** | |
| **Reconstruction and verification (Noir):** |
| yarn test | ||
| ```toml | ||
| [dependencies] | ||
| constants = { path = "../constants" } |
Contributor
There was a problem hiding this comment.
Shouldn't we have an absolute path? e.g. poseidon in noir-protocol-circuits:
poseidon = { tag = "v0.2.3", git = "https://github.com/noir-lang/poseidon" }
| aztec start --sandbox # Start manually in separate terminal | ||
| yarn test # Run tests against existing sandbox | ||
| ``` | ||
| ## Usage |
Contributor
There was a problem hiding this comment.
IIUC we also need to explicitly incorporate the capsule to transactions, right? whether it's on a TX-basis or just one setup at some point. If so, it should be documented here as well.
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
initializerless→constantsconstants.nr→macro.nrschnorr_constants_account_contract→schnorr_initializerless_account_contractNargo.tomldependencies and workspace members to match new namesuse initializerless::constants→use constants::constantsacross contracts