Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
parity
Mirrored projects
polkadot-sdk
Commits
d67821a5
Commit
d67821a5
authored
6 years ago
by
André Silva
Committed by
Gav Wood
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
node: remove grandpa authority flags (#1306)
parent
a6c77e4f
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
substrate/node/cli/src/lib.rs
+1
-12
1 addition, 12 deletions
substrate/node/cli/src/lib.rs
substrate/node/cli/src/params.rs
+0
-8
0 additions, 8 deletions
substrate/node/cli/src/params.rs
substrate/node/cli/src/service.rs
+20
-36
20 additions, 36 deletions
substrate/node/cli/src/service.rs
with
21 additions
and
56 deletions
substrate/node/cli/src/lib.rs
+
1
−
12
View file @
d67821a5
...
...
@@ -120,21 +120,10 @@ pub fn run<I, T, E>(args: I, exit: E, version: cli::VersionInfo) -> error::Resul
Err
(
e
)
=>
e
.exit
(),
};
let
(
spec
,
mut
config
)
=
cli
::
parse_matches
::
<
service
::
Factory
,
_
>
(
let
(
spec
,
config
)
=
cli
::
parse_matches
::
<
service
::
Factory
,
_
>
(
load_spec
,
version
,
"substrate-node"
,
&
matches
)
?
;
if
matches
.is_present
(
"grandpa_authority_only"
)
{
config
.custom.grandpa_authority
=
true
;
config
.custom.grandpa_authority_only
=
true
;
// Authority Setup is only called if validator is set as true
config
.roles
=
ServiceRoles
::
AUTHORITY
;
}
else
if
matches
.is_present
(
"grandpa_authority"
)
{
config
.custom.grandpa_authority
=
true
;
// Authority Setup is only called if validator is set as true
config
.roles
=
ServiceRoles
::
AUTHORITY
;
}
match
cli
::
execute_default
::
<
service
::
Factory
,
_
>
(
spec
,
exit
,
&
matches
,
&
config
)
?
{
cli
::
Action
::
ExecutedInternally
=>
(),
cli
::
Action
::
RunService
(
exit
)
=>
{
...
...
This diff is collapsed.
Click to expand it.
substrate/node/cli/src/params.rs
+
0
−
8
View file @
d67821a5
...
...
@@ -20,14 +20,6 @@ use cli::CoreParams;
/// Extend params for Node
#[derive(Debug,
StructOpt)]
pub
struct
Params
{
/// Should run as a GRANDPA authority node
#[structopt(long
=
"grandpa-authority"
,
help
=
"Run Node as a GRANDPA authority, implies --validator"
)]
grandpa_authority
:
bool
,
/// Should run as a GRANDPA authority node only
#[structopt(long
=
"grandpa-authority-only"
,
help
=
"Run Node as a GRANDPA authority only, don't as a usual validator, implies --grandpa-authority"
)]
grandpa_authority_only
:
bool
,
#[structopt(flatten)]
core
:
CoreParams
}
This diff is collapsed.
Click to expand it.
substrate/node/cli/src/service.rs
+
20
−
36
View file @
d67821a5
...
...
@@ -40,12 +40,7 @@ construct_simple_protocol! {
/// Node specific configuration
pub
struct
NodeConfig
<
F
:
substrate_service
::
ServiceFactory
>
{
/// should run as a grandpa authority
pub
grandpa_authority
:
bool
,
/// should run as a grandpa authority only, don't validate as usual
pub
grandpa_authority_only
:
bool
,
/// grandpa connection to import block
// FIXME: rather than putting this on the config, let's have an actual intermediate setup state
// https://github.com/paritytech/substrate/issues/1134
pub
grandpa_import_setup
:
Option
<
(
Arc
<
grandpa
::
BlockImportForService
<
F
>>
,
grandpa
::
LinkHalfForService
<
F
>
)
>
,
...
...
@@ -54,8 +49,6 @@ pub struct NodeConfig<F: substrate_service::ServiceFactory> {
impl
<
F
>
Default
for
NodeConfig
<
F
>
where
F
:
substrate_service
::
ServiceFactory
{
fn
default
()
->
NodeConfig
<
F
>
{
NodeConfig
{
grandpa_authority
:
false
,
grandpa_authority_only
:
false
,
grandpa_import_setup
:
None
,
}
}
...
...
@@ -77,38 +70,29 @@ construct_service_factory! {
{
|
config
:
FactoryFullConfiguration
<
Self
>
,
executor
:
TaskExecutor
|
FullComponents
::
<
Factory
>
::
new
(
config
,
executor
)
},
AuthoritySetup
=
{
|
mut
service
:
Self
::
FullService
,
executor
:
TaskExecutor
,
key
:
Option
<
Arc
<
Pair
>>
|
{
|
mut
service
:
Self
::
FullService
,
executor
:
TaskExecutor
,
local_
key
:
Option
<
Arc
<
Pair
>>
|
{
let
(
block_import
,
link_half
)
=
service
.config.custom.grandpa_import_setup
.take
()
.expect
(
"Link Half and Block Import are present for Full Services or setup failed before. qed"
);
let
local_key
=
if
let
Some
(
key
)
=
key
{
if
!
service
.config.custom.grandpa_authority_only
{
info!
(
"Using authority key {}"
,
key
.public
());
let
proposer
=
Arc
::
new
(
substrate_service
::
ProposerFactory
{
client
:
service
.client
(),
transaction_pool
:
service
.transaction_pool
(),
});
let
client
=
service
.client
();
executor
.spawn
(
start_aura
(
SlotDuration
::
get_or_compute
(
&*
client
)
?
,
key
.clone
(),
client
,
block_import
.clone
(),
proposer
,
service
.network
(),
));
}
if
service
.config.custom.grandpa_authority
{
info!
(
"Running Grandpa session as Authority {}"
,
key
.public
());
Some
(
key
)
}
else
{
None
}
}
else
{
None
};
if
let
Some
(
ref
key
)
=
local_key
{
info!
(
"Using authority key {}"
,
key
.public
());
let
proposer
=
Arc
::
new
(
substrate_service
::
ProposerFactory
{
client
:
service
.client
(),
transaction_pool
:
service
.transaction_pool
(),
});
let
client
=
service
.client
();
executor
.spawn
(
start_aura
(
SlotDuration
::
get_or_compute
(
&*
client
)
?
,
key
.clone
(),
client
,
block_import
.clone
(),
proposer
,
service
.network
(),
));
info!
(
"Running Grandpa session as Authority {}"
,
key
.public
());
}
let
voter
=
grandpa
::
run_grandpa
(
grandpa
::
Config
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment