Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cellframe-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
20
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
cellframe
cellframe-sdk
Commits
136b7a60
Commit
136b7a60
authored
1 year ago
by
Roman Khlopkov
🔜
Browse files
Options
Downloads
Patches
Plain Diff
[*] Consensus directives support on conditional compilation
parent
1d6d322b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#37920
canceled with stage
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/consensus/esbocs/dap_chain_cs_esbocs.c
+13
-0
13 additions, 0 deletions
modules/consensus/esbocs/dap_chain_cs_esbocs.c
modules/consensus/esbocs/include/dap_chain_cs_esbocs.h
+1
-0
1 addition, 0 deletions
modules/consensus/esbocs/include/dap_chain_cs_esbocs.h
with
14 additions
and
0 deletions
modules/consensus/esbocs/dap_chain_cs_esbocs.c
+
13
−
0
View file @
136b7a60
...
...
@@ -482,6 +482,8 @@ static int s_callback_created(dap_chain_t *a_chain, dap_config_t *a_chain_net_cf
l_session
->
my_addr
.
uint64
=
dap_chain_net_get_cur_addr_int
(
l_net
);
l_session
->
my_signing_addr
=
l_my_signing_addr
;
// TODO make correct link management w/o global DB cluster
#ifdef DAP_CHAIN_CS_ESBOCS_DIRECTIVE_SUPPORT
char
*
l_sync_group
=
s_get_penalty_group
(
l_net
->
pub
.
id
);
l_session
->
db_cluster
=
dap_global_db_cluster_add
(
dap_global_db_instance_get_default
(),
NULL
,
dap_guuid_compose
(
l_net
->
pub
.
id
.
uint64
,
DAP_CHAIN_CLUSTER_ID_ESBOCS
),
...
...
@@ -489,6 +491,7 @@ static int s_callback_created(dap_chain_t *a_chain, dap_config_t *a_chain_net_cf
DAP_GDB_MEMBER_ROLE_NOBODY
,
DAP_CLUSTER_ROLE_AUTONOMIC
);
DAP_DELETE
(
l_sync_group
);
dap_global_db_cluster_add_notify_callback
(
l_session
->
db_cluster
,
s_db_change_notifier
,
l_session
);
#endif
dap_link_manager_add_net_associate
(
l_net
->
pub
.
id
.
uint64
,
l_session
->
db_cluster
->
links_cluster
);
for
(
dap_list_t
*
it
=
l_validators
;
it
;
it
=
it
->
next
)
{
...
...
@@ -1158,8 +1161,10 @@ static void s_session_state_change(dap_chain_esbocs_session_t *a_session, enum s
a_session
->
cur_round
.
attempt_submit_validator
=
l_validator
->
signing_addr
;
if
(
dap_chain_addr_compare
(
&
a_session
->
cur_round
.
attempt_submit_validator
,
&
a_session
->
my_signing_addr
))
{
dap_chain_esbocs_directive_t
*
l_directive
=
NULL
;
#ifdef DAP_CHAIN_CS_ESBOCS_DIRECTIVE_SUPPORT
if
(
!
a_session
->
cur_round
.
directive
&&
!
PVT
(
a_session
->
esbocs
)
->
emergency_mode
)
l_directive
=
s_session_directive_ready
(
a_session
);
#endif
if
(
l_directive
)
{
dap_hash_fast_t
l_directive_hash
;
dap_hash_fast
(
l_directive
,
l_directive
->
size
,
&
l_directive_hash
);
...
...
@@ -2301,6 +2306,10 @@ static void s_session_packet_in(dap_chain_esbocs_session_t *a_session, dap_chain
}
break
;
case
DAP_CHAIN_ESBOCS_MSG_TYPE_DIRECTIVE
:
{
#ifndef DAP_CHAIN_CS_ESBOCS_DIRECTIVE_SUPPORT
debug_if
(
l_cs_debug
,
L_MSG
,
"Directive processing is disabled"
);
break
;
#endif
if
(
l_session
->
cur_round
.
directive
)
{
log_it
(
L_WARNING
,
"Only one directive can be processed by round"
);
break
;
...
...
@@ -2337,6 +2346,10 @@ static void s_session_packet_in(dap_chain_esbocs_session_t *a_session, dap_chain
case
DAP_CHAIN_ESBOCS_MSG_TYPE_VOTE_FOR
:
case
DAP_CHAIN_ESBOCS_MSG_TYPE_VOTE_AGAINST
:
{
#ifndef DAP_CHAIN_CS_ESBOCS_DIRECTIVE_SUPPORT
debug_if
(
l_cs_debug
,
L_MSG
,
"Directive processing is disabled"
);
break
;
#endif
if
(
dap_hash_fast_is_blank
(
l_candidate_hash
))
{
log_it
(
L_WARNING
,
"Receive VOTE %s for empty directive"
,
l_message
->
hdr
.
type
==
DAP_CHAIN_ESBOCS_MSG_TYPE_VOTE_FOR
?
...
...
This diff is collapsed.
Click to expand it.
modules/consensus/esbocs/include/dap_chain_cs_esbocs.h
+
1
−
0
View file @
136b7a60
...
...
@@ -49,6 +49,7 @@ along with any CellFrame SDK based project. If not, see <http://www.gnu.org/lic
#define DAP_CHAIN_BLOCKS_SESSION_ROUND_ID_SIZE 8
#define DAP_CHAIN_BLOCKS_SESSION_MESSAGE_ID_SIZE 8
#define DAP_CHAIN_CS_ESBOCS_DIRECTIVE_SUPPORT // Uncomment it for enable directve supporting
#define DAP_CHAIN_ESBOCS_DIRECTIVE_VERSION 1
#define DAP_CHAIN_ESBOCS_DIRECTIVE_KICK 0x10
#define DAP_CHAIN_ESBOCS_DIRECTIVE_LIFT 0x11
...
...
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