Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Aztec.js consume native noir ABIs #3812

Closed
PhilWindle opened this issue Jan 3, 2024 · 0 comments · Fixed by #3989
Closed

Make Aztec.js consume native noir ABIs #3812

PhilWindle opened this issue Jan 3, 2024 · 0 comments · Fixed by #3989
Assignees

Comments

@PhilWindle
Copy link
Collaborator

PhilWindle commented Jan 3, 2024

Today all aztec ts packages expect contract artifacts to be in a format slightly different to that generated by Nargo. Keys are changed from snake to camel case, a few fields are renamed, and debug info is compressed. Since #3775 and #3843, these changes are done by the cli codegen command, that needs to be run after nargo compile.

However, the codegen command should be optional, only needed if the user wants to generate ts or noir interfaces. So, aztec ts packages should be able to consume contract artifacts directly as outputted by nargo, without any transformation needed.

@PhilWindle PhilWindle added this to A3 Jan 3, 2024
@PhilWindle PhilWindle converted this from a draft issue Jan 3, 2024
@spalladino spalladino self-assigned this Jan 8, 2024
@spalladino spalladino moved this from Todo to In Progress in A3 Jan 8, 2024
spalladino added a commit that referenced this issue Jan 17, 2024
Changes the output of `nargo` and `noir-wasm` to generate a single
artifact that includes debug information. Compiled contracts now have a
`file_map` at the root of the artifact, and a `debug_symbols` within
each function. For consistency, compiled programs also have `file_map`
and `debug_symbols`. Debug symbols are compressed and base64-encoded, as
they were by the former `noir-compiler` postprocessing. The `debug` json
artifact is no longer emitted.

Removes all code related to generating `yarn-project`-specific ABIs from
noir compiler. Instead, `types` now exposes a `loadContractArtifact`
that renames fields as needed (and use camel instead of snake case), and
is required when loading a noir contract artifact. Autogenerated types
run this automatically.

Since we are no longer post-processing artifacts, the `noir-contracts`
project shape is changed. JSON files live in the `target` folder where
nargo outputs them (this is not configurable), and are loaded by the
autogenerated typescript interfaces from there.

As part of the refactor, moves functions for getting functions debug
info out of `acir-simulator` and into `types`.

**Breaking change**: This removes the need to run `codegen` for using a
compiled contract. However, when creating a new contract object from
aztec.js, a dev needs to call `loadContractArtifact`.

**Future changes**: Type information for a compilation artifact is now
spread all over the place, and duplicated in more than one place. There
are types defined within rust code in Noir as
`[wasm_bindgen(typescript_custom_section)]`, others defined within
typescript code in the `noir_wasm` package, others in `foundation`, and
others in `types`. We should unify it in a single place.

Fixes #3812

Supersedes #3906

Noir subrepo has been pushed to
noir-lang/noir#4035 to run the Noir CI
@github-project-automation github-project-automation bot moved this from In Progress to Done in A3 Jan 17, 2024
AztecBot pushed a commit to noir-lang/noir that referenced this issue Jan 17, 2024
Changes the output of `nargo` and `noir-wasm` to generate a single
artifact that includes debug information. Compiled contracts now have a
`file_map` at the root of the artifact, and a `debug_symbols` within
each function. For consistency, compiled programs also have `file_map`
and `debug_symbols`. Debug symbols are compressed and base64-encoded, as
they were by the former `noir-compiler` postprocessing. The `debug` json
artifact is no longer emitted.

Removes all code related to generating `yarn-project`-specific ABIs from
noir compiler. Instead, `types` now exposes a `loadContractArtifact`
that renames fields as needed (and use camel instead of snake case), and
is required when loading a noir contract artifact. Autogenerated types
run this automatically.

Since we are no longer post-processing artifacts, the `noir-contracts`
project shape is changed. JSON files live in the `target` folder where
nargo outputs them (this is not configurable), and are loaded by the
autogenerated typescript interfaces from there.

As part of the refactor, moves functions for getting functions debug
info out of `acir-simulator` and into `types`.

**Breaking change**: This removes the need to run `codegen` for using a
compiled contract. However, when creating a new contract object from
aztec.js, a dev needs to call `loadContractArtifact`.

**Future changes**: Type information for a compilation artifact is now
spread all over the place, and duplicated in more than one place. There
are types defined within rust code in Noir as
`[wasm_bindgen(typescript_custom_section)]`, others defined within
typescript code in the `noir_wasm` package, others in `foundation`, and
others in `types`. We should unify it in a single place.

Fixes AztecProtocol/aztec-packages#3812

Supersedes #3906

Noir subrepo has been pushed to
#4035 to run the Noir CI
michaelelliot pushed a commit to Swoir/noir_rs that referenced this issue Feb 28, 2024
Changes the output of `nargo` and `noir-wasm` to generate a single
artifact that includes debug information. Compiled contracts now have a
`file_map` at the root of the artifact, and a `debug_symbols` within
each function. For consistency, compiled programs also have `file_map`
and `debug_symbols`. Debug symbols are compressed and base64-encoded, as
they were by the former `noir-compiler` postprocessing. The `debug` json
artifact is no longer emitted.

Removes all code related to generating `yarn-project`-specific ABIs from
noir compiler. Instead, `types` now exposes a `loadContractArtifact`
that renames fields as needed (and use camel instead of snake case), and
is required when loading a noir contract artifact. Autogenerated types
run this automatically.

Since we are no longer post-processing artifacts, the `noir-contracts`
project shape is changed. JSON files live in the `target` folder where
nargo outputs them (this is not configurable), and are loaded by the
autogenerated typescript interfaces from there.

As part of the refactor, moves functions for getting functions debug
info out of `acir-simulator` and into `types`.

**Breaking change**: This removes the need to run `codegen` for using a
compiled contract. However, when creating a new contract object from
aztec.js, a dev needs to call `loadContractArtifact`.

**Future changes**: Type information for a compilation artifact is now
spread all over the place, and duplicated in more than one place. There
are types defined within rust code in Noir as
`[wasm_bindgen(typescript_custom_section)]`, others defined within
typescript code in the `noir_wasm` package, others in `foundation`, and
others in `types`. We should unify it in a single place.

Fixes AztecProtocol#3812

Supersedes AztecProtocol#3906

Noir subrepo has been pushed to
noir-lang/noir#4035 to run the Noir CI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
2 participants