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

feat!: Handle generic fields in StructDefinition::fields and move old functionality to StructDefinition::fields_as_written #7067

Merged
merged 2 commits into from
Jan 14, 2025

Conversation

jfecher
Copy link
Contributor

@jfecher jfecher commented Jan 14, 2025

Description

Problem*

Resolves an issue from a private slack request. Needed for implementing derive_serialize recursively so that struct field types have their generics substituted correctly.

Summary*

Adds a generic_args argument to StructDefinition::fields to instantiate the field types with. This means this PR is breaking since this method used to require only self.

Since the old functionality of not instantiating can still be useful, I have moved it to a new function fields_as_written but wanted to emphasize that if users did need field types, and they don't know what the difference is, that they should prefer to use fields.

Additional Context

Documentation*

Check one:

  • No documentation needed.
  • Documentation included in this PR.
  • [For Experimental Features] Documentation to be submitted in a separate PR.

PR Checklist*

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

@jfecher jfecher requested a review from a team January 14, 2025 20:25
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Jan 14, 2025
Copy link
Contributor

github-actions bot commented Jan 14, 2025

Compilation Memory Report

Program Peak Memory %
keccak256 77.73M 0%
workspace 123.80M 0%
regression_4709 424.10M 0%
ram_blowup_regression 1.58G 0%
rollup-root 204.23M -46%
rollup-merge 204.23M -11%
rollup-block-root-single-tx 204.23M 100%
rollup-block-root-empty 204.23M -9%
rollup-block-root 204.23M 100%
rollup-block-merge 204.23M -46%
rollup-base-public 204.23M 100%
rollup-base-private 204.23M -78%
private-kernel-tail 168.37M -19%
private-kernel-reset 168.39M -75%
private-kernel-inner 168.36M -43%

Copy link
Contributor

github-actions bot commented Jan 14, 2025

Execution Memory Report

Program Peak Memory %
keccak256 74.69M 0%
workspace 123.95M 0%
regression_4709 316.01M 0%
ram_blowup_regression 512.61M 0%
rollup-root 204.23M -12%
rollup-merge 204.23M -1%
rollup-block-root 204.23M 100%
rollup-block-merge 204.23M -12%
rollup-base-public 204.23M -58%
rollup-base-private 204.23M -38%
private-kernel-tail 168.36M -7%
private-kernel-reset 168.39M -32%
private-kernel-inner 168.36M -20%

Copy link
Contributor

github-actions bot commented Jan 14, 2025

Copy link
Contributor

@michaeljklein michaeljklein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with small note r.e. using fields on fields_as_written

Co-authored-by: Michael J Klein <michaeljklein@users.noreply.github.com>
@jfecher jfecher enabled auto-merge January 14, 2025 21:03
@jfecher jfecher added this pull request to the merge queue Jan 14, 2025
Copy link
Contributor

FYI @noir-lang/developerrelations on Noir doc changes.

Merged via the queue into master with commit 14a7e37 Jan 14, 2025
76 of 98 checks passed
@jfecher jfecher deleted the jf/struct-def-fields branch January 14, 2025 21:22
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Jan 14, 2025
…oir-lang/noir#7066)

