You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a retroactive issue for the contract scope.
We want Noir to be used as a private smart contract language. At the moment, we are only able to create private programs (libraries/binaries). We want a way to distinguish between a private program and a private contract because there is syntax and semantics that are allowed in contracts that are not allowed in programs.
For example, a private contract has the notion of a storage slot however, private programs do not inherently have this notion. Contracts will also have different visibility identifiers and function types. A Noir function in a program will eventually only be publicly visible or privately visible. This will in turn allow other Noir programs to call such a function (if publicly visible). Contracts on the other hand will have additional rules around what type of functions can call what functions and whether such calls get inlined or not. I am being particularly vague and will refer the reader to Solidities treatment of external and internal functions.
Proposed solution
The proposed solution is to implement the following syntax:
contractFoo{
fn bar(){}fnbaz(){}}
The above introduces the contract keyword and defines a private smart contract named Foo. We have two functions defined in Foo which can be regarded as two Noir separate programs. One way to view "bar" and "baz" is that they are compiled as separate "main" functions.
Alternatives considered
No response
Additional context
No response
Submission Checklist
Once I hit submit, I will assign this issue to the Project Board with the appropriate tags.
The text was updated successfully, but these errors were encountered:
Problem
We want Noir to be used as a private smart contract language. At the moment, we are only able to create private programs (libraries/binaries). We want a way to distinguish between a private program and a private contract because there is syntax and semantics that are allowed in contracts that are not allowed in programs.
For example, a private contract has the notion of a storage slot however, private programs do not inherently have this notion. Contracts will also have different visibility identifiers and function types. A Noir function in a program will eventually only be publicly visible or privately visible. This will in turn allow other Noir programs to call such a function (if publicly visible). Contracts on the other hand will have additional rules around what type of functions can call what functions and whether such calls get inlined or not. I am being particularly vague and will refer the reader to Solidities treatment of external and internal functions.
Proposed solution
The proposed solution is to implement the following syntax:
The above introduces the
contract
keyword and defines a private smart contract namedFoo
. We have two functions defined inFoo
which can be regarded as two Noir separate programs. One way to view "bar" and "baz" is that they are compiled as separate "main" functions.Alternatives considered
No response
Additional context
No response
Submission Checklist
The text was updated successfully, but these errors were encountered: