Skip to content

Invariant can cause infinite recursion stack overflow #201

@NeverFearTomorrow

Description

@NeverFearTomorrow

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions