Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When a function called from within another function should return uint256 but it returns nothing, the caller is terminated without raise #1383

Closed
michwill opened this issue Apr 5, 2019 · 3 comments · Fixed by #1384
Labels
bug Bug that shouldn't change language semantics when fixed.

Comments

@michwill
Copy link

michwill commented Apr 5, 2019

Version Information

  • vyper Version (output of vyper --version): <= 0.1.0-beta9
  • OS: linux
  • Python Version (output of python --version): 3.6.7
  • Environment (output of pip freeze):
asn1crypto==0.24.0
atomicwrites==1.3.0
attrdict==2.0.1
attrs==19.1.0
backcall==0.1.0
certifi==2019.3.9
cffi==1.12.2
chardet==3.0.4
cryptography==2.6.1
cytoolz==0.9.0.1
decorator==4.4.0
eth-abi==2.0.0b8
eth-account==0.3.0
eth-bloom==1.0.3
eth-hash==0.2.0
eth-keyfile==0.5.1
eth-keys==0.2.1
eth-rlp==0.1.2
eth-tester==0.1.0b37
eth-typing==2.0.0
eth-utils==1.4.1
ethpm==0.1.4a13
hexbytes==0.1.0
idna==2.8
ipfsapi==0.4.3
ipython==7.4.0
ipython-genutils==0.2.0
jedi==0.13.3
jsonschema==2.6.0
lru-dict==1.1.6
more-itertools==7.0.0
mypy-extensions==0.4.1
parsimonious==0.8.1
parso==0.3.4
pexpect==4.6.0
pickleshare==0.7.5
pluggy==0.9.0
prompt-toolkit==2.0.9
protobuf==3.7.1
ptyprocess==0.6.0
py==1.8.0
py-ecc==1.4.7
py-evm==0.2.0a39
py-geth==2.1.0
pycparser==2.19
pycryptodome==3.8.0
pyethash==0.1.27
Pygments==2.3.1
pytest==4.4.0
pytest-ethereum==0.1.3a6
requests==2.21.0
rlp==1.1.0
semantic-version==2.6.0
six==1.12.0
toolz==0.9.0
traitlets==4.3.2
trie==1.3.8
urllib3==1.24.1
vyper==0.1.0b9
wcwidth==0.1.7
web3==5.0.0a5
websockets==7.0

What's your issue about?

Take the example contract:

@private
def x(z: uint256) -> uint256:
    if z > 0:
        return z
    else:
        pass

@public
def y():
    self.x(0)
    assert False

Calling y() succeeds without failing.

What I'd expect is either a fail at compile time (because x() can return improper type), or a runtime failure when calling self.x(0). And I certainly wouldn't expect y() to silently terminate when self.x call failed: it should raise

@jacqueswww jacqueswww added the bug Bug that shouldn't change language semantics when fixed. label Apr 5, 2019
@charles-cooper
Copy link
Member

Probably a dup of #590

@charles-cooper
Copy link
Member

I wonder if in addition to #1384 the caller should also check that RETURNDATASIZE is the same as expected by the function signature?

@k06a
Copy link

k06a commented May 22, 2019

Thats why Uniswap/v1-contracts#30 not works. This can be handled by the library or by the compiler. OpenZeppelin re-implemented SafeERC20 to support this kind of tokens: OpenZeppelin/openzeppelin-contracts#1662

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug that shouldn't change language semantics when fixed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants