diff --git a/yarn-project/bb-prover/src/prover/bb_prover.ts b/yarn-project/bb-prover/src/prover/bb_prover.ts index 0b699e74889e..ccc164899d61 100644 --- a/yarn-project/bb-prover/src/prover/bb_prover.ts +++ b/yarn-project/bb-prover/src/prover/bb_prover.ts @@ -342,7 +342,7 @@ export class BBNativeRollupProver implements ServerCircuitProver { await fs.rm(bbWorkingDirectory, { recursive: true, force: true }); const output = convertOutput(outputWitness); - const proof = new Proof(rawProof); + const proof = new Proof(rawProof, vkData.numPublicInputs); logger.info( `Generated proof for ${circuitType} in ${provingResult.duration} ms, size: ${proof.buffer.length} fields`, { diff --git a/yarn-project/circuits.js/src/structs/proof.ts b/yarn-project/circuits.js/src/structs/proof.ts index 875a5b947e0a..2480887471c2 100644 --- a/yarn-project/circuits.js/src/structs/proof.ts +++ b/yarn-project/circuits.js/src/structs/proof.ts @@ -1,3 +1,4 @@ +import { Fr } from '@aztec/bb.js'; import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize'; const EMPTY_PROOF_SIZE = 42; @@ -16,6 +17,8 @@ export class Proof { * Holds the serialized proof data in a binary buffer format. */ public buffer: Buffer, + + public numPublicInputs = 0, ) {} /** @@ -27,9 +30,10 @@ export class Proof { */ static fromBuffer(buffer: Buffer | BufferReader): Proof { const reader = BufferReader.asReader(buffer); + const numPublicInputs = reader.readNumber(); const size = reader.readNumber(); const buf = reader.readBytes(size); - return new Proof(buf); + return new Proof(buf, numPublicInputs); } /** @@ -39,7 +43,7 @@ export class Proof { * @returns A Buffer containing the serialized proof data in custom format. */ public toBuffer() { - return serializeToBuffer(this.buffer.length, this.buffer); + return serializeToBuffer(this.numPublicInputs, this.buffer.length, this.buffer); } /** @@ -50,6 +54,14 @@ export class Proof { return this.toBuffer().toString('hex'); } + public withoutPublicInputs(): Buffer { + if (this.numPublicInputs > 0) { + return this.buffer.subarray(Fr.SIZE_IN_BYTES * this.numPublicInputs); + } else { + return this.buffer; + } + } + /** * Deserialize a Proof instance from a hex string. * @param str - A hex string to deserialize from. @@ -66,5 +78,5 @@ export class Proof { * @returns The empty "proof". */ export function makeEmptyProof() { - return new Proof(Buffer.alloc(EMPTY_PROOF_SIZE, 0)); + return new Proof(Buffer.alloc(EMPTY_PROOF_SIZE, 0), 0); } diff --git a/yarn-project/end-to-end/src/composed/integration_proof_verification.test.ts b/yarn-project/end-to-end/src/composed/integration_proof_verification.test.ts index bbfafefef05f..49ad6b4161ef 100644 --- a/yarn-project/end-to-end/src/composed/integration_proof_verification.test.ts +++ b/yarn-project/end-to-end/src/composed/integration_proof_verification.test.ts @@ -3,7 +3,7 @@ import { BBCircuitVerifier } from '@aztec/bb-prover'; import { Fr, HEADER_LENGTH, Proof } from '@aztec/circuits.js'; import { type L1ContractAddresses } from '@aztec/ethereum'; import { type Logger } from '@aztec/foundation/log'; -import { BufferReader } from '@aztec/foundation/serialize'; +import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize'; import { AvailabilityOracleAbi, RollupAbi } from '@aztec/l1-artifacts'; import { type Anvil } from '@viem/anvil'; @@ -28,9 +28,17 @@ import { getACVMConfig } from '../fixtures/get_acvm_config.js'; import { getBBConfig } from '../fixtures/get_bb_config.js'; import { getLogger, setupL1Contracts, startAnvil } from '../fixtures/utils.js'; +/** + * README + * + * If this test starts failing, regenerate its fixture with + * AZTEC_GENERATE_TEST_DATA=1 yarn workspace @aztec/end-to-end test e2e_prover + */ + describe('proof_verification', () => { let proof: Proof; let block: L2Block; + let aggregationObject: Fr[]; let anvil: Anvil | undefined; let rpcUrl: string; let walletClient: WalletClient; @@ -112,12 +120,15 @@ describe('proof_verification', () => { }); beforeEach(async () => { - proof = Proof.fromString( - await readFile(join(fileURLToPath(import.meta.url), '../../fixtures/dumps/proof.txt'), 'utf-8'), - ); - block = L2Block.fromString( - await readFile(join(fileURLToPath(import.meta.url), '../../fixtures/dumps/block.txt'), 'utf-8'), + // regenerate with + // AZTEC_GENERATE_TEST_DATA=1 yarn workspace @aztec/end-to-end test e2e_prover + const blockResult = JSON.parse( + await readFile(join(fileURLToPath(import.meta.url), '../../fixtures/dumps/block_result.json'), 'utf-8'), ); + + block = L2Block.fromString(blockResult.block); + proof = Proof.fromString(blockResult.proof); + aggregationObject = blockResult.aggregationObject.map((x: string) => Fr.fromString(x)); }); describe('bb', () => { @@ -127,7 +138,7 @@ describe('proof_verification', () => { }); describe('UltraVerifier', () => { - it('verifies proof', async () => { + it('verifies full proof', async () => { const reader = BufferReader.asReader(proof.buffer); // +2 fields for archive const archive = reader.readArray(2, Fr); @@ -144,22 +155,12 @@ describe('proof_verification', () => { }); it('verifies proof taking public inputs from block', async () => { - const aggObject = proof.buffer.subarray( - Fr.SIZE_IN_BYTES * (HEADER_LENGTH + 2), - Fr.SIZE_IN_BYTES * (HEADER_LENGTH + 2 + AGGREGATION_OBJECT_SIZE), + const proofStr = `0x${proof.withoutPublicInputs().toString('hex')}`; + const publicInputs = [...block.archive.toFields(), ...block.header.toFields(), ...aggregationObject].map(x => + x.toString(), ); - const justTheProof = `0x${proof.buffer - .subarray(Fr.SIZE_IN_BYTES * (AGGREGATION_OBJECT_SIZE + HEADER_LENGTH + 2)) - .toString('hex')}` as const; - - const publicInputs = [ - ...block.archive.toFields(), - ...block.header.toFields(), - ...BufferReader.asReader(aggObject).readArray(16, Fr), - ].map(x => x.toString()); - - await expect(verifierContract.read.verify([justTheProof, publicInputs])).resolves.toBeTruthy(); + await expect(verifierContract.read.verify([proofStr, publicInputs])).resolves.toBeTruthy(); }); }); @@ -184,20 +185,14 @@ describe('proof_verification', () => { }); it('verifies proof', async () => { - const aggregationObject = proof.buffer.subarray( - Fr.SIZE_IN_BYTES * (HEADER_LENGTH + 2), - Fr.SIZE_IN_BYTES * (HEADER_LENGTH + 2 + AGGREGATION_OBJECT_SIZE), - ); - const proofBuffer = proof.buffer.subarray(Fr.SIZE_IN_BYTES * (HEADER_LENGTH + 2 + AGGREGATION_OBJECT_SIZE)); - await availabilityContract.write.publish([`0x${block.body.toBuffer().toString('hex')}`]); await expect( rollupContract.write.process([ `0x${block.header.toBuffer().toString('hex')}`, `0x${block.archive.root.toBuffer().toString('hex')}`, - `0x${aggregationObject.toString('hex')}`, - `0x${proofBuffer.toString('hex')}`, + `0x${serializeToBuffer(aggregationObject).toString('hex')}`, + `0x${proof.withoutPublicInputs().toString('hex')}`, ]), ).resolves.toBeDefined(); }); diff --git a/yarn-project/end-to-end/src/e2e_prover/e2e_prover.test.ts b/yarn-project/end-to-end/src/e2e_prover/e2e_prover.test.ts index 016b1c9f2209..923d40256ca6 100644 --- a/yarn-project/end-to-end/src/e2e_prover/e2e_prover.test.ts +++ b/yarn-project/end-to-end/src/e2e_prover/e2e_prover.test.ts @@ -1,5 +1,6 @@ -import { type Tx } from '@aztec/aztec.js'; +import { type Fr, type Tx } from '@aztec/aztec.js'; import { type BBNativeProofCreator } from '@aztec/bb-prover'; +import { getTestData, isGenerateTestDataEnabled, writeTestData } from '@aztec/foundation/testing'; import { type ClientProtocolArtifact } from '@aztec/noir-protocol-circuits-types'; import { FullProverTest } from './e2e_prover_test.js'; @@ -73,6 +74,27 @@ describe('full_prover', () => { ]); tokenSim.transferPrivate(accounts[0].address, accounts[1].address, privateSendAmount); tokenSim.transferPublic(accounts[0].address, accounts[1].address, publicSendAmount); + + if (isGenerateTestDataEnabled()) { + const blockResults = getTestData('blockResults'); + // the first blocks were setup blocks with fake proofs + // the last block is the one that was actually proven to the end + const blockResult: any = blockResults.at(-1); + + if (!blockResult) { + // fail the test. User asked for fixtures but we don't have any + throw new Error('No block result found in test data'); + } + + writeTestData( + 'yarn-project/end-to-end/src/fixtures/dumps/block_result.json', + JSON.stringify({ + block: blockResult.block.toString(), + proof: blockResult.proof.toString(), + aggregationObject: blockResult.aggregationObject.map((x: Fr) => x.toString()), + }), + ); + } }, TIMEOUT, ); diff --git a/yarn-project/end-to-end/src/fixtures/dumps/block.txt b/yarn-project/end-to-end/src/fixtures/dumps/block.txt deleted file mode 100644 index 2d66b194d910..000000000000 --- a/yarn-project/end-to-end/src/fixtures/dumps/block.txt +++ /dev/null @@ -1 +0,0 @@ -07112ac9f8e0c4748801472696fd4043775f20fbd4b6458d23572217cca758a40000000800000000000000000000000000000000000000000000000000000000000000010052cb94973b5c5d2ca911a77f3394d2947fe1d6f247b49b58d6bcd4d9e34d6e00089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c0007638bb56b6dda2b64b8f76841114ac3a87a1820030e2e16772c4d294879c31864fcdaa80ff2719154fa7c8a9050662972707168d69eac9db6fd3110829f8000000080224e27dca8480ee6cc8528ad117af0da5c4125181ca7b920330c9df7f164cb94000004000c183c5a7d161fa8a8ed5ea4673ce8aaa7f131d68ad662013685b841d8ffd7fa00000480213826ddd730ddadb2681940176c54d344f085244859e4e38c1ee01bc19fafb7000002400000000000000000000000000000000000000000000000000000000000007a690000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000664b36a40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001186c1f2e54fb69511ec7ebd3a85ed6dbae8b7d1684b7e2b08af3c2003d0741fd00000009000000020000000000000000000000000000000000000000000000000000000000000000000204669539d851899e5286bd78bb8cb9b017b276b108268f19fb651a24bb25ed19066ce22aa87f013be351c20267fa27656c4ff97ee366e7c0e310029388d2f662022111b2559cae2a97dee1228853d8f4bc9dcf2056e467fdf6f1f6c7c62300fc8c10a3d0a66c6dfa8891be1d15a1ed8e3f6880942b16ec336d5b93376e6f48f0b30000000000000000000000000000000000000000000000000000000000000000026800000000000000000000000000000000000000000000000000000000000000000000026c000002680000013000000000000000000000000000000000000000000000000000000000000000210af978fd4256dd9d79e5691bfd8161bb0cc5006425137cc8dd04b6a5968588558e2d7dfd58ea8aaec3b43fe6f0e14bfe5875daf76311a0bacd297da399a2c97fc15d43b0b04ed7691b07617b0d96f67ebf675d6a8f711fb43aadbc6f14c5724cbf225db4bdf2f10197fddc9cc9315535973a1cb480d6c3c579f4bbb1b9929e117e79401ddb435a03a0a2f5d1937ec47763031485f578832e94ae0ccc213ef58cae12e7d668b34999dabb502dd42a82dbbf2808d1acca70b8a7e4edd901ba9097d4cd37424223c162efd8bb4a8b68718f27b10b5118c247bfc192165fb280ca98ca0847d96d9c0d11ecf3edc2ab19d5340a1980e9feb17f0a576a2cc0165cdee20f07abc37d23592116b469c7941d9b5f000001300000000000000000000000000000000000000000000000000000000000000021430893dfd143f02a76f34414992b19db1d67ffed6c9c83ad89fe9b91fe8d3a3979d11eac1328869b061bb3818febad952f2356b825f46fa16453b8e9f36c4f4f1bb27bac7794d953e83ee2415c89696beced3e8ac74207bfd43f32e0102533b23816e4501bfe03b099f4f6d0a5155fefcffbf3f3770bb23a235a6a871faf93ebc80e3cc2b7c8b67509aa7424bb468c7f2ec87c83adcfc36332bd0b8585085fc7de7e1109b786a60d13a6972e91f7f0ef9280135012178ffbaaaf2acc6266d151e083849c9949c24de52e08df261c17d612277251cc109ceb84f4ecb8c20d9a1f82ae950e882a972ed1397e523e4fdd3e147f9385e3d363a0774f6be956454af8eab2a702f9c9154c1d00ce2a2aeba7db0000000400000000000000040000000000000000000000000000000000000000000000000000000000000000000bebc6000001231f9e43e44cb1876430fbb1fe827dc890994dcfa5946fd1b71b15e19af8eb850002096335edb57a79f623ba83298326fd49b9a9250bc4d673892eae270bd5f9b32e00000000000000000000000000000000000000000000000000000000000013881bd4b02c74770a6c5ef1f3be4fe85b0e83cb7d0812c8912cf71fa9ec83ebe8bd00000000000000000000000000000000000000000000000000000000000013880000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000400000000000000080000000000000000 \ No newline at end of file diff --git a/yarn-project/end-to-end/src/fixtures/dumps/block_result.json b/yarn-project/end-to-end/src/fixtures/dumps/block_result.json new file mode 100644 index 000000000000..7e1cd2f3d1e4 --- /dev/null +++ b/yarn-project/end-to-end/src/fixtures/dumps/block_result.json @@ -0,0 +1 @@ +{"block":"22005aa72e88f7e797202c81799c71ed779e0558ae417c8bfd345639f7b4d15e000000080000000000000000000000000000000000000000000000000000000000000001003faf062c3e9af3e664c57162168d6afa8003810742f8df3f9a7e4248c4681c00089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c0007638bb56b6dda2b64b8f76841114ac3a87a1820030e2e16772c4d294879c31864fcdaa80ff2719154fa7c8a9050662972707168d69eac9db6fd3110829f800000008011d2bc987951707171e86f696caeed3f2aef1073082c71cbee81b7c8bb6f255000000400281d1b2217186e3c43c23013e375e788e03c4059ac4a3eb49e0a63109b443dd6000004800e8c8b3a9dd704220ce7db0010faa27e69c46d3e86d0229f0131d704ec0dfd3b000002400000000000000000000000000000000000000000000000000000000000007a690000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000664d0cde00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010f4e9a1542f3aee1ac3ac023c4a4e14e854e69cd59441c1de455435d71d1d4ae0000000900000002000000000000000000000000000000000000000000000000000000000000000000020a56a677c03442caf4b781d8a3bcac871982f48a304827a4e15436fc0908acc12484f8a98c8786aa71b08966261a7f3f0f03464409f7e232030e9263336d42f30219dc3885eda4a6c04828e8650af3196c28d7f9990773b9ea4adb721ca13f3c0e2591cc9ff0b0c22eba7fabdf6c738dbfa36a458880b72dc0fec95fef35b9ce0c0000000000000000000000000000000000000000000000000000000000000000026800000000000000000000000000000000000000000000000000000000000000000000026c000002680000013000000000000000000000000000000000000000000000000000000000000000210aa631d6823203733cfb223e2f073e5868d17d6771279c9b221e66accb2ef3048707ded5675a0a09b9fe8809e0807109373013cc6b4bf82e1378beaba044a2ca752f49fbbb0efdc87cb77ebf0877a3e32bcb267441f369b4e52541a92281bd1e84c889405a74b9902833edc9da6484f4bf883a57ebe3e81496290c41c4359230bb614b0e14e7a358850784e0eb525221e2958f452e4e17a2a7c2f5e681b0ff18b1761b9950efcc79b060dd5cff7bc7ac4e120c135c98e4ad1fa33b4190d01c7575cc6f725507bced2106595cf886b9a72f0f4d58915490ea8f79166c4bf7d0586b8a72e89eb38382a3af71375eebfac3086e7f8e649d1e078a569474534cdac37e31873ea1ed263aa49071b2f22b1797000001300000000000000000000000000000000000000000000000000000000000000021304aab8b4a22a53b1c5eea492950bcde375e3492c06723a85e94a3a97623a6fe3069a86e597f32ea113ce31f19f9a351aed52d42bed9f50dc85574795201cd22601d748496d54a04098a4d95cab51ac6ba494fbb656ee4281d1699d4d23847d95e0446f0615df24a2016e33de845debde4ac857e412655f04048919e29e1f22c368f9475666482fdd51708055c707fed2297518d6dc2a2582d835e568067860cc9171725d8b8f4dd2b2c6aa4ac76f8357bfc8612f3875ce52f8862987b8e9f1c77f28a05458402b74de50b6ca57c26ad203a3d7f3d6bbae0ff336f3bb8f70c928c4056c70c4d3c55e653cab1789a49fa10d9c010d8ced3eef55ca956eb802c0acf721bc470ed30bf93ad48e657f8df650000000400000000000000040000000000000000000000000000000000000000000000000000000000000000000bebc60000012f443d81c7fd03af60628389db8a841ebf0d6128b9d0e677426cb72a9915739a000214802bf3a344c8331c8033f60496b94d1e282192ea692bf046f89c3aa67944c30000000000000000000000000000000000000000000000000000000000001388177be18bd2b16ad446144034f0eaac67c819e5754460606cdcfbad90db36ddb100000000000000000000000000000000000000000000000000000000000013880000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000400000000000000080000000000000000","proof":"0000002800000d600f4e9a1542f3aee1ac3ac023c4a4e14e854e69cd59441c1de455435d71d1d4ae000000000000000000000000000000000000000000000000000000000000000922005aa72e88f7e797202c81799c71ed779e0558ae417c8bfd345639f7b4d15e00000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000001003faf062c3e9af3e664c57162168d6afa8003810742f8df3f9a7e4248c4681c00089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c0007638bb56b6dda2b64b8f76841114ac3a87a1820030e2e16772c4d294879c31864fcdaa80ff2719154fa7c8a9050662972707168d69eac9db6fd3110829f80000000000000000000000000000000000000000000000000000000000000008011d2bc987951707171e86f696caeed3f2aef1073082c71cbee81b7c8bb6f25500000000000000000000000000000000000000000000000000000000000000400281d1b2217186e3c43c23013e375e788e03c4059ac4a3eb49e0a63109b443dd600000000000000000000000000000000000000000000000000000000000004800e8c8b3a9dd704220ce7db0010faa27e69c46d3e86d0229f0131d704ec0dfd3b00000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000007a690000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000664d0cde0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000006aca0ef65a17d0662000000000000000000000000000000000000000000000000c44ec2d0954a96b20000000000000000000000000000000000000000000000054f8eca26755a4efb00000000000000000000000000000000000000000000000000027f64c3eeb1cd00000000000000000000000000000000000000000000000df94cd06f2d2df0ec000000000000000000000000000000000000000000000002e624d0d96914b57b0000000000000000000000000000000000000000000000029802aabad771ab5d00000000000000000000000000000000000000000000000000020d673f49be12000000000000000000000000000000000000000000000004ce30f9ef0e893acc00000000000000000000000000000000000000000000000cab0c43bbc68da83f00000000000000000000000000000000000000000000000611ece4bc5bbbf05e000000000000000000000000000000000000000000000000000270e14f97e90c00000000000000000000000000000000000000000000000e0dbe805a5d7a47bc00000000000000000000000000000000000000000000000d3d64bd1816a84e740000000000000000000000000000000000000000000000081d1249a975c99cb700000000000000000000000000000000000000000000000000012f522dd126ad0089279e26dd4dc3511fe5bf2ad26b4e8b36fde88681694b9e828ff72c7d3095123b1b42b6bffb2d78d28d852c32375dbf406518472f4f497095a8fa2dece1a60bb6e0006de21ef215e49134ad94920acc90f4fbf44c431ed95296adfcad17471d3085178828844757a91091b2ec935331a4c1959db96c5c53c2f63db77933a8077d292ef50b3a9002284d8dbea6c51505a3b02a0d02b58f7b922ea82d64af7e196af0b670d2729d143c0d5e0d5e422bb39854f2c4823a8810e2ffb9211885070209a8265b8777a9179e9fc37afe4630cb89a8c11e1e5ea970702abf0822fcc62933cc299817e050d58d856fb7030570c9f7d0beb8fc4f3ad6135bae0ffda69d23b5e343dbea6c7e3dd83cc82addddac965983fad40778ef09d582f13e3f97ba0952d0a90754f038995f0240842204940cb1b2da49690ab1e7be05602007d62c28cfbe56f48c99ff4b8ee89a7df302e0a62f21dadc02f0d993a99a2667114dd401ccf2afc5df6caff3636abb755cf3090778f7c45595cca7ff3a349a822dc2cf25e0a04f62b2498f06d81e9649705abebaf2cb54240864c80bb155959b2f5c6b290ceb178b82a8196a610f8d71c5d90332690c874f1463b81b182287cd3521d8191063e6cead6e31e4ebfa7172cbe62483842787df8f686b0c3ab0b72fcd081229b1cd8611cfdca3666b2b3eb58dcaca195ecae8946f3139dccf0dedc1ecd8b6179eac9bb3e6ded3c3d330db1ad0d442012fe297f284aa7563ce9655f29ad4592bbd132c44aa87fb55ecd334b545a48a0b4967e8dcbb65c1deb7c47e2644ec510eeea73d2f6310c8bb9e611d638e994d9dc93fe1a6f1ecb872adeaece5f0d2011a962a6986a882b449d282ec6c1eb3ac8f0f0cedb7782efb6e400bdad863c69a2e423f8e00cb5a4f33be712c923e9711a9435467db525acb72169ce2d5c0b28813bf576b95ee07e03a9c9542b1e2e4f070afd89da14978702c9ef6c893117c9a1bc5adb46ebf0b5a3f7e082a3736e724b5252798624c1c2efa0e64bb39a7c74925870f663963ffd7338f8882b9d7167c24cdc27e5912410035e28d4f5201fc7d2d9c3adef0ff915c61f6e551c18a602231b2d2cc17b6b4a117973ad954a2db95274c896ef36f713d51159cd84684dbed9cf23c00a7849db0583b53886c00506a1c470a316a0a59efecbf1a2d332ade3bb30e75327ab03e654f045ffb59c7413325ffc20bbcdba64b7fbea0ebcfb9534c2a20190c156933c54cc38c90a6e52ef812107edc9fe0581733b9fc33e9580b1f737b0f570db4eb2377dbe037b03467df081100d353e9aa8429d45b3de650da8553fadc8d14fb2f283cf7bc5fae42b1f32e657f06c310e18c4d60d739dae38e320bb41d7ebcfea79192b6ba4ee71babd2012c55c615b543eaa283caf8cdcc5eb3d7db223600737826e917c8b57a225d782024717ca0ef810dceb65861b7fdae5facef4898353df651a7248cc8507bfaf31fd04f70390cf5b553b0a8cddddff16332268079ae591ce7ddc19d8899a5060a0cf640193788c128b1a7fd222c88beddb84117c4bd5c65b56845304ba54d6ede04e82456890ef0051aeb572dfe743ec20200ed2bf5da31db9857693c07fa6bf3114b9fda7b706406fb4090de23a99261c8650ddd85072b3153a7b1857c90004e0ee42bba41c8e36bffa7a8e8ff63b57a14e512ca69e9f4e9de382dd78d2519841ee5f868bbd5c08fd767e22bd1f5eb49fcdbd93c9c118f7ede911b8da0a4839d1627c02d4315e488749c49d44fc65c0973fd6be4a30d410e4c02a31ff27860b905ebb74ee499916a8cb81a16255971460d2790513b49fa76beec84a97bf8470a2f9032db62205d3c9539c68f9fd01ccc72a308483a2cf109694debc1fac77d4320f4b503afef94816633c68539b11a61596951d2b4443f41bd4161e509c427b014e4dfe2166acb46bb42d2143f5d7751620ca53c6986e41a5ad5f2648aa9c17310936011fe3e38ed3c4701ee191f4445178dbf8f381c32a1b250597315ba47a92356bf0593fb8f6a72f517fc091bc66d5a5abbf25d13b79e0b26a4d4fc4f684c21fe91d59c9ad2b5f72a9010bd740c39fe7dccc887a6fac50e24832f1b256fcf23788b2c6267172f3c59641e40c671957774b229ce5776ab81afe61a1e966ffb26c3ba311c56f3dc32c50d59aaf2d3915bbb7360c6f44dfd8c25a1916d84f92c1034b39e01f78506b6c32596f1e61d57d3f9af7de9bd69321a2b8cf03608742b1439fb6bab58680355d11da856e38bbcecebe79d74ee561b031ea9a1ea8ba91f29b619d8201d4909270fd2125e70c91b4df323ade07d45ba058891ab0a1c8b2522209604d9aa7e737b59f5f4741257e205525917382002bb18ac0e850c5ae6a61883f525bedad389ce83b84e530f57eb53f21dc72cc5840d83d7fbc27c581a8d1ec6658e32811f77e89b21e3c1beca72a43c4287de0e53db495f2baf742f88321ef1ca5fb29bc5568c43358dd831c2f32593a1aa0842a1315fedf14614e8b84e16b75e466fefe4a57123e6915032fb37f17e0146195a05a12a151f158f819c171537cf09aaeb9a06bef8016a8e5ea480d803eb62f37022d92950384f64ab8ea02b190a8db76a42a58ae2b680343cfa5175b3c48db8983cf9e4c3e2cc07737dbb05c68cd489f89d4140c8926e5bb54aa95c79aedf4598bf00e4e2e8843fb5a2812aaa0111fd384dd69b00708c288db5b82e0b7ccb519c3312ddf34235f80bb2ba0239b5011ddac647f0c68729b741441d5b7d1863af012042d708a8d812eea6161dcabc6834f76015cc8653e87d28b6103624c180b6d31afd9b506bc059418fdf1cc189a0049efc37d035764c77d940a014bc6e4bb0000fec0d68ae66d644252c0b80e762b33a62404c8de30280ef43b3b623455ba89909473b161f8c4c0341c32d55f5cb75b719f62d7d53640b26d65c5f4a0c272b3baa14a4ee432a19c63a3215adf07294a6f702a9f83f858ade0c74a130ea143987df6944c83e6a5b6c725a","aggregationObject":["0x000000000000000000000000000000000000000000000006aca0ef65a17d0662","0x000000000000000000000000000000000000000000000000c44ec2d0954a96b2","0x0000000000000000000000000000000000000000000000054f8eca26755a4efb","0x00000000000000000000000000000000000000000000000000027f64c3eeb1cd","0x00000000000000000000000000000000000000000000000df94cd06f2d2df0ec","0x000000000000000000000000000000000000000000000002e624d0d96914b57b","0x0000000000000000000000000000000000000000000000029802aabad771ab5d","0x00000000000000000000000000000000000000000000000000020d673f49be12","0x000000000000000000000000000000000000000000000004ce30f9ef0e893acc","0x00000000000000000000000000000000000000000000000cab0c43bbc68da83f","0x00000000000000000000000000000000000000000000000611ece4bc5bbbf05e","0x000000000000000000000000000000000000000000000000000270e14f97e90c","0x00000000000000000000000000000000000000000000000e0dbe805a5d7a47bc","0x00000000000000000000000000000000000000000000000d3d64bd1816a84e74","0x0000000000000000000000000000000000000000000000081d1249a975c99cb7","0x00000000000000000000000000000000000000000000000000012f522dd126ad"]} \ No newline at end of file diff --git a/yarn-project/end-to-end/src/fixtures/dumps/proof.txt b/yarn-project/end-to-end/src/fixtures/dumps/proof.txt deleted file mode 100644 index 1854312d0be0..000000000000 --- a/yarn-project/end-to-end/src/fixtures/dumps/proof.txt +++ /dev/null @@ -1 +0,0 @@ -00000d60186c1f2e54fb69511ec7ebd3a85ed6dbae8b7d1684b7e2b08af3c2003d0741fd000000000000000000000000000000000000000000000000000000000000000907112ac9f8e0c4748801472696fd4043775f20fbd4b6458d23572217cca758a4000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000010052cb94973b5c5d2ca911a77f3394d2947fe1d6f247b49b58d6bcd4d9e34d6e00089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c0007638bb56b6dda2b64b8f76841114ac3a87a1820030e2e16772c4d294879c31864fcdaa80ff2719154fa7c8a9050662972707168d69eac9db6fd3110829f800000000000000000000000000000000000000000000000000000000000000080224e27dca8480ee6cc8528ad117af0da5c4125181ca7b920330c9df7f164cb9400000000000000000000000000000000000000000000000000000000000004000c183c5a7d161fa8a8ed5ea4673ce8aaa7f131d68ad662013685b841d8ffd7fa0000000000000000000000000000000000000000000000000000000000000480213826ddd730ddadb2681940176c54d344f085244859e4e38c1ee01bc19fafb700000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000007a690000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000664b36a4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000cca67970875af217000000000000000000000000000000000000000000000000ef91c2ee6b1d18b45000000000000000000000000000000000000000000000004cb3fbd89cbe708b3000000000000000000000000000000000000000000000000000233fee040a2e000000000000000000000000000000000000000000000000c7ce7ee68bf26a9fd00000000000000000000000000000000000000000000000bd00fda94c1a2db0500000000000000000000000000000000000000000000000a2a2ec8f5353c204600000000000000000000000000000000000000000000000000029e492f8a6e8f0000000000000000000000000000000000000000000000016c867be355d9585b0000000000000000000000000000000000000000000000006dc9f87e1e97ed8c00000000000000000000000000000000000000000000000cbd5a919d2c695549000000000000000000000000000000000000000000000000000205ff2d100e0b00000000000000000000000000000000000000000000000ef20d7a141e12695b00000000000000000000000000000000000000000000000742de8e4b3058295e00000000000000000000000000000000000000000000000e99d1f38e7848704e0000000000000000000000000000000000000000000000000000f249cb02427f22cf23b63e50197508806ad2f4457c581480082d29eb23fb34291aa1b326e05e1ca766b75744659d29cd979cce85ade8fca802f8b007d82c0cfdfabc5b01003f284c9eed484e56a49fbdfd1b1a72ecd055bedb1b600264cb267652c394fcd7d818d51c5d79263f0b186c55f75e1748d0d9939e04c73dedd19a8398fe50366c750c46340f54ced2368081db63ebd8424cae0c7dd23940e450ba7c70c9b18aa4392ec3cb74653d1f2b9c7697a2d62ce86c0f21a98143cf71ffde9a77c12030725411cff8cd43b037af6d00d12da8a9fcbd5b084c798233dfd3bb84cbe12f6c553114047880449b31abce873270b7e4bd03fe328c15bf25da7862e74c714fd8e86728afab08dc411b52bd658b17c4acf33c59d413b842975342d102cd01256e9f2902c249412e2bf222ff31fe65fb96246e832e272451921d0c83a2e65f7674bd3700214e1024234d8d9a724974b3940dd12a23755a393292d41cb390918fc991880fcafe155ad85ba9c306a7c3b351707f349a5347f8c668079bbcec3d5f9a26780811c54970eaa11fe2f50db383c51a400ee1079c41996f7c2bd3b3de1383cb5d0113ef743c96758b39a27fe93fa898a486d1a42852ec75d861f9fdd03494f6b926666f5f38cf6c1ba61434ed59062746a02266a52229cd0c93f09dca7f4fd22a27542ce86b00a4c95d7d339885705c1bd9d20a2dcb7bc2f83438851f6534234c04ab89e34bf892873f140f07772cbd19c83b9d18e4f1c975f70d0bfab6db90cc26be3b2ce10a127d5bbc34721b3bd839ab03738d58c086a89432a9c523721fc400e71e0bc1cc4dc3e1ccf4d5db2d848aceac691bf9565ed8ddd7985a2c23637917e661092123f7757e83d3ae93be4e7e2e3bffccbccbb22a5965f4f2ecdf2b1d2e5b66d863544336f1d9509545c1342cc68b3f94334c9300d4507c856da92b9b1fcb713ecbb75e97e1019f54a45cfc255f8c22db7dc2d30ccc7125b88a5e248f23bea42c9f216581456fb18577448a33d93ead9fbaf179822623e0afed498aff2af71c505972c9db81ae36d705b33daa30f1431c335de0ecec9c12d269cba4301d445d4f8b73a25c2f817a2638ff0af75bd469625cfdd4884acf66fa36f69c2d1a0b4afb0573b8d5ecb0cc56e76dbd7fdc9b4d913c0298137fc8bdf88b70c1af07b8cd94bc30e1e8fb82d39fb386a6c5ffe8011d1a7aec30100e1f24bb9f502217dd0b6598429dd6ac853b4c8d09601113c31467d7402919f87b2d906153c9f2146629abf3ccf54f18270f7f8e85308b451d0357d5b73a2e55ffcec436fc48ee227d549c0360d58b48192282d3594232861fd74badca6f235ddaa0664700360c0773c1543069ede2521306e49e34748336079e923b1f45585ff081cd7b8ac7e3096eb00e34fbaefbac6366d083032121d020f25658dd4b20ccda8556f43f3dfa2c855db8cf74f8b01685293d86372d7989cbaa6689dffa172e143d726c3900122235ce8cec3df6485ef995bbfc262d3e2c590caff0179fb1381898d12a76b64813c066c43622c411482a1ab1a1886f683cf1f23e98844df591c3fd79f90039e2146493645428bd61c2a4c83317d9cb46cc15d980e6d81140c4a7185997d601b71680b2bf81829383ef0b737f3b8790c3c8e262f3d663958769436771a0372e491b678c8085a4c1e49bf8b8cf98085e9277fb7c898038db7201cda635da8221b70bbbac04d09087f03b50dc41be90267032993ecf235f15351f5252be7acaccf50b9e922b2f11ac19177f03035dcb0c699cc0f46c981b889e440de8ba08f053ec02b27ff360f4288b54ce285611e625b725d32f2065382810f99e222b83dfe3f917f186782c72894eee04ca532fce1d92a9a5be07c37ac46790d7929edd0fe58b04a12fa9d9e1ba0fa94aa34360051d6439437c46fa06b6ff45dfbe325e16054502d3e397389b05310feab9c28a46aca8e69ef991262c1579cb5310b7b3e65b1a09dc1576c7e583f46f30476b3c6fa643541e244573c325ae95114f546b908fb02023e913959751e3056a8c92031ecff118a0f5073bd9447f29a4535d522358000c77b4a5de8eacf99f8cd11d59b3067da668bbecc1b4363e38315139e31f1d8c18aeb4b2cec4fc2569f882fddb6ce0c6922a7f450d4a370bd34128d10ba3f7a504024864a2b2a74502664b99db348f1c938e7fb073d8ca7bd0ccd9f4a964dfc014695bb382a75f96b31630e5340371de69f41cb37757efaae14d070a0d3de14d19593dfe2c96344bdc4d9e46cec9823445e81676da2eb08f0044dfdfac78846c1a06cc0a5f6a7cef03872268d2611a7da64a506313156f4ec66ebdb497894ede189131dcc4db394f87d15fe78fa3e1639e5b03ef55ff6fb7e87d64ef0fd454cf09be9738e7a74260c57e4e59b71cb536dc683807018dbab6b9d49cd2086efafb2e8bc084c9b9d8f9e8f2679ce594881b000e36266b37268ba9b3812e73e9e95812dd197d351d8208747261890302a6ac078ea437f3bde5507853ede1999fff3f27a5e0552b60e7f245a827139e0633bc4945df9a55c486bdd43cce50642c55ee0b8070bc0ff01968020792d274badd64f784cec1c43a3289d6a2673f1f5509be2203c4e38db9f7ef29bbffeb9d29bb5493879ab2dac27eccf6e4d7546bcd84ad0af9613dac8960d06dbb1bd5f53655c9caaf3531beda9f16a4cedb74a469d1d218560bf14bdeee68e3c8932c0b65bbf9dd83a45442734ee3da7931eaa15c301426823bdb6570a83324875b06d701b9b700036f629f20e77c4dd8963fced769a91fa58f2d07c7516501d561aecdf7adeb4c69a2be4de6cfb65d840ab508558cfb2512d30437739eb64525baad87fbfba7123aca0a11e652e1f38206f0fe998d0b1fb1b8c6ebecbc2e990649bf2cac1f5306d539646817581045813bff3038ffec20be703e8f4ae550335453df18bdc293c3f07adb77135e00043c1a788b7ab61a12ec37711850f9e5063885b5ee575241637373fe24f44f8688fbcd64615d8cd9 \ No newline at end of file diff --git a/yarn-project/foundation/src/testing/test_data.ts b/yarn-project/foundation/src/testing/test_data.ts index dba6932cd5cc..18018c7de2b8 100644 --- a/yarn-project/foundation/src/testing/test_data.ts +++ b/yarn-project/foundation/src/testing/test_data.ts @@ -4,7 +4,7 @@ import { dirname, join, resolve } from 'path'; import { createConsoleLogger } from '../log/console.js'; import { fileURLToPath } from '../url/index.js'; -const testData: { [key: string]: { toBuffer(): Buffer }[] } = {}; +const testData: { [key: string]: unknown[] } = {}; /** Returns whether test data generation is enabled */ export function isGenerateTestDataEnabled() { @@ -12,7 +12,7 @@ export function isGenerateTestDataEnabled() { } /** Pushes test data with the given name, only if test data generation is enabled. */ -export function pushTestData(itemName: string, data: { toBuffer(): Buffer }) { +export function pushTestData(itemName: string, data: T) { if (!isGenerateTestDataEnabled()) { return; } @@ -31,7 +31,7 @@ export function pushTestData(itemName: string, data: { toBuffer(): Buffer }) { } /** Returns all instances of pushed test data with the given name, or empty if test data generation is not enabled. */ -export function getTestData(itemName: string): { toBuffer(): Buffer }[] { +export function getTestData(itemName: string): unknown[] { if (!isGenerateTestDataEnabled()) { return []; } diff --git a/yarn-project/prover-client/src/orchestrator/orchestrator.ts b/yarn-project/prover-client/src/orchestrator/orchestrator.ts index 5a06fc3dbc06..ea56fa1548cd 100644 --- a/yarn-project/prover-client/src/orchestrator/orchestrator.ts +++ b/yarn-project/prover-client/src/orchestrator/orchestrator.ts @@ -27,7 +27,7 @@ import { type NESTED_RECURSIVE_PROOF_LENGTH, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP, NUM_BASE_PARITY_PER_ROOT_PARITY, - Proof, + type Proof, type PublicKernelCircuitPublicInputs, type RECURSIVE_PROOF_LENGTH, type RecursiveProof, @@ -45,6 +45,7 @@ import { createDebugLogger } from '@aztec/foundation/log'; import { promiseWithResolvers } from '@aztec/foundation/promise'; import { BufferReader, type Tuple } from '@aztec/foundation/serialize'; import { sleep } from '@aztec/foundation/sleep'; +import { pushTestData } from '@aztec/foundation/testing'; import { type MerkleTreeOperations } from '@aztec/world-state'; import { inspect } from 'util'; @@ -283,6 +284,12 @@ export class ProvingOrchestrator { block: l2Block, }; + pushTestData('blockResults', { + block: l2Block.toString(), + proof: this.provingState.finalProof.toString(), + aggregationObject: blockResult.aggregationObject.map(x => x.toString()), + }); + return blockResult; } @@ -547,7 +554,7 @@ export class ProvingOrchestrator { result.proof.binaryProof, result.verificationKey.numPublicInputs, ); - provingState.finalProof = removePublicInputs(result.proof.binaryProof, result.verificationKey.numPublicInputs); + provingState.finalProof = result.proof.binaryProof; const provingResult: ProvingResult = { status: PROVING_STATUS.SUCCESS, @@ -735,11 +742,6 @@ export class ProvingOrchestrator { } } -function removePublicInputs(proof: Proof, numPublicInputs: number): Proof { - const buffer = proof.buffer.subarray(Fr.SIZE_IN_BYTES * numPublicInputs); - return new Proof(buffer); -} - function extractAggregationObject(proof: Proof, numPublicInputs: number): Fr[] { const buffer = proof.buffer.subarray( Fr.SIZE_IN_BYTES * (numPublicInputs - AGGREGATION_OBJECT_LEN), diff --git a/yarn-project/sequencer-client/src/publisher/l1-publisher.ts b/yarn-project/sequencer-client/src/publisher/l1-publisher.ts index 99fabf939074..f4d4b7326047 100644 --- a/yarn-project/sequencer-client/src/publisher/l1-publisher.ts +++ b/yarn-project/sequencer-client/src/publisher/l1-publisher.ts @@ -171,7 +171,7 @@ export class L1Publisher implements L2BlockReceiver { archive: block.archive.root.toBuffer(), body: encodedBody, aggregationObject: serializeToBuffer(aggregationObject), - proof: proof.buffer, + proof: proof.withoutPublicInputs(), }; // Process block diff --git a/yarn-project/sequencer-client/src/receiver.ts b/yarn-project/sequencer-client/src/receiver.ts index 4e7118e9c0b4..a6630f8f0961 100644 --- a/yarn-project/sequencer-client/src/receiver.ts +++ b/yarn-project/sequencer-client/src/receiver.ts @@ -9,6 +9,8 @@ export interface L2BlockReceiver { /** * Receive and L2 block and process it, returns true if successful. * @param l2BlockData - L2 block to process. + * @param aggregationObject - The aggregation object for the block's proof. + * @param proof - The proof for the block. */ processL2Block(l2BlockData: L2Block, aggregationObject: Fr[], proof: Proof): Promise; } diff --git a/yarn-project/update-snapshots.sh b/yarn-project/update-snapshots.sh index 888886de1dac..b166a0926918 100755 --- a/yarn-project/update-snapshots.sh +++ b/yarn-project/update-snapshots.sh @@ -9,6 +9,10 @@ export AZTEC_GENERATE_TEST_DATA=1 yarn workspace @aztec/end-to-end test integration_l1_publisher.test.ts yarn workspace @aztec/end-to-end test e2e_nested_contract -t 'performs nested calls' +# this test takes considerable resources to run since it fully proves blocks +# only enable if needed +# yarn workspace @aztec/end-to-end test e2e_prover + yarn workspace @aztec/circuits.js test -u yarn workspace @aztec/noir-protocol-circuits-types test -u yarn workspace @aztec/protocol-contracts test -u