|
1 | 1 | use std::{
|
2 | 2 | collections::HashMap,
|
3 |
| - fs::File, |
4 |
| - io::BufReader, |
5 |
| - path::Path, |
6 | 3 | time::{Duration, Instant},
|
7 | 4 | };
|
8 | 5 |
|
9 |
| -use anyhow::{bail, ensure}; |
| 6 | +use anyhow::ensure; |
10 | 7 | use eth_trie::{RootWithTrieDiff, Trie};
|
11 | 8 | use ethportal_api::{
|
12 | 9 | types::{execution::transaction::Transaction, state_trie::account_state::AccountState},
|
@@ -36,8 +33,6 @@ use crate::{
|
36 | 33 | };
|
37 | 34 |
|
38 | 35 | pub const BLOCKHASH_SERVE_WINDOW: u64 = 256;
|
39 |
| -const GENESIS_STATE_FILE: &str = "trin-execution/resources/genesis/mainnet.json"; |
40 |
| -const TEST_GENESIS_STATE_FILE: &str = "resources/genesis/mainnet.json"; |
41 | 36 |
|
42 | 37 | #[derive(Debug, Serialize, Deserialize)]
|
43 | 38 | struct AllocBalance {
|
@@ -132,14 +127,8 @@ impl<'a> BlockExecutor<'a> {
|
132 | 127 | }
|
133 | 128 |
|
134 | 129 | fn process_genesis(&mut self) -> anyhow::Result<()> {
|
135 |
| - let genesis_file = if Path::new(GENESIS_STATE_FILE).is_file() { |
136 |
| - File::open(GENESIS_STATE_FILE)? |
137 |
| - } else if Path::new(TEST_GENESIS_STATE_FILE).is_file() { |
138 |
| - File::open(TEST_GENESIS_STATE_FILE)? |
139 |
| - } else { |
140 |
| - bail!("Genesis file not found") |
141 |
| - }; |
142 |
| - let genesis: GenesisConfig = serde_json::from_reader(BufReader::new(genesis_file))?; |
| 130 | + let genesis: GenesisConfig = |
| 131 | + serde_json::from_str(include_str!("../../resources/genesis/mainnet.json"))?; |
143 | 132 |
|
144 | 133 | for (address, alloc_balance) in genesis.alloc {
|
145 | 134 | let address_hash = keccak256(address);
|
|
0 commit comments