Skip to content

feat(aztec.js): expose #[abi] globals on generated contract classes - #25217

Draft
vezenovm wants to merge 25 commits into
merge-train/fairiesfrom
mv/f-619-globals-codegen
Draft

feat(aztec.js): expose #[abi] globals on generated contract classes#25217
vezenovm wants to merge 25 commits into
merge-train/fairiesfrom
mv/f-619-globals-codegen

Conversation

@vezenovm

@vezenovm vezenovm commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Resolves UX improvements as part of resolving #21761

Stacked on #25184. Generated contract classes now expose #[abi(tag)] globals as decoded values, grouped by tag.

Before (runtime accessor over kind-tagged AbiValues):

import { getGlobalsByTag } from '@aztec/aztec.js';

const { EXPORTED_LIMIT_CONSTANT } = getGlobalsByTag(TestContract.artifact, 'limits');
// { kind: 'integer', sign: false, value: '00...0064' }

After (baked into the generated class, fully typed):

TestContract.globals.limits.EXPORTED_LIMIT_CONSTANT; // 100n
TestContract.globals.constants.EXPORTED_STRING_CONSTANT; // "exported"

Also versions the codegen cache so generator changes regenerate wrappers whose artifact hashes are unchanged.

  • Adds cache tests covering cache hits, missing generated outputs, and generator-version invalidation.

ContractArtifact.outputs.globals keeps the named values emitted by Noir
instead of stripping names on load. Adds getNamedContractGlobals for
name-based lookup. Legacy bare-globals artifacts (incl. the pinned
standard contracts) hash identically to before; freshly compiled
artifacts get new metadata hashes and class IDs.
Co-authored-by: Maxim Vezenov <mvezenov@gmail.com>
Drop the bare-globals compat arm: outputs.globals entries are always
{name, value}, artifacts compiled before Noir exported global names are
rejected on load. Bump PXE data schema 13->14 and re-pin the standard
contracts (folds in compile drift accumulated since the July pin).
"cutover" is not in the cspell dictionary, which failed the spellcheck
step of the docs build.
@vezenovm vezenovm added the ci-draft Run CI on draft PRs. label Aug 13, 2026
@vezenovm vezenovm changed the title feat: expose #[abi] globals on generated contract classes feat(aztec.js): expose #[abi] globals on generated contract classes Aug 13, 2026
Base automatically changed from mv/f-619-artifact-global-names to merge-train/fairies August 13, 2026 19:26
…19-globals-codegen

# Conflicts:
#	docs/docs-developers/docs/aztec-nr/framework-description/contract_artifact.md
#	docs/docs-developers/docs/resources/migration_notes.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-draft Run CI on draft PRs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant