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
e1d8548e
Commit
e1d8548e
authored
1 year ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
fix(
#125
): clippy
parent
05025b28
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
node/src/chain_spec/gen_genesis_data.rs
+6
-7
6 additions, 7 deletions
node/src/chain_spec/gen_genesis_data.rs
with
6 additions
and
7 deletions
node/src/chain_spec/gen_genesis_data.rs
+
6
−
7
View file @
e1d8548e
...
@@ -83,7 +83,7 @@ pub struct GenesisData<Parameters: DeserializeOwned, SessionKeys: Decode> {
...
@@ -83,7 +83,7 @@ pub struct GenesisData<Parameters: DeserializeOwned, SessionKeys: Decode> {
}
}
#[derive(Deserialize,
Serialize)]
#[derive(Deserialize,
Serialize)]
struct
Genesis
Config
<
Parameters
>
{
struct
Genesis
Input
<
Parameters
>
{
first_ud
:
Option
<
u64
>
,
first_ud
:
Option
<
u64
>
,
first_ud_reeval
:
Option
<
u64
>
,
first_ud_reeval
:
Option
<
u64
>
,
#[serde(default)]
#[serde(default)]
...
@@ -228,7 +228,7 @@ where
...
@@ -228,7 +228,7 @@ where
{
{
let
genesis_timestamp
:
u64
=
get_genesis_timestamp
()
?
;
let
genesis_timestamp
:
u64
=
get_genesis_timestamp
()
?
;
let
Genesis
Config
{
let
Genesis
Input
{
sudo_key
,
sudo_key
,
treasury_funder
,
treasury_funder
,
first_ud
,
first_ud
,
...
@@ -238,7 +238,7 @@ where
...
@@ -238,7 +238,7 @@ where
mut
clique_smiths
,
mut
clique_smiths
,
technical_committee
,
technical_committee
,
ud
,
ud
,
}
=
get_genesis_
config
::
<
P
>
(
}
=
get_genesis_
input
::
<
P
>
(
std
::
env
::
var
(
"DUNITER_GENESIS_CONFIG"
)
.unwrap_or_else
(|
_
|
json_file_path
.to_owned
()),
std
::
env
::
var
(
"DUNITER_GENESIS_CONFIG"
)
.unwrap_or_else
(|
_
|
json_file_path
.to_owned
()),
)
?
;
)
?
;
...
@@ -855,7 +855,6 @@ where
...
@@ -855,7 +855,6 @@ where
identity_index
identity_index
.get
(
index
)
.get
(
index
)
.expect
(
"authority should have an identity"
)
.expect
(
"authority should have an identity"
)
.clone
()
);
);
});
});
...
@@ -1281,9 +1280,9 @@ fn check_parameters_consistency(
...
@@ -1281,9 +1280,9 @@ fn check_parameters_consistency(
Ok
(())
Ok
(())
}
}
fn
get_genesis_
config
<
P
:
Default
+
DeserializeOwned
>
(
fn
get_genesis_
input
<
P
:
Default
+
DeserializeOwned
>
(
json_file_path
:
String
,
json_file_path
:
String
,
)
->
Result
<
Genesis
Config
<
P
>
,
String
>
{
)
->
Result
<
Genesis
Input
<
P
>
,
String
>
{
// We mmap the file into memory first, as this is *a lot* faster than using
// We mmap the file into memory first, as this is *a lot* faster than using
// `serde_json::from_reader`. See https://github.com/serde-rs/json/issues/160
// `serde_json::from_reader`. See https://github.com/serde-rs/json/issues/160
let
file
=
std
::
fs
::
File
::
open
(
&
json_file_path
)
let
file
=
std
::
fs
::
File
::
open
(
&
json_file_path
)
...
@@ -1294,7 +1293,7 @@ fn get_genesis_config<P: Default + DeserializeOwned>(
...
@@ -1294,7 +1293,7 @@ fn get_genesis_config<P: Default + DeserializeOwned>(
memmap2
::
Mmap
::
map
(
&
file
)
memmap2
::
Mmap
::
map
(
&
file
)
.map_err
(|
e
|
format!
(
"Error mmaping gen conf file `{}`: {}"
,
json_file_path
,
e
))
?
.map_err
(|
e
|
format!
(
"Error mmaping gen conf file `{}`: {}"
,
json_file_path
,
e
))
?
};
};
serde_json
::
from_slice
::
<
Genesis
Config
<
P
>>
(
&
bytes
)
serde_json
::
from_slice
::
<
Genesis
Input
<
P
>>
(
&
bytes
)
.map_err
(|
e
|
format!
(
"Error parsing gen conf file: {}"
,
e
))
.map_err
(|
e
|
format!
(
"Error parsing gen conf file: {}"
,
e
))
}
}
...
...
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