From 34c1c4b9545e7216503db2f2514c0ff5a8d7bc45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Wed, 29 Jan 2020 09:52:54 +0100 Subject: [PATCH] Don't run dev light client as validator (#4757) A light client can not be a validator, so we should not set `authority == true` in dev mode. --- substrate/client/cli/src/lib.rs | 8 +++++--- substrate/client/cli/src/params.rs | 5 ++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/substrate/client/cli/src/lib.rs b/substrate/client/cli/src/lib.rs index fc50259528..d9ea238ba0 100644 --- a/substrate/client/cli/src/lib.rs +++ b/substrate/client/cli/src/lib.rs @@ -998,9 +998,11 @@ where fill_config_keystore_password_and_path(&mut config, &cli)?; let is_dev = cli.shared_params.dev; - let is_authority = cli.validator || cli.sentry || is_dev || cli.keyring.account.is_some(); + let is_light = cli.light; + let is_authority = (cli.validator || cli.sentry || is_dev || cli.keyring.account.is_some()) + && !is_light; let role = - if cli.light { + if is_light { sc_service::Roles::LIGHT } else if is_authority { sc_service::Roles::AUTHORITY @@ -1056,7 +1058,7 @@ where config.dev_key_seed = cli.keyring.account .map(|a| format!("//{}", a)).or_else(|| { - if is_dev { + if is_dev && !is_light { Some("//Alice".into()) } else { None diff --git a/substrate/client/cli/src/params.rs b/substrate/client/cli/src/params.rs index 57b90c2e73..ccaf24454d 100644 --- a/substrate/client/cli/src/params.rs +++ b/substrate/client/cli/src/params.rs @@ -417,7 +417,10 @@ pub struct RunCmd { pub no_grandpa: bool, /// Experimental: Run in light client mode. - #[structopt(long = "light")] + #[structopt( + long = "light", + conflicts_with_all = &[ "validator" ] + )] pub light: bool, /// Listen to all RPC interfaces.