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: Allow secret functions to use public parameters #1051

Merged
merged 3 commits into from
Mar 28, 2023

Conversation

jfecher
Copy link
Contributor

@jfecher jfecher commented Mar 28, 2023

Related issue(s)

No formal issue but resolves an issue in example 1.3 of the noir-aztec3-examples.

Description

Summary of changes

Allows 'secret' functions in contracts to take public parameters and have public return values.

With this the generated abi for the file looks like the following. (... marks omitted lines)

{
  "name": "PrivateToken",
  "functions": {
    "constructor": {
      "func_type": "secret",
      "function": {
        "circuit": [
            ...
        ],
        "abi": {
          "parameters": [ ... ],
          "param_witnesses": {
            "call_context": [1, 2, 3, 4, 5, 6],
            "contract_deployment_data": [7, 8, 9, 10, 11],
            "value": [12],
            "owner": [13, 14]
          },
          "return_type": {
            "kind": "struct",
            "fields": [...],
          },
          "return_witnesses": [15, 15, 15, 15, 15]
        }
      }
    }
  }
}

Dependency additions / changes

Test additions / changes

Checklist

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt with default settings.
  • I have linked this PR to the issue(s) that it resolves.
  • I have reviewed the changes on GitHub, line by line.
  • I have ensured all changes are covered in the description.

Documentation needs

  • This PR requires documentation updates when merged.

Once contract functions are documented, we'll need to also document that secret functions (the default) can use pub parameters and their return values must also be pub. They cannot use pub if they are also unconstrained.

Additional context

@jfecher jfecher changed the title Allow secret functions to use public parameters feat: Allow secret functions to use public parameters Mar 28, 2023
joss-aztec
joss-aztec previously approved these changes Mar 28, 2023
@jfecher jfecher enabled auto-merge March 28, 2023 14:58
@jfecher jfecher added this pull request to the merge queue Mar 28, 2023
Merged via the queue into master with commit 12c0668 Mar 28, 2023
@jfecher jfecher deleted the jf/contract-public branch March 28, 2023 17:12
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
Development

Successfully merging this pull request may close these issues.

3 participants