Skip to content

Commit d8d3550

Browse files
authored
fix: docker portal-bridge can't find genesis.json (#1648)
1 parent 40cab0b commit d8d3550

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

bin/trin-execution/src/evm/block_executor.rs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
use std::{
22
collections::HashMap,
3-
fs::File,
4-
io::BufReader,
5-
path::Path,
63
time::{Duration, Instant},
74
};
85

9-
use anyhow::{bail, ensure};
6+
use anyhow::ensure;
107
use eth_trie::{RootWithTrieDiff, Trie};
118
use ethportal_api::{
129
types::{execution::transaction::Transaction, state_trie::account_state::AccountState},
@@ -36,8 +33,6 @@ use crate::{
3633
};
3734

3835
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";
4136

4237
#[derive(Debug, Serialize, Deserialize)]
4338
struct AllocBalance {
@@ -132,14 +127,8 @@ impl<'a> BlockExecutor<'a> {
132127
}
133128

134129
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"))?;
143132

144133
for (address, alloc_balance) in genesis.alloc {
145134
let address_hash = keccak256(address);

docker/Dockerfile.bridge

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ WORKDIR /app
3535

3636
# copy build artifacts from build stage
3737
COPY --from=builder /app/target/release/trin /usr/bin/
38-
COPY --from=builder /app/bin/trin-execution/resources /resources
3938
COPY --from=builder /app/target/release/portal-bridge /usr/bin/
4039

4140
RUN apt-get update && apt-get install libcurl4 -y

0 commit comments

Comments
 (0)