Skip to content
Snippets Groups Projects
Commit 0ca5be22 authored by Hugo Trentesaux's avatar Hugo Trentesaux
Browse files

add reproducibility

parent de28baf2
No related branches found
No related tags found
No related merge requests found
...@@ -116,9 +116,7 @@ pub fn build_genesis( ...@@ -116,9 +116,7 @@ pub fn build_genesis(
// track if fatal error occured, but let processing continue // track if fatal error occured, but let processing continue
let mut fatal = false; let mut fatal = false;
// monetary mass for double check // monetary mass for double check
let mut monetary_mass = 0u64; // u128 let mut monetary_mass = 0u64;
// wallet index to generate random id
let mut wallet_index: u32 = 0;
// counter for online authorities at genesis // counter for online authorities at genesis
let mut counter_online_authorities = 0; let mut counter_online_authorities = 0;
// track identity index // track identity index
...@@ -162,12 +160,11 @@ pub fn build_genesis( ...@@ -162,12 +160,11 @@ pub fn build_genesis(
// double check the monetary mass // double check the monetary mass
monetary_mass += balance; monetary_mass += balance;
wallet_index += 1;
// json prevents duplicate wallets // json prevents duplicate wallets
accounts.insert( accounts.insert(
pubkey.clone(), pubkey.clone(),
GenesisAccountData { GenesisAccountData {
random_id: H256(blake2_256(&(wallet_index, &pubkey).encode())), random_id: H256(blake2_256(&(balance, &pubkey).encode())),
balance: *balance, balance: *balance,
is_identity: false, is_identity: false,
}, },
...@@ -265,6 +262,8 @@ pub fn build_genesis( ...@@ -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 // // Technical Comittee //
// NOTE : when changing owner key, the technical committee is not changed // NOTE : when changing owner key, the technical committee is not changed
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment