* State sync

* Importing state fixes

* Bugfixes

* Sync with proof

* Status reporting

* Unsafe sync mode

* Sync test

* Cleanup

* Apply suggestions from code review

Co-authored-by: cheme <emericchevalier.pro@gmail.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* set_genesis_storage

* Extract keys from range proof

* Detect iter completion

* Download and import bodies with fast sync

* Replaced meta updates tuple with a struct

* Fixed reverting finalized state

* Reverted timeout

* Typo

* Doc

* Doc

* Fixed light client test

* Fixed error handling

* Tweaks

* More UpdateMeta changes

* Rename convert_transaction

* Apply suggestions from code review

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

* Apply suggestions from code review

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

* Code review suggestions

* Fixed count handling

Co-authored-by: cheme <emericchevalier.pro@gmail.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Arkadiy Paronyan
2021-06-22 11:32:43 +02:00
committed by GitHub
parent 5899eedc8c
commit 77a4b980ae
54 changed files with 2128 additions and 379 deletions
+24
View File
@@ -232,6 +232,30 @@ arg_enum! {
}
}
arg_enum! {
/// Syncing mode.
#[allow(missing_docs)]
#[derive(Debug, Clone, Copy)]
pub enum SyncMode {
// Full sync. Donwnload end verify all blocks.
Full,
// Download blocks without executing them. Download latest state with proofs.
Fast,
// Download blocks without executing them. Download latest state without proofs.
FastUnsafe,
}
}
impl Into<sc_network::config::SyncMode> for SyncMode {
fn into(self) -> sc_network::config::SyncMode {
match self {
SyncMode::Full => sc_network::config::SyncMode::Full,
SyncMode::Fast => sc_network::config::SyncMode::Fast { skip_proofs: false },
SyncMode::FastUnsafe => sc_network::config::SyncMode::Fast { skip_proofs: true },
}
}
}
/// Default value for the `--execution-syncing` parameter.
pub const DEFAULT_EXECUTION_SYNCING: ExecutionStrategy = ExecutionStrategy::NativeElseWasm;
/// Default value for the `--execution-import-block` parameter.
@@ -17,6 +17,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use crate::params::node_key_params::NodeKeyParams;
use crate::arg_enums::SyncMode;
use sc_network::{
config::{NetworkConfiguration, NodeKeyConfig, NonReservedPeerMode, SetConfig, TransportConfig},
multiaddr::Protocol,
@@ -125,6 +126,13 @@ pub struct NetworkParams {
/// Join the IPFS network and serve transactions over bitswap protocol.
#[structopt(long)]
pub ipfs_server: bool,
/// Blockchain syncing mode.
/// Full - Download and validate full blockchain history (Default).
/// Fast - Download blocks and the latest state only.
/// FastUnsafe - Same as Fast, but do skips downloading state proofs.
#[structopt(long, default_value = "Full")]
pub sync: SyncMode,
}
impl NetworkParams {
@@ -218,6 +226,7 @@ impl NetworkParams {
kademlia_disjoint_query_paths: self.kademlia_disjoint_query_paths,
yamux_window_size: None,
ipfs_server: self.ipfs_server,
sync_mode: self.sync.into(),
}
}
}