-
Notifications
You must be signed in to change notification settings - Fork 344
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
Find a stable and convenient solution for floats implicit loading before cosmwasm 1.0 #458
Comments
hi guys, checking the unsupported symbol during compiling~ how do you think ? |
@KamiD such a tool seems very helpful for debugging. However, I would only check the Wasm and explain. Manipulating the Wasm can easily become dangerous when the tool does not 100 % work as intended. Building a call tree for debugging is nice until you hit call_indirect, where the call tree suddenly depends on runtime variable values. I was thinking about a different approach to rejecting Wasm ops codes: we can replace every float operation with |
I did this in a preprocessing compile step, before uploading wasm blobs, when working on the TinyGo prototype. There were float operations that were never executed in runtime, but still not removed by the compiler/optimizer. This is a bit dangerous, as it may cause contracts that really use floats to fail unexpectedly, but it can resolve the issue. I would not do this on the server, but require the user uploading contracts to do this as a pre-processing step, maybe with some warning if there were more floats removed than typical |
Removing from the 1.0 milestone as the state of this is too vague to block the release. We can open up floats later on. It would be consensus breaking but existing contracts would not be affected. |
Agree |
NaN canonicalization is available for all Wasmer backends now. NEAR is using to overcome the only non-deterministic aspect of floats in Wasm and seems to be happy with it. Should we just open up? That would allow all kinds of calculations to become possible in CosmWasm contracts that you cannot do in native Cosmos SDK because of the additional sandbox layer. |
If we can guarantee they produce the same results on ARM (M1 and "Rasperry Pi"), Intel and AMD, then I am happy to allow them. It would make lots of things much easier. I just want to make sure this is safe. |
Maybe you can show me the NEAR test vectors / fuzzing that I can use to convince myself this is safe. |
Singlepass v1 is x86_64 only and looking at wasmerio/wasmer#2463 this will not change anymore. So for a cross-chipset test you first need a cross-backend test. I wonder if that is desired? Why should e.g. cranelift and singlepass calculate deterministic results. Maybe it works though. There are tests in the Wasmer code base I can look into. |
The issue for me is if floats are safe in x86 only singlepass v1, but no longer safe in multi-architecture singlepass v2, but we already enabled float support with v1, then we can never upgrade to v2. The conservative alternative is to not allow them until v2 is out and we are sure this is deterministic cross-architecture. At that point we can remove the "no-float" rule with a minor release of CosmWasm, either together with v2 support or separate. But sure that we will not regret that step. Personally, it would make PoE and bonding curves much easier to code. Just too much time at Tendermint having "floats are evil in blockchain" drilled into my head. |
Hey all, any update on the state of support across various architectures that would allow this to move forward? |
Hey everyone! |
I just started working on float support, probably coming in CosmWasm 1.5. |
Closing in favour of #1845 |
Summary of Bug
there is a problem about floating number type support differentiation in tinyGo and rust-wasm.
that's not a finally solution, I think there at least have two way to fix that:
Version
The text was updated successfully, but these errors were encountered: