Skip to content

feat: stamping aztec version into contract artifacts#22550

Merged
benesjan merged 14 commits into
merge-train/fairiesfrom
jan/f-549-include-aztecnr-and-stack-versions-in-contract-artifact
May 5, 2026
Merged

feat: stamping aztec version into contract artifacts#22550
benesjan merged 14 commits into
merge-train/fairiesfrom
jan/f-549-include-aztecnr-and-stack-versions-in-contract-artifact

Conversation

@benesjan

@benesjan benesjan commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Injects aztec stack version into Noir contract artifacts as it's a very useful info for debugging and other purposes (like verifying our backwards compatibility infra works).

Closes F-549

benesjan commented Apr 15, 2026

Copy link
Copy Markdown
Contributor Author

@benesjan benesjan force-pushed the jan/f-549-include-aztecnr-and-stack-versions-in-contract-artifact branch from 5d6c31a to b03cf2f Compare April 15, 2026 06:47
@benesjan benesjan added ci-draft Run CI on draft PRs. and removed ci-draft Run CI on draft PRs. labels Apr 15, 2026
*
* Does not include public bytecode, apart from the public_dispatch function.
* @param compiled - Noir build output.
* @returns Aztec contract build artifact.

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.

Updated the docs here as they were misleading - on the input is not nargo output but the postr-processed nargo output (transpiled, aztec prefixes stripped from fn names etc.)

Comment thread noir-projects/noir-contracts/bootstrap.sh Outdated
Comment thread ci3/source_refname Outdated
@benesjan benesjan force-pushed the jan/f-549-include-aztecnr-and-stack-versions-in-contract-artifact branch from 30b81d7 to c050f2c Compare April 15, 2026 08:41
@benesjan benesjan marked this pull request as ready for review April 15, 2026 08:41
@benesjan benesjan requested a review from charlielye as a code owner April 15, 2026 08:41
@benesjan benesjan requested review from ludamad and mverzilli and removed request for charlielye April 15, 2026 09:10
@benesjan benesjan force-pushed the jan/f-549-include-aztecnr-and-stack-versions-in-contract-artifact branch from c050f2c to af53a43 Compare April 15, 2026 13:17
@benesjan benesjan added claudebox Owned by claudebox. it can push to this PR. and removed claudebox Owned by claudebox. it can push to this PR. labels Apr 15, 2026
@benesjan benesjan marked this pull request as draft April 16, 2026 01:28
@benesjan benesjan force-pushed the jan/f-549-include-aztecnr-and-stack-versions-in-contract-artifact branch from af53a43 to 0647f10 Compare April 16, 2026 01:29
@benesjan benesjan marked this pull request as ready for review April 16, 2026 01:51
@benesjan benesjan changed the base branch from merge-train/fairies to graphite-base/22550 April 16, 2026 02:52
@benesjan benesjan force-pushed the jan/f-549-include-aztecnr-and-stack-versions-in-contract-artifact branch from b413d74 to 4881317 Compare April 16, 2026 02:52
@benesjan benesjan changed the base branch from graphite-base/22550 to jan/fix-verdaccio-install April 16, 2026 02:52
@benesjan benesjan marked this pull request as draft April 16, 2026 03:17
Base automatically changed from jan/fix-verdaccio-install to next April 16, 2026 05:30
benesjan added a commit that referenced this pull request Apr 17, 2026
…22590)

