Skip to content

test: add noir tests#27

Merged
zkfrov merged 1 commit into
feat/immutables-macrofrom
test/nr
Mar 3, 2026
Merged

test: add noir tests#27
zkfrov merged 1 commit into
feat/immutables-macrofrom
test/nr

Conversation

@zkfrov
Copy link
Copy Markdown
Collaborator

@zkfrov zkfrov commented Mar 2, 2026

Description

  • Add Noir TXE test scaffolding for immutables_contract and schnorr_initializerless_account_contract
  • Most tests are disabled because the TXE does not support deploying contracts with a custom salt (aztec-packages#16656), which is required for Immutables::init() salt verification
  • One storage-only test (increment_counter_success) runs successfully since it doesn't depend on salt verification
  • Update README with test directory structure and TXE limitation note

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 2, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (2)
  • dev
  • main

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch test/nr

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 10 files

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 2, 2026

Benchmark Comparison

CPU Cores RAM Arch
AMD EPYC 7763 64-Core Processor 16 63 GiB x64

Contract: account

Function Gates DA Gas L2 Gas Proving Time (ms)
Status Base PR Diff Base PR Diff Base PR Diff Base PR Diff
🆕 Immutables Account: transfer_private_to_private 0 537,939 +Inf% 0 1,312 +Inf% 0 512 +Inf% N/A 6,983 +Inf%
🆕 Immutables Account: transfer_private_to_public 0 573,546 +Inf% 0 800 +Inf% 0 149,749 +Inf% N/A 7,361 +Inf%
🆕 Standard Account: deploy + initialize 0 511,144 +Inf% 0 768 +Inf% 0 512 +Inf% N/A 6,810 +Inf%
🆕 Standard Account: transfer_private_to_private 0 536,841 +Inf% 0 1,312 +Inf% 0 512 +Inf% N/A 6,986 +Inf%
🆕 Standard Account: transfer_private_to_public 0 572,448 +Inf% 0 800 +Inf% 0 149,749 +Inf% N/A 7,224 +Inf%

@zkfrov zkfrov merged commit d592854 into feat/immutables-macro Mar 3, 2026
6 checks passed
@zkfrov zkfrov deleted the test/nr branch March 3, 2026 14:33
@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