diff --git a/.circleci/config.yml b/.circleci/config.yml index af2ade399dd2..64acce4922a2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -69,6 +69,7 @@ jobs: - run: name: "Build" command: cond_spot_run_build aztec3-circuits-wasm-linux-clang 64 + yarn-project-base: machine: image: ubuntu-2004:202010-01 @@ -91,6 +92,17 @@ jobs: name: "Build and test" command: build ethereum.js + circuits-js: + machine: + image: ubuntu-2004:202010-01 + resource_class: large + steps: + - *checkout + - *setup_env + - run: + name: "Build and test" + command: build circuits.js + foundation: machine: image: ubuntu-2004:202010-01 @@ -231,6 +243,7 @@ workflows: - aztec-js: *yarn_project - end-to-end: *yarn_project - foundation: *yarn_project + - circuits-js: *yarn_project - e2e-join: requires: - ethereum-js @@ -238,6 +251,7 @@ workflows: - end-to-end - noir-contracts - foundation + - circuits-js <<: *defaults - e2e-deploy-contract: *e2e_test - world-state: *yarn_project diff --git a/build_manifest.json b/build_manifest.json index a477bbef626d..d22ac9133e5b 100644 --- a/build_manifest.json +++ b/build_manifest.json @@ -73,6 +73,13 @@ "rebuildPatterns": ["^yarn-project/aztec.js/"], "dependencies": ["aztec-rpc"] }, + "circuits.js": { + "buildDir": "yarn-project", + "projectDir": "yarn-project/circuits.js", + "dockerfile": "circuits.js/Dockerfile", + "rebuildPatterns": ["^yarn-project/circuits.js/"], + "dependencies": ["aztec-rpc"] + }, "barretenberg.js": { "buildDir": "yarn-project", "projectDir": "yarn-project/barretenberg.js", diff --git a/yarn-project/circuits.js/Dockerfile b/yarn-project/circuits.js/Dockerfile new file mode 100644 index 000000000000..1f7c5b4c5d34 --- /dev/null +++ b/yarn-project/circuits.js/Dockerfile @@ -0,0 +1,20 @@ +FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/yarn-project-base AS builder + +COPY foundation foundation +COPY circuits.js circuits.js + +WORKDIR /usr/src/yarn-project/foundation +RUN yarn build + +WORKDIR /usr/src/yarn-project/circuits.js +RUN cp /usr/src/aztec3-circuits/cpp/build-wasm/bin/aztec3-circuits.wasm src/wasm/aztec3-circuits.wasm +RUN yarn build && yarn formatting && yarn test + +# Prune dev dependencies. See comment in base image. +RUN yarn cache clean +RUN yarn workspaces focus --production > /dev/null + +FROM alpine:latest +COPY --from=builder /usr/src/yarn-project/circuits.js /usr/src/yarn-project/circuits.js +WORKDIR /usr/src/yarn-project/merkle-tree +ENTRYPOINT ["yarn", "test"] \ No newline at end of file diff --git a/yarn-project/circuits.js/package.json b/yarn-project/circuits.js/package.json index 806b14990498..a2f1a6216b1d 100644 --- a/yarn-project/circuits.js/package.json +++ b/yarn-project/circuits.js/package.json @@ -18,7 +18,7 @@ "clean": "rm -rf ./dest .tsbuildinfo", "formatting": "prettier --check ./src && eslint --max-warnings 278 ./src", "formatting:fix": "prettier -w ./src", - "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --passWithNoTests", + "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --passWithNoTests --maxWorkers=2", "test-debug": "NODE_NO_WARNINGS=1 node --inspect-brk --experimental-vm-modules $(yarn bin jest) --no-cache --passWithNoTests --runInBand" }, "jest": { diff --git a/yarn-project/circuits.js/src/structs/merge_rollup.ts b/yarn-project/circuits.js/src/structs/merge_rollup.ts index 405e7b5cca33..fd562badb894 100644 --- a/yarn-project/circuits.js/src/structs/merge_rollup.ts +++ b/yarn-project/circuits.js/src/structs/merge_rollup.ts @@ -16,8 +16,7 @@ export class PreviousRollupData { */ public vkIndex: UInt32, public vkSiblingPath: MembershipWitness, - ) { - } + ) {} toBuffer() { return serializeToBuffer(this.publicInputs, this.proof, this.vk, this.vkIndex, this.vkSiblingPath); diff --git a/yarn-project/circuits.js/src/tests/factories.ts b/yarn-project/circuits.js/src/tests/factories.ts index 7ca3e5698d34..f00c6c580afc 100644 --- a/yarn-project/circuits.js/src/tests/factories.ts +++ b/yarn-project/circuits.js/src/tests/factories.ts @@ -1,5 +1,11 @@ import { AztecAddress, EthAddress, Fq, Fr } from '@aztec/foundation'; -import { CallContext, PreviousRollupData, PrivateCircuitPublicInputs, RootRollupInputs, RootRollupPublicInputs } from '../index.js'; +import { + CallContext, + PreviousRollupData, + PrivateCircuitPublicInputs, + RootRollupInputs, + RootRollupPublicInputs, +} from '../index.js'; import { AppendOnlyTreeSnapshot, BaseRollupPublicInputs, ConstantBaseRollupData } from '../structs/base_rollup.js'; import { ARGS_LENGTH, @@ -22,7 +28,7 @@ import { PUBLIC_CALL_STACK_LENGTH, RETURN_VALUES_LENGTH, ROLLUP_VK_TREE_HEIGHT, - VK_TREE_HEIGHT + VK_TREE_HEIGHT, } from '../structs/constants.js'; import { FunctionData } from '../structs/function_data.js'; import { @@ -34,7 +40,7 @@ import { PreviousKernelData, PrivateCallData, PrivateKernelInputs, - PrivateKernelPublicInputs + PrivateKernelPublicInputs, } from '../structs/kernel.js'; import { PrivateCallStackItem } from '../structs/private_call_stack_item.js'; import { @@ -43,7 +49,7 @@ import { ComposerType, EcdsaSignature, MembershipWitness, - UInt8Vector + UInt8Vector, } from '../structs/shared.js'; import { ContractDeploymentData, SignedTxRequest, TxContext, TxRequest } from '../structs/tx.js'; import { CommitmentMap, G1AffineElement, VerificationKey } from '../structs/verification_key.js'; @@ -260,7 +266,7 @@ export function makePreviousBaseRollupData(seed = 0) { makeVerificationKey(), seed + 0x110, makeMembershipWitness(ROLLUP_VK_TREE_HEIGHT, seed + 0x120), - ) + ); } export function makeRootRollupInputs(seed = 0) { diff --git a/yarn-project/circuits.js/src/utils/serialize.ts b/yarn-project/circuits.js/src/utils/serialize.ts index 834f8c643955..527a45cfbaa0 100644 --- a/yarn-project/circuits.js/src/utils/serialize.ts +++ b/yarn-project/circuits.js/src/utils/serialize.ts @@ -119,7 +119,7 @@ export type Bufferable = } | Bufferable[]; -function isSerializableToBuffer32(obj: Object): obj is { toBuffer32: () => Buffer } { +function isSerializableToBuffer32(obj: object): obj is { toBuffer32: () => Buffer } { return !!(obj as { toBuffer32: () => Buffer }).toBuffer32; }