Commit 9098140d authored by UNHALE NILESH ARUN's avatar UNHALE NILESH ARUN

read me updated

parent fd6c5dba
...@@ -2,7 +2,7 @@ lambda_proposer = 30# wait time for priority messages to be received ...@@ -2,7 +2,7 @@ lambda_proposer = 30# wait time for priority messages to be received
tou_proposer = 26 # proposer rolecount tou_proposer = 26 # proposer rolecount
ROLE_BLOCK_PROPOSER = 'BLOCK_PROPOSER' ROLE_BLOCK_PROPOSER = 'BLOCK_PROPOSER'
tou_step = 60 # tou is expected number of users that sortition selects for committee tou_step = 28 # tou is expected number of users that sortition selects for committee
ROLE_COMMITEE_FOR_VOTE = 'committee' ROLE_COMMITEE_FOR_VOTE = 'committee'
lambda_block = 300 #seconds lambda_block = 300 #seconds
...@@ -21,8 +21,13 @@ FINALIZED_BLOCK_msg_type = "FINALIZED_BLOCK" ...@@ -21,8 +21,13 @@ FINALIZED_BLOCK_msg_type = "FINALIZED_BLOCK"
TENTATIVE_BLOCK_msg_type = "TENTATIVE_BLOCK" TENTATIVE_BLOCK_msg_type = "TENTATIVE_BLOCK"
NUMBER_OF_NODES_IN_NETWORK = 100 NUMBER_OF_NODES_IN_NETWORK = 50
MAXSTEP = 15 MAXSTEP = 15
FINAL_STEP = 9999999999 FINAL_STEP = 9999999999
'''------------------------------------------------------------------------------'''
Experiment_1_OBS = {} #KEY : (subusercount,sortitionCount)
\ No newline at end of file
...@@ -92,6 +92,14 @@ class Network(): ...@@ -92,6 +92,14 @@ class Network():
for node in self.nodes.values(): for node in self.nodes.values():
node.simulate(time) node.simulate(time)
if time == str(99999):
for link in self.links.values():
self.logger.info("remaining tasks : {}".format((link.link,link.todoList)))
for node in self.nodes.values():
self.logger.info("reamaining tasks : {}".format((node.id,node.todoList)))
self.logger.info("reamaining tasks : {}".format(node.ResumeTasks))
pass pass
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -167,6 +167,7 @@ class OverlayNode(Node): ...@@ -167,6 +167,7 @@ class OverlayNode(Node):
while True: while True:
#increment round number #increment round number
self.logger.info("STARTING ROUND NUMBER : {}".format(self.currentRound))
blockForBA = None blockForBA = None
...@@ -234,6 +235,7 @@ class OverlayNode(Node): ...@@ -234,6 +235,7 @@ class OverlayNode(Node):
else: # others than block proposers else: # others than block proposers
# everybody is waiting for lambda_proposer+ lambda_block 33 seconds # everybody is waiting for lambda_proposer+ lambda_block 33 seconds
self.logger.info("GOING TO SLEEP for {}".format(Config.lambda_proposer+Config.lambda_block))
yield "resume", Config.lambda_proposer+Config.lambda_block yield "resume", Config.lambda_proposer+Config.lambda_block
# TODO:done : drop any priority messages in queue # TODO:done : drop any priority messages in queue
...@@ -661,15 +663,16 @@ class OverlayNode(Node): ...@@ -661,15 +663,16 @@ class OverlayNode(Node):
var_BBA_star['step'] += 1 var_BBA_star['step'] += 1
self.printStats() self.printStats()
# self.uniqueReceivedMessages[Config.COMMITTEE_VOTE_MSG_type].clear() # self.uniqueReceivedMessages[Config.COMMITTEE_VOTE_MSG_type].clear()
yield 'resume', 50 yield "resume", 50
'''END : BBAStar case 3''' '''END : BBAStar case 3'''
yield "resume",1 yield "resume",1
if var_BBA_star['step'] == Config.MAXSTEP : if var_BBA_star['step'] == Config.MAXSTEP :
self.logger.info("I AM GOING TO HANG FOREVER")
yield "resume", 40120000 # hang forever yield "resume", 40120000 # hang forever
exit(0) # exit(0)
''' END : BBA* ALGORITHM ''' ''' END : BBA* ALGORITHM '''
...@@ -727,7 +730,10 @@ class OverlayNode(Node): ...@@ -727,7 +730,10 @@ class OverlayNode(Node):
self.messagesTillNow.clear() self.messagesTillNow.clear()
self.logger.info("PROPOSED BLOCKS IN ROUND :"+str(self.currentRound)+" : {} ".format(self.network.BlocksHashTOBLOCK_MAP)) self.logger.info("PROPOSED BLOCKS IN ROUND :"+str(self.currentRound)+" : {} ".format(self.network.BlocksHashTOBLOCK_MAP))
self.network.BlocksHashTOBLOCK_MAP.clear() self.network.BlocksHashTOBLOCK_MAP.clear()
yield 'resume', 50 yield 'resume', 10
print("stats for experiment 1 : {}".format(Config.Experiment_1_OBS))
self.currentRound = self.currentRound + 1
# self.logger.info(self.uniqueReceivedMessages) # self.logger.info(self.uniqueReceivedMessages)
...@@ -765,6 +771,7 @@ class OverlayNode(Node): ...@@ -765,6 +771,7 @@ class OverlayNode(Node):
pass pass
self.ResumeTasks[str(int(self.network.time)+10)].append(("nextOn", self.startNodeLifeCycleGenerator,))
pass pass
......
import matplotlib.pyplot as plt
stats= {49: [5, 3], 41: [14, 12], 23: [7, 5], 40: [5, 4], 19: [3, 3], 31: [7, 6], 28: [1, 1], 33: [7, 5], 38: [10, 8], 16: [2, 2], 48: [3, 3], 50: [4, 2], 12: [1, 1], 17: [3, 1], 42: [2, 2], 35: [1, 1], 45: [2, 2], 37: [7, 6], 36: [4, 2], 7: [1, 1], 29: [1, 1], 26: [4, 3], 32: [1, 1], 34: [1, 1], 39: [1, 1], 25: [5, 3], 46: [1, 1], 8: [1, 1], 30: [1, 1]}
stats2 ={38: [2, 2], 20: [2, 2], 37: [2, 2], 47: [2, 2], 41: [11, 8], 46: [1, 1], 49: [4, 3], 40: [2, 2], 32: [1, 1], 45: [4, 3], 24: [2, 2], 30: [1, 1], 31: [2, 2], 28: [2, 2], 35: [2, 2], 22: [1, 1], 43: [3, 3], 23: [1, 1], 39: [1, 1], 27: [2, 2], 7: [1, 1], 29: [3, 2]}
stats3 = {41: [2, 2], 16: [2, 2], 48: [1, 1], 5: [1, 1], 21: [2, 2], 39: [1, 1], 47: [2, 2], 46: [1, 1], 38: [1, 1], 45: [1, 1], 42: [1, 1], 40: [1, 1]}
dict = {}
for key, val in stats.items():
# print(key)
# print(val)
dict[key] = (val[0]/val[1])
# print(sorted(dict))
lists = sorted(dict.items()) # sorted by key, return a list of tuples
x, y = zip(*lists)
plt.xlabel('Stake')
plt.ylabel('Sub User')
plt.plot(x, y)
plt.savefig('stats.png')
plt.show()
...@@ -5,11 +5,6 @@ ...@@ -5,11 +5,6 @@
`pip3 install -r requirements.txt` `pip3 install -r requirements.txt`
`pip3 install python-louvain==0.5`
`sudo pip3 install networkx`
`apt-get install python3-tk`
* Setup * Setup
...@@ -19,7 +14,7 @@ ...@@ -19,7 +14,7 @@
* How to run * How to run
`$ python3 Starter.py` `$ ./start.sh`
...@@ -2,7 +2,7 @@ from ecdsa import SigningKey,SECP256k1 ...@@ -2,7 +2,7 @@ from ecdsa import SigningKey,SECP256k1
from ecdsa.keys import BadSignatureError from ecdsa.keys import BadSignatureError
from numpy.random import randint from numpy.random import randint
import numpy as np import numpy as np
import Config
import binascii import binascii
import random import random
import scipy.stats as stats import scipy.stats as stats
...@@ -48,6 +48,14 @@ def verifyVRF(pk,hash,proof,seed): ...@@ -48,6 +48,14 @@ def verifyVRF(pk,hash,proof,seed):
return False return False
return True return True
def gatherStatsExperiment1(w,j):
temp = Config.Experiment_1_OBS.get(w, [0,0])
temp[0]=temp[0]+j
temp[1]=temp[1]+1
Config.Experiment_1_OBS[w] = temp
def sortition(sk,seed,rolecount,role,w,badaW,pk): def sortition(sk,seed,rolecount,role,w,badaW,pk):
''' '''
...@@ -94,6 +102,7 @@ def sortition(sk,seed,rolecount,role,w,badaW,pk): ...@@ -94,6 +102,7 @@ def sortition(sk,seed,rolecount,role,w,badaW,pk):
print('\n') print('\n')
print('===============> The j value is >>>' , j) print('===============> The j value is >>>' , j)
print('\n') print('\n')
gatherStatsExperiment1(w,j)
return (hash,proof,j) return (hash,proof,j)
......
x = (1,2)
y = (3,2)
x[0] = 5
print(x[1]+y[1])
\ No newline at end of file
#!/usr/bin/env bash #!/usr/bin/env bash
python3 filegen.py 100 python3 filegen.py 50
rm -rf ASim.log rm -rf ASim.log
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment