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

Access/modify function runtime type in comptime #5954

Closed
Thunkar opened this issue Sep 6, 2024 · 1 comment · Fixed by #5962
Closed

Access/modify function runtime type in comptime #5954

Thunkar opened this issue Sep 6, 2024 · 1 comment · Fixed by #5962
Assignees
Labels
enhancement New feature or request

Comments

@Thunkar
Copy link
Contributor

Thunkar commented Sep 6, 2024

Problem

In aztec contracts, unconstrained functions are modified to inject context and abstract their storage. We do this without the need for an annotation.

Aztec #[public] functions are unconstrained, because it's the AVM's role to constrain them. We don't want the user to have to mark every single one of them as unconstrained (also it might give them the incorrect impression that they won't be constrained)

Happy Case

It's possible to both access:

comptime fn my_annotation(f: FunctionDefinition) {
  let is_unconstrained = f.is_unconstrained(); 
}

and modify

comptime fn my_annotation(f: FunctionDefinition) {
  f.set_unconstrained(true);
}

a function's runtime in a macro.

Workaround

None

Workaround Description

No response

Additional Context

No response

Project Impact

None

Blocker Context

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

@Thunkar Thunkar added the enhancement New feature or request label Sep 6, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Sep 6, 2024
@Thunkar
Copy link
Contributor Author

Thunkar commented Sep 6, 2024

I know this might be controversial (at least the set part), because it might be dangerous if a library author decides to unconstrain certain things and devs don't realize. I've created this to at least have a place to discuss it.

The getter should be fine?

@asterite asterite self-assigned this Sep 6, 2024
github-merge-queue bot pushed a commit that referenced this issue Sep 6, 2024
…constrained` (#5962)

…constrained`

# Description

## Problem

Resolves #5954

## Summary



## Additional Context



## Documentation

Check one:
- [ ] No documentation needed.
- [x] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist

- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants