Compare commits
2 Commits
0ab5395508
...
913fe06d5c
| Author | SHA1 | Date | |
|---|---|---|---|
|
913fe06d5c
|
|||
|
ae934da1c8
|
@@ -13,7 +13,7 @@ LEAST_DIFFICULT_HASH = int('F' * (SECURITY_PARAMETER // 4), 16)
|
||||
|
||||
NUMBER_OF_BITS_IN_AVERAGE_FOR_SOLVING_PUZZLE = int(math.log2(1 / MAXIMUM_HASH_DIFFICULTY))
|
||||
|
||||
PROBABILITY_TO_CATCH_MALICIOUS = 1 - 2 ** -1
|
||||
PROBABILITY_TO_CATCH_MALICIOUS = 1 - 2 ** -50
|
||||
# Let's hardcode that we dedicate 1% of extra storage for the proof probability.
|
||||
SPACE_UPPER_BOUND_IN_BITS_POTENTIALLY_MALICIOUS = math.ceil(SPACE_TO_PROVE_IN_BITS / 100)
|
||||
|
||||
|
||||
2
meta.py
2
meta.py
@@ -40,5 +40,5 @@ while True:
|
||||
write(verifier, 'entries.txt')
|
||||
result = ' '.join(getProgramLine(verifier).split()[1:])
|
||||
print(result)
|
||||
if result.startswith('The received difficulty'):#not result.startswith('Verified'):
|
||||
if not result.startswith('Verified'):
|
||||
break
|
||||
|
||||
11
verifier.py
11
verifier.py
@@ -28,13 +28,13 @@ merkleTreeRoot = input('merkleTreeRoot: ')
|
||||
|
||||
# Note that there's no advantage to request the last table entry by hoping that the prover is storing the nonces with delta in such order, for instance he can have stored the delta the other way around which screw up this additional request aim.
|
||||
|
||||
indexesRequest = set() if len(sys.argv) <= 3 else ast.literal_eval(sys.argv[3])
|
||||
indexesRequest = [] if len(sys.argv) <= 3 else ast.literal_eval(sys.argv[3])
|
||||
|
||||
if indexesRequest == set():
|
||||
if indexesRequest == []:
|
||||
while len(indexesRequest) < common.NUMBER_OF_ENTRIES_TO_VERIFY:
|
||||
index = secrets.randbelow(common.ENTRIES_NUMBER)
|
||||
if not common.otherIndex(index) in indexesRequest:
|
||||
indexesRequest.add(index)
|
||||
if not common.otherIndex(index) in indexesRequest and not index in indexesRequest:
|
||||
indexesRequest += [index]
|
||||
|
||||
indexesRequestFilePath = 'indexesRequest.txt'
|
||||
|
||||
@@ -63,7 +63,8 @@ for index in indexesRequest:
|
||||
if not common.doesHashMatchDifficulty(hashed):
|
||||
print("The received difficulty doesn't match the claimed one!")
|
||||
exit(1)
|
||||
merkleTreeLevels[0][i] = common.hash(protocolInitializationPhaseId + protocolExecutionPhaseId + str(nonce))
|
||||
hashed = common.hash(protocolInitializationPhaseId + protocolExecutionPhaseId + str(nonce))
|
||||
merkleTreeLevels[0][i] = hashed
|
||||
|
||||
for merkleTreeLevelsIndex, merkleTreeLevel in enumerate(merkleTreeLevels[:-1]):
|
||||
for index in merkleTreeLevel.copy():
|
||||
|
||||
Reference in New Issue
Block a user