diff --git a/prover.py b/prover.py index 21ac83d..c77306c 100755 --- a/prover.py +++ b/prover.py @@ -82,14 +82,19 @@ with open(input('indexesRequest: ')) as f: verificationMerkleTreeLevels = [{} for _ in range(common.LEVELS)] +print(len(indexesRequest)) for indexRequest in indexesRequest: otherIndex = common.otherIndex(indexRequest) + print(indexRequest, otherIndex) for index in [indexRequest, otherIndex]: verificationMerkleTreeLevels[0][index] = merkleTreeLevels[0][index] +print(len(verificationMerkleTreeLevels[0]), verificationMerkleTreeLevels[0]) + # Should rename `entries`, as they aren't *entries* for higher levels. entries = [] for verificationMerkleTreeLevelsIndex, verificationMerkleTreeLevel in enumerate(verificationMerkleTreeLevels[:-1]): + #print('len', len(verificationMerkleTreeLevel)) for index in verificationMerkleTreeLevel: otherIndex = common.otherIndex(index) leftIndex, rightIndex = sorted([index, otherIndex]) @@ -100,9 +105,16 @@ for verificationMerkleTreeLevelsIndex, verificationMerkleTreeLevel in enumerate( if verificationMerkleTreeLevelsIndex == 0: leftNonce = sum(STORED_NONCES[:leftIndex + 1]) rightNonce = leftNonce + STORED_NONCES[rightIndex] + print(leftNonce, rightNonce) entries += [leftNonce, rightNonce] else: + print('once', otherHash) entries += [otherHash] + elif verificationMerkleTreeLevelsIndex == 0: + leftNonce = sum(STORED_NONCES[:leftIndex + 1]) + rightNonce = leftNonce + STORED_NONCES[rightIndex] + print('nope', leftNonce, rightNonce) + entriesFilePath = 'entries.txt' diff --git a/verifier.py b/verifier.py index e392792..ab98754 100755 --- a/verifier.py +++ b/verifier.py @@ -54,12 +54,16 @@ with open(input('entries: ')) as f: merkleTreeLevels = [{} for _ in range(common.LEVELS)] +print(entries[:len(indexesRequest) * 2]) +print(len(indexesRequest)) # 18 for index in indexesRequest: otherIndex = common.otherIndex(index) leftIndex, rightIndex = sorted([index, otherIndex]) for i, nonce in zip([leftIndex, rightIndex], [entries.pop(0) for _ in range(2)]): + print(protocolInitializationPhaseId, str(nonce)) hashed = common.hash(protocolInitializationPhaseId + str(nonce)) if not common.doesHashMatchDifficulty(hashed): + print(hashed) print("The received difficulty doesn't match the claimed one!") exit(1) merkleTreeLevels[0][i] = common.hash(protocolInitializationPhaseId + protocolExecutionPhaseId + str(nonce))