diff --git a/.circleci/config.yml b/.circleci/config.yml index bbb89ae9a2a..c77f64bc8a0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -407,18 +407,6 @@ jobs: command: create_ecr_manifest yarn-project x86_64,arm64 aztec_manifest_key: yarn-project - prover-client-test: - docker: - - image: aztecprotocol/alpine-build-image - resource_class: small - steps: - - *checkout - - *setup_env - - run: - name: "Build and test" - command: cond_spot_run_build prover-client-test 128 - aztec_manifest_key: prover-client-test - aztec-package: machine: image: default @@ -695,7 +683,6 @@ workflows: - noir-projects <<: *defaults - end-to-end: *defaults_yarn_project - - prover-client-test: *defaults_yarn_project - yarn-project-x86_64: *defaults_yarn_project_pre_join - yarn-project-arm64: *defaults_yarn_project_pre_join - yarn-project-ecr-manifest: @@ -744,7 +731,6 @@ workflows: - boxes-vanilla - boxes-react - noir-packages-tests - - prover-client-test - e2e-join - aztec-builder <<: *defaults diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d9f0f8c5699..ad26c91b495 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -178,6 +178,22 @@ jobs: timeout-minutes: 25 run: earthly-ci --no-output ./yarn-project/+test + prover-client-test: + needs: noir-projects + runs-on: ${{ github.actor }}-x86 + steps: + - { + uses: actions/checkout@v4, + with: { ref: "${{ github.event.pull_request.head.sha }}" }, + } + - uses: ./.github/ci-setup-action + with: + dockerhub_password: "${{ secrets.DOCKERHUB_PASSWORD }}" + concurrency_key: prover-client-test-${{ github.actor }}-x86 + - name: "Prover Client Tests" + timeout-minutes: 25 + run: earthly-ci --no-output ./yarn-project/+prover-client-test + docs-preview: needs: setup runs-on: ${{ inputs.username || github.actor }}-x86 @@ -257,6 +273,7 @@ jobs: - bb-bench - yarn-project-formatting - yarn-project-test + - prover-client-test if: always() steps: - run: | @@ -279,6 +296,7 @@ jobs: bb-bench, yarn-project-formatting, yarn-project-test, + prover-client-test, ] runs-on: ubuntu-latest if: ${{ github.ref == 'refs/heads/master' && failure() }} diff --git a/yarn-project/Earthfile b/yarn-project/Earthfile index 7663641719d..9a98815ccfe 100644 --- a/yarn-project/Earthfile +++ b/yarn-project/Earthfile @@ -133,3 +133,7 @@ run-e2e: ARG test FROM +end-to-end RUN DEBUG=aztec:* yarn test $test + +prover-client-test: + FROM +build + RUN cd prover-client && yarn test diff --git a/yarn-project/prover-client/package.json b/yarn-project/prover-client/package.json index 64580446844..3bdf4749602 100644 --- a/yarn-project/prover-client/package.json +++ b/yarn-project/prover-client/package.json @@ -16,6 +16,10 @@ "name": "Prover Client", "tsconfig": "./tsconfig.json" }, + "inherits": [ + "../package.common.json", + "./package.local.json" + ], "scripts": { "build": "yarn clean && tsc -b", "build:dev": "tsc -b --watch", @@ -23,12 +27,8 @@ "formatting": "run -T prettier --check ./src && run -T eslint ./src", "formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src", "bb": "node --no-warnings ./dest/bb/index.js", - "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests", - "generate-and-test": "yarn bb-cli write-server-vks && yarn test" + "test": "LOG_LEVEL=${LOG_LEVEL:-silent} DEBUG_COLORS=1 NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=600000 --forceExit" }, - "inherits": [ - "../package.common.json" - ], "jest": { "moduleNameMapper": { "^(\\.{1,2}/.*)\\.[cm]?js$": "$1" diff --git a/yarn-project/prover-client/package.local.json b/yarn-project/prover-client/package.local.json new file mode 100644 index 00000000000..5eeed2af06a --- /dev/null +++ b/yarn-project/prover-client/package.local.json @@ -0,0 +1,5 @@ +{ + "scripts": { + "test": "LOG_LEVEL=${LOG_LEVEL:-silent} DEBUG_COLORS=1 NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=600000 --forceExit" + } +} diff --git a/yarn-project/prover-client/src/orchestrator/orchestrator_errors.test.ts b/yarn-project/prover-client/src/orchestrator/orchestrator_errors.test.ts index 8f23bd02b3b..b4269bfc453 100644 --- a/yarn-project/prover-client/src/orchestrator/orchestrator_errors.test.ts +++ b/yarn-project/prover-client/src/orchestrator/orchestrator_errors.test.ts @@ -12,7 +12,7 @@ describe('prover/orchestrator/errors', () => { beforeEach(async () => { context = await TestContext.new(logger); - }, 20_000); + }); afterEach(async () => { await context.cleanup(); @@ -49,25 +49,25 @@ describe('prover/orchestrator/errors', () => { const finalisedBlock = await context.orchestrator.finaliseBlock(); expect(finalisedBlock.block.number).toEqual(context.blockNumber); - }, 40_000); + }); it('throws if adding a transaction before start', async () => { await expect( async () => await context.orchestrator.addNewTx(await makeEmptyProcessedTestTx(context.actualDb)), ).rejects.toThrow(`Invalid proving state, call startNewBlock before adding transactions`); - }, 1000); + }); it('throws if completing a block before start', async () => { await expect(async () => await context.orchestrator.setBlockCompleted()).rejects.toThrow( 'Invalid proving state, call startNewBlock before adding transactions or completing the block', ); - }, 1000); + }); it('throws if finalising an incomplete block', async () => { await expect(async () => await context.orchestrator.finaliseBlock()).rejects.toThrow( 'Invalid proving state, a block must be proven before it can be finalised', ); - }, 1000); + }); it('throws if finalising an already finalised block', async () => { const txs = await Promise.all([ @@ -91,7 +91,7 @@ describe('prover/orchestrator/errors', () => { const finalisedBlock = await context.orchestrator.finaliseBlock(); expect(finalisedBlock.block.number).toEqual(context.blockNumber); await expect(async () => await context.orchestrator.finaliseBlock()).rejects.toThrow('Block already finalised'); - }, 60000); + }); it('throws if adding to a cancelled block', async () => { await context.orchestrator.startNewBlock( @@ -106,7 +106,7 @@ describe('prover/orchestrator/errors', () => { await expect( async () => await context.orchestrator.addNewTx(await makeEmptyProcessedTestTx(context.actualDb)), ).rejects.toThrow('Rollup not accepting further transactions'); - }, 10000); + }); it.each([[-4], [0], [1], [3], [8.1], [7]] as const)( 'fails to start a block with %i transactions', diff --git a/yarn-project/prover-client/src/orchestrator/orchestrator_failures.test.ts b/yarn-project/prover-client/src/orchestrator/orchestrator_failures.test.ts index 5b06d8418fe..0c56061d87a 100644 --- a/yarn-project/prover-client/src/orchestrator/orchestrator_failures.test.ts +++ b/yarn-project/prover-client/src/orchestrator/orchestrator_failures.test.ts @@ -22,7 +22,7 @@ describe('prover/orchestrator/failures', () => { beforeEach(async () => { context = await TestContext.new(logger); - }, 20_000); + }); afterEach(async () => { await context.cleanup(); @@ -75,30 +75,26 @@ describe('prover/orchestrator/failures', () => { jest.spyOn(mockProver, 'getRootParityProof').mockRejectedValue('Root Parity Failed'); }, ], - ] as const)( - 'handles a %s error', - async (message: string, fn: () => void) => { - fn(); - const txs = await Promise.all([ - makeEmptyProcessedTestTx(context.actualDb), - makeEmptyProcessedTestTx(context.actualDb), - makeEmptyProcessedTestTx(context.actualDb), - makeEmptyProcessedTestTx(context.actualDb), - ]); + ] as const)('handles a %s error', async (message: string, fn: () => void) => { + fn(); + const txs = await Promise.all([ + makeEmptyProcessedTestTx(context.actualDb), + makeEmptyProcessedTestTx(context.actualDb), + makeEmptyProcessedTestTx(context.actualDb), + makeEmptyProcessedTestTx(context.actualDb), + ]); - const blockTicket = await orchestrator.startNewBlock( - txs.length, - context.globalVariables, - [], - await makeEmptyProcessedTestTx(context.actualDb), - ); + const blockTicket = await orchestrator.startNewBlock( + txs.length, + context.globalVariables, + [], + await makeEmptyProcessedTestTx(context.actualDb), + ); - for (const tx of txs) { - await orchestrator.addNewTx(tx); - } - await expect(blockTicket.provingPromise).resolves.toEqual({ status: PROVING_STATUS.FAILURE, reason: message }); - }, - 60000, - ); + for (const tx of txs) { + await orchestrator.addNewTx(tx); + } + await expect(blockTicket.provingPromise).resolves.toEqual({ status: PROVING_STATUS.FAILURE, reason: message }); + }); }); }); diff --git a/yarn-project/prover-client/src/orchestrator/orchestrator_lifecycle.test.ts b/yarn-project/prover-client/src/orchestrator/orchestrator_lifecycle.test.ts index 898e3aab9bb..f380b7cbef9 100644 --- a/yarn-project/prover-client/src/orchestrator/orchestrator_lifecycle.test.ts +++ b/yarn-project/prover-client/src/orchestrator/orchestrator_lifecycle.test.ts @@ -14,7 +14,7 @@ describe('prover/orchestrator/lifecycle', () => { beforeEach(async () => { context = await TestContext.new(logger); - }, 20_000); + }); afterEach(async () => { await context.cleanup(); @@ -75,7 +75,7 @@ describe('prover/orchestrator/lifecycle', () => { const finalisedBlock = await context.orchestrator.finaliseBlock(); expect(finalisedBlock.block.number).toEqual(101); - }, 40000); + }); it('automatically cancels an incomplete block when starting a new one', async () => { const txs1 = await Promise.all([ @@ -123,6 +123,6 @@ describe('prover/orchestrator/lifecycle', () => { const finalisedBlock = await context.orchestrator.finaliseBlock(); expect(finalisedBlock.block.number).toEqual(101); - }, 60000); + }); }); }); diff --git a/yarn-project/prover-client/src/orchestrator/orchestrator_mixed_blocks.test.ts b/yarn-project/prover-client/src/orchestrator/orchestrator_mixed_blocks.test.ts index 53a6959b710..8c63265a8e5 100644 --- a/yarn-project/prover-client/src/orchestrator/orchestrator_mixed_blocks.test.ts +++ b/yarn-project/prover-client/src/orchestrator/orchestrator_mixed_blocks.test.ts @@ -14,7 +14,7 @@ describe('prover/orchestrator/mixed-blocks', () => { beforeEach(async () => { context = await TestContext.new(logger); - }, 20_000); + }); afterEach(async () => { await context.cleanup(); @@ -49,6 +49,6 @@ describe('prover/orchestrator/mixed-blocks', () => { const finalisedBlock = await context.orchestrator.finaliseBlock(); expect(finalisedBlock.block.number).toEqual(context.blockNumber); - }, 60_000); + }); }); }); diff --git a/yarn-project/prover-client/src/orchestrator/orchestrator_mixed_blocks_2.test.ts b/yarn-project/prover-client/src/orchestrator/orchestrator_mixed_blocks_2.test.ts index 1233bbe30f7..0a0ae2abb2f 100644 --- a/yarn-project/prover-client/src/orchestrator/orchestrator_mixed_blocks_2.test.ts +++ b/yarn-project/prover-client/src/orchestrator/orchestrator_mixed_blocks_2.test.ts @@ -19,7 +19,7 @@ describe('prover/orchestrator/mixed-blocks', () => { beforeEach(async () => { context = await TestContext.new(logger); expectsDb = await MerkleTrees.new(openTmpStore()).then(t => t.asLatest()); - }, 20_000); + }); afterEach(async () => { await context.cleanup(); @@ -70,7 +70,6 @@ describe('prover/orchestrator/mixed-blocks', () => { const expectedNoteHashTreeAfter = await expectsDb.getTreeInfo(MerkleTreeId.NOTE_HASH_TREE).then(t => t.root); expect(noteHashTreeAfter.root).toEqual(expectedNoteHashTreeAfter); }, - 60000, ); }); }); diff --git a/yarn-project/prover-client/src/orchestrator/orchestrator_multi_public_functions.test.ts b/yarn-project/prover-client/src/orchestrator/orchestrator_multi_public_functions.test.ts index 6e1054032b1..d9c7e24b0e9 100644 --- a/yarn-project/prover-client/src/orchestrator/orchestrator_multi_public_functions.test.ts +++ b/yarn-project/prover-client/src/orchestrator/orchestrator_multi_public_functions.test.ts @@ -12,7 +12,7 @@ describe('prover/orchestrator/public-functions', () => { beforeEach(async () => { context = await TestContext.new(logger); - }, 20_000); + }); afterEach(async () => { await context.cleanup(); @@ -56,7 +56,6 @@ describe('prover/orchestrator/public-functions', () => { expect(finalisedBlock.block.number).toEqual(context.blockNumber); }, - 60_000, ); }); }); diff --git a/yarn-project/prover-client/src/orchestrator/orchestrator_multiple_blocks.test.ts b/yarn-project/prover-client/src/orchestrator/orchestrator_multiple_blocks.test.ts index 1525aeff740..4626edffac3 100644 --- a/yarn-project/prover-client/src/orchestrator/orchestrator_multiple_blocks.test.ts +++ b/yarn-project/prover-client/src/orchestrator/orchestrator_multiple_blocks.test.ts @@ -11,7 +11,7 @@ describe('prover/orchestrator/multi-block', () => { beforeEach(async () => { context = await TestContext.new(logger); - }, 20_000); + }); afterEach(async () => { await context.cleanup(); @@ -49,6 +49,6 @@ describe('prover/orchestrator/multi-block', () => { await context.actualDb.commit(); } - }, 60_000); + }); }); }); diff --git a/yarn-project/prover-client/src/orchestrator/orchestrator_public_functions.test.ts b/yarn-project/prover-client/src/orchestrator/orchestrator_public_functions.test.ts index 2f7679b973b..fa75b9d7ae0 100644 --- a/yarn-project/prover-client/src/orchestrator/orchestrator_public_functions.test.ts +++ b/yarn-project/prover-client/src/orchestrator/orchestrator_public_functions.test.ts @@ -11,7 +11,7 @@ describe('prover/orchestrator/public-functions', () => { beforeEach(async () => { context = await TestContext.new(logger); - }, 20_000); + }); afterEach(async () => { await context.cleanup(); @@ -59,7 +59,6 @@ describe('prover/orchestrator/public-functions', () => { expect(finalisedBlock.block.number).toEqual(context.blockNumber); }, - 60_000, ); }); }); diff --git a/yarn-project/prover-client/src/orchestrator/orchestrator_single_blocks.test.ts b/yarn-project/prover-client/src/orchestrator/orchestrator_single_blocks.test.ts index 959a6105c6a..dc3212195a4 100644 --- a/yarn-project/prover-client/src/orchestrator/orchestrator_single_blocks.test.ts +++ b/yarn-project/prover-client/src/orchestrator/orchestrator_single_blocks.test.ts @@ -19,7 +19,7 @@ describe('prover/orchestrator/blocks', () => { beforeEach(async () => { context = await TestContext.new(logger); expectsDb = await MerkleTrees.new(openTmpStore()).then(t => t.asLatest()); - }, 20_000); + }); afterEach(async () => { await context.cleanup(); @@ -48,7 +48,7 @@ describe('prover/orchestrator/blocks', () => { const finalisedBlock = await context.orchestrator.finaliseBlock(); expect(finalisedBlock.block.number).toEqual(context.blockNumber); - }, 60_000); + }); it('builds a block with 1 transaction', async () => { const txs = await Promise.all([makeBloatedProcessedTx(context.actualDb, 1)]); @@ -75,7 +75,7 @@ describe('prover/orchestrator/blocks', () => { const finalisedBlock = await context.orchestrator.finaliseBlock(); expect(finalisedBlock.block.number).toEqual(context.blockNumber); - }, 60_000); + }); it('builds a block concurrently with transaction simulation', async () => { const txs = await Promise.all([ @@ -104,6 +104,6 @@ describe('prover/orchestrator/blocks', () => { const finalisedBlock = await context.orchestrator.finaliseBlock(); expect(finalisedBlock.block.number).toEqual(context.blockNumber); - }, 60_000); + }); }); }); diff --git a/yarn-project/prover-client/src/prover/bb_prover_base_rollup.test.ts b/yarn-project/prover-client/src/prover/bb_prover_base_rollup.test.ts index 7e05cba9871..f560008db23 100644 --- a/yarn-project/prover-client/src/prover/bb_prover_base_rollup.test.ts +++ b/yarn-project/prover-client/src/prover/bb_prover_base_rollup.test.ts @@ -16,11 +16,11 @@ describe('prover/bb_prover/base-rollup', () => { return BBNativeRollupProver.new(bbConfig); }; context = await TestContext.new(logger, 1, buildProver); - }, 60_000); + }); afterAll(async () => { await context.cleanup(); - }, 5000); + }); it('proves the base rollup', async () => { const tx = await makeBloatedProcessedTx(context.actualDb, 1); @@ -31,5 +31,5 @@ describe('prover/bb_prover/base-rollup', () => { const proofOutputs = await context.prover.getBaseRollupProof(baseRollupInputs); logger.verbose('Verifying base rollups'); await expect(context.prover.verifyProof('BaseRollupArtifact', proofOutputs.proof)).resolves.not.toThrow(); - }, 200_000); + }); }); diff --git a/yarn-project/prover-client/src/prover/bb_prover_full_rollup.test.ts b/yarn-project/prover-client/src/prover/bb_prover_full_rollup.test.ts index dca24b599fb..8fda8107161 100644 --- a/yarn-project/prover-client/src/prover/bb_prover_full_rollup.test.ts +++ b/yarn-project/prover-client/src/prover/bb_prover_full_rollup.test.ts @@ -14,11 +14,11 @@ describe('prover/bb_prover/full-rollup', () => { beforeAll(async () => { context = await TestContext.new(logger, 1, BBNativeRollupProver.new); - }, 60_000); + }); afterAll(async () => { await context.cleanup(); - }, 5000); + }); it('proves all circuits', async () => { const numTransactions = 4; @@ -58,5 +58,5 @@ describe('prover/bb_prover/full-rollup', () => { const blockResult = await context.orchestrator.finaliseBlock(); await expect(context.prover.verifyProof('RootRollupArtifact', blockResult.proof)).resolves.not.toThrow(); - }, 600_000); + }); }); diff --git a/yarn-project/prover-client/src/prover/bb_prover_parity.test.ts b/yarn-project/prover-client/src/prover/bb_prover_parity.test.ts index 2300450f495..091f00662c1 100644 --- a/yarn-project/prover-client/src/prover/bb_prover_parity.test.ts +++ b/yarn-project/prover-client/src/prover/bb_prover_parity.test.ts @@ -31,11 +31,11 @@ describe('prover/bb_prover/parity', () => { return bbProver; }; context = await TestContext.new(logger, 1, buildProver); - }, 60_000); + }); afterAll(async () => { await context.cleanup(); - }, 5000); + }); it('proves the parity circuits', async () => { const l1ToL2Messages = makeTuple( @@ -134,5 +134,5 @@ describe('prover/bb_prover/parity', () => { ]).toContainEqual(error); } } - }, 200_000); + }); }); diff --git a/yarn-project/prover-client/src/prover/bb_prover_public_kernel.test.ts b/yarn-project/prover-client/src/prover/bb_prover_public_kernel.test.ts index 251b1f19706..59c6a5786e3 100644 --- a/yarn-project/prover-client/src/prover/bb_prover_public_kernel.test.ts +++ b/yarn-project/prover-client/src/prover/bb_prover_public_kernel.test.ts @@ -22,11 +22,11 @@ describe('prover/bb_prover/public-kernel', () => { return BBNativeRollupProver.new(bbConfig); }; context = await TestContext.new(logger, 1, buildProver); - }, 60_000); + }); afterAll(async () => { await context.cleanup(); - }, 5000); + }); it('proves the public kernel circuits', async () => { const tx = mockTx(1000, { @@ -83,5 +83,5 @@ describe('prover/bb_prover/public-kernel', () => { logger.verbose(`Verifying kernel type: ${PublicKernelType[request.type]}`); await expect(context.prover.verifyProof(artifact, proof)).resolves.not.toThrow(); } - }, 60_000); + }); });