Skip to content

feat(trin-execution): replace EraManager with E2HSManager #1855

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

Merged
merged 2 commits into from
May 24, 2025

Conversation

KolbyML
Copy link
Member

@KolbyML KolbyML commented May 24, 2025

What was wrong?

Trin Execution was using Era/Era1 files to execute to near the head of the chain. Handling Era/Era1 files adds a lot of complexity. Downloading Era files and processing them is slow and memory intensive. We want to transition to using E2HS files because they are smaller and we can use them to execute near the head of the chain.

Also Era files are generated with a week delay, where we generate E2HS files as soon as we can. The S3 bucket we used has also be very unreliable missing files multiple times last month.

How was it fixed?

Replacing Era/Era1 support for E2HS support

@KolbyML KolbyML requested a review from morph-dev May 24, 2025 02:15
@KolbyML KolbyML self-assigned this May 24, 2025
Copy link
Collaborator

@morph-dev morph-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

🚀

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe rename file to era_binary_search.rs

Comment on lines 57 to 60
attempts += 1;
if attempts > 10 {
anyhow::bail!("Failed to download e2store file after {attempts} attempts");
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
attempts += 1;
if attempts > 10 {
anyhow::bail!("Failed to download e2store file after {attempts} attempts");
}
if attempts => 10 {
anyhow::bail!("Failed to download e2store file after {attempts} attempts");
}
attempts += 1;

nit: I think log message is off by one

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we already have this file here: test_assets/era1/mainnet-00000-a6860fef.e2hs.

Maybe remove it, since it's in the wrong directory.

Comment on lines 49 to 50
let first_block_number = self.blocks[0].header.number;
(first_block_number..first_block_number + BLOCKS_PER_E2HS as u64).contains(&block_number)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: if we assume that ProcessedE2HS is created correctly (which we already do), we can just check that e2hs index for block_number is the same as self.index.

} else {
Self::Era
}
&self.blocks[block_number as usize - self.blocks[0].header.number as usize]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should we panic if block number doesn't match expected one? Up to you.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: If I'm not mistaken, now we always call download_raw_e2store_file and follow it with process_e2hs_file.

Maybe create one more function download_e2hs_file that will download and return ProcessedE2HS


pub async fn last_fetched_block(&self) -> anyhow::Result<&ProcessedBlock> {
let Some(current_e2hs) = &self.current_e2hs else {
panic!("current_e2hs should be initialized in E2HSManager::new");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think current message is a confusing/incorrect.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you misunderstood my comment. Now it says:
current_e2hs should always be present, perhaps it wasn't initialized in E2HSManager::new()?

Looking at E2HSManager::new, it never initializes current_e2hs. The current_e2hs is set only during get_next_block.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you misunderstood my comment. Now it says: current_e2hs should always be present, perhaps it wasn't initialized in E2HSManager::new()?

Looking at E2HSManager::new, it never initializes current_e2hs. The current_e2hs is set only during get_next_block.

I see what you mean now, I made a PR to address this #1857

@KolbyML KolbyML merged commit 47fa171 into ethereum:master May 24, 2025
16 checks passed
@KolbyML KolbyML deleted the trin-execution-use-e2hs-instead branch May 25, 2025 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants