Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which Rust data structures are non deterministic

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?

like image 517
ilblackdragon Avatar asked May 28 '20 13:05

ilblackdragon


1 Answers

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.

like image 160
Evgeny Kuzyakov Avatar answered Sep 22 '22 02:09

Evgeny Kuzyakov