Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Grandpa warp sync request-response protocol (#7711)
Browse files Browse the repository at this point in the history
* Made a start

* So the proof between authority set is phragmen one, this is crazy big,
or is there some signing of the result : that is the storage key, damn?

* ok getting from header digest seems doable.

* for testing

* get set id from storage directly (should use runtime to handler change).

* move test to init

* correct auth key

* fix iteration

* Correct proof content

* actually update block number.

* actually check last justif against its header

* justification relation to new authorities through header hash check is
needed here. This assumes the hash from header is calculated.

* Few changes

* Connected up cheme's branch

* Clean up

* Move things around a bit so that adding the grandpa warp sync request response protocol happens in the node code

* Nits

* Changes to comments

* Cheme changes

* Remove todos and test compile.

* Rename _authority_ related proof function to _warp_sync_ .

* Update client/grandpa-warp-sync/src/lib.rs

quick fix

* Put the warp sync request response protocol behind a feature flag because we dont' need it on a light client.

* Update client/grandpa-warp-sync/src/lib.rs

Quick fix

* Update Cargo.lock

* Adding test, comment on limitation related to 'delay', this could
be implemented but with a cost.

* Set between a delay override last fragment.

* Check for pending authority set change at start.

* adjust index

* custom cache is not a good idea.

* Use a simple cache instead.

* restore broken indentation

* Address crate rename

* Merge conflict badly resolved, sorry

Co-authored-by: cheme <[email protected]>
Co-authored-by: Pierre Krieger <[email protected]>
  • Loading branch information
3 people authored Jan 21, 2021
1 parent d9e56ef commit 4b687df
Show file tree
Hide file tree
Showing 12 changed files with 770 additions and 33 deletions.
87 changes: 70 additions & 17 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ members = [
"client/executor/wasmi",
"client/executor/wasmtime",
"client/finality-grandpa",
"client/finality-grandpa-warp-sync",
"client/informant",
"client/keystore",
"client/light",
Expand Down
2 changes: 2 additions & 0 deletions bin/node/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ sc-service = { version = "0.8.0", default-features = false, path = "../../../cli
sc-tracing = { version = "2.0.0", path = "../../../client/tracing" }
sc-telemetry = { version = "2.0.0", path = "../../../client/telemetry" }
sc-authority-discovery = { version = "0.8.0", path = "../../../client/authority-discovery" }
sc-finality-grandpa-warp-sync = { version = "0.8.0", path = "../../../client/finality-grandpa-warp-sync", optional = true }

# frame dependencies
pallet-indices = { version = "2.0.0", path = "../../../frame/indices" }
Expand Down Expand Up @@ -151,6 +152,7 @@ cli = [
"frame-benchmarking-cli",
"substrate-frame-cli",
"sc-service/db",
"sc-finality-grandpa-warp-sync",
"structopt",
"substrate-build-script-utils",
]
Expand Down
5 changes: 5 additions & 0 deletions bin/node/cli/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ pub fn new_full_base(

config.network.extra_sets.push(grandpa::grandpa_peers_set_config());

#[cfg(feature = "cli")]
config.network.request_response_protocols.push(sc_finality_grandpa_warp_sync::request_response_config_for_chain(
&config, task_manager.spawn_handle(), backend.clone(),
));

let (network, network_status_sinks, system_rpc_tx, network_starter) =
sc_service::build_network(sc_service::BuildNetworkParams {
config: &config,
Expand Down
28 changes: 28 additions & 0 deletions client/finality-grandpa-warp-sync/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[package]
description = "A request-response protocol for handling grandpa warp sync requests"
name = "sc-finality-grandpa-warp-sync"
version = "0.8.0"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
authors = ["Parity Technologies <[email protected]>"]
edition = "2018"
publish = false
homepage = "https://substrate.dev"
repository = "https://github.com/paritytech/substrate/"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
sc-network = { version = "0.8.0", path = "../network" }
sc-finality-grandpa = { version = "0.8.0", path = "../finality-grandpa" }
sp-runtime = { version = "2.0.0", path = "../../primitives/runtime" }
sp-blockchain = { version = "2.0.0", path = "../../primitives/blockchain" }
sc-client-api = { version = "2.0.0", path = "../api" }
sc-service = { version = "0.8.0", path = "../service" }
futures = "0.3.8"
log = "0.4.11"
derive_more = "0.99.11"
codec = { package = "parity-scale-codec", version = "1.3.5" }
prost = "0.6.1"
num-traits = "0.2.14"
parking_lot = "0.11.1"
Loading

0 comments on commit 4b687df

Please sign in to comment.