Skip to content

chore: remove knowledge of aztec function types from compiler - #4975

Merged
spalladino merged 3 commits into
palla/remove-open-keywordfrom
tf/remove-aztec-leakage-into-function-types
Mar 6, 2024
Merged

chore: remove knowledge of aztec function types from compiler#4975
spalladino merged 3 commits into
palla/remove-open-keywordfrom
tf/remove-aztec-leakage-into-function-types

Conversation

@TomAFrench

Copy link
Copy Markdown
Member

This PR removes the concept of a function being internal or "open" from the Noir compiler as these are now concepts which are aztec specific. We instead attach all of a contract functions custom attributes to it in the build artifact so aztec can parse these to determine whether a function is open or secret, etc.

@spalladino This follows on from #4967 but I've made this as a separate PR into yours as I don't want to hijack it.

@TomAFrench

Copy link
Copy Markdown
Member Author

I'm assuming that all the contract artifacts get fed through the AVM transpiler so perhaps this could parse the custom attributes and set the function type, etc (although this could just be done on the fly).

Comment thread noir/noir-repo/aztec_macros/src/lib.rs Outdated
@TomAFrench
TomAFrench requested a review from spalladino March 6, 2024 11:15
Comment thread noir/noir-repo/compiler/wasm/src/types/noir_artifact.ts Outdated

@spalladino spalladino left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, thanks @TomAFrench! I just left a question to double check, but if it's fine, I'll merge with my PR. Next step (which I can tackle) would be to tweak yarn-project/types/src/abi/contract_artifact.ts#loadContractArtifact to understand the attributes for populating the fields we expect in ts-land.

match ty {
"Private" => func.def.return_distinctness = Distinctness::Distinct,
"Public" => func.def.is_open = true,
"Public" => func.def.is_unconstrained = true,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For compilation purposes (ie emitting ACIR or Brillig or AVM bytecode), is it equivalent to flag the function as unconstrained instead of open? @TomAFrench @Maddiaa0 @sirasistant

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

"open" implies AVM, no? We should compile to brillig in this case so we should tell the Noir compiler that it should compile the function as if it were unconstrained.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We don't output AVM bytecode so we can only output ACIR or brillig.

@spalladino
spalladino merged commit cff565e into palla/remove-open-keyword Mar 6, 2024
@spalladino
spalladino deleted the tf/remove-aztec-leakage-into-function-types branch March 6, 2024 18:59
spalladino pushed a commit that referenced this pull request Mar 6, 2024
This PR removes the concept of a function being internal or "open" from
the Noir compiler as these are now concepts which are aztec specific. We
instead attach all of a contract functions custom attributes to it in
the build artifact so aztec can parse these to determine whether a
function is open or secret, etc.

@spalladino This follows on from #4967 but I've made this as a separate
PR into yours as I don't want to hijack it.
spalladino pushed a commit that referenced this pull request Mar 7, 2024
This PR removes the concept of a function being internal or "open" from
the Noir compiler as these are now concepts which are aztec specific. We
instead attach all of a contract functions custom attributes to it in
the build artifact so aztec can parse these to determine whether a
function is open or secret, etc.

@spalladino This follows on from #4967 but I've made this as a separate
PR into yours as I don't want to hijack it.
spalladino pushed a commit that referenced this pull request Mar 11, 2024
This PR removes the concept of a function being internal or "open" from
the Noir compiler as these are now concepts which are aztec specific. We
instead attach all of a contract functions custom attributes to it in
the build artifact so aztec can parse these to determine whether a
function is open or secret, etc.

@spalladino This follows on from #4967 but I've made this as a separate
PR into yours as I don't want to hijack it.
spalladino pushed a commit that referenced this pull request Mar 11, 2024
This PR removes the concept of a function being internal or "open" from
the Noir compiler as these are now concepts which are aztec specific. We
instead attach all of a contract functions custom attributes to it in
the build artifact so aztec can parse these to determine whether a
function is open or secret, etc.

@spalladino This follows on from #4967 but I've made this as a separate
PR into yours as I don't want to hijack it.
spalladino pushed a commit that referenced this pull request Mar 11, 2024
This PR removes the concept of a function being internal or "open" from
the Noir compiler as these are now concepts which are aztec specific. We
instead attach all of a contract functions custom attributes to it in
the build artifact so aztec can parse these to determine whether a
function is open or secret, etc.

@spalladino This follows on from #4967 but I've made this as a separate
PR into yours as I don't want to hijack it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants