diff --git a/node/src/chain_spec/gtest_genesis.rs b/node/src/chain_spec/gtest_genesis.rs index d8a4a03a9f2c904c267a712a285b5ac44c017be2..f7a341ed071be44da8947093b2c66f76349167de 100644 --- a/node/src/chain_spec/gtest_genesis.rs +++ b/node/src/chain_spec/gtest_genesis.rs @@ -116,9 +116,7 @@ pub fn build_genesis( // track if fatal error occured, but let processing continue let mut fatal = false; // monetary mass for double check - let mut monetary_mass = 0u64; // u128 - // wallet index to generate random id - let mut wallet_index: u32 = 0; + let mut monetary_mass = 0u64; // counter for online authorities at genesis let mut counter_online_authorities = 0; // track identity index @@ -162,12 +160,11 @@ pub fn build_genesis( // double check the monetary mass monetary_mass += balance; - wallet_index += 1; // json prevents duplicate wallets accounts.insert( pubkey.clone(), GenesisAccountData { - random_id: H256(blake2_256(&(wallet_index, &pubkey).encode())), + random_id: H256(blake2_256(&(balance, &pubkey).encode())), balance: *balance, is_identity: false, }, @@ -265,6 +262,8 @@ pub fn build_genesis( ); } } + // sort the identities by index for reproducibility (should have been a vec in json) + identities.sort_unstable_by(|a, b| (a.index as u32).cmp(&(b.index as u32))); // Technical Comittee // // NOTE : when changing owner key, the technical committee is not changed