Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: add e2hs mode to portal-bridge #1735

Merged
merged 2 commits into from
Mar 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions bin/e2hs-writer/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ impl EraProvider {
let first_source = match starting_block < MERGE_BLOCK_NUMBER {
true => {
let era1_paths = get_era1_files(&http_client).await?;
let era1_path = era1_paths.get(&starting_block).ok_or(anyhow!(
"Era1 file not found for block number: {starting_block}",
let epoch_index = starting_block / EPOCH_SIZE;
let era1_path = era1_paths.get(&epoch_index).ok_or(anyhow!(
"Era1 file not found for epoch index: {epoch_index}",
))?;
let raw_era1 = fetch_bytes(http_client.clone(), era1_path).await?;
EraSource::PreMerge(Arc::new(raw_era1))
Expand Down
4 changes: 2 additions & 2 deletions bin/e2hs-writer/src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use e2store::{
};
use ethportal_api::utils::bytes::hex_encode;
use futures::StreamExt;
use tracing::{debug, info};
use tracing::info;

use crate::reader::EpochReader;

Expand All @@ -27,7 +27,7 @@ impl EpochWriter {
let mut block_stream = Box::pin(reader.iter_blocks());

while let Some(Ok(block_data)) = block_stream.next().await {
debug!(
info!(
"Writing block {}",
block_data.header_with_proof.header.number
);
Expand Down
6 changes: 6 additions & 0 deletions bin/portal-bridge/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ cargo run -p portal-bridge -- --executable-path ./target/debug/trin --epoch-accu
- before gossiping a individual piece of content, the bridge will perform a lookup to see if the content is already in the portal network. If it is, the content will not be gossiped.
- `"--mode fourfours:single_hunter:10:50`: sample size = 10, threshold = 50
- same as the above hunter mode, but it will only gossip a single era1 file before exiting

#### E2HS Bridge

- `"--mode e2hs --e2hs-range 100-200"`: gossip a block range from #100 to #200 (inclusive) using `E2HS` files as the data source
- `"--mode e2hs --e2hs-range 1000-10000 --e2hs-randomize"`: randomize the order in which epochs from block range are gossiped

#### Beacon Subnetwork

- `"--mode latest"`: follow the head of the chain and gossip latest blocks
Expand Down
Loading
Loading