[input-output-hk/cardano-sl] The result of fts is dependent on unspecified behaviour. (#3425)

We are aware of this issue. Unfortunately these issues are due to poor or undocumented decisions the original developers. Fortunately these issues are not as serious as they initially seem.

On the genesis `StakesMap` this is unfortunate but not hugely problematic unless something changes. The genesis stakes map is static and won’t ever change. The other thing than can change is the ordering provided by the `HashMap` implementation. In this case the line of code you highlight could be replaced with something that orders the stakes in the correct/required order without using the `HashMap` at all.

On the second issue, yes, the RocksDB iterator produces outputs in the same order as if they were `ByteString`s of `Word8`. The only potential problem is if the RocksDB implementation changes its ordering from some reason. This is highly unlikely as it would probably break a lot of other software that depends on RocksDB. We should however have a test in the test suite to check for this issue.