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

Commit

Permalink
Add BEEFY capabilities to Westend and Kusama (#7591)
Browse files Browse the repository at this point in the history
* runtime: add BEEFY and MMR to Westend

Signed-off-by: Adrian Catangiu <adrian@parity.io>

* runtime: add BEEFY and MMR to Kusama

Signed-off-by: Adrian Catangiu <adrian@parity.io>

* node/service: enable BEEFY for Westend and Kusama

Signed-off-by: Adrian Catangiu <adrian@parity.io>

* node/service: regenerate genesis keys for westend-native and kusama-native

Since these keys are only used for development/local chains, also publish
the secret seeds used to generate the public keys, so that developers can
recover/generate the private key pairs if needed.

Signed-off-by: Adrian Catangiu <adrian@parity.io>

* runtime: add session keys migration to add BEEFY to Westend and Kusama

* runtime: fix migration

* fix try-runtime build

* cargo fmt

* fix parachains slashing benchmark

* address review comments

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <git@kchr.de>

* runtime: fix session keys migration

---------

Signed-off-by: Adrian Catangiu <adrian@parity.io>
Co-authored-by: parity-processbot <>
Co-authored-by: Bastian Köcher <git@kchr.de>
  • Loading branch information
acatangiu and bkchr committed Aug 22, 2023
1 parent 0bbe0a7 commit e39c003
Show file tree
Hide file tree
Showing 14 changed files with 638 additions and 247 deletions.
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,8 @@ where
.map_err(Error::from)?;
let chain_spec = &runner.config().chain_spec;

// By default, enable BEEFY on test networks.
let enable_beefy = (chain_spec.is_rococo() || chain_spec.is_wococo() || chain_spec.is_versi()) &&
!cli.run.no_beefy;
// By default, enable BEEFY on all networks except Polkadot (for now).
let enable_beefy = !chain_spec.is_polkadot() && !cli.run.no_beefy;

set_default_ss58_version(chain_spec);

Expand Down
339 changes: 188 additions & 151 deletions node/service/src/chain_spec.rs

Large diffs are not rendered by default.

18 changes: 7 additions & 11 deletions node/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,13 +753,9 @@ pub fn new_full<OverseerGenerator: OverseerGen>(
Some(backoff)
};

// If not on a known test network, warn the user that BEEFY is still experimental.
if enable_beefy &&
!config.chain_spec.is_rococo() &&
!config.chain_spec.is_wococo() &&
!config.chain_spec.is_versi()
{
gum::warn!("BEEFY is still experimental, usage on a production network is discouraged.");
// Warn the user that BEEFY is still experimental for Polkadot.
if enable_beefy && config.chain_spec.is_polkadot() {
gum::warn!("BEEFY is still experimental, usage on Polkadot network is discouraged.");
}

let disable_grandpa = config.disable_grandpa;
Expand Down Expand Up @@ -1204,14 +1200,14 @@ pub fn new_full<OverseerGenerator: OverseerGen>(

let gadget = beefy::start_beefy_gadget::<_, _, _, _, _, _, _>(beefy_params);

// BEEFY currently only runs on testnets, if it fails we'll
// bring the node down with it to make sure it is noticed.
// BEEFY is part of consensus, if it fails we'll bring the node down with it to make sure it
// is noticed.
task_manager
.spawn_essential_handle()
.spawn_blocking("beefy-gadget", None, gadget);

// When offchain indexing is enabled, MMR gadget should also run.
if is_offchain_indexing_enabled {
task_manager.spawn_handle().spawn_blocking(
task_manager.spawn_essential_handle().spawn_blocking(
"mmr-gadget",
None,
MmrGadget::start(
Expand Down
12 changes: 12 additions & 0 deletions runtime/kusama/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ smallvec = "1.8.0"
authority-discovery-primitives = { package = "sp-authority-discovery", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
babe-primitives = { package = "sp-consensus-babe", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
beefy-primitives = { package = "sp-consensus-beefy", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
binary-merkle-tree = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
kusama-runtime-constants = { package = "kusama-runtime-constants", path = "./constants", default-features = false }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
inherents = { package = "sp-inherents", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
offchain-primitives = { package = "sp-offchain", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-std = { package = "sp-std", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
Expand All @@ -42,6 +44,8 @@ pallet-authorship = { git = "https://github.com/paritytech/substrate", branch =
pallet-babe = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-bags-list = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-beefy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-beefy-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-bounties = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-child-bounties = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
Expand All @@ -61,6 +65,7 @@ pallet-im-online = { git = "https://github.com/paritytech/substrate", branch = "
pallet-indices = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-membership = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-message-queue = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-multisig = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-nomination-pools = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-offences = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
Expand Down Expand Up @@ -144,6 +149,8 @@ std = [
"pallet-authorship/std",
"pallet-bags-list/std",
"pallet-balances/std",
"pallet-beefy/std",
"pallet-beefy-mmr/std",
"pallet-bounties/std",
"pallet-child-bounties/std",
"pallet-transaction-payment/std",
Expand All @@ -161,6 +168,7 @@ std = [
"pallet-indices/std",
"pallet-membership/std",
"pallet-message-queue/std",
"pallet-mmr/std",
"pallet-multisig/std",
"pallet-nomination-pools/std",
"pallet-nomination-pools-runtime-api/std",
Expand All @@ -184,6 +192,7 @@ std = [
"pallet-whitelist/std",
"pallet-babe/std",
"pallet-xcm/std",
"sp-application-crypto/std",
"sp-mmr-primitives/std",
"sp-runtime/std",
"sp-staking/std",
Expand Down Expand Up @@ -265,6 +274,8 @@ try-runtime = [
"pallet-authorship/try-runtime",
"pallet-bags-list/try-runtime",
"pallet-balances/try-runtime",
"pallet-beefy/try-runtime",
"pallet-beefy-mmr/try-runtime",
"pallet-bounties/try-runtime",
"pallet-child-bounties/try-runtime",
"pallet-transaction-payment/try-runtime",
Expand All @@ -281,6 +292,7 @@ try-runtime = [
"pallet-indices/try-runtime",
"pallet-membership/try-runtime",
"pallet-message-queue/try-runtime",
"pallet-mmr/try-runtime",
"pallet-multisig/try-runtime",
"pallet-nomination-pools/try-runtime",
"pallet-offences/try-runtime",
Expand Down
Loading

0 comments on commit e39c003

Please sign in to comment.