Comments (5)
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.
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.
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.
from sway.
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.
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)
- Wrong "This declaration is never used." warning when variables are used only in reassignment LHS in index expressions
- Various DCA issues reproducible in E2E tests
- Type of the array index not type-checked in reassignment LHS
- Check for usages of incomplete referred symbols in IR optimizations
- Compiler panics when duplicate enum declarations exists in library
- Disallow test function arguments
- Problem inferring generic types only used in returns HOT 1
- Use rust sdk v0.58.0
- Contract calls need their return method imported manually
- Ambiguous star imports resolved incorrectly
- Missing semicolon error reported at the following token and not at the actual source of issue
- Storing the result of an `abi()` declaration in storage or configurables HOT 1
- Hash based ABI & Indexer support
- Devise a definition to use in tags
- Emit tags in LOG and LOGD
- Rework the ABI spec to use event tag hashes instead of integers as type ids
- Create `#[abi_name(name)]` annotation
- Type specific impl blocks for the std-lib don't have generated docs
- Update the "known issues and workarounds" doc
- Price
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sway.