Skip to content

Access/modify function runtime type in comptime #5954

@Thunkar

Description

@Thunkar

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions