-
Notifications
You must be signed in to change notification settings - Fork 201
chore(l1): add phase completion markers for snap sync validation #6189
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -689,6 +689,7 @@ pub fn calculate_staleness_timestamp(timestamp: u64) -> u64 { | |||||
|
|
||||||
| pub async fn validate_state_root(store: Store, state_root: H256) -> bool { | ||||||
| info!("Starting validate_state_root"); | ||||||
| let start = std::time::Instant::now(); | ||||||
| let validated = tokio::task::spawn_blocking(move || { | ||||||
| store | ||||||
| .open_locked_state_trie(state_root) | ||||||
|
|
@@ -698,8 +699,12 @@ pub async fn validate_state_root(store: Store, state_root: H256) -> bool { | |||||
| .await | ||||||
| .expect("We should be able to create threads"); | ||||||
|
|
||||||
| let elapsed = start.elapsed(); | ||||||
| let secs = elapsed.as_secs(); | ||||||
| let elapsed_str = format!("{:02}:{:02}:{:02}", secs / 3600, (secs % 3600) / 60, secs % 60); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: This formatting is repeated three times in this PR. There's already a fn format_duration(duration: Duration) -> String {
let total_seconds = duration.as_secs();
let hours = total_seconds / 3600;
let minutes = (total_seconds % 3600) / 60;
let seconds = total_seconds % 60;
format!("{hours:02}:{minutes:02}:{seconds:02}")
}Making it |
||||||
| if validated.is_ok() { | ||||||
| info!("Succesfully validated tree, {state_root} found"); | ||||||
|
||||||
| info!("Succesfully validated tree, {state_root} found"); | |
| info!("Successfully validated tree, {state_root} found"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elapsed_strformatting logic is duplicated across the three validation functions. Consider extracting a small helper (or reusing the existing HH:MM:SS formatter used for sync phase logs incrates/networking/p2p/network.rs) so the duration format stays consistent and future changes only need to be made in one place.