You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I added a build script for convenience, and then removed all the existing async stuff from the example, because it doesn't seem to work on Windows. that is the #171 bug, which is most likely unrelated to this issue.
First problem: Import/export async function returning a non-u64 primitive
If you declare any primitive other than u64 as the return type in either the import or export for an async function as the return type, the plugin will not build properly, saying that is is expecting u64 instead of the actual type. Full error message here: https://pastebin.com/15WPqtCw
Second problem: Export u64 async function gives a different error
On the other hand, exporting an async function that returns an u64 makes the runtime not compile. The error is about expecting u8 slice (or Vec) instead of u64. Again, full error here: https://pastebin.com/15WPqtCw
Third problem: You can return anything in async import function returning u64
If the protocol defines an async import function that should return a u64, you can actually return anything in the implementation in the runtime. Returning u64 (or u8/u16/u32 it seems) compiles and works as expected (can read correct value in wasm plugin), but returning anything else (other primitive or complex type) still compiles, but the test freezes at runtime. Tests that run before finish correctly.
Workaround
You can use a newtype as the return type to work around this, but of course it would be better to fix the issue.
The text was updated successfully, but these errors were encountered:
While working on this issue (#171), I discovered some wierd bugs with futures that have a primitive type as an output. I tried to re-trace my steps and add commits at logical point, see here: https://github.com/kajacx/fp-bindgen/commits/futures-primitive-return-types
The Setup
I added a build script for convenience, and then removed all the existing async stuff from the example, because it doesn't seem to work on Windows. that is the #171 bug, which is most likely unrelated to this issue.
First problem: Import/export async function returning a non-u64 primitive
If you declare any primitive other than u64 as the return type in either the import or export for an async function as the return type, the plugin will not build properly, saying that is is expecting u64 instead of the actual type. Full error message here: https://pastebin.com/15WPqtCw
Second problem: Export u64 async function gives a different error
On the other hand, exporting an async function that returns an u64 makes the runtime not compile. The error is about expecting u8 slice (or Vec) instead of u64. Again, full error here: https://pastebin.com/15WPqtCw
Third problem: You can return anything in async import function returning u64
If the protocol defines an async import function that should return a u64, you can actually return anything in the implementation in the runtime. Returning u64 (or u8/u16/u32 it seems) compiles and works as expected (can read correct value in wasm plugin), but returning anything else (other primitive or complex type) still compiles, but the test freezes at runtime. Tests that run before finish correctly.
Workaround
You can use a newtype as the return type to work around this, but of course it would be better to fix the issue.
The text was updated successfully, but these errors were encountered: