Skip to content

docs: add docs and renaming#16

Merged
zkfrov merged 21 commits into
feat/constant-accountfrom
docs/add-documentation
Feb 11, 2026
Merged

docs: add docs and renaming#16
zkfrov merged 21 commits into
feat/constant-accountfrom
docs/add-documentation

Conversation

@zkfrov
Copy link
Copy Markdown
Collaborator

@zkfrov zkfrov commented Feb 11, 2026

Description

  • Rename macro library: initializerlessconstants
  • Rename macro file: constants.nrmacro.nr
  • Rename contract: schnorr_constants_account_contractschnorr_initializerless_account_contract
  • Update all Nargo.toml dependencies and workspace members to match new names
  • Update all use initializerless::constantsuse constants::constants across contracts
  • Rewrite README with full usage guide, how-it-works explanation, and project structure

@zkfrov zkfrov mentioned this pull request Feb 11, 2026
Base automatically changed from feat/nr-contracts to feat/constant-account February 11, 2026 14:32
Signed-off-by: frov <frov@wonderland.xyz>
@zkfrov zkfrov merged commit 94f319a into feat/constant-account Feb 11, 2026
2 of 3 checks passed
@zkfrov zkfrov deleted the docs/add-documentation branch February 11, 2026 15:17
Comment thread README.md
## 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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread README.md
<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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think an overview should go into implementation details

Comment thread README.md

<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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread README.md

**Option 1: Automatic**
Just run the tests and the sandbox will be handled automatically:
**Verification (Noir):**
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
**Verification (Noir):**
**Reconstruction and verification (Noir):**

Comment thread README.md
yarn test
```toml
[dependencies]
constants = { path = "../constants" }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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" }

Comment thread README.md
aztec start --sandbox # Start manually in separate terminal
yarn test # Run tests against existing sandbox
```
## Usage
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@zkfrov zkfrov mentioned this pull request Mar 3, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants