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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
rust
Duniter v2S
Commits
35eb66d9
Commit
35eb66d9
authored
9 months ago
by
Hugo Trentesaux
Browse files
Options
Downloads
Patches
Plain Diff
wip sketch endpoint gossip service
parent
f7d5ad47
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#38366
waiting for manual action
Stage: quality
Stage: build
Stage: tests
Stage: deploy
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
node/src/cli.rs
+17
-0
17 additions, 0 deletions
node/src/cli.rs
node/src/command.rs
+3
-1
3 additions, 1 deletion
node/src/command.rs
node/src/service.rs
+23
-0
23 additions, 0 deletions
node/src/service.rs
with
43 additions
and
1 deletion
node/src/cli.rs
+
17
−
0
View file @
35eb66d9
...
@@ -19,9 +19,14 @@ pub struct Cli {
...
@@ -19,9 +19,14 @@ pub struct Cli {
#[clap(subcommand)]
#[clap(subcommand)]
pub
subcommand
:
Option
<
Subcommand
>
,
pub
subcommand
:
Option
<
Subcommand
>
,
/// substrate base options
#[clap(flatten)]
#[clap(flatten)]
pub
run
:
sc_cli
::
RunCmd
,
pub
run
:
sc_cli
::
RunCmd
,
/// duniter specific options
#[clap(flatten)]
pub
duniter_options
:
DuniterConfigExtension
,
/// How blocks should be sealed
/// How blocks should be sealed
///
///
/// Options are "production", "instant", "manual", or timer interval in milliseconds
/// Options are "production", "instant", "manual", or timer interval in milliseconds
...
@@ -29,6 +34,18 @@ pub struct Cli {
...
@@ -29,6 +34,18 @@ pub struct Cli {
pub
sealing
:
crate
::
cli
::
Sealing
,
pub
sealing
:
crate
::
cli
::
Sealing
,
}
}
/// add options specific to duniter client
#[derive(Debug,
Clone,
clap::Parser)]
pub
struct
DuniterConfigExtension
{
/// Public RPC endpoint to gossip on the network and make available in the apps.
#[arg(long)]
pub
public_rpc
:
Option
<
String
>
,
/// Public Squid graphql endpoint to gossip on the network and make available in the apps.
#[arg(long)]
pub
public_squid
:
Option
<
String
>
,
}
#[derive(Debug,
clap::Subcommand)]
#[derive(Debug,
clap::Subcommand)]
pub
enum
Subcommand
{
pub
enum
Subcommand
{
/// Build a chain specification.
/// Build a chain specification.
...
...
This diff is collapsed.
Click to expand it.
node/src/command.rs
+
3
−
1
View file @
35eb66d9
...
@@ -364,6 +364,8 @@ pub fn run() -> sc_cli::Result<()> {
...
@@ -364,6 +364,8 @@ pub fn run() -> sc_cli::Result<()> {
}
}
None
=>
{
None
=>
{
let
runner
=
cli
.create_runner
(
&
cli
.run
)
?
;
let
runner
=
cli
.create_runner
(
&
cli
.run
)
?
;
// TODO add endpoint config here
let
config_extension
:
DuniterConfigExtension
=
();
runner
.run_node_until_exit
(|
mut
config
|
async
move
{
runner
.run_node_until_exit
(|
mut
config
|
async
move
{
// Force offchain worker and offchain indexing if we have the role Authority
// Force offchain worker and offchain indexing if we have the role Authority
if
config
.role
.is_authority
()
{
if
config
.role
.is_authority
()
{
...
@@ -376,7 +378,7 @@ pub fn run() -> sc_cli::Result<()> {
...
@@ -376,7 +378,7 @@ pub fn run() -> sc_cli::Result<()> {
service
::
runtime_executor
::
runtime
::
RuntimeApi
,
service
::
runtime_executor
::
runtime
::
RuntimeApi
,
Executor
,
Executor
,
sc_network
::
Litep2pNetworkBackend
,
sc_network
::
Litep2pNetworkBackend
,
>
(
config
,
cli
.sealing
)
>
(
config
,
cli
.sealing
,
config_extension
)
.map_err
(
sc_cli
::
Error
::
Service
)
.map_err
(
sc_cli
::
Error
::
Service
)
}
}
})
})
...
...
This diff is collapsed.
Click to expand it.
node/src/service.rs
+
23
−
0
View file @
35eb66d9
...
@@ -147,6 +147,7 @@ type FullGrandpaBlockImport<RuntimeApi, Executor> = sc_consensus_grandpa::Grandp
...
@@ -147,6 +147,7 @@ type FullGrandpaBlockImport<RuntimeApi, Executor> = sc_consensus_grandpa::Grandp
pub
fn
new_partial
<
RuntimeApi
,
Executor
>
(
pub
fn
new_partial
<
RuntimeApi
,
Executor
>
(
config
:
&
Configuration
,
config
:
&
Configuration
,
consensus_manual
:
bool
,
consensus_manual
:
bool
,
config_extension
:
DuniterConfigExtension
,
)
->
Result
<
)
->
Result
<
sc_service
::
PartialComponents
<
sc_service
::
PartialComponents
<
FullClient
<
RuntimeApi
,
Executor
>
,
FullClient
<
RuntimeApi
,
Executor
>
,
...
@@ -348,6 +349,28 @@ where
...
@@ -348,6 +349,28 @@ where
);
);
net_config
.add_notification_protocol
(
grandpa_protocol_config
);
net_config
.add_notification_protocol
(
grandpa_protocol_config
);
// endpoint gossip
// only active for non-authority (to save workload)
if
!
role
.is_authority
()
{
// configure protocol
let
(
endpoint_gossip_protocol_config
,
endpoint_gossip_notification_service
)
=
((),
());
net_config
.add_notification_protocol
(
endpoint_gossip_protocol_config
);
let
endpoint_gossip_config
=
();
let
endpoint_gossip_params
=
EndpointGossipParams
{
config
:
endpoint_gossip_config
,
network
,
notification_service
:
endpoint_gossip_notification_service
,
// offchain storage
offchain_endpoint_tester
:
(),
};
// spawn task
task_manager
.spawn_handle
()
.spawn
(
"endpoint-gossip"
,
None
,
run_gossip_worker
(
endpoint_gossip_params
)
?
,
);
}
let
warp_sync
=
Arc
::
new
(
sc_consensus_grandpa
::
warp_proof
::
NetworkProvider
::
new
(
let
warp_sync
=
Arc
::
new
(
sc_consensus_grandpa
::
warp_proof
::
NetworkProvider
::
new
(
backend
.clone
(),
backend
.clone
(),
grandpa_link
.shared_authority_set
()
.clone
(),
grandpa_link
.shared_authority_set
()
.clone
(),
...
...
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