feat: store immutables#20
Merged
Merged
Conversation
wei3erHase
reviewed
Feb 20, 2026
|
|
||
| /// Generates the `#[abi(immutables)]` layout for the contract artifact. | ||
| /// | ||
| /// Mirrors the `#[abi(storage)]` pattern from aztec-nr (`aztec/src/macros/storage.nr:96-109`). |
Member
There was a problem hiding this comment.
full link to a fixed commit 🙏 (tagging v4.devnet... may be smart so it appears when search and replacing to next version), how can we make sure references to lines are updated? coderabbit?
Collaborator
Author
There was a problem hiding this comment.
for the time being added the proper fixed commit in #10
wei3erHase
reviewed
Feb 20, 2026
Comment on lines
+106
to
+115
| // TODO: This wrapper should be auto-generated by the #[immutables] macro or | ||
| // enshrined in aztec-nr. Currently requires a manual wrapper in each contract | ||
| // because struct macros cannot emit #[external("utility")] functions (blocked | ||
| // by #[aztec]'s check_all_functions_have_context_macro). | ||
| /// Persists immutables data to the PXE's CapsuleStore. | ||
| /// Called once after deployment via `.simulate()` from TypeScript. | ||
| #[external("utility")] | ||
| unconstrained fn store_immutables(capsule_data: [Field; 3]) { | ||
| Immutables::store(self.context, capsule_data); | ||
| } |
Member
There was a problem hiding this comment.
let's check whether this is intended or oversight, it may be wise to trigger an issue explaining our usecase
Collaborator
Author
There was a problem hiding this comment.
This is intended, I understand that introducing a injecting a macro like #[external("utility")] is not possible from another macro.
wei3erHase
reviewed
Feb 20, 2026
|
|
||
| import { SchnorrInitializerlessAccountContractArtifact } from "../../artifacts/SchnorrInitializerlessAccount.js"; | ||
| import { | ||
| SchnorrInitializerlessAccountContract as SchnorrInitializerlessAccountContractHandle, |
wei3erHase
approved these changes
Feb 20, 2026
Member
wei3erHase
left a comment
There was a problem hiding this comment.
only nits, good to continue on test/js imo
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.
🤖 Linear
Closes AZT-727
Description
store_immutables()replaces per-transaction transient capsules with a one-time.simulate()call after deployment#[abi(immutables)]layout generation to the#[immutables]macro, enabling TypeScript artifact introspection (getImmutablesLayout,serializeFromLayout)deploySchnorrInitializerlessAccount()to the public API for npm consumersskipClassPublication/skipInstancePublicationto opt-inpublishClass/publishInstance(defaultfalse)Changes
Noir (
src/nr/)#[immutables]macro: generatesImmutables::store(context, capsule_data)— validatesposeidon2_hash(capsule_data) == instance.saltthen persists to PXE CapsuleStore#[immutables]macro: generates#[abi(immutables)]layout (field names, indices, serialized length) for TypeScript introspection — mirrors#[abi(storage)]from aztec-nrstore_immutablesutility wrapper (manual, pending macro auto-generation)TypeScript (
src/ts/)immutables/utils.ts: addgetImmutablesLayout(),serializeFromLayout(), artifact layout validation indeployWithImmutables, automaticstore_immutables().simulate()call during deployment, returncapsuleData: Fr[]instead ofactualSalt: Frimmutables/utils.ts: renameskipClassPublication/skipInstancePublication→publishClass/publishInstance(defaultfalse)schnorr-initializerless-account/index.ts: adddeploySchnorrInitializerlessAccount()(full lifecycle: key derivation, deploy, Account creation), updateserializeSigningKeyto useserializeFromLayout,return
capsuleDatafromcomputeSchnorrAccountAddressschnorr-initializerless-account/utils.ts: redundant withdeploySchnorrInitializerlessAccountinindex.tsTests
actualSalt→capsuleData,registerInitializerlessAccount→deploySchnorrInitializerlessAccount, opt-in publication flagsdeployAndRegisterhelper for TestWallet-specific account registrationDocs
store_immutableswrapper docs, PXE recovery, npm usage examples, capsule data loss warning