Skip to content

Commit

Permalink
fix: docker portal-bridge can't find genesis.json (#1648)
Browse files Browse the repository at this point in the history
  • Loading branch information
KolbyML authored Jan 25, 2025
1 parent 40cab0b commit d8d3550
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
17 changes: 3 additions & 14 deletions bin/trin-execution/src/evm/block_executor.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
use std::{
collections::HashMap,
fs::File,
io::BufReader,
path::Path,
time::{Duration, Instant},
};

use anyhow::{bail, ensure};
use anyhow::ensure;
use eth_trie::{RootWithTrieDiff, Trie};
use ethportal_api::{
types::{execution::transaction::Transaction, state_trie::account_state::AccountState},
Expand Down Expand Up @@ -36,8 +33,6 @@ use crate::{
};

pub const BLOCKHASH_SERVE_WINDOW: u64 = 256;
const GENESIS_STATE_FILE: &str = "trin-execution/resources/genesis/mainnet.json";
const TEST_GENESIS_STATE_FILE: &str = "resources/genesis/mainnet.json";

#[derive(Debug, Serialize, Deserialize)]
struct AllocBalance {
Expand Down Expand Up @@ -132,14 +127,8 @@ impl<'a> BlockExecutor<'a> {
}

fn process_genesis(&mut self) -> anyhow::Result<()> {
let genesis_file = if Path::new(GENESIS_STATE_FILE).is_file() {
File::open(GENESIS_STATE_FILE)?
} else if Path::new(TEST_GENESIS_STATE_FILE).is_file() {
File::open(TEST_GENESIS_STATE_FILE)?
} else {
bail!("Genesis file not found")
};
let genesis: GenesisConfig = serde_json::from_reader(BufReader::new(genesis_file))?;
let genesis: GenesisConfig =
serde_json::from_str(include_str!("../../resources/genesis/mainnet.json"))?;

for (address, alloc_balance) in genesis.alloc {
let address_hash = keccak256(address);
Expand Down
1 change: 0 additions & 1 deletion docker/Dockerfile.bridge
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ WORKDIR /app

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

RUN apt-get update && apt-get install libcurl4 -y
Expand Down

0 comments on commit d8d3550

Please sign in to comment.