Skip to content

feat(aztec)!: add counter template for aztec init#22751

Merged
nchamo merged 2 commits into
merge-train/fairiesfrom
feat/init-counter-template
Apr 24, 2026
Merged

feat(aztec)!: add counter template for aztec init#22751
nchamo merged 2 commits into
merge-train/fairiesfrom
feat/init-counter-template

Conversation

@nchamo

@nchamo nchamo commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Why we are doing this

The default project scaffolded by aztec init was too minimal -- it created a blank contract with no callable functions, making it hard for new developers to understand how Aztec contracts work.

How it worked before

  • aztec init created a workspace with a blank contract (empty impl block) and a basic test
  • aztec new <name> created the same blank contract, either as a new project or adding to an existing workspace

What changes

  • aztec new stays the same -- it scaffolds a blank contract, either as a new standalone project or as a new crate added to an existing workspace
  • aztec init now scaffolds a Counter example with:
    • A private counter contract using Owned<BalanceSet> for encrypted state
    • Annotated functions (constructor, increment, get_counter) with short docs explaining privacy model and execution context
    • A test suite covering constructor initialization and increment

Technical details

We used to build the blank project directly from the bash script. Now we have templates we can simply copy, instead of containing the entire code inside the .sh file

What doesn't change

The existing Counter tutorial docs remain valid since they use aztec new, which still scaffolds the blank template.

Feedback wanted

Please let me know if you have any suggestions on the template content, comments or anything else.

Fixes F-581

@nchamo nchamo requested a review from charlielye as a code owner April 23, 2026 18:24
@nchamo nchamo self-assigned this Apr 23, 2026
@nchamo nchamo changed the title feat(aztec): add counter template for aztec init feat(aztec)!: add counter template for aztec init Apr 23, 2026
#[storage]
struct Storage<Context> {
// Each owner has their own counter, stored as private encrypted notes.
// Owned: only the owner can interact with their own counter.

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.

it might be worth clarifying that "ownership" is achieved via readability (encryption) rather than access control (e.g. "Owned dictates who will receive the encrypted notes")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You are right, definitely worth mentioning

@nchamo nchamo requested review from dbanks12 and vezenovm April 23, 2026 20:32

@dbanks12 dbanks12 left a comment

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.

LGTM once @critesjosh and others are happy!

@nchamo nchamo requested a review from mverzilli April 24, 2026 12:35
@nchamo nchamo merged commit 9a9cb8b into merge-train/fairies Apr 24, 2026
12 checks passed
@nchamo nchamo deleted the feat/init-counter-template branch April 24, 2026 13:34
@AztecBot

Copy link
Copy Markdown
Collaborator

✅ Successfully backported to backport-to-v4-next-staging #22763.

AztecBot added a commit that referenced this pull request Apr 27, 2026
BEGIN_COMMIT_OVERRIDE
feat(aztec)!: add counter template for aztec init (#22751)
cherry-pick: fix(pxe): restrict setSenderForTags override to current
call (F-564) (#22672) (with conflicts)
fix: backport restrict setSenderForTags override to current call
(#22672) (#22767)
fix(pxe): backport anchor header threading from #22679 to v4-next
(#22705)
END_COMMIT_OVERRIDE
aminsammara added a commit that referenced this pull request May 15, 2026
First release candidate for the v4.3 minor.

## What's in this PR

1. **Merge commit `68a4f598` brings v4-next into v4** — 223 non-merge
   commits accumulated on `v4-next` since `v4.2.1`. Merged cleanly, no
   conflicts.

2. **Release-prep commit `792385e9`:**
   - `CHANGELOG.md` — prepended a v4.3.0-rc.1 entry. 162 commits
auto-categorized into BREAKING / Features / Bug Fixes / Documentation /
Miscellaneous, with PR and commit links. Descriptions are raw commit
     subjects (uncurated).
   - `release-notes-4.3.0-rc.1.md` — narrative GitHub release body with
Summary, Breaking Changes, Highlights (PXE/Wallet, Aztec.nr/TXE, CLI,
     Docs), and Notable Bug Fixes. Needs a curation pass before the
     release is published.
   - `docs/docs-developers/docs/resources/migration_notes.md` — renamed
     ` ## TBD` to ` ## 4.3.0-rc.1`; new empty ` ## TBD` left at the top
     for the next cycle.

3. **Follow-up commit `73d4c80c`:** corrects the framing of the SQLite
   kv-store change. Per engineer feedback, this is an opt-in additional
   backend (alongside LMDB / IndexedDB), not a forced migration. Removed
   from Breaking Changes; moved to PXE/Wallet highlights.

## Breaking changes

- `aztec init` / `aztec new` counter template (#22751)
- Shared protocol-circuit utilities in the history module (refactor!)

## Companion PR

`bump-v4-next-to-4.4.0` opens v4-next's next minor cycle. Merge order
doesn't matter, but both should land before the v4.3.0-rc.1 tag is cut.
critesjosh added a commit that referenced this pull request May 20, 2026
…or items

Backfills v4.3.0 docs with items from the official release notes that
weren't carried into the migration notes, framework docs, tutorials, or
operator changelog:

- migration_notes: add '[CLI] aztec init now scaffolds a Counter example
  template' under v4.3.0 (#22751). aztec new continues to scaffold blank.
- contract_structure: rewrite Directory structure for the 2-crate
  workspace; drop the stale --name reference removed in v4.3.0.
- token_contract tutorial: fix 'aztec init created...' wording to
  'aztec new' (the command shown is aztec new bob_token); update live
  copy from single-crate to 2-crate layout.
- recursive_verification tutorial: replace removed 'aztec new --name X Y'
  with 'aztec new ValueNotEqual'; fix the workspace layout, package name
  (ValueNotEqual_contract), ccc script, and artifact paths.
- v4.3 operator changelog: add 'Other notable changes' for the three
  non-breaking release-notes items (sequencer last-block signing #22117,
  stdlib package.json stamping #23393, macOS aztec-up install fixes
  #23310 / #23335).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants