When writing smart contracts it's important to make sure that all data structures used are deterministic.
Specifically, if HashMap
or HashSet
are used - is there a possible non determinism coming from Rust standard library?
When writing smart contracts it's important to make sure that all data structures used are deterministic.
Specifically, if HashMap
or HashSet
are used - is there a possible non determinism coming from Rust standard library?
Since Wasm runtime doesn't have access to non-deterministic inputs, the entire execution is deterministic. HashSet
and HashMap
use seed from the available source, in case of Wasm compilation there are no available source, the execution will always be the same. It should be easy to confirm.
To add to what @evgeny-kuzyakov said, the only sources of non-determinism are OS-level features, like threads, clock, OS randomness, networking, devices, file system, etc. If contract is compiled with the code that tries to access these features it will not be executed on our blockchain (though one can deploy it, because one can deploy any sequence of bytes as a contract) and will fail with an error before the execution starts.