Skip to content

panic on some cyclic function call checks #4194

@Leminkay

Description

@Leminkay

Version Information

  • vyper Version (output of vyper --version): 0.4.0b6+commit.7485ceab

Issue description and/or POC

The _compute_reachable_set will recursively call itself with the modified path variable, checking only the root = path[0] variable for every fn_t.called_functions iteration.

if g == root:
    message = " -> ".join([f.name for f in path])
    raise CallViolation(f"Contract contains cyclic function call: {message}")

In the following example, the path list will be [foo, bar, bar, bar, ...], where root is foo, falling into infinite recursion.

@external 
def foo():
    self.bar()

@internal
def bar():
    self.bar()

The error message RecursionError: maximum recursion depth exceeded while calling a Python object

How can it be fixed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions