Skip to content

chore: v4 update and rename to immutables#19

Merged
zkfrov merged 4 commits into
feat/constant-accountfrom
chore/v4-update-and-rename-to-immutables
Feb 17, 2026
Merged

chore: v4 update and rename to immutables#19
zkfrov merged 4 commits into
feat/constant-accountfrom
chore/v4-update-and-rename-to-immutables

Conversation

@zkfrov
Copy link
Copy Markdown
Collaborator

@zkfrov zkfrov commented Feb 17, 2026

Description

  • Renamed constants → immutables across the entire codebase: Noir libraries, contracts, directory names, file names, artifacts, config files, and README
  • Added capsule usage documentation (Section 4 in README) showing how to attach capsules to transactions
  • Bumped aztec dependency from v4.0.0-nightly.20260204 to v4.0.0-devnet.1-patch.0 (Nargo.toml + package.json)
  • Fixed breaking changes from the version bump:
    • #[nophasecheck] → #[allow_phase_change] (renamed in aztec-nr)
    • use dep::aztec:: → use aztec:: (Noir compiler dropped the dep:: prefix)

Copy link
Copy Markdown
Contributor

@paperclip-minim paperclip-minim left a comment

Choose a reason for hiding this comment

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

Very gucci

Comment thread src/nr/immutables/src/macro.nr Outdated
/// 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);`
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
/// 3. Auto-inject `let immutables =Immutables::init(context);`
/// 3. Auto-inject `let immutables = Immutables::init(context);`

Comment thread src/nr/immutables/src/macro.nr Outdated

// 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
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.

Do this lol

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Comment thread src/nr/initializerless/src/immutables.nr Outdated
Comment thread src/nr/initializerless/src/immutables.nr Outdated

// 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
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.

Do

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
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") */);
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.

Why is poseidon2_hash_bytes between comments? IMO there's no need

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

part of computing it, now yes feat: add slot value

Comment thread README.md
Comment on lines +110 to +113
const capsule = new Capsule(contractAddress, IMMUTABLES_SLOT, [
actualSalt,
...serializedImmutables,
]);
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.

Do we have utils to handle this? just to know. Like, how does serializedImmutables usually get coded?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, this comes in the js tests PR

zkfrov and others added 2 commits February 17, 2026 12:10
Co-authored-by: Paperclip Minimizer <minim@wonderland.xyz>
Signed-off-by: frov <frov@wonderland.xyz>
Copy link
Copy Markdown
Contributor

@paperclip-minim paperclip-minim left a comment

Choose a reason for hiding this comment

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

LGTM

@zkfrov zkfrov merged commit 0251b5b into feat/constant-account Feb 17, 2026
2 of 3 checks passed
@zkfrov zkfrov deleted the chore/v4-update-and-rename-to-immutables branch February 17, 2026 16:26
@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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants