-
Notifications
You must be signed in to change notification settings - Fork 23
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
FLIP 255: Cadence WebAssembly API #256
base: main
Are you sure you want to change the base?
Conversation
Hi @darkdrag00nv2 - This FLIP is not reflected on FLIP project tracker. Can you pls follow the process outlined in https://github.com/onflow/flips? Specifically the following would help show the FLIP on the project tracker-
Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
As we're finishing work on Cadence 1.0, we can finally come back to proposals like this. Thank you for your patience!
I left some comments and suggestions, and am happy to apply suggested edits and add remaining details. Does that sound good to you @darkdrag00nv2 ?
Once we addressed the outstanding issues, we can schedule to vote on it in the next WG call
|
||
### Dependencies | ||
|
||
None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll likely won't implement a new WebAssembly runtime and use an existing one
|
||
While the specifics are dependant on the exact engine used, the high level idea is the following: | ||
1. FVM should provide a way to remaining computation units: A new function `RemainingComputation(kind)` will be added in FVM. | ||
2. Computation units should be converted to its WASM engine equivalent. For example, in wasmtime, it is called `Fuel`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to define how fuel translates to computation usage in Flow
3. The user code must be executed with the computed amount of wasm engine computation units. | ||
|
||
##### Memory | ||
To limit the memory being consumed, some constraints will be defined on the various ways that memory is used in the wasm-engine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to define limits. Currently the PoC defines these: https://github.com/onflow/cadence/pull/2760/files#diff-e898ac8338568dfcac62c2017b09e956e5f99c1cda6eedb3f7c48b830595f9d1R76-R90
### Drawbacks | ||
|
||
None | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to define which WebAssembly features will be supported. Currently the PoC specifies: https://github.com/onflow/cadence/pull/2760/files#diff-e898ac8338568dfcac62c2017b09e956e5f99c1cda6eedb3f7c48b830595f9d1R43-R70
### Drawbacks | ||
|
||
None | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to point out that deterministic execution is required. WebAssmbly allows non-determinism through NaNs. However, some WebAssembly runtiumes allow determinism by enforcing NaN-normalization.
Fixes #255