Warp sync part II (#9284)

* Gap sync

* Gap epoch test

* Simplified network requests

* Update client/db/src/utils.rs

Co-authored-by: cheme <emericchevalier.pro@gmail.com>

* Fixed v1 migration and added some comments

* Next epoch is always regular

* Removed fork tree change

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Added a comment and converted assert to error

Co-authored-by: cheme <emericchevalier.pro@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Arkadiy Paronyan
2021-10-07 11:31:39 +02:00
committed by GitHub
parent 9f1c3acb7d
commit e6ff531d0b
29 changed files with 800 additions and 169 deletions
+9 -3
View File
@@ -20,7 +20,7 @@ use crate::OutputFormat;
use ansi_term::Colour;
use log::info;
use sc_client_api::ClientInfo;
use sc_network::{NetworkStatus, SyncState};
use sc_network::{NetworkStatus, SyncState, WarpSyncPhase, WarpSyncProgress};
use sp_runtime::traits::{Block as BlockT, CheckedDiv, NumberFor, Saturating, Zero};
use std::{
convert::{TryFrom, TryInto},
@@ -97,11 +97,17 @@ impl<B: BlockT> InformantDisplay<B> {
net_status.state_sync,
net_status.warp_sync,
) {
(
_,
_,
_,
Some(WarpSyncProgress { phase: WarpSyncPhase::DownloadingBlocks(n), .. }),
) => ("", "Block history".into(), format!(", #{}", n)),
(_, _, _, Some(warp)) => (
"",
"Warping".into(),
format!(
", {}, ({:.2}) Mib",
", {}, {:.2} Mib",
warp.phase,
(warp.total_bytes as f32) / (1024f32 * 1024f32)
),
@@ -110,7 +116,7 @@ impl<B: BlockT> InformantDisplay<B> {
"⚙️ ",
"Downloading state".into(),
format!(
", {}%, ({:.2}) Mib",
", {}%, {:.2} Mib",
state.percentage,
(state.size as f32) / (1024f32 * 1024f32)
),