feat!: Handle generic fields in `StructDefinition::fields` and move old functionality to `StructDefinition::fields_as_written` (noir-lang/noir#7067)
chore(ci): Check various inliner aggressiveness setttings in Brillig reports (noir-lang/noir#7049)
chore: reenable reports on rollup root circuits (noir-lang/noir#7061)
fix: don't always select trait impl when verifying trait constraints (noir-lang/noir#7041)
chore: mark some critical libraries as good again (noir-lang/noir#7065)
fix: Reduce memory usage in mem2reg (noir-lang/noir#7053)
feat: Allow associated types to be ellided from trait constraints (noir-lang/noir#7026)
chore(perf): try using vec-collections's VecSet in AliasSet (noir-lang/noir#7058)
chore: reduce number of iterations of `acvm::compiler::compile` (noir-lang/noir#7050)
chore: add `noir_check_shuffle` as a critical library (noir-lang/noir#7056)
chore: clippy warning fix (noir-lang/noir#7051)
chore(ci): Unify compilation/execution report jobs that take averages with single runs  (noir-lang/noir#7048)
fix(nargo_fmt): let doc comment could come after regular comment (noir-lang/noir#7046)
fix(nargo_fmt): don't consider identifiers the same if they are equal… (noir-lang/noir#7043)
feat: auto-import traits when suggesting trait methods (noir-lang/noir#7037)
feat: avoid inserting `inc_rc` instructions into ACIR (noir-lang/noir#7036)
fix(lsp): suggest all possible trait methods, but only visible ones (noir-lang/noir#7027)
chore: add more protocol circuits to reports (noir-lang/noir#6977)
feat: avoid generating a new witness when checking if linear expression is zero (noir-lang/noir#7031)
feat: skip codegen of zero iteration loops (noir-lang/noir#7030)
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Jan 14, 2025
…ir#7066)

feat!: Handle generic fields in `StructDefinition::fields` and move old functionality to `StructDefinition::fields_as_written` (noir-lang/noir#7067)
chore(ci): Check various inliner aggressiveness setttings in Brillig reports (noir-lang/noir#7049)
chore: reenable reports on rollup root circuits (noir-lang/noir#7061)
fix: don't always select trait impl when verifying trait constraints (noir-lang/noir#7041)
chore: mark some critical libraries as good again (noir-lang/noir#7065)
fix: Reduce memory usage in mem2reg (noir-lang/noir#7053)
feat: Allow associated types to be ellided from trait constraints (noir-lang/noir#7026)
chore(perf): try using vec-collections's VecSet in AliasSet (noir-lang/noir#7058)
chore: reduce number of iterations of `acvm::compiler::compile` (noir-lang/noir#7050)
chore: add `noir_check_shuffle` as a critical library (noir-lang/noir#7056)
chore: clippy warning fix (noir-lang/noir#7051)
chore(ci): Unify compilation/execution report jobs that take averages with single runs  (noir-lang/noir#7048)
fix(nargo_fmt): let doc comment could come after regular comment (noir-lang/noir#7046)
fix(nargo_fmt): don't consider identifiers the same if they are equal… (noir-lang/noir#7043)
feat: auto-import traits when suggesting trait methods (noir-lang/noir#7037)
feat: avoid inserting `inc_rc` instructions into ACIR (noir-lang/noir#7036)
fix(lsp): suggest all possible trait methods, but only visible ones (noir-lang/noir#7027)
chore: add more protocol circuits to reports (noir-lang/noir#6977)
feat: avoid generating a new witness when checking if linear expression is zero (noir-lang/noir#7031)
feat: skip codegen of zero iteration loops (noir-lang/noir#7030)
@TomAFrench
Copy link
Member

In future please coordinate with me if merging breaking changes which blow up all of our benchmarks. Having this dropped on me when noir syncs are blocked is not fun.

AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Jan 15, 2025
…ir#7070)

feat(LSP): code action to import trait in a method call (noir-lang/noir#7066)
feat!: Handle generic fields in `StructDefinition::fields` and move old functionality to `StructDefinition::fields_as_written` (noir-lang/noir#7067)
chore(ci): Check various inliner aggressiveness setttings in Brillig reports (noir-lang/noir#7049)
chore: reenable reports on rollup root circuits (noir-lang/noir#7061)
fix: don't always select trait impl when verifying trait constraints (noir-lang/noir#7041)
chore: mark some critical libraries as good again (noir-lang/noir#7065)
fix: Reduce memory usage in mem2reg (noir-lang/noir#7053)
feat: Allow associated types to be ellided from trait constraints (noir-lang/noir#7026)
chore(perf): try using vec-collections's VecSet in AliasSet (noir-lang/noir#7058)
chore: reduce number of iterations of `acvm::compiler::compile` (noir-lang/noir#7050)
chore: add `noir_check_shuffle` as a critical library (noir-lang/noir#7056)
chore: clippy warning fix (noir-lang/noir#7051)
chore(ci): Unify compilation/execution report jobs that take averages with single runs  (noir-lang/noir#7048)
fix(nargo_fmt): let doc comment could come after regular comment (noir-lang/noir#7046)
fix(nargo_fmt): don't consider identifiers the same if they are equal… (noir-lang/noir#7043)
feat: auto-import traits when suggesting trait methods (noir-lang/noir#7037)
feat: avoid inserting `inc_rc` instructions into ACIR (noir-lang/noir#7036)
fix(lsp): suggest all possible trait methods, but only visible ones (noir-lang/noir#7027)
chore: add more protocol circuits to reports (noir-lang/noir#6977)
feat: avoid generating a new witness when checking if linear expression is zero (noir-lang/noir#7031)
feat: skip codegen of zero iteration loops (noir-lang/noir#7030)
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Jan 15, 2025
feat(LSP): code action to import trait in a method call (noir-lang/noir#7066)
feat!: Handle generic fields in `StructDefinition::fields` and move old functionality to `StructDefinition::fields_as_written` (noir-lang/noir#7067)
chore(ci): Check various inliner aggressiveness setttings in Brillig reports (noir-lang/noir#7049)
chore: reenable reports on rollup root circuits (noir-lang/noir#7061)
fix: don't always select trait impl when verifying trait constraints (noir-lang/noir#7041)
chore: mark some critical libraries as good again (noir-lang/noir#7065)
fix: Reduce memory usage in mem2reg (noir-lang/noir#7053)
feat: Allow associated types to be ellided from trait constraints (noir-lang/noir#7026)
chore(perf): try using vec-collections's VecSet in AliasSet (noir-lang/noir#7058)
chore: reduce number of iterations of `acvm::compiler::compile` (noir-lang/noir#7050)
chore: add `noir_check_shuffle` as a critical library (noir-lang/noir#7056)
chore: clippy warning fix (noir-lang/noir#7051)
chore(ci): Unify compilation/execution report jobs that take averages with single runs  (noir-lang/noir#7048)
fix(nargo_fmt): let doc comment could come after regular comment (noir-lang/noir#7046)
fix(nargo_fmt): don't consider identifiers the same if they are equal… (noir-lang/noir#7043)
feat: auto-import traits when suggesting trait methods (noir-lang/noir#7037)
feat: avoid inserting `inc_rc` instructions into ACIR (noir-lang/noir#7036)
fix(lsp): suggest all possible trait methods, but only visible ones (noir-lang/noir#7027)
chore: add more protocol circuits to reports (noir-lang/noir#6977)
feat: avoid generating a new witness when checking if linear expression is zero (noir-lang/noir#7031)
feat: skip codegen of zero iteration loops (noir-lang/noir#7030)
@asterite
Copy link
Collaborator

Another thing that might have been good to do, given that this is a breaking change, is to also return the visibility of each field (we also have an issue to be able to set those visibilities when setting those fields)

@jfecher
Copy link
Contributor Author

jfecher commented Jan 15, 2025

@TomAFrench sorry about that, I mistakenly assumed the sync itself would be quick and it'd just break aztec-noir downstream which could be fixed fairly quickly. I'll definitely coordinate more in the future

TomAFrench added a commit to AztecProtocol/aztec-packages that referenced this pull request Jan 15, 2025
Automated pull of development from the
[noir](https://github.com/noir-lang/noir) programming language, a
dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
chore: add end step for formatting workflow
(noir-lang/noir#7070)
feat(LSP): code action to import trait in a method call
(noir-lang/noir#7066)
feat!: Handle generic fields in `StructDefinition::fields` and move old
functionality to `StructDefinition::fields_as_written`
(noir-lang/noir#7067)
chore(ci): Check various inliner aggressiveness setttings in Brillig
reports (noir-lang/noir#7049)
chore: reenable reports on rollup root circuits
(noir-lang/noir#7061)
fix: don't always select trait impl when verifying trait constraints
(noir-lang/noir#7041)
chore: mark some critical libraries as good again
(noir-lang/noir#7065)
fix: Reduce memory usage in mem2reg
(noir-lang/noir#7053)
feat: Allow associated types to be ellided from trait constraints
(noir-lang/noir#7026)
chore(perf): try using vec-collections's VecSet in AliasSet
(noir-lang/noir#7058)
chore: reduce number of iterations of `acvm::compiler::compile`
(noir-lang/noir#7050)
chore: add `noir_check_shuffle` as a critical library
(noir-lang/noir#7056)
chore: clippy warning fix (noir-lang/noir#7051)
chore(ci): Unify compilation/execution report jobs that take averages
with single runs (noir-lang/noir#7048)
fix(nargo_fmt): let doc comment could come after regular comment
(noir-lang/noir#7046)
fix(nargo_fmt): don't consider identifiers the same if they are equal…
(noir-lang/noir#7043)
feat: auto-import traits when suggesting trait methods
(noir-lang/noir#7037)
feat: avoid inserting `inc_rc` instructions into ACIR
(noir-lang/noir#7036)
fix(lsp): suggest all possible trait methods, but only visible ones
(noir-lang/noir#7027)
chore: add more protocol circuits to reports
(noir-lang/noir#6977)
feat: avoid generating a new witness when checking if linear expression
is zero (noir-lang/noir#7031)
feat: skip codegen of zero iteration loops
(noir-lang/noir#7030)
END_COMMIT_OVERRIDE

---------

Co-authored-by: Tom French <tom@tomfren.ch>
Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
Co-authored-by: Jake Fecher <jfecher11@gmail.com>
AztecBot added a commit to AztecProtocol/aztec-nr that referenced this pull request Jan 16, 2025
Automated pull of development from the
[noir](https://github.com/noir-lang/noir) programming language, a
dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
chore: add end step for formatting workflow
(noir-lang/noir#7070)
feat(LSP): code action to import trait in a method call
(noir-lang/noir#7066)
feat!: Handle generic fields in `StructDefinition::fields` and move old
functionality to `StructDefinition::fields_as_written`
(noir-lang/noir#7067)
chore(ci): Check various inliner aggressiveness setttings in Brillig
reports (noir-lang/noir#7049)
chore: reenable reports on rollup root circuits
(noir-lang/noir#7061)
fix: don't always select trait impl when verifying trait constraints
(noir-lang/noir#7041)
chore: mark some critical libraries as good again
(noir-lang/noir#7065)
fix: Reduce memory usage in mem2reg
(noir-lang/noir#7053)
feat: Allow associated types to be ellided from trait constraints
(noir-lang/noir#7026)
chore(perf): try using vec-collections's VecSet in AliasSet
(noir-lang/noir#7058)
chore: reduce number of iterations of `acvm::compiler::compile`
(noir-lang/noir#7050)
chore: add `noir_check_shuffle` as a critical library
(noir-lang/noir#7056)
chore: clippy warning fix (noir-lang/noir#7051)
chore(ci): Unify compilation/execution report jobs that take averages
with single runs (noir-lang/noir#7048)
fix(nargo_fmt): let doc comment could come after regular comment
(noir-lang/noir#7046)
fix(nargo_fmt): don't consider identifiers the same if they are equal…
(noir-lang/noir#7043)
feat: auto-import traits when suggesting trait methods
(noir-lang/noir#7037)
feat: avoid inserting `inc_rc` instructions into ACIR
(noir-lang/noir#7036)
fix(lsp): suggest all possible trait methods, but only visible ones
(noir-lang/noir#7027)
chore: add more protocol circuits to reports
(noir-lang/noir#6977)
feat: avoid generating a new witness when checking if linear expression
is zero (noir-lang/noir#7031)
feat: skip codegen of zero iteration loops
(noir-lang/noir#7030)
END_COMMIT_OVERRIDE

---------

Co-authored-by: Tom French <tom@tomfren.ch>
Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
Co-authored-by: Jake Fecher <jfecher11@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants