Coder Social home page Coder Social logo

Fake return values from stack. about vyper HOT 7 CLOSED

vyperlang avatar vyperlang commented on May 14, 2024
Fake return values from stack.

from vyper.

Comments (7)

jacqueswww avatar jacqueswww commented on May 14, 2024 1

I investigated this some more, and because we use CALL and don't have a in memory stack like solidity. In it's current iteration vyper can not have this issue.
However this is something to consider when we make a decision with regards to #901 .

from vyper.

DavidKnott avatar DavidKnott commented on May 14, 2024

@Dexaran You're on it! This is a huge problem, I think this problem will be easier to deal with once we have the functionality to make calls to other contracts in place. Then I'll start by trying to come up with a failing test case similar to the one you made in Solidity.

from vyper.

fubuloubu avatar fubuloubu commented on May 14, 2024

As a fancier solution, implementing a basic verification stage type checking all return values in the function's control flow path would be useful to provide programmer feedback to a bad contract.

from vyper.

jacqueswww avatar jacqueswww commented on May 14, 2024

Adding this to Fix up the beta project, so some time can be taken to investigate and see if we can avoid this.

from vyper.

haydenadams avatar haydenadams commented on May 14, 2024

@jacqueswww @DavidKnott You should be careful here: ethereum/solidity#4116

Many ERC20 contracts including OMG do not return booleans as specified in the ERC20 standard. If you have a contract with a common interface for all ERC20s that expects boolean return values for transfer(), approve(), and transferFrom() and enforce that any call using that interface has to return either True or False, all calls to the OMG token contract (and several other tokens) will revert. This is problematic for many DEX designs.

EDIT: did some digging. Apparently its at least 130 tokens affected.

from vyper.

fubuloubu avatar fubuloubu commented on May 14, 2024

Interfaces should be implemented exactly as designed, 💯 agree on that. I am curious if the random stack value return influences this at all because sometimes the value will be non-zero, and that would be difficult to debug. Your suggestion to enforce call return values as the interface specifies should absolutely be enforced.

I don't know if this solves the problem here though, as the OP notes it will return without throwing random values from the stack.

from vyper.

haydenadams avatar haydenadams commented on May 14, 2024

@fubuloubu I wasn't necessarily suggesting it. I was saying if it is enforced over 130 tokens currently on EtherDelta will no longer be able to be transferred using the standard ERC20 interface.

from vyper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.