diff --git a/lib/ain-evm/src/block.rs b/lib/ain-evm/src/block.rs index 1055a8b985..c6009e527d 100644 --- a/lib/ain-evm/src/block.rs +++ b/lib/ain-evm/src/block.rs @@ -272,18 +272,18 @@ pub fn new_block_from_json(path: PathBuf, state_root: H256) -> Result, - pub gas_limit: U256, - pub nonce: H64, - pub timestamp: u64, - pub alloc: HashMap, + pub coinbase: Option, + pub difficulty: Option, + pub extra_data: Option>, + pub gas_limit: Option, + pub nonce: Option, + pub timestamp: Option, + pub alloc: Option>, + pub parent_hash: Option, + pub mix_hash: Option, } diff --git a/lib/ain-evm/src/trie.rs b/lib/ain-evm/src/trie.rs index 3a78a56a5e..527154ecbf 100644 --- a/lib/ain-evm/src/trie.rs +++ b/lib/ain-evm/src/trie.rs @@ -71,24 +71,26 @@ impl TrieDBStore { let reader = BufReader::new(file); let genesis: GenesisData = serde_json::from_reader(reader)?; - for (address, data) in genesis.alloc { - debug!("Setting data {:#?} for address {:x?}", data, address); - let basic = backend.basic(address); + if let Some(alloc) = genesis.alloc { + for (address, data) in alloc { + debug!("Setting data {:#?} for address {:x?}", data, address); + let basic = backend.basic(address); - let new_basic = Basic { - balance: data.balance, - ..basic - }; - backend - .apply( - address, - new_basic, - data.code, - data.storage.unwrap_or_default(), - false, - ) - .expect("Could not set account data"); - backend.commit(); + let new_basic = Basic { + balance: data.balance, + ..basic + }; + backend + .apply( + address, + new_basic, + data.code, + data.storage.unwrap_or_default(), + false, + ) + .expect("Could not set account data"); + backend.commit(); + } } let state_root = backend.commit();