diff --git a/verifier_circuit/src/poly_commitment/commitment.ts b/verifier_circuit/src/poly_commitment/commitment.ts index 7dae2a35..2c0f15e6 100644 --- a/verifier_circuit/src/poly_commitment/commitment.ts +++ b/verifier_circuit/src/poly_commitment/commitment.ts @@ -221,6 +221,15 @@ export class AggregatedEvaluationProof /** scaling factor for polynomials */ evalscale: Scalar /** batched opening proof */ - opening: &'a OpeningProof + opening: OpeningProof combined_inner_product: Scalar } + +export class OpeningProof { + /** vector of rounds of L & R commitments */ + lr: [Group, Group][] + delta: Group + z1: Scalar + z2: Scalar + sg: Group +} diff --git a/verifier_circuit/src/prover/prover.ts b/verifier_circuit/src/prover/prover.ts index 15674568..d1ecb21f 100644 --- a/verifier_circuit/src/prover/prover.ts +++ b/verifier_circuit/src/prover/prover.ts @@ -1,6 +1,6 @@ import { Polynomial } from "../polynomial.js" import { Field, Group, Scalar } from "o1js" -import { PolyComm, bPoly, bPolyCoefficients } from "../poly_commitment/commitment"; +import { PolyComm, bPoly, bPolyCoefficients, OpeningProof } from "../poly_commitment/commitment"; import { getLimbs64 } from "../util/bigint"; import { Sponge } from "../verifier/sponge"; import { Verifier, VerifierIndex } from "../verifier/verifier.js"; @@ -16,20 +16,22 @@ export class ProverProof { evals: ProofEvaluations> prev_challenges: RecursionChallenge[] commitments: ProverCommitments - /** Required evaluation for Maller's optimization */ ft_eval1: Scalar + proof: OpeningProof constructor( evals: ProofEvaluations>, prev_challenges: RecursionChallenge[], commitments: ProverCommitments, - ft_eval1: Scalar + ft_eval1: Scalar, + proof: OpeningProof ) { this.evals = evals; this.prev_challenges = prev_challenges; this.commitments = commitments; - this.ft_eval1 = ft_eval1 + this.ft_eval1 = ft_eval1; + this.proof = proof; } /** diff --git a/verifier_circuit/src/serde/serde_index.ts b/verifier_circuit/src/serde/serde_index.ts index 63545972..94ef4153 100644 --- a/verifier_circuit/src/serde/serde_index.ts +++ b/verifier_circuit/src/serde/serde_index.ts @@ -8,7 +8,7 @@ import { Polynomial } from "../polynomial" import { Alphas } from "../alphas" export interface PolyCommJSON { - unshifted: { x: string, y: string }[] + unshifted: GroupJSON[] shifted: null } @@ -103,16 +103,21 @@ interface VerifierIndexJSON { linearization: LinearizationJSON, } -export function deserGroup(x: string, y: string): Group { - if (x === "0" && y === "1") { +export interface GroupJSON { + x: string + y: string +} + +export function deserGroup(json: GroupJSON): Group { + if (json.x === "0" && json.y === "1") { return Group.zero } else { - return Group.from(x, y); + return Group.from(json.x, json.y); } } export function deserPolyComm(json: PolyCommJSON): PolyComm { - const unshifted = json.unshifted.map(({ x, y }) => deserGroup(x, y)); + const unshifted = json.unshifted.map(deserGroup); let shifted = undefined; if (json.shifted != null) { shifted = json.shifted; diff --git a/verifier_circuit/src/serde/serde_proof.ts b/verifier_circuit/src/serde/serde_proof.ts index 5cbf931e..66dba7ad 100644 --- a/verifier_circuit/src/serde/serde_proof.ts +++ b/verifier_circuit/src/serde/serde_proof.ts @@ -1,7 +1,7 @@ -import { Proof, Scalar } from "o1js" -import { PolyComm } from "../poly_commitment/commitment.js"; +import { Group, Proof, Scalar } from "o1js" +import { OpeningProof, PolyComm } from "../poly_commitment/commitment.js"; import { LookupEvaluations, PointEvaluations, ProofEvaluations, ProverCommitments, ProverProof, RecursionChallenge } from "../prover/prover.js" -import { deserPolyComm, PolyCommJSON } from "./serde_index.js"; +import { deserPolyComm, PolyCommJSON, deserGroup, GroupJSON } from "./serde_index.js"; type PointEvals = PointEvaluations; @@ -120,19 +120,41 @@ export function deserProverCommitments(json: ProverCommitmentsJSON): ProverCommi }; } + +interface OpeningProofJSON { + lr: GroupJSON[][] // [GroupJSON, GroupJSON] + delta: GroupJSON + z1: string + z2: string + sg: GroupJSON +} + +export function deserOpeningProof(json: OpeningProofJSON): OpeningProof { + return { + lr: json.lr.map((g) => [deserGroup(g[0]), deserGroup(g[1])]), + delta: deserGroup(json.delta), + z1: deserHexScalar(json.z1), + z2: deserHexScalar(json.z2), + sg: deserGroup(json.sg), + } +} + interface ProverProofJSON { evals: ProofEvalsJSON prev_challenges: RecursionChallenge[] commitments: ProverCommitmentsJSON ft_eval1: string + proof: OpeningProofJSON } + export function deserProverProof(json: ProverProofJSON): ProverProof { - const { evals, prev_challenges, commitments, ft_eval1 } = json; + const { evals, prev_challenges, commitments, ft_eval1, proof } = json; return new ProverProof( deserProofEvals(evals), prev_challenges, deserProverCommitments(commitments), - deserHexScalar(ft_eval1) + deserHexScalar(ft_eval1), + deserOpeningProof(proof) ); } diff --git a/verifier_circuit/src/verifier/batch.ts b/verifier_circuit/src/verifier/batch.ts index 32f4138a..ab51723c 100644 --- a/verifier_circuit/src/verifier/batch.ts +++ b/verifier_circuit/src/verifier/batch.ts @@ -1,4 +1,4 @@ -import { Evaluation, PolyComm } from "../poly_commitment/commitment.js"; +import { AggregatedEvaluationProof, Evaluation, PolyComm } from "../poly_commitment/commitment.js"; import { ProverProof, PointEvaluations, ProofEvaluations, Constants } from "../prover/prover.js"; import { Verifier, VerifierIndex } from "./verifier.js"; import { Group, Scalar } from "o1js"; @@ -181,31 +181,17 @@ export class Batch extends Verifier { } // prepare for the opening proof verification - let evaluation_points = vec![oracles.zeta, oracles.zeta * verifier_index.domain.group_gen]; - Ok(BatchEvaluationProof { + let evaluation_points = [oracles.zeta, oracles.zeta.mul(verifier_index.domain_gen)]; + const agg_proof: AggregatedEvaluationProof = { sponge: fq_sponge, evaluations, evaluation_points, polyscale: oracles.v, evalscale: oracles.u, - opening: &proof.proof, + opening: proof.proof, combined_inner_product, - }) - /* - Compute the commitment to the linearized polynomial $f$. To do this, add the constraints of all of the gates, of the permutation, and optionally of the lookup. (See the separate sections in the constraints section.) Any polynomial should be replaced by its associated commitment, contained in the verifier index or in the proof, unless a polynomial has its evaluation provided by the proof in which case the evaluation should be used in place of the commitment. - Compute the (chuncked) commitment of $ft$ (see Maller’s optimization). - List the polynomial commitments, and their associated evaluations, that are associated to the aggregated evaluation proof in the proof: - recursion - public input commitment - ft commitment (chunks of it) - permutation commitment - index commitments that use the coefficients - witness commitments - coefficient commitments - sigma commitments - lookup commitments - */ - return public_comm; + }; + return agg_proof; } /* diff --git a/verifier_circuit/src/verifier/batching.test.ts b/verifier_circuit/src/verifier/batching.test.ts index a3d3c18d..1ef4abfd 100644 --- a/verifier_circuit/src/verifier/batching.test.ts +++ b/verifier_circuit/src/verifier/batching.test.ts @@ -14,12 +14,5 @@ test("Partial verification integration test", () => { const vi = deserVerifierIndex(verifier_index_json); const proof = deserProverProof(proof_json); - let f_comm = Batch.toBatch(vi, proof, []); // upto step 2 implemented. - let expected_f_comm = new PolyComm([ - Group({ - x: Field(0x221b959dacd2052aae26193fca36b53279866a4fbbab0d5a2f828b5fd7778201n), - y: Field(0x058c8f1105cae57f4891eadc9b85c8954e5067190e155e61d66855ace69c16c0n) - }) - ]) - expect(f_comm).toEqual(expected_f_comm) + Batch.toBatch(vi, proof, []); // upto step 2 implemented. }) diff --git a/verifier_circuit/test/proof.json b/verifier_circuit/test/proof.json index 0ca8831d..cecd99fa 100644 --- a/verifier_circuit/test/proof.json +++ b/verifier_circuit/test/proof.json @@ -11,206 +11,206 @@ "w": [ { "zeta": [ - "1b84914ce28dacce1d54a7fc2e8a1dc389766a990d60f1af33c3b74aa1d9f639" + "8b2c538fa6bb310747d7f2d08c609f452331703fe80360fcef185dc4bfa70926" ], "zeta_omega": [ - "5e5fb350a3eb37e19269b676d56a9c205abf6db5957b7b9a163cd36385833426" + "8218ee48e3805f14f65584629c40e59d640c3f9424556dc9532d1df5f55ea23f" ] }, { "zeta": [ - "7ec0af6bf648ff7818b175106bab96d2132801400a86250ab850467cb7ecde06" + "d1cb58042c203b4da7d3dff1c3f8d6b5abda77708aec5ec9e029e696441bd936" ], "zeta_omega": [ - "7aa25ba34f88a253ff64a909e76419f9619835c5432cf93726981f258f7b2628" + "e51900e3d2b76393e494ea9e71b1f844ae4cd72fb42af6e469d1a6333c18b90b" ] }, { "zeta": [ - "daae1aa94989b578fac6725048f416ef21814b62c410e6bea1ed0cdefec39005" + "b2fed2ee23793ec0462f21322beb44eef1c696a3f75e7a28e820a5013c79f234" ], "zeta_omega": [ - "5c14c7394e637497e7850a3173995c758ed549ef680f35da8466ca29c646ba28" + "9ea02d96df1a948078661fb13443616cb1a3c9b9e543e4d91f7c7f513737a81a" ] }, { "zeta": [ - "5eb9ea40b5b40622d1178de59a3a616d6965c5e6a17f534b5edbf0d1e726022c" + "067be2f4d2c68f0a861023680f8754495d8fc34f473c970384ae9fded700681e" ], "zeta_omega": [ - "ec0c7757660ec88b7b1fcad14ff133aeae84f13f18f94ffc85c8e1db471d2305" + "196787e113ab255930c26f28cca1f127842fae3c0d66438785498e66d9446534" ] }, { "zeta": [ - "df81bae9e1de1c1038a29c9c484e7d10278aa06f83e20e7eb96386214d78c523" + "bcf7ba6ae738befba1c992b2b27542158de40d90f8b01fbd0daaf6bbec2da411" ], "zeta_omega": [ - "00d48c8791bd959d633c9412691da79fe1c429d05abfe61d98f8a073e11bcf1d" + "a0c6c358f13a1dc2af4aca8dea25b30f6cda08a3f032b825ba402d924e3aac23" ] }, { "zeta": [ - "e41643f8733e37b62b21a3e8531d422fa39dac095d4a4c679ac1824146c5d703" + "098db6fe501c6b19ae8882c5b9138b1b785a6c91e77d1174837915d9d1740d10" ], "zeta_omega": [ - "cc4e740b2d48d4fdeaad57d95483b6dd8105999d22396aee5e8e435b094d6b0d" + "c36d666711799c7c59a9e660161d1b43e591f5ac24aaabf7b8a1707dca604021" ] }, { "zeta": [ - "c3188be83a1b88ea34e8a0cf8c8a9c6d733ed3bf503fca2ad74fc8e27880fa18" + "db020a9bef3c8ccd2d7d9a64688f0a61d03eb9e002275d5b762bed7ffd95a415" ], "zeta_omega": [ - "be7e409a5df6877628400ae15226d9ad64962def131080b5e2034bd043e4101c" + "e77bf0fe9f97cf89b956d63116b97f215354de8c838c86fae390d8ffaa61d00d" ] }, { "zeta": [ - "1c6cc1b0df828af6ac333804dc1bf8c2a589c7e63390627f8cea0e12408fa71c" + "fc2b079b16d98b634307c360c400169e37c76fb3f90ee9344b7b9dca2ed01618" ], "zeta_omega": [ - "d7223aa033e5122ee58327fc4d5a1224d9897054686e8906b576ddb87bf1b607" + "893d20700261d6a339fa8387030166373980f1d265387a3cd8b2331467b1571c" ] }, { "zeta": [ - "8f31f787acd2d9d6f427a92f3e8863255e7c6ac3b2025352c623b8ab8464fd25" + "3aed782682357f30840674607196c37e390327db2a6d20924c1a0cc98109193d" ], "zeta_omega": [ - "8b7b9598d8126ee0f00601a56848af49cfdd75a078edb0b3a5871a9fd8825b19" + "b8cecd5ff39f695f1192303050674bd0437337fb92c057f79e4140459b51c931" ] }, { "zeta": [ - "d6543bfef8a264c9be8e2f8e95543d2c8c3b010e030443d6e500fc482e4fd63a" + "eae2b67ee4dd590e653913fdf516fa8abe56b3d9d2ec9c88203dc872c6ac083a" ], "zeta_omega": [ - "1efda04a9a988cc8977585d29e6e4efd9bd97819de39fd54c800829f5285aa03" + "eac639d740e157b3c249480278b383d7ef008298e9dd71d54ee0548d74e0ad33" ] }, { "zeta": [ - "f69173b5b133153d90bbd0c811e9ef76591819a06235982c2f0b3afcfcce2009" + "c90acb57aa3d057cb3780d1b4ced4998dea984ca72e1ddc412f6869dcfe51508" ], "zeta_omega": [ - "083455b0e255449d9ae01002d20aaa5e2e58ac893ca6de130f64827c5d9da90e" + "f5a0daaccde8ee3102aecc407aea91aae398c8e17d64b8efdb599d4cb8c9a007" ] }, { "zeta": [ - "25f8e6f3fbd0a584d5b699da47b8e613cfd42091ae96e6367b1982b307a76934" + "496869679bae9072a0fc73cbc8c764ae683f4f4a2270b2abc105ab4f26aaa926" ], "zeta_omega": [ - "2610b5518deb9c5dda85c5ff19ecd9293b1154bdb0b3e2d3708ea6b35ba22f08" + "58602a5b5f961f8bd5e8c8e53a84ed5b6f2ea53e31ca3acc91fd05af3334fb11" ] }, { "zeta": [ - "c7604de7d925a308e92506bc02230702c787b2d5b1bcf9fa5ead18ace45a9d28" + "578c4156df58aadc01ee0239b0575ce8d7e0f3f40863c288ab97c5a409efe40c" ], "zeta_omega": [ - "12bc054e7c8704beee1b590ad7450d324e7f30394f92ae3dad794b8a65edaa2d" + "ac8205ff72170613c35e3b0ff3a1fa118b84cbdd9de8aa90b70d3b5d9302d234" ] }, { "zeta": [ - "c5a4fad42db8f159d7f4d5ad5e47a19e22d2beabbde834d981c6c3d74f10f636" + "85ef58552b6499b8eca0c1f3017109f578e90044f0d0df8c2400282e6871e23d" ], "zeta_omega": [ - "1992fad7edc7bbc3d4b6f6c671befda405fb8581f98323d1a2f0342678999903" + "5bde1e8b7d7ad437d037a31413b3774ba251299a329d7d519c801b1c3c3ccd38" ] }, { "zeta": [ - "f1b79471aea32662e29c896c71f1b16ce1c5b6be5b151d5fae59b69919d2da16" + "220ce491657b242a40d7e86868787da4fb922e06bdd027517963875449d9602e" ], "zeta_omega": [ - "a8a309ff6ebb8d31dc0414865b006cd78c39a5bc99ee96bc13a8cb945a7c8831" + "305c2c0dfa0489a97c0df27f5f42ddfd3e20c726ef1408ad87bec03cde9a6008" ] } ], "z": { "zeta": [ - "cd20c83412e6b5ba1b1d3185953ae953050339a01d29d888720ca45d9cc2200f" + "35f2e384b391de9d1ddb3db386f7aacdc50350b0e450bc8ec37c448fadd38314" ], "zeta_omega": [ - "88ee630e824848aa148b3ace41573fc412905a52debba3516dc31c0aa2f2753c" + "b7696ff0b24f82e6c3cb091646144a3dc4946598e6bfc5f8a4d3f54d8071df37" ] }, "s": [ { "zeta": [ - "941e281020a37d2adeeeaa7b719f1798f4577fa0138506251532c4ab04673812" + "1a5855240c55c7c3e3b28467a28ce8fb3e8e5ce1c1d23ae8469a98d92cb35b0f" ], "zeta_omega": [ - "eaac6b7ae3a5b5d3806073670a2a383493691da435aaaabeb1b7934c0abf9d0e" + "dc40cf987f9384c2bc8dbb9f5c56526e86410cbaabc84523a0d98b94a686e81f" ] }, { "zeta": [ - "1fc2296ef7bc2cab2e4696d81424586f8a445569ce7ff07731312c111501113f" + "aab7172ac79a2639192d31db7aec8e4c1a3b29cc3a466dfd62b4dc27c73b8521" ], "zeta_omega": [ - "ee0cde2956d24fc7c6dc861bde123c9d995419bf40a3a92e894e5e05e3914d05" + "25a333ab8692185daccef726f4b7e3eea0605b6f479758d5d24779c5467b670a" ] }, { "zeta": [ - "c70a584606169e3866a0fb900d7c8c1785fe7c715e721dce2f3b1a57cdaee823" + "4da0fb324b6669f862ce31a66bd26fc9e362ff8b12d69dfc088596e12985b13c" ], "zeta_omega": [ - "41105db70c1a16039ff123e800cf69e19ec32cdb69d0b13ea8dbca02138e6f11" + "730620d51d3fb1f81e5e5ac45d5941ad07ca7f4a0670d6081b4ac4f17dd0eb18" ] }, { "zeta": [ - "4be355643fd98301cec6c23635c037012bc2679eefecfcda62f52b553ad3bf38" + "a6389d10412a41c2c553cf14cbb53de0e9f31935c97e8da86452341c57c86f03" ], "zeta_omega": [ - "f2026d060c7af764beb3c9a49dfe63de85464da4c8acb80c989ff3e308dbb43f" + "dede143b8c04bdfa4946dc293b5cc1b8878f68bad4565dcfe9fcfa5eafb3e53e" ] }, { "zeta": [ - "80d08be4f2939d721f6178beb3417137a81cb921fe7e3189551172c2fbee6b19" + "f08687bea8e3b5cd5c4df579aa7e768c099c47fe22ed34b74b9d0be0d1bf142a" ], "zeta_omega": [ - "1c6ffed6de27a02abdf97c36fa66acc28bd914b98dc48c35864be0fa0e599b16" + "395853012d51ab8a64a424356f24273aaeba115c6947a138dfd97da410ac552e" ] }, { "zeta": [ - "53e043e32df24d36873fc53a55945f5ff6fd6d12501bb822f7200a2a2adb2638" + "2e4e3396a67b6742cb3e1f5f1f3815f091671d93d5d3f26be21431c6484e1b27" ], "zeta_omega": [ - "5ba55543382ecc382358352329006ee9200821e4829767ccadc430a5df503d3e" + "0c4fd3cf38dc75ecde024041450fb9ff238c7718f1e37c2077173d3c0d5e4d11" ] } ], "coefficients": [ { "zeta": [ - "76cd54c0088866ed1048e2e8e5d4235a7f8e93a138e1cfa5fb54504b6e57e31a" + "71b383c6cf66d3e5c92a5879ef84c180d3a6ad8a1a8060ab9eaff105a859932c" ], "zeta_omega": [ - "d8ff0190826b4a95aab1321bee271a8f7a8f81765bf52ed5b4668a78db430c1f" + "c9997f6110e968d3e29761ffa57d89a293c6b888f2491f6da1bf2dd4c394dc19" ] }, { "zeta": [ - "df1c599bf01826b320a37e00d94c17c36f0228bb705d0fd75dd78d70d41f5910" + "a5c4bdd4e705df5ff756c21c884282d3017e91fa360101c66194c54e9c8d8722" ], "zeta_omega": [ - "d155e71ec4afe6872a3ef4e8fe224e570259502cda0c3506217df49d38ef160d" + "d296955bf420f924dad7053a9ee63cf864f28d74c8f72816f17e29d629c3df2b" ] }, { "zeta": [ - "0ca137ccd0e2e4a5d2c7bf5e5e7fe98b85549dc12f3650b8e0627bda63f58c3a" + "ca1316b9d393fc168b36a9aace827086ffd5245798ff54138ace6890767b7d34" ], "zeta_omega": [ - "66e3b2f5345b4fb424949866fc37d7af54e28f46b7fb98a89f2b59cb9705a33b" + "6578238cb998c47756f0849a743b030e890426d967ad47a3afd59cb89c69b506" ] }, { @@ -223,18 +223,18 @@ }, { "zeta": [ - "7fb45a5a18578003a91c01591f0039f9f1566dd6c6b99fe56ad89c8e8919af3f" + "54aa3281baa7f2c65428e3c3b1e5ca958789885ae780dfc38585f03ca480cd1c" ], "zeta_omega": [ - "4b56e16e7e4395e0e57a85aa2cdd8cee92aacbc8c72ca88602495534a623f22f" + "78c91637e45005370fb97545a806e732aa9e63daf019cbce0c40a059de044a1e" ] }, { "zeta": [ - "816e8c8cb87f040706670d3e48bbc6c304e330636817205edcb7cb25d24c7015" + "3ac7997f820f897077b86c1ac26eebe4d27cd2e1b27fb5be287e5a961ed51021" ], "zeta_omega": [ - "3de3b48596db52bdf19c3678eec6aa1ccf7111bd12f1c77d5492e3437349af1a" + "2e12a3edc9812d4b3988e6991ab98cb01ccbde615af766105195ca8c60fe9120" ] }, { @@ -247,26 +247,26 @@ }, { "zeta": [ - "0ca137ccd0e2e4a5d2c7bf5e5e7fe98b85549dc12f3650b8e0627bda63f58c3a" + "ca1316b9d393fc168b36a9aace827086ffd5245798ff54138ace6890767b7d34" ], "zeta_omega": [ - "66e3b2f5345b4fb424949866fc37d7af54e28f46b7fb98a89f2b59cb9705a33b" + "6578238cb998c47756f0849a743b030e890426d967ad47a3afd59cb89c69b506" ] }, { "zeta": [ - "eabd9067a010c4cc15c2a9553b33ba2cf556c57ca0935f8f3e3a094b3815e60a" + "6ed8d38d9aae94eaa4e4d6bd5a2cac370154b651cf0056d9eb622edf12090517" ], "zeta_omega": [ - "36399a14d81fefaf7129f845ffc1dee4563be0729108ceaec0a84d69d0f4b908" + "370fb9e7adb9bd9c30c88ad412224006eef6b34d30a570b9a054c68ec62c9532" ] }, { "zeta": [ - "7dd74141a75777f59c4ee6dc8e89ab71e8900b10f68a5f29b2680543e57fce14" + "e11bff81d673277243609e9829a13aeee18fe3968181744634893b1067d6ab1a" ], "zeta_omega": [ - "d28f7763727736f2dfe9acc34be87dd7f4c6a84ea24a188b59248eacbf90933a" + "1da5d05b7138f12c7a513d1b6f2d14f47008a6163c2bfdad6a150b401d08261d" ] }, { @@ -312,10 +312,10 @@ ], "generic_selector": { "zeta": [ - "76cd54c0088866ed1048e2e8e5d4235a7f8e93a138e1cfa5fb54504b6e57e31a" + "71b383c6cf66d3e5c92a5879ef84c180d3a6ad8a1a8060ab9eaff105a859932c" ], "zeta_omega": [ - "d8ff0190826b4a95aab1321bee271a8f7a8f81765bf52ed5b4668a78db430c1f" + "c9997f6110e968d3e29761ffa57d89a293c6b888f2491f6da1bf2dd4c394dc19" ] }, "poseidon_selector": { @@ -386,8 +386,8 @@ { "unshifted": [ { - "x": "6299097875791836279395133841990199818503549336220632475020139396220155313137", - "y": "14059044089197323591390881581586988930338761982864186850511401107658044169745" + "x": "20254676613426313669593606594973767365785047421230504376518218206236215653646", + "y": "10024183091282719208382088145269615824305562134688625437479084882398159717597" } ], "shifted": null @@ -395,8 +395,8 @@ { "unshifted": [ { - "x": "25369122912588727303465658852913293989582945695573841016147502804634817794054", - "y": "25947863147061864146970655368439853343266894024007242927426275264302809148311" + "x": "25424737690742093500627540804318740352066516558128728351718157575560851267338", + "y": "1365245715359236044569227792606167975134033025653501906665332540161634609379" } ], "shifted": null @@ -404,8 +404,8 @@ { "unshifted": [ { - "x": "6153601619829377658055998430410670066678331179536538674978138287425467659946", - "y": "914887817360151729932844010763286711492530351991438216538668197006601175174" + "x": "22262086214860759716675049457316678618912130540659082899281055588428005575724", + "y": "19273245764788914823722102371970707171505154603677408917099966329614426681162" } ], "shifted": null @@ -413,8 +413,8 @@ { "unshifted": [ { - "x": "17936869834370606345946183980895166981262205581379862626133593673124975212994", - "y": "4939004462806081772158385052505815621861271440439010999887637394820089312181" + "x": "6465844236007646277995145630720786978267015746654823481144072058696746195109", + "y": "3137564151286492488221310834940592305674827439863126115257985452722730339984" } ], "shifted": null @@ -422,8 +422,8 @@ { "unshifted": [ { - "x": "15427236694652627413514517109990197466506474342177898382500371225154788018689", - "y": "20763710534337872824636381759509607089931877532591541928784474952083754486119" + "x": "14127516144952186145577581523713926620703541811857872451106882500906395541436", + "y": "4976599636929657166133816347342795839068928125535606475423949702691718726156" } ], "shifted": null @@ -431,8 +431,8 @@ { "unshifted": [ { - "x": "2537305378944231147557949861290439559494826798017379231676134367435284368398", - "y": "10188559143725071735389007080970229290710684001920834037148501352654308043411" + "x": "11971750755527707030130443762379556080190147641182027287901247613393508054652", + "y": "12450119372123477434839354312782677113085879058278184669735824268351831866354" } ], "shifted": null @@ -440,8 +440,8 @@ { "unshifted": [ { - "x": "17481954340735180023322339768907051392005844377623383614367681520218757897086", - "y": "3172008621141668577988769251140436898941113611605811425121361936662666572671" + "x": "21427282844638454718455039851519493988911642471765230777677940901800335867642", + "y": "15510814336009575457581838309654077704082352052756999492412673001489779997607" } ], "shifted": null @@ -449,8 +449,8 @@ { "unshifted": [ { - "x": "23102944710665870476778513906356457931623687389120507714255472771874377870494", - "y": "18469598723880381179328980473619016122693937316427035353894816945013200890909" + "x": "21813940468505259380218892595697541186390074813443378254685702736884765195406", + "y": "6250322726662553315255858262987366196495291252344693180107242164082783536619" } ], "shifted": null @@ -458,8 +458,8 @@ { "unshifted": [ { - "x": "16245435149004107932987804526367311698174184528417380760631234294918420999553", - "y": "2239272676469217311389213232665337771674992416969098416623414848030197216734" + "x": "13865437709009928163269308574130241969579844362072842958642080423514472379990", + "y": "22180502439930517703609343106690725472651094870872925176027029235458222920121" } ], "shifted": null @@ -467,8 +467,8 @@ { "unshifted": [ { - "x": "1369915303471792225266155542318765277046616683160331935452874251870840026270", - "y": "12432720407241315103213987925761825748745504411310474139371488929426646081393" + "x": "27328104955713104513716830434777578138869266256020711664835921519602258280023", + "y": "13161925056372067577589915882515928466766550565774288952321346146041326453385" } ], "shifted": null @@ -476,8 +476,8 @@ { "unshifted": [ { - "x": "8175876371926759693387478326691010181869918163391920037624181495901988283456", - "y": "21727852251499751502941189472133068470999558934334334278061354422352248883636" + "x": "6689204997036738851898372268193600528781120767630931793768547012377712136348", + "y": "3349227059597784310529127908468671168807229641108722258776594601454547697372" } ], "shifted": null @@ -485,8 +485,8 @@ { "unshifted": [ { - "x": "1208966347282255705781700828946909614543797465044355981901980976590602296444", - "y": "27560451924327602407694888427212066799443839920488937002281018924461327535539" + "x": "24542814385468095083517730270071208862645643117884750986108602999656167585587", + "y": "7670357435359372188647065512310035618479501872741580858843838124445841689074" } ], "shifted": null @@ -494,8 +494,8 @@ { "unshifted": [ { - "x": "20463590238855747276557115314396693435021415968680938455352435106194132865151", - "y": "24102007991957766591456259453497067416589587788966475165011083304936310327560" + "x": "5613926342407631488089604971432699301804301810543718273639636358546452037496", + "y": "20068373751060701002798963908996943743730972832084289576256315526042468634464" } ], "shifted": null @@ -503,8 +503,8 @@ { "unshifted": [ { - "x": "14625290625450278155103467534511143381877834436776912195093515363571113429577", - "y": "13624143645789282836457350887519985070394805293283494566644803887200971863981" + "x": "3138192356798232595785264187207073912490976523441550524234229316834604744374", + "y": "10627860056197686822130899537622362719881028324923146604287485508809288135620" } ], "shifted": null @@ -512,8 +512,8 @@ { "unshifted": [ { - "x": "18445050025926196794457129236941733873785925383920390544302694079879557927574", - "y": "21899700172737193140179718966037320307242277850324716612337610422264735897590" + "x": "26474515027869265268582453116381151800776264194793273900492349536985585384382", + "y": "3186633371935912995423177738946429783132186517663404328169602745475629366628" } ], "shifted": null @@ -522,8 +522,8 @@ "z_comm": { "unshifted": [ { - "x": "2503988952118414135577393901983755185909666237125252257556972367342002577483", - "y": "24685885701582169203606229072554317007953942332092926983472670543376802720635" + "x": "17928856072394228313727545342776820100790678538861410479008032542842359601189", + "y": "3016978053886438222101392151289621959716703555793108434971014456875772172918" } ], "shifted": null @@ -531,37 +531,211 @@ "t_comm": { "unshifted": [ { - "x": "24507551576226738042786585529228402938845751312533595399497353186374560156173", - "y": "27697673525265901615020104415404354262919874963403336905784688839556160982483" + "x": "529359241569767471452976010468608913111825273287643544035999836280595323324", + "y": "22678945073113109896784483031200760640840833342222458217208577576019058511248" }, { - "x": "7487188258198856378740668760030282140681688792492994292093096627058823166991", - "y": "11918340673485416257594209028671483128289886723865088571128086991113546445281" + "x": "12557065413118799937967084574148257341393826813200928685977238173536173687427", + "y": "26895978946943339893314649762454378642027262823538880511117532388285785652598" }, { - "x": "28564805340091547934277652781043783290943125418573542338685009987646063191503", - "y": "8846684969893203640509590263299242765336941144904917416406282928494963000914" + "x": "24072635607147371909179659896012346309495579775442669056654479952091032392559", + "y": "23719215313907687710544999712340166982446152005201196056673262318571530125793" }, { - "x": "3621053397636966805194337855096407608267811246472664989063869676224062930890", - "y": "24256753827818448682668652482349989080933051479222819843076700495639989656767" + "x": "6893768223334212092131536651469441976174512552686629075898423079678133045978", + "y": "8396250600368642698353929695715594591013783820796734557659146849837064337711" }, { - "x": "21885414007143796344513428776455816543584239428561624939663900099405192453481", - "y": "27715565606305134649598099424679689836320166514415416305431362664799732408279" + "x": "4549142168990751884539490576974704729121345525312851412555177218003771883698", + "y": "7367546760967088751509991993683351376926762261000240694097641794262261279566" }, { - "x": "464731134951064512960682814943138861797925650674255950475379594910640559252", - "y": "2418330688399777269330519078985505300734759983547766722392637620139314723487" + "x": "20413883502331809190160073060428867433200052202149564540746413610577866092070", + "y": "23384045002399571980791469200924190346925228556485078282539918241731715787802" }, { - "x": "26376779937031647789690510097026315682861989525044740311342981844916773008380", - "y": "2872287503533575582257277305691118045190532450259703215491653674867121851431" + "x": "16634549916286536260318734276669112770709423616818374193866086548293394754807", + "y": "8680695842851170046254817107270356195619429974459982238971411281539385862283" } ], "shifted": null }, "lookup": null }, - "ft_eval1": "c697a799f3359d166b0f5ce3d9192f70e7b454aaa04c002c46b3115def775137" + "ft_eval1": "97c0b3735c326dd5511be9e37e1304f9fc1b25022767f2fa6501a64751b24115", + "proof": { + "lr": [ + [ + { + "x": "3847571233950985128364788830429943209928096945060387643063009074759962706223", + "y": "19104074973643475321979495450379990299172524000580337169347226406783056494151" + }, + { + "x": "16541883684206006706448322842304374397656517959707718648943972413695344218213", + "y": "13820717385187967297355980905059415232797132810151594623242441700231134146653" + } + ], + [ + { + "x": "21551738830537936068630110740810449405371481044565379722299311136520129661937", + "y": "28143944948395363977473929053945788864151582670607225712512511676714614108010" + }, + { + "x": "4766706266275442811443090380048230632629953012671617854412332267204700046928", + "y": "14570415747486220923801164595889513055982013270203694853098499907859245836260" + } + ], + [ + { + "x": "18723016605740871554169429423903069359109051541530229362126986566055012131292", + "y": "13828753901868597784476671455765658555250622810951825552967738939392829522490" + }, + { + "x": "5563282831169434812023650556749290531935663347444943933223083539376015840731", + "y": "10178635738189660480687367687747366020792943089012200468565095439589440807542" + } + ], + [ + { + "x": "16648853361831653619646164292497274400559092801725042293594077476572327920698", + "y": "13761479194008774892510911422329490564856350046509787786687522153495779466005" + }, + { + "x": "8534936469595264026688844367651065310561269248379067208961213235357035800518", + "y": "15646986358578579943110485895639094632556861907391176315594166246523950828705" + } + ], + [ + { + "x": "5939164590887454304438043389861986986254741797280281106691934025413509534628", + "y": "1803642709832639902620859483818955547278768360374941838470763953861959327135" + }, + { + "x": "10235762990752204408581702347867382182631291465633857387760178880659814229699", + "y": "3527073487023513132580319280201798768708520069117391045933890390895607367449" + } + ], + [ + { + "x": "4156042747861794844419108787480743137412320046221213736368651804054343099563", + "y": "12501055449529973124777288418805824109233913559623779403483337863678811031067" + }, + { + "x": "18971704066771363371844189742802291169334634116868106271421046627461540695472", + "y": "14135876074821870489798061823534790503556579697623980377120500967003601016684" + } + ], + [ + { + "x": "13403815202193710348335853525254820087666956383170340556522604043200647364891", + "y": "2106170699021735291549043772245056988791364781379840149661900540541974977116" + }, + { + "x": "936453322158120138387892918520666022810472957995668913774112461248059065798", + "y": "10357530057632587758874323562792322187965725799522177660828570124379171365630" + } + ], + [ + { + "x": "12938382666352035394151632013199903289319166652820549967981422975853596567362", + "y": "4189492875349882221232096321386956656566721548672672020201133813565530005470" + }, + { + "x": "26111197871003760156282659827286525391281078118092436272954143434139953382989", + "y": "8375946149061710444258610659821263202834963025617866159847986036281999342453" + } + ], + [ + { + "x": "2825778897463936618397546250827475329668219122445745937218311895932581703573", + "y": "27522842916112935843493113138182698292533190166491054271988210310889621720218" + }, + { + "x": "11653688488044770746735668974922550769249366181383471939980281088366488556216", + "y": "1256405561191410414795743888855275228926784009312941392646135310026723881374" + } + ], + [ + { + "x": "2109728173172783512040071578651142009816228752528549497112497051656119473050", + "y": "26879343390918671856874319862631606438384778380446383803136630809789192580918" + }, + { + "x": "8298554989797500223279738387945069536461065344623923087117815692305244805181", + "y": "14604213961220832002679885312381919520205317972006252056623269891021418667758" + } + ], + [ + { + "x": "13943634174448182376815247940931042265813744069111240061757342467895852570914", + "y": "25063750438914809060729933471337407689279570216306953766440510217784927414356" + }, + { + "x": "13424298122065263774081954354359254802020995482373200160901887429452279112425", + "y": "5345635169251134494839587895611594948129955200262992056476591001863604152344" + } + ], + [ + { + "x": "28332044787787649530206438142681690575633569398435824440397901404890109827088", + "y": "15070236799501512361461002130687152466390176205891386090515362353905681855150" + }, + { + "x": "7913704418767632812194465764723003055357490599632299159826467004979643825614", + "y": "26275156992217718050126471345123058951831113068339109288574503133695560222168" + } + ], + [ + { + "x": "2362355829097432225503989114930064532201676231047432444993472736952616060341", + "y": "11748140881723066990370178548980752994994292492413310315362862664365142598730" + }, + { + "x": "14626774977167810971490282672520745658094515740710173412492355982409828731114", + "y": "4076280372342995817615198826079522558005522180938762118494541874377710769" + } + ], + [ + { + "x": "27544384617713568819908679792497535778442449300073683880585714372374689671675", + "y": "21218686215413386690057007607786998858561294544538363147899502558869834994225" + }, + { + "x": "22384046999428428422169594958561233774790624923632321443562306089234689835829", + "y": "14951086400158133005538271075273987524538767511546875590688327493614921260286" + } + ], + [ + { + "x": "19660870497921467214668596014780943206003172849197918985328039816602652296225", + "y": "13605515570361634802530936053058342744127362534921237056069790766378906033268" + }, + { + "x": "10072360092562534047296584245631456309924211418379671373245294368219343538918", + "y": "25669748128808522700352435251911688565034384584829951257449311324203852368199" + } + ], + [ + { + "x": "20614125220820076547455775886107204177478044966346591861710580833419026767737", + "y": "26959764888206120893812299903114305899957219212456347975993358542892108355448" + }, + { + "x": "15046061455039450425264181166533806097576443372027905803052054737871592896447", + "y": "5168951755940726286354787061478329446424617908778369062464901687782485215845" + } + ] + ], + "delta": { + "x": "25269110726284165847344997255875198654023777249470692692495770244607517905232", + "y": "15399427935609677815530603826013116733303718600794934933780271426473114786999" + }, + "z1": "e67268f7113b8bda99702900dbdd5ca80c86a3faf372097d1ef54a63f0e28f30", + "z2": "fdfa0c21975fbc55279640bc0c9e48888e1a975242c716d749fac93a1445e519", + "sg": { + "x": "3124466425544846187408255718304470460313558042937915202987191922538498950681", + "y": "16797923120559997287472815420025330404673174866136470764264296578223738263391" + } + } } \ No newline at end of file diff --git a/verifier_circuit_tests/src/lib.rs b/verifier_circuit_tests/src/lib.rs index 6bd9ada6..0172179b 100644 --- a/verifier_circuit_tests/src/lib.rs +++ b/verifier_circuit_tests/src/lib.rs @@ -191,6 +191,15 @@ pub struct UncompressedPoint { pub y: String, } +impl From<&Pallas> for UncompressedPoint { + fn from(value: &Pallas) -> Self { + UncompressedPoint { + x: value.x.to_biguint().to_string(), + y: value.y.to_biguint().to_string(), + } + } +} + /// Useful for serializing into JSON and importing in Typescript tests. #[derive(Serialize, Debug)] pub struct UncompressedPolyComm { @@ -204,15 +213,9 @@ impl From<&PolyComm> for UncompressedPolyComm { unshifted: value .unshifted .iter() - .map(|u| UncompressedPoint { - x: u.x.to_biguint().to_string(), - y: u.y.to_biguint().to_string(), - }) + .map(UncompressedPoint::from) .collect(), - shifted: value.shifted.map(|s| UncompressedPoint { - x: s.x.to_biguint().to_string(), - y: s.y.to_biguint().to_string(), - }), + shifted: value.shifted.map(|s| UncompressedPoint::from(&s)), } } } @@ -465,6 +468,41 @@ impl From<&RecursionChallenge> for RecursionChallengeTS { } } +#[derive(Serialize)] +pub struct OpeningProofTS { + lr: Vec<(UncompressedPoint, UncompressedPoint)>, + delta: UncompressedPoint, + z1: String, + z2: String, + sg: UncompressedPoint, +} + +impl From<&OpeningProof> for OpeningProofTS { + fn from(value: &OpeningProof) -> Self { + let OpeningProof { + lr, + delta, + z1, + z2, + sg, + } = value; + + let lr = lr.iter().map(|(g1, g2)| (g1.into(), g2.into())).collect(); + let delta = delta.into(); + let z1 = z1.to_hex(); + let z2 = z2.to_hex(); + let sg = sg.into(); + + OpeningProofTS { + lr, + delta, + z1, + z2, + sg, + } + } +} + /// A helper type for serializing the proof data used in the verifier circuit. #[derive(Serialize)] pub struct ProverProofTS { @@ -474,6 +512,7 @@ pub struct ProverProofTS { prev_challenges: Vec, commitments: ProverCommitmentsTS, ft_eval1: String, + proof: OpeningProofTS, } impl From<&ProverProof>> for ProverProofTS { @@ -483,6 +522,7 @@ impl From<&ProverProof>> for ProverProofTS { prev_challenges, commitments, ft_eval1, + proof, .. } = value; @@ -494,6 +534,7 @@ impl From<&ProverProof>> for ProverProofTS { .collect(), commitments: ProverCommitmentsTS::from(commitments), ft_eval1: ft_eval1.to_hex(), + proof: proof.into(), } } }