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

feat: display warning for op-mainnet launch without pre-Bedrock state #11765

Merged
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/optimism/chainspec/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ serde_json.workspace = true
# misc
derive_more.workspace = true
once_cell.workspace = true
tracing.workspace = true

[dev-dependencies]
reth-chainspec = { workspace = true, features = ["test-utils"] }
Expand Down
11 changes: 11 additions & 0 deletions crates/optimism/chainspec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ use reth_optimism_forks::OptimismHardforks;
use reth_primitives_traits::Header;
#[cfg(feature = "std")]
pub(crate) use std::sync::LazyLock;
use tracing::warn;

/// Chain spec builder for a OP stack chain.
#[derive(Debug, Default, From)]
Expand Down Expand Up @@ -67,6 +68,16 @@ impl OpChainSpecBuilder {
let forks = OP_MAINNET.hardforks.clone();
inner = inner.with_forks(forks);

let is_bedrock_active = OP_MAINNET.is_bedrock_active_at_block(105235063);

if !is_bedrock_active {
warn!(
"Warning: Op-mainnet has been launched without importing the pre-Bedrock state. \
The chain will not progress without this import. \
Please ensure that the pre-Bedrock state is imported to avoid synchronization issues and ensure proper chain operation."
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

this isn't quite right, because the chainspec only tracks static activation.

but we need checks this against the local database when the chain is op-mainnet

I believe the best location to do this would be somewhere here

pub fn check_pipeline_consistency(&self) -> ProviderResult<Option<B256>> {

we could introduce a helper function that is something like

fn chain_specific_db_checks

which would only check if the chain id is op-mainnet for example

wdyt @joshieDo

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah i think it could work

}

Self { inner }
}
}
Expand Down
Loading