Skip to content

Commit

Permalink
fix: raw_call type when max_outsize=0 is set
Browse files Browse the repository at this point in the history
prior to this commit, when `raw_call` is used with `max_outsize`
explicitly set to 0 (`max_outsize=0`) the compiler incorrectly infers that
raw_call has no return type

```vyper
@external
@payable
def foo(_target: address):
    # compiles
    a: bool = raw_call(_target, method_id("foo()"), revert_on_failure=False)
    # should have same behavior, but prior to this commit does not compile:
    b: bool = raw_call(_target, method_id("foo()"), max_outsize=0, revert_on_failure=False)
```

chainsec june 2023 review 5.16
  • Loading branch information
charles-cooper committed Aug 28, 2023
1 parent 43c8d85 commit 237f0a5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion vyper/builtins/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,7 @@ def fetch_call_return(self, node):
revert_on_failure = kwargz.get("revert_on_failure")
revert_on_failure = revert_on_failure.value if revert_on_failure is not None else True

if outsize is None:
if outsize is None or outsize.value == 0:
if revert_on_failure:
return None
return BoolT()
Expand Down

0 comments on commit 237f0a5

Please sign in to comment.