I made the assumption that chainspec building was reproducible, however, it seems I missed something for ĞTest.
# do this twice for test1 and test2 DUNITER_GTEST_GENESIS=/home/hugo/duniter/specs/gtest_genesis.json \ DUNITER_GTEST_CLIENT_SPEC=/home/hugo/duniter/specs/gtest_client-specs.json \ duniter build-spec --chain gtest_live > test1 # the diff should be empty but is not diff test1 test2
I can see two differences:
- in “accounts” randomId are different
- in “identities” the order of the list is not the same
This is how randomId is generated :
// for wallet random_id: H256(blake2_256(&(wallet_index, &pubkey).encode())), // for identity random_id: H256(blake2_256(&(identity.index, &identity.owner_key).encode())),
The problem is that the hashmaps are not ordered and the wallet_index is based on the order of iteration. I have to make it reproducible (todo).
Note : elois already met this problem and fixed it for genesis in commit fix(idty): make genesis build deterministic (80b78ae2) · Commits · nodes / rust / Duniter v2S · GitLab