Giter VIP home page Giter VIP logo

Comments (5)

sezna avatar sezna commented on May 14, 2024 1

Ah, great, yeah I misinterpreted that as bits and thought they were word aligned. Perfect. So, then, let's decide that this can be our convention and move forward with it.

from sway.

adlerjohn avatar adlerjohn commented on May 14, 2024 1

Ideally it should simply return with RET and let the caller handle the error, however there's no downside at this time of having a revert at the end of the switch if no cases are taken. You can just make it revert with $zero for now. Eventually we can standardize some error codes.

from sway.

sezna avatar sezna commented on May 14, 2024

cc @adlerjohn for confirmation -- the "input" to the selector comes from the first four bytes of in (addr, size)s in the call frame, so it can be accessed with:

addi $rA $fp i7;
lw $rB $rA i0;

The above follows my aforementioned assumption that the selector is in the first four bytes of the input data, which, if my counting is correct, is word 7.

(citing here)

from sway.

adlerjohn avatar adlerjohn commented on May 14, 2024

It depends on our convention. But using the first parameter exclusively as the selector is probably the most reasonable approach.

You can fetch it as 4 + 4 + 1*64 + 1 + 1 + 1 = 75 words offset from $fp, not 7, if my math is right. (Each row in the call frame table in the specs isn't one word.)

from sway.

sezna avatar sezna commented on May 14, 2024

Should I put a revert opcode after the contract ABI switch statement? It seems correct to me, but I just want to double check.
And, if yes, what should the RVRT return?
cc @adlerjohn

from sway.

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.