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
ddc6d5d5
Commit
ddc6d5d5
authored
4 years ago
by
André Silva
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
cli: set default ss58 address format for each chain (#1127)
parent
b01ee6eb
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
polkadot/cli/src/command.rs
+30
-7
30 additions, 7 deletions
polkadot/cli/src/command.rs
with
30 additions
and
7 deletions
polkadot/cli/src/command.rs
+
30
−
7
View file @
ddc6d5d5
...
...
@@ -63,10 +63,27 @@ impl SubstrateCli for Cli {
pub
fn
run
()
->
Result
<
()
>
{
let
cli
=
Cli
::
from_args
();
fn
set_default_ss58_version
(
spec
:
&
Box
<
dyn
service
::
ChainSpec
>
)
{
use
sp_core
::
crypto
::
Ss58AddressFormat
;
let
ss58_version
=
if
spec
.is_kusama
()
{
Ss58AddressFormat
::
KusamaAccount
}
else
if
spec
.is_westend
()
{
Ss58AddressFormat
::
SubstrateAccount
}
else
{
Ss58AddressFormat
::
PolkadotAccount
};
sp_core
::
crypto
::
set_default_ss58_version
(
ss58_version
);
};
match
&
cli
.subcommand
{
None
=>
{
let
runtime
=
cli
.create_runner
(
&
cli
.run.base
)
?
;
let
config
=
runtime
.config
();
let
chain_spec
=
&
runtime
.config
()
.chain_spec
;
set_default_ss58_version
(
chain_spec
);
let
authority_discovery_enabled
=
cli
.run.authority_discovery_enabled
;
let
grandpa_pause
=
if
cli
.run.grandpa_pause
.is_empty
()
{
None
...
...
@@ -74,7 +91,7 @@ pub fn run() -> Result<()> {
Some
((
cli
.run.grandpa_pause
[
0
],
cli
.run.grandpa_pause
[
1
]))
};
if
config
.
chain_spec
.is_kusama
()
{
if
chain_spec
.is_kusama
()
{
info!
(
"----------------------------"
);
info!
(
"This chain is not in any way"
);
info!
(
" endorsed by the "
);
...
...
@@ -97,7 +114,7 @@ pub fn run() -> Result<()> {
},
service
::
KusamaExecutor
::
native_version
()
.runtime_version
)
}
else
if
config
.
chain_spec
.is_westend
()
{
}
else
if
chain_spec
.is_westend
()
{
runtime
.run_node
(
|
config
|
{
service
::
westend_new_light
(
config
)
...
...
@@ -135,8 +152,11 @@ pub fn run() -> Result<()> {
},
Some
(
Subcommand
::
Base
(
subcommand
))
=>
{
let
runtime
=
cli
.create_runner
(
subcommand
)
?
;
let
chain_spec
=
&
runtime
.config
()
.chain_spec
;
set_default_ss58_version
(
chain_spec
);
if
runtime
.config
()
.
chain_spec
.is_kusama
()
{
if
chain_spec
.is_kusama
()
{
runtime
.run_subcommand
(
subcommand
,
|
config
|
service
::
new_chain_ops
::
<
service
::
kusama_runtime
::
RuntimeApi
,
...
...
@@ -144,7 +164,7 @@ pub fn run() -> Result<()> {
service
::
kusama_runtime
::
UncheckedExtrinsic
,
>
(
config
)
)
}
else
if
runtime
.config
()
.
chain_spec
.is_westend
()
{
}
else
if
chain_spec
.is_westend
()
{
runtime
.run_subcommand
(
subcommand
,
|
config
|
service
::
new_chain_ops
::
<
service
::
westend_runtime
::
RuntimeApi
,
...
...
@@ -175,12 +195,15 @@ pub fn run() -> Result<()> {
},
Some
(
Subcommand
::
Benchmark
(
cmd
))
=>
{
let
runtime
=
cli
.create_runner
(
cmd
)
?
;
let
chain_spec
=
&
runtime
.config
()
.chain_spec
;
set_default_ss58_version
(
chain_spec
);
if
runtime
.config
()
.
chain_spec
.is_kusama
()
{
if
chain_spec
.is_kusama
()
{
runtime
.sync_run
(|
config
|
{
cmd
.run
::
<
service
::
kusama_runtime
::
Block
,
service
::
KusamaExecutor
>
(
config
)
})
}
else
if
runtime
.config
()
.
chain_spec
.is_westend
()
{
}
else
if
chain_spec
.is_westend
()
{
runtime
.sync_run
(|
config
|
{
cmd
.run
::
<
service
::
westend_runtime
::
Block
,
service
::
WestendExecutor
>
(
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