From 815080552e93d6485436450b5b578756ec01202a Mon Sep 17 00:00:00 2001 From: Qi Zhou Date: Wed, 18 Jan 2023 14:44:17 -0800 Subject: [PATCH] fix fri test with permuted merkle tree --- mimc_stark/test.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mimc_stark/test.py b/mimc_stark/test.py index 557b32cb..fb944ee7 100644 --- a/mimc_stark/test.py +++ b/mimc_stark/test.py @@ -1,6 +1,7 @@ from fft import fft from mimc_stark import mk_mimc_proof, modulus, mimc, verify_mimc_proof from merkle_tree import merkelize, mk_branch, verify_branch, bin_length +from permuted_tree import merkelize as pmerkelize from fri import prove_low_degree, verify_low_degree_proof def test_merkletree(): @@ -19,17 +20,17 @@ def test_fri(): evaluations = fft(poly, modulus, root_of_unity) proof = prove_low_degree(evaluations, root_of_unity, 4096, modulus) print("Approx proof length: %d" % fri_proof_bin_length(proof)) - assert verify_low_degree_proof(merkelize(evaluations)[1], root_of_unity, proof, 4096, modulus) + assert verify_low_degree_proof(pmerkelize(evaluations)[1], root_of_unity, proof, 4096, modulus) try: fakedata = [x if pow(3, i, 4096) > 400 else 39 for x, i in enumerate(evaluations)] proof2 = prove_low_degree(fakedata, root_of_unity, 4096, modulus) - assert verify_low_degree_proof(merkelize(fakedata)[1], root_of_unity, proof, 4096, modulus) + assert verify_low_degree_proof(pmerkelize(fakedata)[1], root_of_unity, proof, 4096, modulus) raise Exception("Fake data passed FRI") except: pass try: - assert verify_low_degree_proof(merkelize(evaluations)[1], root_of_unity, proof, 2048, modulus) + assert verify_low_degree_proof(pmerkelize(evaluations)[1], root_of_unity, proof, 2048, modulus) raise Exception("Fake data passed FRI") except: pass @@ -50,4 +51,5 @@ def test_stark(): assert verify_mimc_proof(3, 2**LOGSTEPS, constants, mimc(3, 2**LOGSTEPS, constants), proof) if __name__ == '__main__': + test_fri() test_stark()