scribble
scribble copied to clipboard
Invariant can cause infinite recursion stack overflow
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.