Giter VIP home page Giter VIP logo

Comments (7)

fubuloubu avatar fubuloubu commented on May 12, 2024

I think the problem with my example is only in function arguments... hmm

from vyper.

vbuterin avatar vbuterin commented on May 12, 2024

Viper assumes maps all have infinite type size; you're right that it's incorrect in that particular case. IMO it's not worth it to have some kind of special-case support for two-item maps.

from vyper.

fubuloubu avatar fubuloubu commented on May 12, 2024

I agree with you on that, it was a spurious example.

More for my understanding, what is the reasoning behind this decision? A viper contract can store it's own data in maps, which could reach infinite size in theory, but function arguments (or return values) are not allowed to be of variable size. Is this to ensure that gas estimates can be computed, or something more fundamental to the EVM?

I'm still very much learning, excuse my ignorance!

from vyper.

vbuterin avatar vbuterin commented on May 12, 2024

The reason why infinite sized types in general are not allowed as function arguments is indeed gas estimation. The reason why maps specifically are not allowed is that there is no standard for how an entire map can be passed around as a data structure in the ABI, and the code complexity of implementing such a format, as well as the mechanisms for converting between this format and storage maps, is hard.

from vyper.

fubuloubu avatar fubuloubu commented on May 12, 2024

@vbuterin as a suggestion, can we change that error message to "Maps are not supported for function arguments or outputs"? A much more descriptive error than "has infinite size"

from vyper.

yograterol avatar yograterol commented on May 12, 2024

@fubuloubu that's great idea.

from vyper.

fubuloubu avatar fubuloubu commented on May 12, 2024

Thanks @yograterol. I'll close this one

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.