Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Duniter v2S
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
nodes
rust
Duniter v2S
Commits
ded25e75
Commit
ded25e75
authored
3 years ago
by
Éloïs
Browse files
Options
Downloads
Patches
Plain Diff
feat(gdev): create local chain spec
parent
26f4cc13
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!28
Smiths sub-wot
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
node/src/chain_spec/gdev.rs
+48
-0
48 additions, 0 deletions
node/src/chain_spec/gdev.rs
node/src/command.rs
+27
-4
27 additions, 4 deletions
node/src/command.rs
with
75 additions
and
4 deletions
node/src/chain_spec/gdev.rs
+
48
−
0
View file @
ded25e75
...
...
@@ -101,6 +101,54 @@ pub fn development_chain_spec() -> Result<ChainSpec, String> {
))
}
pub
fn
local_testnet_config
(
initial_authorities_len
:
usize
,
initial_smiths_len
:
usize
,
initial_identities_len
:
usize
,
)
->
Result
<
ChainSpec
,
String
>
{
let
wasm_binary
=
WASM_BINARY
.ok_or_else
(||
"wasm not available"
.to_string
())
?
;
Ok
(
ChainSpec
::
from_genesis
(
// Name
"Ğdev Local Testnet"
,
// ID
"gdev_local_testnet"
,
ChainType
::
Local
,
move
||
{
gen_genesis_conf
(
wasm_binary
,
// Initial authorities len
initial_authorities_len
,
// Initial smiths len,
initial_smiths_len
,
// Initial identities len
initial_identities_len
,
// Sudo account
get_account_id_from_seed
::
<
sr25519
::
Public
>
(
"Alice"
),
true
,
)
},
// Bootnodes
vec!
[],
// Telemetry
None
,
// Protocol ID
None
,
// Properties
Some
(
serde_json
::
json!
({
"tokenDecimals"
:
TOKEN_DECIMALS
,
"tokenSymbol"
:
TOKEN_SYMBOL
,
})
.as_object
()
.expect
(
"must be a map"
)
.clone
(),
),
// Extensions
None
,
))
}
fn
gen_genesis_conf
(
wasm_binary
:
&
[
u8
],
initial_authorities_len
:
usize
,
...
...
This diff is collapsed.
Click to expand it.
node/src/command.rs
+
27
−
4
View file @
ded25e75
...
...
@@ -54,15 +54,38 @@ impl SubstrateCli for Cli {
fn
load_spec
(
&
self
,
id
:
&
str
)
->
Result
<
Box
<
dyn
sc_service
::
ChainSpec
>
,
String
>
{
Ok
(
match
id
{
#[cfg(feature
=
"gdev"
)]
"dev"
|
"gdev"
=>
Box
::
new
(
chain_spec
::
gdev
::
development_chain_spec
()
?
),
"dev"
=>
Box
::
new
(
chain_spec
::
gdev
::
development_chain_spec
()
?
),
#[cfg(feature
=
"gdev"
)]
"local"
=>
Box
::
new
(
chain_spec
::
gdev
::
local_testnet_config
(
1
,
3
,
4
)
?
),
#[cfg(feature
=
"gdev"
)]
"local2"
=>
Box
::
new
(
chain_spec
::
gdev
::
local_testnet_config
(
2
,
3
,
4
)
?
),
#[cfg(feature
=
"gdev"
)]
"local3"
=>
Box
::
new
(
chain_spec
::
gdev
::
local_testnet_config
(
3
,
3
,
4
)
?
),
#[cfg(feature
=
"gdev"
)]
"local4"
=>
Box
::
new
(
chain_spec
::
gdev
::
local_testnet_config
(
4
,
4
,
5
)
?
),
#[cfg(feature
=
"gdev"
)]
"gdev"
=>
{
unimplemented!
()
//Box::new(chain_spec::gdev::ChainSpec::from_json_file(file_path)?)
}
#[cfg(feature
=
"gtest"
)]
"gtest_dev"
=>
Box
::
new
(
chain_spec
::
gtest
::
development_chain_spec
()
?
),
#[cfg(feature
=
"gtest"
)]
"local"
|
"gtest_local"
=>
Box
::
new
(
chain_spec
::
gtest
::
local_testnet_config
(
2
,
3
)
?
),
"gtest_local"
=>
Box
::
new
(
chain_spec
::
gtest
::
local_testnet_config
(
2
,
3
)
?
),
#[cfg(feature
=
"gtest"
)]
"gtest_local3"
=>
Box
::
new
(
chain_spec
::
gtest
::
local_testnet_config
(
3
,
4
)
?
),
#[cfg(feature
=
"gtest"
)]
"local3"
|
"gtest_local
3
"
=>
Box
::
new
(
chain_spec
::
gtest
::
local_testnet_config
(
3
,
4
)
?
),
"gtest_local
4
"
=>
Box
::
new
(
chain_spec
::
gtest
::
local_testnet_config
(
4
,
5
)
?
),
#[cfg(feature
=
"gtest"
)]
"local4"
|
"gtest_local4"
=>
Box
::
new
(
chain_spec
::
gtest
::
local_testnet_config
(
4
,
5
)
?
),
"gtest"
=>
{
unimplemented!
()
//Box::new(chain_spec::gtest::ChainSpec::from_json_file(file_path)?)
}
#[cfg(feature
=
"g1"
)]
"g1"
=>
{
unimplemented!
()
//Box::new(chain_spec::g1::ChainSpec::from_json_file(file_path)?)
}
// Specs provided as json specify which runtime to use in their file name. For example,
// `g1-custom.json` uses the g1 runtime.
// `gdev-workshop.json` uses the gdev runtime.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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