When working on [another
PR](#22550) of mine
I realized that we are having a problem and that is that we have 2 paths
by which contracts get compiled:
1. one is via aztec-packages bootstrap,
2. another is via `aztec compile`

This started to become problematic as our contract compilation pipeline
was getting more complicated:
1. nargo compile,
2. transpile,
3. strip prefixes,
4. and with that PR also inject aztec version

This meant that the duplication started to have real cost. In this PR I
clean this up a bit by moving the prefix stripping into the `bb
aztec_process` command. This results that the compilation pipeline is
simply:
1. `nargo compile`,
2. `bb aztec_process`

Given that it's just 2 commands it is fine to have it be duplicated
between `bootstrap.sh` and `aztec compile`. Once this is merged I will
try to refactor #22550 such that the version is also injected only in
`bb aztec_process`.

## AI Summary

- Moved `__aztec_nr_internals__` prefix stripping into `bb
aztec_process` (C++), which already handles transpilation and VK
generation
- Simplified the bootstrap `compile` function to just call `nargo
compile` + `bb aztec_process`, removing ~50 lines of manual VK
generation shell code
- Removed the separate `stripInternalPrefixes()` TypeScript function
from the CLI path
- Deleted the now-unused `strip_aztec_nr_prefix.sh` script
- Updated protocol-fuzzer scripts and docs to reflect the unified
pipeline

Both compilation paths (bootstrap and `aztec compile`) now go through
`bb aztec_process` for all post-nargo processing, eliminating the
duplication.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@benesjan benesjan changed the base branch from next to graphite-base/22550 April 17, 2026 14:01
@benesjan benesjan force-pushed the jan/f-549-include-aztecnr-and-stack-versions-in-contract-artifact branch from 38fe387 to 3d9e599 Compare May 5, 2026 14:37
export -f get_contract_path

# Stamps the aztec version into a contract artifact JSON in place. Mirrors stampAztecVersion in
# yarn-project/aztec/src/cli/cmds/compile.ts so monorepo-built artifacts match those produced by `aztec compile`.

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.

It's unfortunate that this is a duplicate of the typescript functionality but merging the 2 possible contract compilation paths (bootstrap.sh in monorepo and aztec compile) is not practical.

@benesjan benesjan marked this pull request as ready for review May 5, 2026 14:39
@benesjan benesjan requested a review from mverzilli May 5, 2026 16:14

@mverzilli mverzilli 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.

🚀

@benesjan benesjan enabled auto-merge (squash) May 5, 2026 16:42
@benesjan benesjan merged commit 7073efe into merge-train/fairies May 5, 2026
29 checks passed
@benesjan benesjan deleted the jan/f-549-include-aztecnr-and-stack-versions-in-contract-artifact branch May 5, 2026 16:42
AztecBot pushed a commit that referenced this pull request May 5, 2026
Injects aztec stack version into Noir contract artifacts as it's a very
useful info for debugging and other purposes (like verifying our
backwards compatibility infra works).

Closes
[F-549](https://linear.app/aztec-labs/issue/F-549/include-aztecnr-and-stack-versions-in-contract-artifact)

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@AztecBot

AztecBot commented May 5, 2026

Copy link
Copy Markdown
Collaborator

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

benesjan pushed a commit that referenced this pull request May 5, 2026
## Summary

Fixes the merge-train/fairies CI failure introduced by #22550 (`feat:
stamping aztec version into contract artifacts`). That PR added
`aztecVersion` as a required field on `ContractArtifact` but missed
updating the hand-rolled fixture in
`pxe/src/storage/backwards_compatibility_tests/schema_tests.ts`,
breaking the `yarn tsgo -b --emitDeclarationOnly` step:

```
pxe/src/storage/backwards_compatibility_tests/schema_tests.ts(658,3):
  error TS2741: Property 'aztecVersion' is missing in type '{...}'
  but required in type 'ContractArtifact'.
```

## Fix

- Add `aztecVersion: 'schema-fixture-version'` to
`buildSchemaContractArtifact()` so the literal satisfies
`ContractArtifact`. Uses a deterministic test-only string (rather than
`DEV_VERSION`) to keep the snapshot stable across release version bumps.
- Update `__snapshots__/ContractStore.json` to include the new field in
the serialized hex bytes (insertion is between `name` and `functions`,
matching declaration order in `ContractArtifactSchema`).

## Schema-version impact

`ARTIFACT_VERSION_BEFORE_INJECTION` is the schema's default for missing
`aztecVersion`, so this is **read-defaultable**, not breaking —
`PXE_DATA_SCHEMA_VERSION` does not need bumping.

CI log: http://ci.aztec-labs.com/1777999383723761

ClaudeBox log: https://claudebox.work/s/0e57df71aab3db0e?run=1
AztecBot added a commit that referenced this pull request May 6, 2026
BEGIN_COMMIT_OVERRIDE
feat: stamping aztec version into contract artifacts (#22550)
feat(pxe): deduplicate class ID verification per contract (#22966)
END_COMMIT_OVERRIDE
rangozd pushed a commit to rangozd/aztec-packages that referenced this pull request May 16, 2026
BEGIN_COMMIT_OVERRIDE
refactor: `getPackageVersion` fn cleanup (AztecProtocol#22941)
fix(ci): skip acceptance test for canary -commit. tags (AztecProtocol#22951)
fix: closing db, correct stub side effects (AztecProtocol#22939)
feat: wallet-sdk heartbeat (AztecProtocol#22948)
chore: pxe db schema compatibility test (AztecProtocol#22872)
feat: stamping aztec version into contract artifacts (AztecProtocol#22550)
fix: add aztecVersion to PXE schema_tests fixture (AztecProtocol#22960)
feat(pxe): deduplicate class ID verification per contract (AztecProtocol#22966)
chore: add noirfmt.toml to noir-contracts and run nargo fmt (AztecProtocol#22971)
feat(aztec-nr): Initial handshake registry contract with non interactive
handshake function (AztecProtocol#22854)
chore: merge next into merge-train/fairies (AztecProtocol#22991)
fix(aztec-up): Aztec installer does not shadow user installed binaries
on PATH (AztecProtocol#22902)
test(ci): drop e2e_kernelless_simulation from backwards-compat e2e
(AztecProtocol#23005)
feat(ci): notify #team-fairies when backwards-compat e2e fails on
nightly (AztecProtocol#23006)
chore: merge next into merge-train/fairies (AztecProtocol#23021)
fix: better DeployMethod (AztecProtocol#22985)
refactor(pxe): batch RPC calls for note and event validation (AztecProtocol#22988)
END_COMMIT_OVERRIDE
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.

4 participants