scilla
scilla copied to clipboard
Polymorphic hash tables should be replaced
I think it’s reasonable to assume that miners can build Scilla from source code. Different major OCaml versions do not guarantee stability of the Hashtbl’s hash function.
I.e. if we want reproducible computations across the whole network, we need that people can take equal Maps and turn those into the same hashes (and raw bytes before that).
To achieve that, we need a standard way of traversing a map. This might be achieved with sorting, but that's expensive.
Also, if we use OCaml's standard hashtables, then every time we want to change some representation, we would need to release a backwards incompatible Scilla version because of the polymorphic hash function.
I believe we could try and solve this issue by switching to Base’s hashtables and write the hash function manually.
@anton-trunov does https://github.com/Zilliqa/scilla/pull/764 also fix this Issue?
Related: https://github.com/Zilliqa/scilla/issues/65
I'm not sure, I guess we would need to run an experiment to have a definite answer.