Zilliqa / scilla

Scilla - A Smart Contract Intermediate Level Language
https://scilla-lang.org
GNU General Public License v3.0
241 stars 78 forks source link

Polymorphic hash tables should be replaced #533

Open anton-trunov opened 5 years ago

anton-trunov commented 5 years ago

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.

vaivaswatha commented 4 years ago

@anton-trunov does https://github.com/Zilliqa/scilla/pull/764 also fix this Issue?

Related: https://github.com/Zilliqa/scilla/issues/65

anton-trunov commented 4 years ago

I'm not sure, I guess we would need to run an experiment to have a definite answer.