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
9b5dc4bb
Commit
9b5dc4bb
authored
1 year ago
by
Pascal Engélibert
Browse files
Options
Downloads
Patches
Plain Diff
feat: embed distance oracle in duniter with subcommand
parent
23c25376
No related branches found
No related tags found
1 merge request
!225
embed distance oracle in duniter with subcommand
Pipeline
#35214
passed
1 year ago
Stage: labels
Stage: quality
Stage: build
Stage: tests
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Cargo.toml
+2
-2
2 additions, 2 deletions
Cargo.toml
distance-oracle/Cargo.toml
+1
-1
1 addition, 1 deletion
distance-oracle/Cargo.toml
node/src/cli.rs
+15
-0
15 additions, 0 deletions
node/src/cli.rs
node/src/command.rs
+13
-0
13 additions, 0 deletions
node/src/command.rs
with
31 additions
and
3 deletions
Cargo.toml
+
2
−
2
View file @
9b5dc4bb
...
...
@@ -18,7 +18,7 @@ name = 'duniter'
path
=
"node/src/main.rs"
[features]
default
=
[
"gdev"
]
default
=
[
"gdev"
,
"distance-oracle"
]
gdev
=
[
"gdev-runtime"
]
# gdev feature enables gdev runtime and gdev command line options
g1
=
[
"g1-runtime"
]
gtest
=
[
"gtest-runtime"
]
...
...
@@ -58,7 +58,7 @@ sp-trie = { git = "https://github.com/duniter/substrate", branch = "duniter-subs
# local dependencies
common-runtime
=
{
path
=
'runtime/common'
}
dc-distance
=
{
path
=
'client/distance'
}
distance-oracle
=
{
path
=
'distance-oracle'
,
optional
=
true
}
distance-oracle
=
{
path
=
'distance-oracle'
,
default-features
=
false
,
optional
=
true
}
g1-runtime
=
{
path
=
'runtime/g1'
,
optional
=
true
}
gdev-runtime
=
{
path
=
'runtime/gdev'
,
optional
=
true
}
gtest-runtime
=
{
path
=
'runtime/gtest'
,
optional
=
true
}
...
...
This diff is collapsed.
Click to expand it.
distance-oracle/Cargo.toml
+
1
−
1
View file @
9b5dc4bb
...
...
@@ -9,7 +9,7 @@ edition = "2021"
[dependencies]
sp-distance
=
{
path
=
"../primitives/distance"
}
codec
=
{
package
=
"parity-scale-codec"
,
version
=
"3.
1
.5"
}
codec
=
{
package
=
"parity-scale-codec"
,
version
=
"3.
6
.5"
}
fnv
=
"1.0.7"
log
=
"0.4.17"
num-traits
=
"0.2.15"
...
...
This diff is collapsed.
Click to expand it.
node/src/cli.rs
+
15
−
0
View file @
9b5dc4bb
...
...
@@ -37,6 +37,10 @@ pub enum Subcommand {
/// Validate blocks.
CheckBlock
(
sc_cli
::
CheckBlockCmd
),
/// Run distance oracle.
#[cfg(feature
=
"distance-oracle"
)]
DistanceOracle
(
DistanceOracle
),
/// Export blocks.
ExportBlocks
(
sc_cli
::
ExportBlocksCmd
),
...
...
@@ -132,3 +136,14 @@ pub struct Completion {
#[clap(short,
long,
value_enum)]
pub
generator
:
clap_complete
::
Shell
,
}
#[derive(Debug,
clap::Args)]
pub
struct
DistanceOracle
{
#[clap(short
=
'd'
,
long,
default_value
=
"/tmp/duniter/chains/gdev/distance"
)]
pub
evaluation_result_dir
:
String
,
/// Maximum depth to explore the WoT graph for referees
#[clap(short
=
'D'
,
long,
default_value
=
"5"
)]
pub
max_depth
:
u32
,
#[clap(short
=
'u'
,
long,
default_value
=
"ws://127.0.0.1:9944"
)]
pub
rpc_url
:
String
,
}
This diff is collapsed.
Click to expand it.
node/src/command.rs
+
13
−
0
View file @
9b5dc4bb
...
...
@@ -304,6 +304,19 @@ pub fn run() -> sc_cli::Result<()> {
);
Ok
(())
}
#[cfg(feature
=
"distance-oracle"
)]
Some
(
Subcommand
::
DistanceOracle
(
cmd
))
=>
sc_cli
::
build_runtime
()
?
.block_on
(
async
move
{
distance_oracle
::
run_and_save
(
&
distance_oracle
::
api
::
client
(
cmd
.rpc_url
.clone
())
.await
,
distance_oracle
::
Settings
{
evaluation_result_dir
:
cmd
.evaluation_result_dir
.clone
()
.into
(),
max_depth
:
cmd
.max_depth
,
rpc_url
:
cmd
.rpc_url
.clone
(),
},
)
.await
;
Ok
(())
}),
#[cfg(feature
=
"runtime-benchmarks"
)]
Some
(
Subcommand
::
Benchmark
(
cmd
))
=>
{
let
runner
=
cli
.create_runner
(
&**
cmd
)
?
;
...
...
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