-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix RecursionError tracing child computations
- Loading branch information
Showing
2 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import pytest | ||
import boa | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def external_contract(): | ||
source_code = """ | ||
@external | ||
@view | ||
def foo(a: uint256) -> uint256: | ||
return a * a | ||
""" | ||
return boa.loads(source_code, name="ExternalContract") | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def source_contract(external_contract): | ||
source_code = """ | ||
interface Foo: | ||
def foo(a: uint256) -> uint256: view | ||
FOO: immutable(address) | ||
@external | ||
def __init__(_foo_address: address): | ||
FOO = _foo_address | ||
@external | ||
@view | ||
def bar(b: uint256) -> uint256: | ||
c: uint256 = Foo(FOO).foo(b) | ||
return c | ||
""" | ||
return boa.loads(source_code, external_contract.address, name="TestContract") | ||
|
||
|
||
def test_sub_computations(source_contract): | ||
boa.env._coverage_enabled = True | ||
source_contract.bar(10) | ||
|