We are looking to enable reproducible floating point operations on chain by implementing the IEEE 754 standard as an on-chain wasm function.
As discussed in this stackoverflow post, substrate does not support naive floating point operations due to nondeterminism. Most use cases therefore go with fixed point arithmetics, which would be sub-optimal for us.
The following link gives additional insights into non-determinism in wasm: https://github.com/WebAssembly/design/blob/main/Nondeterminism.md
Given this information it still seems possible to come up with an IEEE 754 implementation that behaves deterministically in the context of substrate pallets, or am I missing something?
My questions are the following:
- Is there a wasm implementation of the IEEE 754 standard out there that can be used in substrate pallets? (I have not come across it in the substrate ecosystem and I wonder why that is the case).
- Are there any hidden pitfalls that I'm unaware of? E.g certain operations not being supported by the wasm executor used in substrate?
Any feedback would be appreciated.