Compare commits

..
2 Commits
Author SHA1 Message Date
Benjamin_Loison 913fe06d5c Clean #10 2023-06-03 19:32:24 +02:00
Benjamin_Loison ae934da1c8 Fix #10: The prover hasn't provided a correct proof! 2023-06-03 19:30:40 +02:00
3 changed files with 8 additions and 7 deletions
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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
+6 -5
View File
@@ -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():