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
Methods and state variables in a contract scope have functionality and semantics that does not apply when you are not speaking about contracts.
Consider the following program copied from Jake's awesome PR:
fnmain(x:Field,y: pub Field){
constrain Foo::xy(x) == Foo::triple(y);}contractFoo{y:Field
fn double(x:Field) -> Field{ x *2}fnxy(x:Field) -> Field{ x * y }}
Calling xy outside a contract brings forth a few question:
What does it mean when one calls xy and accesses the state variable y in this context?
Does this behaviour differ in anyways if xy was called by another contract?
Can a regular Noir program modify the state of y?
I think we could possibly define semantics for this however since there is no usecase for it and it would lead to additional complexity, its better to not allow it now and allow it in the future if we need to.
Proposed solution
Noir contracts can call other contracts and programs. However, Noir programs cannot call Noir contracts.
Alternatives considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered:
Problem
Methods and state variables in a contract scope have functionality and semantics that does not apply when you are not speaking about contracts.
Consider the following program copied from Jake's awesome PR:
Calling xy outside a contract brings forth a few question:
xy
and accesses the state variabley
in this context?xy
was called by another contract?y
?I think we could possibly define semantics for this however since there is no usecase for it and it would lead to additional complexity, its better to not allow it now and allow it in the future if we need to.
Proposed solution
Noir contracts can call other contracts and programs. However, Noir programs cannot call Noir contracts.
Alternatives considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: