Skip to content

Commit

Permalink
chore: Migrate the prover client test to earthly (#6118)
Browse files Browse the repository at this point in the history
This PR migrates the `prover-client-test` CI job from CCI to GA and
Earthly.
  • Loading branch information
PhilWindle authored May 1, 2024
1 parent 853913f commit a59a6c0
Show file tree
Hide file tree
Showing 18 changed files with 85 additions and 79 deletions.
14 changes: 0 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -744,7 +731,6 @@ workflows:
- boxes-vanilla
- boxes-react
- noir-packages-tests
- prover-client-test
- e2e-join
- aztec-builder
<<: *defaults
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -257,6 +273,7 @@ jobs:
- bb-bench
- yarn-project-formatting
- yarn-project-test
- prover-client-test
if: always()
steps:
- run: |
Expand All @@ -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() }}
Expand Down
4 changes: 4 additions & 0 deletions yarn-project/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 5 additions & 5 deletions yarn-project/prover-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
"name": "Prover Client",
"tsconfig": "./tsconfig.json"
},
"inherits": [
"../package.common.json",
"./package.local.json"
],
"scripts": {
"build": "yarn clean && tsc -b",
"build:dev": "tsc -b --watch",
"clean": "rm -rf ./dest .tsbuildinfo",
"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"
Expand Down
5 changes: 5 additions & 0 deletions yarn-project/prover-client/package.local.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('prover/orchestrator/errors', () => {

beforeEach(async () => {
context = await TestContext.new(logger);
}, 20_000);
});

afterEach(async () => {
await context.cleanup();
Expand Down Expand Up @@ -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([
Expand 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(
Expand All @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('prover/orchestrator/failures', () => {

beforeEach(async () => {
context = await TestContext.new(logger);
}, 20_000);
});

afterEach(async () => {
await context.cleanup();
Expand Down Expand Up @@ -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 });
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('prover/orchestrator/lifecycle', () => {

beforeEach(async () => {
context = await TestContext.new(logger);
}, 20_000);
});

afterEach(async () => {
await context.cleanup();
Expand Down Expand Up @@ -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([
Expand Down Expand Up @@ -123,6 +123,6 @@ describe('prover/orchestrator/lifecycle', () => {
const finalisedBlock = await context.orchestrator.finaliseBlock();

expect(finalisedBlock.block.number).toEqual(101);
}, 60000);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('prover/orchestrator/mixed-blocks', () => {

beforeEach(async () => {
context = await TestContext.new(logger);
}, 20_000);
});

afterEach(async () => {
await context.cleanup();
Expand Down Expand Up @@ -49,6 +49,6 @@ describe('prover/orchestrator/mixed-blocks', () => {
const finalisedBlock = await context.orchestrator.finaliseBlock();

expect(finalisedBlock.block.number).toEqual(context.blockNumber);
}, 60_000);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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,
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('prover/orchestrator/public-functions', () => {

beforeEach(async () => {
context = await TestContext.new(logger);
}, 20_000);
});

afterEach(async () => {
await context.cleanup();
Expand Down Expand Up @@ -56,7 +56,6 @@ describe('prover/orchestrator/public-functions', () => {

expect(finalisedBlock.block.number).toEqual(context.blockNumber);
},
60_000,
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('prover/orchestrator/multi-block', () => {

beforeEach(async () => {
context = await TestContext.new(logger);
}, 20_000);
});

afterEach(async () => {
await context.cleanup();
Expand Down Expand Up @@ -49,6 +49,6 @@ describe('prover/orchestrator/multi-block', () => {

await context.actualDb.commit();
}
}, 60_000);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('prover/orchestrator/public-functions', () => {

beforeEach(async () => {
context = await TestContext.new(logger);
}, 20_000);
});

afterEach(async () => {
await context.cleanup();
Expand Down Expand Up @@ -59,7 +59,6 @@ describe('prover/orchestrator/public-functions', () => {

expect(finalisedBlock.block.number).toEqual(context.blockNumber);
},
60_000,
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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)]);
Expand All @@ -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([
Expand Down Expand Up @@ -104,6 +104,6 @@ describe('prover/orchestrator/blocks', () => {
const finalisedBlock = await context.orchestrator.finaliseBlock();

expect(finalisedBlock.block.number).toEqual(context.blockNumber);
}, 60_000);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
});
});
Loading

0 comments on commit a59a6c0

Please sign in to comment.