-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: contract_abi-exports (AztecProtocol/aztec-packages#5386)
# Goal This PR aims to expose arbitrary types and values resulting from contract compilation in the resulting JSON artifact, in a way that is not tied to aztec-specific features or even smart contracts at all. # Problem Up until now, Noir compiled crates that used the `contract` keyword with a specific flow, which also added additional structs and metadata to the output such as whatever structs were marked with the `#[event]` attribute. This coupled Noir to smart contract specific constructs, which were propagated through the compiler (from the parser to the actual compilation output). For AztecProtocol/aztec-packages#5079 and several other tasks that aim to reduce the mental load and improve the general devex of our users, we ***need*** to expose several other structs that are even more specific to aztec, which would only compromise the generality of the compiler further. # Proposed solution The introduction of a new attribute `#[abi(tag)]` that can be applied to both `structs` and `global` top-level statements, and export types (with the current `ABIType` format) and values (with the new `ABIValue` format) in a way that can be interpreted by components further downstream (for example, our typescript codegen). This way, the noir compiler doesn't know (or care) about whatever gets included in the artifact. The `events` contract artifact key gets replaced by: ```typescript outputs: { structs: Record<string, ABIType[]>; globals: Record<string, ABIValue[]>; }; ``` # What this approach allows - Removing the smart contract specific attribute `#[event]`, replacing it by a more general `#[abi(events)]`. - Substantial devex improvements, such as exposing storage layout, note ids: ![image](https://github.com/AztecProtocol/aztec-packages/assets/5404052/dba1d6ca-1286-4d4d-912e-f222d3414f32) ...or even private function return values prior to macro processing for decoding `.view` calls AztecProtocol/aztec-packages#2665 --------- Co-authored-by: esau <[email protected]> Co-authored-by: Tom French <[email protected]>
- Loading branch information
1 parent
a0f7474
commit 0322464
Showing
73 changed files
with
958 additions
and
1,864 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
bb719200034e3bc6db09fb56538dadca4203abf4 | ||
745d5229db86b2188f52ab7ccc8f568aef8f5797 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,15 +79,6 @@ jobs: | |
- name: Install Yarn dependencies | ||
uses: ./.github/actions/setup | ||
|
||
- name: Install wasm-bindgen-cli | ||
uses: taiki-e/install-action@v2 | ||
with: | ||
tool: [email protected] | ||
|
||
- name: Install wasm-opt | ||
run: | | ||
npm i wasm-opt -g | ||
- name: Query new noir version | ||
id: noir-version | ||
run: | | ||
|
@@ -116,20 +107,17 @@ jobs: | |
if: ${{ always() }} | ||
|
||
needs: | ||
- release-please | ||
- update-acvm-workspace-package-versions | ||
- update-docs | ||
|
||
env: | ||
# We treat any skipped or failing jobs as a failure for the workflow as a whole. | ||
FAIL: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }} | ||
FAIL: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') } | ||
|
||
steps: | ||
- name: Add warning to sticky comment | ||
uses: marocchino/sticky-pull-request-comment@v2 | ||
with: | ||
# We need to specify the PR on which to make the comment as workflow is triggered by push. | ||
number: ${{ fromJSON(needs.release-please.outputs.release-pr).number }} | ||
# delete the comment in case failures have been fixed | ||
delete: ${{ !env.FAIL }} | ||
message: "The release workflow has not completed successfully. Releasing now will result in a broken release" | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.