duneanalytics/dune-client

Query Hash is not deterministic!

Opened this issue · 2 comments

between different runs, the hash function uses different seeds. So just be aware that it is deterministic in a single run, but not between different executions.

https://github.com/cowprotocol/dune-client/blob/55d5f92f5436ad5b4fc18d7c050a01f463fce017/dune_client/query.py#L37-L42

TODO

  1. Document this and
  2. offer a deterministic hash function as well

I think, this can get fixed by setting PYTHONHASHSEED to a particular value (can be moved to config or something)
https://docs.python.org/3/using/cmdline.html#envvar-PYTHONHASHSEED

That's cool! Although I've also been reading that we should not rely on object hashes to be deterministic and that it's better to use a real hash function from hash lib. I've settled it in the meantime external to this package so this isn't urgent by any means, but feel free to go for it if you like!