Conversation
# 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:  ...or even private function return values prior to macro processing for decoding `.view` calls AztecProtocol/aztec-packages#2665 --------- Co-authored-by: esau <152162806+sklppy88@users.noreply.github.com> Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
vezenovm
reviewed
Apr 4, 2024
|
|
||
| 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') }} |
Contributor
There was a problem hiding this comment.
This is reverting a lot of the same things last time we did an aztec-packages sync. Would this be solved with a Noir sync into aztec?
Member
There was a problem hiding this comment.
I think so. I opened a PR at AztecProtocol/aztec-packages#5572 but there's a bunch of updates which need to be made on the aztec-packages side.
Contributor
|
I'll sync them up! |
|
No dependency changes detected. Learn more about Socket for GitHub ↗︎ 👍 No dependency changes detected in pull request |
Contributor
|
Closing to re-sync |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated pull of Noir development from aztec-packages.
BEGIN_COMMIT_OVERRIDE
feat!: contract_abi-exports (AztecProtocol/aztec-packages#5386)
feat(avm): integrate AVM with initializers (AztecProtocol/aztec-packages#5469)
feat: Restore hashing args via slice for performance (AztecProtocol/aztec-packages#5539)
END_COMMIT_OVERRIDE