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

fix: add temporary flag to disable storing headers #1668

Merged
merged 3 commits into from
Feb 5, 2025

Conversation

njgheorghita
Copy link
Collaborator

@njgheorghita njgheorghita commented Feb 4, 2025

What was wrong?

Part of #1666 ...

How was it fixed?

  • Added flag for disabling the storage of all HeaderWithProof types
  • I spoke with @morph-dev offline about not using a flag and just hardcoding this exception, but I figured that would probably mess with our tests somewhere so the flag seems like the easier solution.

To-Do

@njgheorghita njgheorghita marked this pull request as ready for review February 4, 2025 20:40
@njgheorghita njgheorghita requested review from KolbyML and morph-dev and removed request for KolbyML February 4, 2025 20:42
Copy link
Member

@KolbyML KolbyML left a comment

Choose a reason for hiding this comment

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

:shipit: looks good, there was a check missing for HeaderByNumber, I assume the cluster repo will be updated with --disable-storing-header=true

Comment on lines 39 to 44
// temporarily disable storing all block headers
if self.disable_storing_headers {
if let HistoryContentKey::BlockHeaderByHash(_) = key {
return Ok(ShouldWeStoreContent::NotWithinRadius);
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// temporarily disable storing all block headers
if self.disable_storing_headers {
if let HistoryContentKey::BlockHeaderByHash(_) = key {
return Ok(ShouldWeStoreContent::NotWithinRadius);
}
}
// temporarily disable storing all block headers
if self.disable_storing_headers {
if let HistoryContentKey::BlockHeaderByHash(_) | HistoryContentKey::BlockHeaderByNumber(_) = key {
return Ok(ShouldWeStoreContent::NotWithinRadius);
}
}

Don't you need to add a check for BlockHeaderByNumber as well

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.

I think we should disable storing all history content (for the time being).

Reason for not storing new bodies and receipts until migration is completed, is that I'm not sure we can verify them if we can't fetch correct headers from the network. Meaning, we might end up doing a lot of unnecessary work..

Also, I'm not sure this content will be gossiped until migration is complete either.


#[arg(
long = "disable-storing-headers",
help = "Disable storing headers in the database. This is a temporary flag used for upgrading the network, and should be removed once the upgrade is complete.",
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 add link to tracking issue

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added this pr to the list of todos in the tracking issue so I'm confident this won't slip through the cracks

@@ -127,6 +129,7 @@ pub struct PortalStorageConfig {
pub distance_fn: DistanceFunction,
pub sql_connection_pool: Pool<SqliteConnectionManager>,
pub max_radius: Distance,
pub disable_storing_headers: bool,
Copy link
Collaborator

@morph-dev morph-dev Feb 5, 2025

Choose a reason for hiding this comment

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

I know that this is only temporarily, but I don't like that this is history network specific thing and it's present in the PortalStorageConfig.

Instead, I believe we can:

  1. add parameter to initialize_history_network
  2. pass it to HistoryNetwork::new
  3. pass it to HistoryStorage::new

This would make change smaller and also easier to revert.

Again, since this is temporarily, I won't block/insist on this.

@njgheorghita njgheorghita force-pushed the disable-storing-headers branch from cdf8d3e to 3949755 Compare February 5, 2025 20:39
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.

LGTM 🚢

@njgheorghita njgheorghita merged commit a63239f into ethereum:master Feb 5, 2025
11 checks passed
@njgheorghita njgheorghita deleted the disable-storing-headers branch February 5, 2025 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants