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
If an invariant calls a function that makes an external call, then the invariant winds up triggering itself, which leads to infinite recursion.
This could be considered user error, but it's very hard to detect the source of the problem, because stack overflow leads to an unhelpful error message on revert. I think it would be good if scribble would explicitly detect and disallow the use of a function that makes external calls in an invariant. Or maybe there's some other way to warn the user against doing this, or preventing this from happening. The user may not realize right away that a simple view function is technically crossing a contract boundary when they use that function to acquire some basic info for use in their invariant, so anything to help ward the user off of this is helpful.
The text was updated successfully, but these errors were encountered:
I did a few attempt to try to reproduce mentioned behavior, however I did not hit the issue. An example that I used is following:
contractSample {
function foo(uint256i) externalpurereturns (bool) {
return i ==1;
}
/// #if_succeeds this.foo(i) ? $result == (i + 2) : $result == (i + 5);function bar(uint256i) externalviewreturns (uint256) {
returnthis.foo(i) ? i +2 : i +5;
}
}
Maybe I'm digging in the wrong direction.
Is there a possibility that you still have a minimalistic example that would allow us to reproduce the problem? Or maybe you could hint us additional details? Let us know if you have a bit more clues on this.
If an invariant calls a function that makes an external call, then the invariant winds up triggering itself, which leads to infinite recursion.
This could be considered user error, but it's very hard to detect the source of the problem, because stack overflow leads to an unhelpful error message on revert. I think it would be good if scribble would explicitly detect and disallow the use of a function that makes external calls in an invariant. Or maybe there's some other way to warn the user against doing this, or preventing this from happening. The user may not realize right away that a simple view function is technically crossing a contract boundary when they use that function to acquire some basic info for use in their invariant, so anything to help ward the user off of this is helpful.
The text was updated successfully, but these errors were encountered: