From 9018472b75039faa5edabb95fd7270722c59725b Mon Sep 17 00:00:00 2001 From: runcomet Date: Tue, 4 Nov 2025 01:25:18 +0100 Subject: [PATCH 01/19] add eras_synced --- .../consensus/grandpa/src/warp_proof.rs | 6 +++++ substrate/client/informant/src/display.rs | 24 +++++++++++-------- .../network/sync/src/strategy/chain_sync.rs | 1 + .../client/network/sync/src/strategy/warp.rs | 20 ++++++++++++---- 4 files changed, 37 insertions(+), 14 deletions(-) diff --git a/substrate/client/consensus/grandpa/src/warp_proof.rs b/substrate/client/consensus/grandpa/src/warp_proof.rs index 42701a9cb3edd..0067ceb8ba79b 100644 --- a/substrate/client/consensus/grandpa/src/warp_proof.rs +++ b/substrate/client/consensus/grandpa/src/warp_proof.rs @@ -312,6 +312,7 @@ where .ok_or_else(|| "Empty proof".to_string())?; let (next_set_id, next_authorities) = proof.verify(set_id, authorities, &self.hard_forks).map_err(Box::new)?; + let eras_verified = proof.proofs.len() as u64; let justifications = proof .proofs .into_iter() @@ -321,12 +322,16 @@ where (p.header, justifications) }) .collect::>(); + + //let eras_verified = proof.proofs.len() as u64; + if proof.is_finished { Ok(VerificationResult::::Complete( next_set_id, next_authorities, last_header, justifications, + eras_verified, )) } else { Ok(VerificationResult::::Partial( @@ -334,6 +339,7 @@ where next_authorities, last_header.hash(), justifications, + eras_verified, )) } } diff --git a/substrate/client/informant/src/display.rs b/substrate/client/informant/src/display.rs index 8b3e2730584ff..73d670bf40a95 100644 --- a/substrate/client/informant/src/display.rs +++ b/substrate/client/informant/src/display.rs @@ -105,16 +105,20 @@ impl InformantDisplay { ) if !sync_status.is_major_syncing() => ("⏩", "Block history".into(), format!(", #{}", n)), // Handle all phases besides the two phases we already handle above. (_, _, Some(warp)) - if !matches!(warp.phase, WarpSyncPhase::DownloadingBlocks(_)) => - ( - "⏩", - "Warping".into(), - format!( - ", {}, {:.2} Mib", - warp.phase, - (warp.total_bytes as f32) / (1024f32 * 1024f32) - ), - ), + if !matches!(warp.phase, WarpSyncPhase::DownloadingBlocks(_)) => + { + let progress_text = if warp.eras_synced > 0 { + format!(", {} eras synced, {:.2} Mib", warp.eras_synced, (warp.total_bytes as f32) / (1024f32 * 1024f32)) + } else { + format!(", {:.2} Mib", (warp.total_bytes as f32) / (1024f32 * 1024f32)) + }; + + ( + "⏩", + "Warping".into(), + progress_text, + ) + }, (_, Some(state), _) => ( "⚙️ ", "State sync".into(), diff --git a/substrate/client/network/sync/src/strategy/chain_sync.rs b/substrate/client/network/sync/src/strategy/chain_sync.rs index 7eed775e03bfb..6fad491a420e2 100644 --- a/substrate/client/network/sync/src/strategy/chain_sync.rs +++ b/substrate/client/network/sync/src/strategy/chain_sync.rs @@ -839,6 +839,7 @@ where let warp_sync_progress = self.gap_sync.as_ref().map(|gap_sync| WarpSyncProgress { phase: WarpSyncPhase::DownloadingBlocks(gap_sync.best_queued_number), total_bytes: 0, + eras_synced: 0, }); SyncStatus { diff --git a/substrate/client/network/sync/src/strategy/warp.rs b/substrate/client/network/sync/src/strategy/warp.rs index c815ca1b86d6a..a29af5d683018 100644 --- a/substrate/client/network/sync/src/strategy/warp.rs +++ b/substrate/client/network/sync/src/strategy/warp.rs @@ -63,9 +63,9 @@ pub struct WarpProofRequest { /// Proof verification result. pub enum VerificationResult { /// Proof is valid, but the target was not reached. - Partial(SetId, AuthorityList, Block::Hash, Vec<(Block::Header, Justifications)>), + Partial(SetId, AuthorityList, Block::Hash, Vec<(Block::Header, Justifications)>, u64), /// Target finality is proved. - Complete(SetId, AuthorityList, Block::Header, Vec<(Block::Header, Justifications)>), + Complete(SetId, AuthorityList, Block::Header, Vec<(Block::Header, Justifications)>, u64), } /// Warp sync backend. Handles retrieving and verifying warp sync proofs. @@ -151,6 +151,8 @@ pub struct WarpSyncProgress { pub phase: WarpSyncPhase, /// Total bytes downloaded so far. pub total_bytes: u64, + /// Number of eras that have been verified and synced. + pub eras_synced: u64, } /// Warp sync configuration as accepted by [`WarpSync`]. @@ -217,6 +219,7 @@ pub struct WarpSync { result: Option>, /// Number of peers that need to be connected before warp sync is started. min_peers_to_start_warp_sync: usize, + eras_synced: u64, } impl WarpSync @@ -256,6 +259,7 @@ where actions: vec![SyncingAction::Finished], result: None, min_peers_to_start_warp_sync, + eras_synced: 0, } } @@ -277,6 +281,7 @@ where actions: Vec::new(), result: None, min_peers_to_start_warp_sync, + eras_synced: 0, } } @@ -335,6 +340,7 @@ where last_hash: self.client.info().genesis_hash, warp_sync_provider: Arc::clone(warp_sync_provider), }; + self.eras_synced = 0; trace!(target: LOG_TARGET, "Started warp sync with {} peers.", self.peers.len()); } @@ -430,7 +436,7 @@ where self.actions .push(SyncingAction::DropPeer(BadPeer(*peer_id, rep::BAD_WARP_PROOF))) }, - Ok(VerificationResult::Partial(new_set_id, new_authorities, new_last_hash, proofs)) => { + Ok(VerificationResult::Partial(new_set_id, new_authorities, new_last_hash, proofs, eras_verified)) => { log::debug!(target: LOG_TARGET, "Verified partial proof, set_id={:?}", new_set_id); *set_id = new_set_id; *authorities = new_authorities; @@ -440,8 +446,9 @@ where origin: BlockOrigin::NetworkInitialSync, blocks: proofs.into_iter().map(proof_to_incoming_block).collect(), }); + self.eras_synced = eras_verified; }, - Ok(VerificationResult::Complete(new_set_id, _, header, proofs)) => { + Ok(VerificationResult::Complete(new_set_id, _, header, proofs, eras_verified)) => { log::debug!( target: LOG_TARGET, "Verified complete proof, set_id={:?}. Continuing with target block download: {} ({}).", @@ -455,6 +462,7 @@ where origin: BlockOrigin::NetworkInitialSync, blocks: proofs.into_iter().map(proof_to_incoming_block).collect(), }); + self.eras_synced = eras_verified; }, } } @@ -649,18 +657,22 @@ where required_peers: self.min_peers_to_start_warp_sync, }, total_bytes: self.total_proof_bytes, + eras_synced: self.eras_synced, }, Phase::WarpProof { .. } => WarpSyncProgress { phase: WarpSyncPhase::DownloadingWarpProofs, total_bytes: self.total_proof_bytes, + eras_synced: self.eras_synced, }, Phase::TargetBlock(_) => WarpSyncProgress { phase: WarpSyncPhase::DownloadingTargetBlock, total_bytes: self.total_proof_bytes, + eras_synced: self.eras_synced, }, Phase::Complete => WarpSyncProgress { phase: WarpSyncPhase::Complete, total_bytes: self.total_proof_bytes + self.total_state_bytes, + eras_synced: self.eras_synced, }, } } From 240e3b75f3542a579c0ca3567102625499afe111 Mon Sep 17 00:00:00 2001 From: runcomet Date: Wed, 5 Nov 2025 12:35:34 +0100 Subject: [PATCH 02/19] nit + fmt --- .../consensus/grandpa/src/warp_proof.rs | 8 +- substrate/client/informant/src/display.rs | 80 ++++++++++++------- .../network/sync/src/strategy/chain_sync.rs | 2 +- .../client/network/sync/src/strategy/warp.rs | 32 +++++--- 4 files changed, 75 insertions(+), 47 deletions(-) diff --git a/substrate/client/consensus/grandpa/src/warp_proof.rs b/substrate/client/consensus/grandpa/src/warp_proof.rs index 0067ceb8ba79b..1d2bbf7e4587b 100644 --- a/substrate/client/consensus/grandpa/src/warp_proof.rs +++ b/substrate/client/consensus/grandpa/src/warp_proof.rs @@ -312,7 +312,7 @@ where .ok_or_else(|| "Empty proof".to_string())?; let (next_set_id, next_authorities) = proof.verify(set_id, authorities, &self.hard_forks).map_err(Box::new)?; - let eras_verified = proof.proofs.len() as u64; + let eras_verified = proof.proofs.len() as u64; let justifications = proof .proofs .into_iter() @@ -323,7 +323,7 @@ where }) .collect::>(); - //let eras_verified = proof.proofs.len() as u64; + //let eras_verified = proof.proofs.len() as u64; if proof.is_finished { Ok(VerificationResult::::Complete( @@ -331,7 +331,7 @@ where next_authorities, last_header, justifications, - eras_verified, + eras_verified, )) } else { Ok(VerificationResult::::Partial( @@ -339,7 +339,7 @@ where next_authorities, last_header.hash(), justifications, - eras_verified, + eras_verified, )) } } diff --git a/substrate/client/informant/src/display.rs b/substrate/client/informant/src/display.rs index 73d670bf40a95..6188f909c0b76 100644 --- a/substrate/client/informant/src/display.rs +++ b/substrate/client/informant/src/display.rs @@ -90,9 +90,10 @@ impl InformantDisplay { } else { (diff_bytes_inbound, diff_bytes_outbound) }; + // let warp_sync = sync_status.warp_sync.clone(); let (level, status, target) = - match (sync_status.state, sync_status.state_sync, sync_status.warp_sync) { + match (sync_status.state, sync_status.state_sync, sync_status.warp_sync.clone()) { // Do not set status to "Block history" when we are doing a major sync. // // A node could for example have been warp synced to the tip of the chain and @@ -105,20 +106,20 @@ impl InformantDisplay { ) if !sync_status.is_major_syncing() => ("⏩", "Block history".into(), format!(", #{}", n)), // Handle all phases besides the two phases we already handle above. (_, _, Some(warp)) - if !matches!(warp.phase, WarpSyncPhase::DownloadingBlocks(_)) => - { - let progress_text = if warp.eras_synced > 0 { - format!(", {} eras synced, {:.2} Mib", warp.eras_synced, (warp.total_bytes as f32) / (1024f32 * 1024f32)) - } else { - format!(", {:.2} Mib", (warp.total_bytes as f32) / (1024f32 * 1024f32)) - }; - - ( - "⏩", - "Warping".into(), - progress_text, - ) - }, + if !matches!(warp.phase, WarpSyncPhase::DownloadingBlocks(_)) => + { + let progress_text = if warp.eras_synced > 0 { + format!( + ", {} eras synced, {:.2} Mib", + warp.eras_synced, + (warp.total_bytes as f32) / (1024f32 * 1024f32) + ) + } else { + format!(", {:.2} Mib", (warp.total_bytes as f32) / (1024f32 * 1024f32)) + }; + + ("⏩", "Warping".into(), progress_text) + }, (_, Some(state), _) => ( "⚙️ ", "State sync".into(), @@ -136,20 +137,41 @@ impl InformantDisplay { ("⚙️ ", format!("Preparing{}", speed), format!(", target=#{target}")), }; - info!( - target: "substrate", - "{} {}{} ({} peers), best: #{} ({}), finalized #{} ({}), ⬇ {} ⬆ {}", - level, - style(&status).white().bold(), - target, - style(num_connected_peers).white().bold(), - style(best_number).white().bold(), - PrintFullHashOnDebugLogging(&best_hash), - style(finalized_number).white().bold(), - PrintFullHashOnDebugLogging(&info.chain.finalized_hash), - style(TransferRateFormat(avg_bytes_per_sec_inbound)).green(), - style(TransferRateFormat(avg_bytes_per_sec_outbound)).red(), - ) + let (show_best_block, show_finalized_block) = match sync_status.warp_sync { + Some(warp) if !matches!(warp.phase, WarpSyncPhase::DownloadingBlocks(_)) => + (false, false), + _ => (true, true), + }; + + if show_best_block && show_finalized_block { + // Show full log with best/finalized blocks + info!( + target: "substrate", + "{} {}{} ({} peers), best: #{} ({}), finalized #{} ({}), ⬇ {} ⬆ {}", + level, + style(&status).white().bold(), + target, + style(num_connected_peers).white().bold(), + style(best_number).white().bold(), + PrintFullHashOnDebugLogging(&best_hash), + style(finalized_number).white().bold(), + PrintFullHashOnDebugLogging(&info.chain.finalized_hash), + style(TransferRateFormat(avg_bytes_per_sec_inbound)).green(), + style(TransferRateFormat(avg_bytes_per_sec_outbound)).red(), + ) + } else { + // Simplified log for warp sync without best/finalized blocks + info!( + target: "substrate", + "{} {}{} ({} peers), ⬇ {} ⬆ {}", + level, + style(&status).white().bold(), + target, + style(num_connected_peers).white().bold(), + style(TransferRateFormat(avg_bytes_per_sec_inbound)).green(), + style(TransferRateFormat(avg_bytes_per_sec_outbound)).red(), + ) + } } } diff --git a/substrate/client/network/sync/src/strategy/chain_sync.rs b/substrate/client/network/sync/src/strategy/chain_sync.rs index 6fad491a420e2..a2ed2512f70dd 100644 --- a/substrate/client/network/sync/src/strategy/chain_sync.rs +++ b/substrate/client/network/sync/src/strategy/chain_sync.rs @@ -839,7 +839,7 @@ where let warp_sync_progress = self.gap_sync.as_ref().map(|gap_sync| WarpSyncProgress { phase: WarpSyncPhase::DownloadingBlocks(gap_sync.best_queued_number), total_bytes: 0, - eras_synced: 0, + eras_synced: 0, }); SyncStatus { diff --git a/substrate/client/network/sync/src/strategy/warp.rs b/substrate/client/network/sync/src/strategy/warp.rs index a29af5d683018..4cb145e0db265 100644 --- a/substrate/client/network/sync/src/strategy/warp.rs +++ b/substrate/client/network/sync/src/strategy/warp.rs @@ -151,8 +151,8 @@ pub struct WarpSyncProgress { pub phase: WarpSyncPhase, /// Total bytes downloaded so far. pub total_bytes: u64, - /// Number of eras that have been verified and synced. - pub eras_synced: u64, + /// Number of eras that have been verified and synced. + pub eras_synced: u64, } /// Warp sync configuration as accepted by [`WarpSync`]. @@ -219,7 +219,7 @@ pub struct WarpSync { result: Option>, /// Number of peers that need to be connected before warp sync is started. min_peers_to_start_warp_sync: usize, - eras_synced: u64, + eras_synced: u64, } impl WarpSync @@ -259,7 +259,7 @@ where actions: vec![SyncingAction::Finished], result: None, min_peers_to_start_warp_sync, - eras_synced: 0, + eras_synced: 0, } } @@ -281,7 +281,7 @@ where actions: Vec::new(), result: None, min_peers_to_start_warp_sync, - eras_synced: 0, + eras_synced: 0, } } @@ -340,7 +340,7 @@ where last_hash: self.client.info().genesis_hash, warp_sync_provider: Arc::clone(warp_sync_provider), }; - self.eras_synced = 0; + self.eras_synced = 0; trace!(target: LOG_TARGET, "Started warp sync with {} peers.", self.peers.len()); } @@ -436,7 +436,13 @@ where self.actions .push(SyncingAction::DropPeer(BadPeer(*peer_id, rep::BAD_WARP_PROOF))) }, - Ok(VerificationResult::Partial(new_set_id, new_authorities, new_last_hash, proofs, eras_verified)) => { + Ok(VerificationResult::Partial( + new_set_id, + new_authorities, + new_last_hash, + proofs, + eras_verified, + )) => { log::debug!(target: LOG_TARGET, "Verified partial proof, set_id={:?}", new_set_id); *set_id = new_set_id; *authorities = new_authorities; @@ -446,7 +452,7 @@ where origin: BlockOrigin::NetworkInitialSync, blocks: proofs.into_iter().map(proof_to_incoming_block).collect(), }); - self.eras_synced = eras_verified; + self.eras_synced = eras_verified; }, Ok(VerificationResult::Complete(new_set_id, _, header, proofs, eras_verified)) => { log::debug!( @@ -462,7 +468,7 @@ where origin: BlockOrigin::NetworkInitialSync, blocks: proofs.into_iter().map(proof_to_incoming_block).collect(), }); - self.eras_synced = eras_verified; + self.eras_synced = eras_verified; }, } } @@ -657,22 +663,22 @@ where required_peers: self.min_peers_to_start_warp_sync, }, total_bytes: self.total_proof_bytes, - eras_synced: self.eras_synced, + eras_synced: self.eras_synced, }, Phase::WarpProof { .. } => WarpSyncProgress { phase: WarpSyncPhase::DownloadingWarpProofs, total_bytes: self.total_proof_bytes, - eras_synced: self.eras_synced, + eras_synced: self.eras_synced, }, Phase::TargetBlock(_) => WarpSyncProgress { phase: WarpSyncPhase::DownloadingTargetBlock, total_bytes: self.total_proof_bytes, - eras_synced: self.eras_synced, + eras_synced: self.eras_synced, }, Phase::Complete => WarpSyncProgress { phase: WarpSyncPhase::Complete, total_bytes: self.total_proof_bytes + self.total_state_bytes, - eras_synced: self.eras_synced, + eras_synced: self.eras_synced, }, } } From e1f24c4ab8ec1b7df94e34eea0d587becd9147cc Mon Sep 17 00:00:00 2001 From: runcomet Date: Wed, 5 Nov 2025 13:00:51 +0100 Subject: [PATCH 03/19] add pr_doc --- prdoc/pr_10196.prdoc | 16 ++++++++++++++++ .../client/consensus/grandpa/src/warp_proof.rs | 2 -- 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 prdoc/pr_10196.prdoc diff --git a/prdoc/pr_10196.prdoc b/prdoc/pr_10196.prdoc new file mode 100644 index 0000000000000..16aeccf9fb8a7 --- /dev/null +++ b/prdoc/pr_10196.prdoc @@ -0,0 +1,16 @@ +title: Improve Warp Sync Logging +doc: +- audience: Node Operator + description: |- + Enhanced warp sync logging to provide more meaningful progress indicators by: + - Tracking and displaying the number of eras synced during warp sync + - Hiding irrelevant best/finalized block information during warp proof phase + - Showing simplified logs with era count and data transfer metrics + +crates: +- name: sc-consensus-grandpa + bump: minor +- name: sc-informant + bump: minor +- name: sc-network-sync + bump: major diff --git a/substrate/client/consensus/grandpa/src/warp_proof.rs b/substrate/client/consensus/grandpa/src/warp_proof.rs index 1d2bbf7e4587b..72a8f85b3305d 100644 --- a/substrate/client/consensus/grandpa/src/warp_proof.rs +++ b/substrate/client/consensus/grandpa/src/warp_proof.rs @@ -323,8 +323,6 @@ where }) .collect::>(); - //let eras_verified = proof.proofs.len() as u64; - if proof.is_finished { Ok(VerificationResult::::Complete( next_set_id, From 70ff44adba47e0c4386a138900154224cb7a2c52 Mon Sep 17 00:00:00 2001 From: runcomet Date: Wed, 5 Nov 2025 13:45:08 +0100 Subject: [PATCH 04/19] tests fix --- .../client/network/sync/src/strategy/warp.rs | 50 ++++++++++++++++--- substrate/client/network/test/src/lib.rs | 8 ++- 2 files changed, 51 insertions(+), 7 deletions(-) diff --git a/substrate/client/network/sync/src/strategy/warp.rs b/substrate/client/network/sync/src/strategy/warp.rs index 4cb145e0db265..fdbe898ad3899 100644 --- a/substrate/client/network/sync/src/strategy/warp.rs +++ b/substrate/client/network/sync/src/strategy/warp.rs @@ -1303,6 +1303,7 @@ mod test { authorities, target_header.hash(), vec![(target_header, justifications)], + Default::default(), )) }); } @@ -1387,6 +1388,7 @@ mod test { authorities, target_header.clone(), vec![(target_header, justifications)], + Default::default(), )) }); } @@ -1492,7 +1494,13 @@ mod test { let target_header = target_block.header().clone(); // Warp proof is complete. provider.expect_verify().return_once(move |_proof, set_id, authorities| { - Ok(VerificationResult::Complete(set_id, authorities, target_header, Default::default())) + Ok(VerificationResult::Complete( + set_id, + authorities, + target_header, + Default::default(), + Default::default(), + )) }); let config = WarpSyncConfig::WithProvider(Arc::new(provider)); let mut warp_sync = @@ -1566,7 +1574,13 @@ mod test { let target_header = target_block.header().clone(); // Warp proof is complete. provider.expect_verify().return_once(move |_proof, set_id, authorities| { - Ok(VerificationResult::Complete(set_id, authorities, target_header, Default::default())) + Ok(VerificationResult::Complete( + set_id, + authorities, + target_header, + Default::default(), + Default::default(), + )) }); let config = WarpSyncConfig::WithProvider(Arc::new(provider)); let mut warp_sync = @@ -1605,7 +1619,13 @@ mod test { let target_header = target_block.header().clone(); // Warp proof is complete. provider.expect_verify().return_once(move |_proof, set_id, authorities| { - Ok(VerificationResult::Complete(set_id, authorities, target_header, Default::default())) + Ok(VerificationResult::Complete( + set_id, + authorities, + target_header, + Default::default(), + Default::default(), + )) }); let config = WarpSyncConfig::WithProvider(Arc::new(provider)); let mut warp_sync = @@ -1660,7 +1680,13 @@ mod test { let target_header = target_block.header().clone(); // Warp proof is complete. provider.expect_verify().return_once(move |_proof, set_id, authorities| { - Ok(VerificationResult::Complete(set_id, authorities, target_header, Default::default())) + Ok(VerificationResult::Complete( + set_id, + authorities, + target_header, + Default::default(), + Default::default(), + )) }); let config = WarpSyncConfig::WithProvider(Arc::new(provider)); let mut warp_sync = @@ -1738,7 +1764,13 @@ mod test { let target_header = target_block.header().clone(); // Warp proof is complete. provider.expect_verify().return_once(move |_proof, set_id, authorities| { - Ok(VerificationResult::Complete(set_id, authorities, target_header, Default::default())) + Ok(VerificationResult::Complete( + set_id, + authorities, + target_header, + Default::default(), + Default::default(), + )) }); let config = WarpSyncConfig::WithProvider(Arc::new(provider)); let mut warp_sync = @@ -1792,7 +1824,13 @@ mod test { let target_header = target_block.header().clone(); // Warp proof is complete. provider.expect_verify().return_once(move |_proof, set_id, authorities| { - Ok(VerificationResult::Complete(set_id, authorities, target_header, Default::default())) + Ok(VerificationResult::Complete( + set_id, + authorities, + target_header, + Default::default(), + Default::default(), + )) }); let config = WarpSyncConfig::WithProvider(Arc::new(provider)); let mut warp_sync = diff --git a/substrate/client/network/test/src/lib.rs b/substrate/client/network/test/src/lib.rs index 79a0a42138bf7..511378cfca1db 100644 --- a/substrate/client/network/test/src/lib.rs +++ b/substrate/client/network/test/src/lib.rs @@ -673,7 +673,13 @@ impl WarpSyncProvider for TestWarpSyncProvider { ) -> Result, Box> { let EncodedProof(encoded) = proof; let header = B::Header::decode(&mut encoded.as_slice()).unwrap(); - Ok(VerificationResult::Complete(0, Default::default(), header, Default::default())) + Ok(VerificationResult::Complete( + 0, + Default::default(), + header, + Default::default(), + Default::default(), + )) } fn current_authorities(&self) -> AuthorityList { Default::default() From 2113d76c70f2f9f11547f5517bbe8ce788131c47 Mon Sep 17 00:00:00 2001 From: runcomet Date: Fri, 5 Dec 2025 07:54:23 +0100 Subject: [PATCH 05/19] nit --- substrate/client/informant/src/display.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/substrate/client/informant/src/display.rs b/substrate/client/informant/src/display.rs index 6188f909c0b76..715b080ff2b55 100644 --- a/substrate/client/informant/src/display.rs +++ b/substrate/client/informant/src/display.rs @@ -90,7 +90,6 @@ impl InformantDisplay { } else { (diff_bytes_inbound, diff_bytes_outbound) }; - // let warp_sync = sync_status.warp_sync.clone(); let (level, status, target) = match (sync_status.state, sync_status.state_sync, sync_status.warp_sync.clone()) { From facc56989fe41183430f8a9b73c613d6e9bc2361 Mon Sep 17 00:00:00 2001 From: runcomet Date: Thu, 18 Dec 2025 12:43:51 +0100 Subject: [PATCH 06/19] single bool --- substrate/client/informant/src/display.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/substrate/client/informant/src/display.rs b/substrate/client/informant/src/display.rs index 715b080ff2b55..02d17629725ff 100644 --- a/substrate/client/informant/src/display.rs +++ b/substrate/client/informant/src/display.rs @@ -136,13 +136,12 @@ impl InformantDisplay { ("⚙️ ", format!("Preparing{}", speed), format!(", target=#{target}")), }; - let (show_best_block, show_finalized_block) = match sync_status.warp_sync { - Some(warp) if !matches!(warp.phase, WarpSyncPhase::DownloadingBlocks(_)) => - (false, false), - _ => (true, true), + let show_block_info = match sync_status.warp_sync { + Some(warp) if !matches!(warp.phase, WarpSyncPhase::DownloadingBlocks(_)) => false, + _ => true, }; - if show_best_block && show_finalized_block { + if show_block_info { // Show full log with best/finalized blocks info!( target: "substrate", From f87d563eabd606d7d541c10a57245841c8475b37 Mon Sep 17 00:00:00 2001 From: runcomet Date: Thu, 18 Dec 2025 18:45:34 +0100 Subject: [PATCH 07/19] nit --- .../consensus/grandpa/src/warp_proof.rs | 13 +++++--- substrate/client/informant/src/display.rs | 14 +++----- .../network/sync/src/strategy/chain_sync.rs | 2 +- .../client/network/sync/src/strategy/warp.rs | 32 ++++++------------- 4 files changed, 24 insertions(+), 37 deletions(-) diff --git a/substrate/client/consensus/grandpa/src/warp_proof.rs b/substrate/client/consensus/grandpa/src/warp_proof.rs index 5aa8516f2135b..9c3f6a1667375 100644 --- a/substrate/client/consensus/grandpa/src/warp_proof.rs +++ b/substrate/client/consensus/grandpa/src/warp_proof.rs @@ -34,6 +34,7 @@ use sp_runtime::{ traits::{Block as BlockT, Header as HeaderT, NumberFor, One}, Justifications, }; +use sp_arithmetic::traits::Zero; use std::{collections::HashMap, sync::Arc}; @@ -291,7 +292,7 @@ struct VerifierState { struct GrandpaVerifier { state: VerifierState, hard_forks: HashMap<(Block::Hash, NumberFor), (SetId, AuthorityList)>, - eras_synced: u64, + eras_synced: u64, } impl Verifier for GrandpaVerifier @@ -324,6 +325,9 @@ where next_proof_context: last_header.hash(), }; + // Track eras synced + self.eras_synced += proof.proofs.len() as u64; + let justifications = proof .proofs .into_iter() @@ -333,9 +337,6 @@ where (p.header, justifications) }) .collect::>(); - - // Track eras synced - self.eras_synced += proof.proofs.len() as u64; if proof.is_finished { Ok(VerificationResult::Complete(last_header, justifications)) @@ -348,7 +349,8 @@ where self.state.next_proof_context } - fn status_text(&self) -> Option { + + fn status(&self) -> Option { if self.eras_synced > 0 { Some(format!("{} eras synced", self.eras_synced)) } else { @@ -385,6 +387,7 @@ where next_proof_context: genesis_hash, }, hard_forks: self.hard_forks.clone(), + eras_synced: Zero::zero(), }) } } diff --git a/substrate/client/informant/src/display.rs b/substrate/client/informant/src/display.rs index 02d17629725ff..cf3057ef1ffa0 100644 --- a/substrate/client/informant/src/display.rs +++ b/substrate/client/informant/src/display.rs @@ -107,15 +107,11 @@ impl InformantDisplay { (_, _, Some(warp)) if !matches!(warp.phase, WarpSyncPhase::DownloadingBlocks(_)) => { - let progress_text = if warp.eras_synced > 0 { - format!( - ", {} eras synced, {:.2} Mib", - warp.eras_synced, - (warp.total_bytes as f32) / (1024f32 * 1024f32) - ) - } else { - format!(", {:.2} Mib", (warp.total_bytes as f32) / (1024f32 * 1024f32)) - }; + let mut progress_text = format!(", {:.2} Mib", (warp.total_bytes as f32) / (1024f32 * 1024f32)); + + if let Some(ref status) = warp.status { + progress_text = format!("{}, {}", status, progress_text); + } ("⏩", "Warping".into(), progress_text) }, diff --git a/substrate/client/network/sync/src/strategy/chain_sync.rs b/substrate/client/network/sync/src/strategy/chain_sync.rs index a2ed2512f70dd..6f8b8595542e8 100644 --- a/substrate/client/network/sync/src/strategy/chain_sync.rs +++ b/substrate/client/network/sync/src/strategy/chain_sync.rs @@ -839,7 +839,7 @@ where let warp_sync_progress = self.gap_sync.as_ref().map(|gap_sync| WarpSyncProgress { phase: WarpSyncPhase::DownloadingBlocks(gap_sync.best_queued_number), total_bytes: 0, - eras_synced: 0, + status: None, }); SyncStatus { diff --git a/substrate/client/network/sync/src/strategy/warp.rs b/substrate/client/network/sync/src/strategy/warp.rs index 231744a801689..cecb94e783ed6 100644 --- a/substrate/client/network/sync/src/strategy/warp.rs +++ b/substrate/client/network/sync/src/strategy/warp.rs @@ -68,6 +68,8 @@ pub trait Verifier: Send + Sync { ) -> Result, Box>; /// Hash to be used as the starting point for the next proof request. fn next_proof_context(&self) -> Block::Hash; + /// Get status text for progress reporting + fn status(&self) -> Option; } /// Proof verification result. @@ -153,10 +155,8 @@ pub struct WarpSyncProgress { pub phase: WarpSyncPhase, /// Total bytes downloaded so far. pub total_bytes: u64, - /// Number of eras that have been verified and synced. - pub eras_synced: u64, - /// Optional status text from the verifier. - pub status_text: Option, + /// Optional status text from the verifier. + pub status: Option, } /// Warp sync configuration as accepted by [`WarpSync`]. @@ -217,7 +217,6 @@ pub struct WarpSync { result: Option>, /// Number of peers that need to be connected before warp sync is started. min_peers_to_start_warp_sync: usize, - eras_synced: u64, } impl WarpSync @@ -258,7 +257,6 @@ where actions: vec![SyncingAction::Finished], result: None, min_peers_to_start_warp_sync, - eras_synced: 0, } } @@ -279,7 +277,6 @@ where actions: Vec::new(), result: None, min_peers_to_start_warp_sync, - eras_synced: 0, } } @@ -434,11 +431,6 @@ where origin: BlockOrigin::NetworkInitialSync, blocks: proofs.into_iter().map(proof_to_incoming_block).collect(), }); - // Get status text from verifier to update eras_synced if available - if let Some(status_text) = verifier.status_text() { - // TODO: Parse eras synced from status text - self.eras_synced += 1; - } }, Ok(VerificationResult::Complete(header, proofs)) => { debug!( @@ -453,11 +445,6 @@ where origin: BlockOrigin::NetworkInitialSync, blocks: proofs.into_iter().map(proof_to_incoming_block).collect(), }); - // Get final status from verifier - if let Some(status_text) = verifier.status_text() { - // TODO: Parse eras synced from status text - self.eras_synced += 1; - } }, } } @@ -652,22 +639,22 @@ where required_peers: self.min_peers_to_start_warp_sync, }, total_bytes: self.total_proof_bytes, - eras_synced: self.eras_synced, + status: None, }, - Phase::WarpProof { .. } => WarpSyncProgress { + Phase::WarpProof { verifier } => WarpSyncProgress { phase: WarpSyncPhase::DownloadingWarpProofs, total_bytes: self.total_proof_bytes, - eras_synced: self.eras_synced, + status: verifier.status(), }, Phase::TargetBlock(_) => WarpSyncProgress { phase: WarpSyncPhase::DownloadingTargetBlock, total_bytes: self.total_proof_bytes, - eras_synced: self.eras_synced, + status: None, }, Phase::Complete => WarpSyncProgress { phase: WarpSyncPhase::Complete, total_bytes: self.total_proof_bytes + self.total_state_bytes, - eras_synced: self.eras_synced, + status: None, }, } } @@ -829,6 +816,7 @@ mod test { proof: &EncodedProof, ) -> Result, Box>; fn next_proof_context(&self) -> B::Hash; + fn status_text(&self) -> Option; } } From 5b806d90176e00149e264b8f844a2e6c7614254b Mon Sep 17 00:00:00 2001 From: runcomet Date: Thu, 18 Dec 2025 20:06:45 +0100 Subject: [PATCH 08/19] fix test --- substrate/client/network/test/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/substrate/client/network/test/src/lib.rs b/substrate/client/network/test/src/lib.rs index 92bb62ad58a24..a7fdf5407b31e 100644 --- a/substrate/client/network/test/src/lib.rs +++ b/substrate/client/network/test/src/lib.rs @@ -673,6 +673,10 @@ impl WarpVerifier for TestVerifier { fn next_proof_context(&self) -> B::Hash { self.genesis_hash } + + fn status_text(&self) -> Option { + None + } } impl WarpSyncProvider for TestWarpSyncProvider { From dfbf659d977faba472021c236818d919966cb0b4 Mon Sep 17 00:00:00 2001 From: runcomet Date: Thu, 18 Dec 2025 20:23:07 +0100 Subject: [PATCH 09/19] status --- substrate/client/network/test/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/client/network/test/src/lib.rs b/substrate/client/network/test/src/lib.rs index a7fdf5407b31e..8de13c8328ca6 100644 --- a/substrate/client/network/test/src/lib.rs +++ b/substrate/client/network/test/src/lib.rs @@ -674,7 +674,7 @@ impl WarpVerifier for TestVerifier { self.genesis_hash } - fn status_text(&self) -> Option { + fn status(&self) -> Option { None } } From da0f238225fb82187e0db7b8ebe223da50b87969 Mon Sep 17 00:00:00 2001 From: runcomet Date: Thu, 18 Dec 2025 20:53:22 +0100 Subject: [PATCH 10/19] warp.rs status --- substrate/client/network/sync/src/strategy/warp.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/client/network/sync/src/strategy/warp.rs b/substrate/client/network/sync/src/strategy/warp.rs index cecb94e783ed6..398220226f471 100644 --- a/substrate/client/network/sync/src/strategy/warp.rs +++ b/substrate/client/network/sync/src/strategy/warp.rs @@ -816,7 +816,7 @@ mod test { proof: &EncodedProof, ) -> Result, Box>; fn next_proof_context(&self) -> B::Hash; - fn status_text(&self) -> Option; + fn status(&self) -> Option; } } From 07cf1291f6f680976216794093f1f358213931bf Mon Sep 17 00:00:00 2001 From: runcomet Date: Fri, 19 Dec 2025 20:23:43 +0100 Subject: [PATCH 11/19] fmt --- .../consensus/grandpa/src/warp_proof.rs | 25 +++++++++---------- substrate/client/informant/src/display.rs | 9 ++++--- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/substrate/client/consensus/grandpa/src/warp_proof.rs b/substrate/client/consensus/grandpa/src/warp_proof.rs index 9c3f6a1667375..ca16f5bd44f87 100644 --- a/substrate/client/consensus/grandpa/src/warp_proof.rs +++ b/substrate/client/consensus/grandpa/src/warp_proof.rs @@ -27,6 +27,7 @@ use sc_client_api::Backend as ClientBackend; use sc_network_sync::strategy::warp::{ EncodedProof, VerificationResult, Verifier, WarpSyncProvider, }; +use sp_arithmetic::traits::Zero; use sp_blockchain::{Backend as BlockchainBackend, HeaderBackend}; use sp_consensus_grandpa::{AuthorityList, SetId, GRANDPA_ENGINE_ID}; use sp_runtime::{ @@ -34,7 +35,6 @@ use sp_runtime::{ traits::{Block as BlockT, Header as HeaderT, NumberFor, One}, Justifications, }; -use sp_arithmetic::traits::Zero; use std::{collections::HashMap, sync::Arc}; @@ -292,7 +292,7 @@ struct VerifierState { struct GrandpaVerifier { state: VerifierState, hard_forks: HashMap<(Block::Hash, NumberFor), (SetId, AuthorityList)>, - eras_synced: u64, + eras_synced: u64, } impl Verifier for GrandpaVerifier @@ -325,8 +325,8 @@ where next_proof_context: last_header.hash(), }; - // Track eras synced - self.eras_synced += proof.proofs.len() as u64; + // Track eras synced + self.eras_synced += proof.proofs.len() as u64; let justifications = proof .proofs @@ -349,14 +349,13 @@ where self.state.next_proof_context } - - fn status(&self) -> Option { - if self.eras_synced > 0 { - Some(format!("{} eras synced", self.eras_synced)) - } else { - None - } - } + fn status(&self) -> Option { + if self.eras_synced > 0 { + Some(format!(" {} eras synced", self.eras_synced)) + } else { + None + } + } } impl> WarpSyncProvider @@ -387,7 +386,7 @@ where next_proof_context: genesis_hash, }, hard_forks: self.hard_forks.clone(), - eras_synced: Zero::zero(), + eras_synced: Zero::zero(), }) } } diff --git a/substrate/client/informant/src/display.rs b/substrate/client/informant/src/display.rs index cf3057ef1ffa0..69e03dc494544 100644 --- a/substrate/client/informant/src/display.rs +++ b/substrate/client/informant/src/display.rs @@ -107,11 +107,12 @@ impl InformantDisplay { (_, _, Some(warp)) if !matches!(warp.phase, WarpSyncPhase::DownloadingBlocks(_)) => { - let mut progress_text = format!(", {:.2} Mib", (warp.total_bytes as f32) / (1024f32 * 1024f32)); + let mut progress_text = + format!(" {:.2} Mib", (warp.total_bytes as f32) / (1024f32 * 1024f32)); - if let Some(ref status) = warp.status { - progress_text = format!("{}, {}", status, progress_text); - } + if let Some(ref status) = warp.status { + progress_text = format!("{}, {}", status, progress_text); + } ("⏩", "Warping".into(), progress_text) }, From 8923024117477e9d7d5afb46aef8e8507771982b Mon Sep 17 00:00:00 2001 From: runcomet Date: Sat, 20 Dec 2025 05:27:57 +0100 Subject: [PATCH 12/19] fmt --- .../network/sync/src/strategy/chain_sync.rs | 2 +- .../client/network/sync/src/strategy/warp.rs | 18 +++++++++--------- substrate/client/network/test/src/lib.rs | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/substrate/client/network/sync/src/strategy/chain_sync.rs b/substrate/client/network/sync/src/strategy/chain_sync.rs index 6f8b8595542e8..b7e962c5e3bcd 100644 --- a/substrate/client/network/sync/src/strategy/chain_sync.rs +++ b/substrate/client/network/sync/src/strategy/chain_sync.rs @@ -839,7 +839,7 @@ where let warp_sync_progress = self.gap_sync.as_ref().map(|gap_sync| WarpSyncProgress { phase: WarpSyncPhase::DownloadingBlocks(gap_sync.best_queued_number), total_bytes: 0, - status: None, + status: None, }); SyncStatus { diff --git a/substrate/client/network/sync/src/strategy/warp.rs b/substrate/client/network/sync/src/strategy/warp.rs index 398220226f471..668f173198990 100644 --- a/substrate/client/network/sync/src/strategy/warp.rs +++ b/substrate/client/network/sync/src/strategy/warp.rs @@ -68,8 +68,8 @@ pub trait Verifier: Send + Sync { ) -> Result, Box>; /// Hash to be used as the starting point for the next proof request. fn next_proof_context(&self) -> Block::Hash; - /// Get status text for progress reporting - fn status(&self) -> Option; + /// Get status text for progress reporting + fn status(&self) -> Option; } /// Proof verification result. @@ -155,8 +155,8 @@ pub struct WarpSyncProgress { pub phase: WarpSyncPhase, /// Total bytes downloaded so far. pub total_bytes: u64, - /// Optional status text from the verifier. - pub status: Option, + /// Optional status text from the verifier. + pub status: Option, } /// Warp sync configuration as accepted by [`WarpSync`]. @@ -639,22 +639,22 @@ where required_peers: self.min_peers_to_start_warp_sync, }, total_bytes: self.total_proof_bytes, - status: None, + status: None, }, Phase::WarpProof { verifier } => WarpSyncProgress { phase: WarpSyncPhase::DownloadingWarpProofs, total_bytes: self.total_proof_bytes, - status: verifier.status(), + status: verifier.status(), }, Phase::TargetBlock(_) => WarpSyncProgress { phase: WarpSyncPhase::DownloadingTargetBlock, total_bytes: self.total_proof_bytes, - status: None, + status: None, }, Phase::Complete => WarpSyncProgress { phase: WarpSyncPhase::Complete, total_bytes: self.total_proof_bytes + self.total_state_bytes, - status: None, + status: None, }, } } @@ -816,7 +816,7 @@ mod test { proof: &EncodedProof, ) -> Result, Box>; fn next_proof_context(&self) -> B::Hash; - fn status(&self) -> Option; + fn status(&self) -> Option; } } diff --git a/substrate/client/network/test/src/lib.rs b/substrate/client/network/test/src/lib.rs index 8de13c8328ca6..3cdf3bea2811d 100644 --- a/substrate/client/network/test/src/lib.rs +++ b/substrate/client/network/test/src/lib.rs @@ -674,9 +674,9 @@ impl WarpVerifier for TestVerifier { self.genesis_hash } - fn status(&self) -> Option { - None - } + fn status(&self) -> Option { + None + } } impl WarpSyncProvider for TestWarpSyncProvider { From 9b6d6c29261f7a531760a0a0c62d1d1ea3eb27bb Mon Sep 17 00:00:00 2001 From: runcomet Date: Sun, 21 Dec 2025 19:00:14 +0100 Subject: [PATCH 13/19] fmt --- substrate/client/consensus/grandpa/src/warp_proof.rs | 2 +- substrate/client/informant/src/display.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/substrate/client/consensus/grandpa/src/warp_proof.rs b/substrate/client/consensus/grandpa/src/warp_proof.rs index ca16f5bd44f87..1eebc3a40480c 100644 --- a/substrate/client/consensus/grandpa/src/warp_proof.rs +++ b/substrate/client/consensus/grandpa/src/warp_proof.rs @@ -351,7 +351,7 @@ where fn status(&self) -> Option { if self.eras_synced > 0 { - Some(format!(" {} eras synced", self.eras_synced)) + Some(format!("{} eras synced", self.eras_synced)) } else { None } diff --git a/substrate/client/informant/src/display.rs b/substrate/client/informant/src/display.rs index 69e03dc494544..2dc83accc102e 100644 --- a/substrate/client/informant/src/display.rs +++ b/substrate/client/informant/src/display.rs @@ -107,12 +107,12 @@ impl InformantDisplay { (_, _, Some(warp)) if !matches!(warp.phase, WarpSyncPhase::DownloadingBlocks(_)) => { - let mut progress_text = - format!(" {:.2} Mib", (warp.total_bytes as f32) / (1024f32 * 1024f32)); - - if let Some(ref status) = warp.status { - progress_text = format!("{}, {}", status, progress_text); - } + let total_mib = (warp.total_bytes as f32) / (1024f32 * 1024f32); + let progress_text = if let Some(ref status) = warp.status { + format!(" {}, {:.2} Mib", status, total_mib) + } else { + format!(" {:.2} Mib", total_mib) + }; ("⏩", "Warping".into(), progress_text) }, From 6cfd28bb73d81b141ddae2596b728e6d27759331 Mon Sep 17 00:00:00 2001 From: runcomet Date: Thu, 1 Jan 2026 23:46:35 +0100 Subject: [PATCH 14/19] remove Zero trait import MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- substrate/client/consensus/grandpa/src/warp_proof.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/substrate/client/consensus/grandpa/src/warp_proof.rs b/substrate/client/consensus/grandpa/src/warp_proof.rs index 1eebc3a40480c..2cb8fa5181ca2 100644 --- a/substrate/client/consensus/grandpa/src/warp_proof.rs +++ b/substrate/client/consensus/grandpa/src/warp_proof.rs @@ -27,7 +27,6 @@ use sc_client_api::Backend as ClientBackend; use sc_network_sync::strategy::warp::{ EncodedProof, VerificationResult, Verifier, WarpSyncProvider, }; -use sp_arithmetic::traits::Zero; use sp_blockchain::{Backend as BlockchainBackend, HeaderBackend}; use sp_consensus_grandpa::{AuthorityList, SetId, GRANDPA_ENGINE_ID}; use sp_runtime::{ From 650aa8cb18479d9cc3fae8b275d801ba42ffa037 Mon Sep 17 00:00:00 2001 From: runcomet Date: Thu, 1 Jan 2026 23:47:14 +0100 Subject: [PATCH 15/19] hardcode 0 eras_synced MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- substrate/client/consensus/grandpa/src/warp_proof.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/client/consensus/grandpa/src/warp_proof.rs b/substrate/client/consensus/grandpa/src/warp_proof.rs index 2cb8fa5181ca2..024117c7bd8df 100644 --- a/substrate/client/consensus/grandpa/src/warp_proof.rs +++ b/substrate/client/consensus/grandpa/src/warp_proof.rs @@ -385,7 +385,7 @@ where next_proof_context: genesis_hash, }, hard_forks: self.hard_forks.clone(), - eras_synced: Zero::zero(), + eras_synced: 0, }) } } From e0902a2537109819a8724274e4bf42132ed8f0b4 Mon Sep 17 00:00:00 2001 From: runcomet Date: Thu, 1 Jan 2026 23:47:49 +0100 Subject: [PATCH 16/19] improve format construction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- substrate/client/informant/src/display.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/client/informant/src/display.rs b/substrate/client/informant/src/display.rs index 2dc83accc102e..b32149882da41 100644 --- a/substrate/client/informant/src/display.rs +++ b/substrate/client/informant/src/display.rs @@ -109,7 +109,7 @@ impl InformantDisplay { { let total_mib = (warp.total_bytes as f32) / (1024f32 * 1024f32); let progress_text = if let Some(ref status) = warp.status { - format!(" {}, {:.2} Mib", status, total_mib) + format!(" {status}, {total_mib:.2} Mib") } else { format!(" {:.2} Mib", total_mib) }; From c2aefde759e5c41542302c9a7755c6d9009cf353 Mon Sep 17 00:00:00 2001 From: runcomet Date: Thu, 1 Jan 2026 23:48:09 +0100 Subject: [PATCH 17/19] improve format construction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- substrate/client/informant/src/display.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/client/informant/src/display.rs b/substrate/client/informant/src/display.rs index b32149882da41..2517e20f8d65d 100644 --- a/substrate/client/informant/src/display.rs +++ b/substrate/client/informant/src/display.rs @@ -111,7 +111,7 @@ impl InformantDisplay { let progress_text = if let Some(ref status) = warp.status { format!(" {status}, {total_mib:.2} Mib") } else { - format!(" {:.2} Mib", total_mib) + format!(" {total_mib:.2} Mib") }; ("⏩", "Warping".into(), progress_text) From e67c7cadc6e803848d802203a0cd0e2de7ce021f Mon Sep 17 00:00:00 2001 From: runcomet Date: Fri, 2 Jan 2026 07:07:34 +0100 Subject: [PATCH 18/19] change prdoc --- prdoc/pr_10196.prdoc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/prdoc/pr_10196.prdoc b/prdoc/pr_10196.prdoc index 16aeccf9fb8a7..c1f159dc13e95 100644 --- a/prdoc/pr_10196.prdoc +++ b/prdoc/pr_10196.prdoc @@ -2,10 +2,8 @@ title: Improve Warp Sync Logging doc: - audience: Node Operator description: |- - Enhanced warp sync logging to provide more meaningful progress indicators by: - - Tracking and displaying the number of eras synced during warp sync - - Hiding irrelevant best/finalized block information during warp proof phase - - Showing simplified logs with era count and data transfer metrics + This updates makes warp sync logs more useful. it shows a clear count of synced eras and removes + unnecessary block details during the proof phase, giving a better view of progress. crates: - name: sc-consensus-grandpa From 09ab3627641ed0179d33c67b5087c8dd4f22419e Mon Sep 17 00:00:00 2001 From: runcomet Date: Mon, 5 Jan 2026 11:32:05 +0100 Subject: [PATCH 19/19] nit --- prdoc/pr_10196.prdoc | 2 +- substrate/client/consensus/grandpa/src/warp_proof.rs | 6 +----- substrate/client/informant/src/display.rs | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/prdoc/pr_10196.prdoc b/prdoc/pr_10196.prdoc index c1f159dc13e95..e1754c83085fb 100644 --- a/prdoc/pr_10196.prdoc +++ b/prdoc/pr_10196.prdoc @@ -2,7 +2,7 @@ title: Improve Warp Sync Logging doc: - audience: Node Operator description: |- - This updates makes warp sync logs more useful. it shows a clear count of synced eras and removes + This update makes warp sync logs more useful. it shows a clear count of synced eras and removes unnecessary block details during the proof phase, giving a better view of progress. crates: diff --git a/substrate/client/consensus/grandpa/src/warp_proof.rs b/substrate/client/consensus/grandpa/src/warp_proof.rs index 024117c7bd8df..04505af45670f 100644 --- a/substrate/client/consensus/grandpa/src/warp_proof.rs +++ b/substrate/client/consensus/grandpa/src/warp_proof.rs @@ -349,11 +349,7 @@ where } fn status(&self) -> Option { - if self.eras_synced > 0 { - Some(format!("{} eras synced", self.eras_synced)) - } else { - None - } + Some(format!("{} eras synced", self.eras_synced)) } } diff --git a/substrate/client/informant/src/display.rs b/substrate/client/informant/src/display.rs index 2517e20f8d65d..384c3132d3036 100644 --- a/substrate/client/informant/src/display.rs +++ b/substrate/client/informant/src/display.rs @@ -109,7 +109,7 @@ impl InformantDisplay { { let total_mib = (warp.total_bytes as f32) / (1024f32 * 1024f32); let progress_text = if let Some(ref status) = warp.status { - format!(" {status}, {total_mib:.2} Mib") + format!(", {status}, {total_mib:.2} Mib") } else { format!(" {total_mib:.2} Mib") }; @@ -134,7 +134,7 @@ impl InformantDisplay { }; let show_block_info = match sync_status.warp_sync { - Some(warp) if !matches!(warp.phase, WarpSyncPhase::DownloadingBlocks(_)) => false, + Some(warp) => matches!(warp.phase, WarpSyncPhase::DownloadingBlocks(_)), _ => true, };