steemit / simple_steem_client

A minimalist Steem RPC client in Python
2 stars 5 forks source link

Fix dictionary iteration order #17

Open theoreticalbts opened 6 years ago

theoreticalbts commented 6 years ago

Dictionary iteration order is undefined and (in CPython) varies from run to run, causing test_map() to sometimes fail.

goldibex commented 6 years ago

@theoreticalbts what is the expectation of steemd for ordering of objects in maps?

goldibex commented 6 years ago

we shouldn't change the implementation to make a test pass unless the change is actually required by the protocol. I'll rewrite the test in such a way that it passes without changing the behavior of the system.

theoreticalbts commented 6 years ago

what is the expectation of steemd for ordering of objects in maps?

It serializes in the same order as iteration, which for map and flat_map is sorted order of keys. The deserializer does not currently check the order.