Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
algorand
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nilak
algorand
Commits
6b047651
Commit
6b047651
authored
Apr 29, 2019
by
THAKARE AKSHAY HARIBHAU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added committee vote function of first step of Reduction
parent
2e164077
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
12 deletions
+31
-12
Config.py
Config.py
+3
-1
Links.dat
Links.dat
+4
-0
Nodes.dat
Nodes.dat
+3
-0
OverlayNode.py
OverlayNode.py
+21
-11
No files found.
Config.py
View file @
6b047651
...
...
@@ -9,4 +9,6 @@ lambda_block = 30 #seconds
BLOCK_PROPOSAL_MSG_type
=
'BLOCK_PROPOSAL_MSGs'
PRIORITY_MSG_type
=
'PRIORITY_MSG'
\ No newline at end of file
PRIORITY_MSG_type
=
'PRIORITY_MSG'
COMMITTEE_VOTE_MSG_type
=
"COMMITTEE_VOTE"
Links.dat
View file @
6b047651
...
...
@@ -2,3 +2,7 @@
2 3
3 4
4 1
3 5
2 6
3 7
7 4
\ No newline at end of file
Nodes.dat
View file @
6b047651
...
...
@@ -2,3 +2,6 @@
2
3
4
5
6
7
\ No newline at end of file
OverlayNode.py
View file @
6b047651
...
...
@@ -102,8 +102,6 @@ class OverlayNode(Node):
self
.
uniqueReceivedMessages
.
pop
(
Config
.
PRIORITY_MSG_type
)
except
Exception
:
pass
# print("NOde id :"+self.id)
# print(self.uniqueReceivedMessages)
######### Performing selection of block BA* ############################
if
not
(
self
.
uniqueReceivedMessages
[
Config
.
BLOCK_PROPOSAL_MSG_type
]
or
blockForBA
)
:
...
...
@@ -129,23 +127,35 @@ class OverlayNode(Node):
except
Exception
as
e
:
self
.
logger
.
error
(
e
)
print
(
blockForBA
)
# print(blockForBA)
hashof_blockForBA
=
Utility
.
pseudoRandomGenerator
(
blockForBA
)
######### END : Performing selection of block BA* ############################
''' START : REDUCTION ALGORITHM '''
# reduct_step_1 = 1
# reduct_seed = (previousHash, self.currentRound, reduct_step_1)
# reduct_hash, reduct_proof, reduct_j = Utility.sortition(self.sk, reduct_seed, Config.tou_step, Config.ROLE_COMMITEE_FOR_VOTE,
# self.weight, self.network.badaW, self.pk)
#
# if reduct_j :
# self.logger.info("selection for VOTIN COMMITEE with J =" + str(reduct_j))
''' COmmitte vote reduction step 1'''
reduct_step_1
=
1
reduct_seed
=
(
previousHash
,
self
.
currentRound
,
reduct_step_1
)
reduct_role_1
=
(
Config
.
ROLE_COMMITEE_FOR_VOTE
,
self
.
currentRound
,
reduct_step_1
)
reduct_sorthash
,
reduct_proof
,
reduct_j
=
Utility
.
sortition
(
self
.
sk
,
reduct_seed
,
Config
.
tou_step
,
reduct_role_1
,
self
.
weight
,
self
.
network
.
badaW
,
self
.
pk
)
print
(
self
.
id
,
" : "
,
reduct_j
)
if
reduct_j
>
0
:
self
.
logger
.
info
(
"selection for VOTING COMMITEE with J ="
+
str
(
reduct_j
))
payload
=
(
self
.
currentRound
,
reduct_step_1
,
reduct_sorthash
,
reduct_proof
,
previousHash
,
hashof_blockForBA
)
committeeVoteMsg
=
(
Config
.
COMMITTEE_VOTE_MSG_type
,(
self
.
pk
,
payload
,
self
.
sk
.
sign
(
bytes
(
str
(
payload
)
.
encode
(
'UTF8'
)))))
self
.
broadcast
(
self
.
network
.
time
,
committeeVoteMsg
)
self
.
logger
.
info
(
"Broadcasting commitee messgae"
+
str
(
committeeVoteMsg
))
print
(
self
.
uniqueReceivedMessages
[
Config
.
COMMITTEE_VOTE_MSG_type
])
''' END : COmmitte vote reduction step 1'''
yield
"resume"
,
9
self
.
logger
.
info
(
self
.
uniqueReceivedMessages
)
#
self.logger.info(self.uniqueReceivedMessages)
yield
"resume"
,
400
''' END : REDUCTION ALGORITHM '''
'''
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment