From 2b17dc14b1298b40c48a5db870754d343dff6358 Mon Sep 17 00:00:00 2001 From: ludamad Date: Sat, 8 Apr 2023 17:48:59 +0100 Subject: [PATCH 01/12] fix: wasm memory limit, bump test timeout --- circuits | 2 +- .../src/wasm/barretenberg_wasm.ts | 4 +- yarn-project/circuits.js/package.json | 2 +- .../src/abis/__snapshots__/abis.test.ts.snap | 62 +++++++++---------- .../circuits.js/src/abis/abis.test.ts | 4 +- .../circuits.js/src/structs/kernel.test.ts | 2 +- .../circuits.js/src/wasm/circuits_wasm.ts | 4 +- .../src/wasm/wasm/async_call_state.ts | 7 ++- 8 files changed, 45 insertions(+), 42 deletions(-) diff --git a/circuits b/circuits index fdd7a3577de..ffd6b2a271d 160000 --- a/circuits +++ b/circuits @@ -1 +1 @@ -Subproject commit fdd7a3577deb2bc6fd90bb68b16c654695331d08 +Subproject commit ffd6b2a271dffeb3a771fdca9181f80d659f0b44 diff --git a/yarn-project/barretenberg.js/src/wasm/barretenberg_wasm.ts b/yarn-project/barretenberg.js/src/wasm/barretenberg_wasm.ts index b6879d7507c..73d3c6a705a 100644 --- a/yarn-project/barretenberg.js/src/wasm/barretenberg_wasm.ts +++ b/yarn-project/barretenberg.js/src/wasm/barretenberg_wasm.ts @@ -43,12 +43,12 @@ export class BarretenbergWasm { constructor(private loggerName?: string) {} /** - * 20 pages by default. 20*2**16 \> 1mb stack size plus other overheads. + * 30 pages by default. 30*2**16 \> 1mb stack size plus other overheads. * 8192 maximum by default. 512mb. * @param initial - Initial memory pages. * @param maximum - Max memory pages. */ - public async init(initial = 20, maximum = 8192) { + public async init(initial = 30, maximum = 8192) { const { store } = this; let wasm: WasmModule; this.wasm = wasm = new WasmModule( diff --git a/yarn-project/circuits.js/package.json b/yarn-project/circuits.js/package.json index b2f0b053315..863dc37d476 100644 --- a/yarn-project/circuits.js/package.json +++ b/yarn-project/circuits.js/package.json @@ -22,7 +22,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) --runInBand --no-cache --passWithNoTests" + "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --runInBand --no-cache --passWithNoTests --testTimeout=15000" }, "jest": { "preset": "ts-jest/presets/default-esm", diff --git a/yarn-project/circuits.js/src/abis/__snapshots__/abis.test.ts.snap b/yarn-project/circuits.js/src/abis/__snapshots__/abis.test.ts.snap index 147868531e7..934c5962e07 100644 --- a/yarn-project/circuits.js/src/abis/__snapshots__/abis.test.ts.snap +++ b/yarn-project/circuits.js/src/abis/__snapshots__/abis.test.ts.snap @@ -130,38 +130,38 @@ Fr { exports[`abis wasm bindings computes function tree root 1`] = ` Object { "data": Array [ - 0, - 32, - 75, - 45, - 86, - 220, - 44, - 202, - 122, + 10, + 161, + 52, + 51, + 174, + 59, + 37, + 232, + 246, + 84, + 204, + 233, + 101, + 46, 163, - 215, - 123, - 83, - 121, - 26, - 194, - 99, - 141, - 0, - 103, - 126, - 236, - 147, - 241, - 131, - 252, - 87, - 140, - 173, - 250, - 199, - 73, + 190, + 109, + 45, + 13, + 72, + 237, + 243, + 18, + 166, + 107, + 11, + 225, + 96, + 192, + 30, + 25, + 222, ], "type": "Buffer", } diff --git a/yarn-project/circuits.js/src/abis/abis.test.ts b/yarn-project/circuits.js/src/abis/abis.test.ts index 4d97d2af8b8..6505d6dab0c 100644 --- a/yarn-project/circuits.js/src/abis/abis.test.ts +++ b/yarn-project/circuits.js/src/abis/abis.test.ts @@ -31,9 +31,7 @@ describe('abis wasm bindings', () => { expect(res).toMatchSnapshot(); }); - // TODO: This test fails on CI since build-system is not updating the latest circuits wasm - // We may need to wait until we bump to the next commit to see if it picks up the change - it.skip('hashes VK', async () => { + it('hashes VK', async () => { const vk = makeVerificationKey(); const res = await hashVK(wasm, vk.toBuffer()); expect(res).toMatchSnapshot(); diff --git a/yarn-project/circuits.js/src/structs/kernel.test.ts b/yarn-project/circuits.js/src/structs/kernel.test.ts index a047a7efe3f..be9b309120f 100644 --- a/yarn-project/circuits.js/src/structs/kernel.test.ts +++ b/yarn-project/circuits.js/src/structs/kernel.test.ts @@ -24,7 +24,7 @@ describe('structs/kernel', () => { }); // TODO: Reenable once we can move back to circuits master and have this c_bind available - it.skip(`serializes and prints private_kernel_public_inputs`, async () => { + it(`serializes and prints private_kernel_public_inputs`, async () => { const wasm = await CircuitsWasm.new(); const kernelInputs = makePrivateKernelPublicInputs(); await expectSerializeToMatchSnapshot( diff --git a/yarn-project/circuits.js/src/wasm/circuits_wasm.ts b/yarn-project/circuits.js/src/wasm/circuits_wasm.ts index 907ece18def..1f8bebaa381 100644 --- a/yarn-project/circuits.js/src/wasm/circuits_wasm.ts +++ b/yarn-project/circuits.js/src/wasm/circuits_wasm.ts @@ -44,12 +44,12 @@ export class CircuitsWasm { constructor(private loggerName?: string) {} /** - * 20 pages by default. 20*2**16 \> 1mb stack size plus other overheads. + * 30 pages by default. 30*2**16 \> 1mb stack size plus other overheads. * 8192 maximum by default. 512mb. * @param initial - Initial memory pages. * @param maximum - Max memory pages. */ - public async init(initial = 20, maximum = 8192) { + public async init(initial = 30, maximum = 8192) { const { asyncCallState, store } = this; let wasm: WasmModule; this.wasm = wasm = new WasmModule( diff --git a/yarn-project/foundation/src/wasm/wasm/async_call_state.ts b/yarn-project/foundation/src/wasm/wasm/async_call_state.ts index 17554f4889d..68ce83e28f6 100644 --- a/yarn-project/foundation/src/wasm/wasm/async_call_state.ts +++ b/yarn-project/foundation/src/wasm/wasm/async_call_state.ts @@ -37,6 +37,8 @@ export class AsyncCallState { private ASYNCIFY_DATA_SIZE = 16 * 1024; private asyncifyDataAddr!: number; private asyncPromise?: Promise; + // For debug purposes, the last running function + private debugLastFuncName?: string; private wasm!: WasmModule; private state?: AsyncFnState; private callExport!: (...args: any[]) => number; @@ -84,9 +86,12 @@ export class AsyncCallState { */ public async call(name: string, ...args: any) { if (this.state) { - throw new Error(`Can only handle one async call at a time: ${name}(${args})`); + throw new Error( + `Can only handle one async call at a time: Can't run ${name}(${args}) because we are still running ${this.debugLastFuncName}`, + ); } this.state = { continuation: false }; + this.debugLastFuncName = name; let result = this.callExport(name, ...args); while (this.asyncPromise) { From 98f472479b9487ee12b1a445266f28d0edff1604 Mon Sep 17 00:00:00 2001 From: ludamad Date: Mon, 10 Apr 2023 14:34:34 -0400 Subject: [PATCH 02/12] fix: Redo 20 initial pages => 30 --- yarn-project/foundation/src/wasm/wasm/async_wasm_wrapper.ts | 5 +++-- yarn-project/foundation/src/wasm/wasm/wasm_module.ts | 4 ++-- yarn-project/foundation/src/wasm/wasm/wasm_wrapper.ts | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/yarn-project/foundation/src/wasm/wasm/async_wasm_wrapper.ts b/yarn-project/foundation/src/wasm/wasm/async_wasm_wrapper.ts index 2adfe0bab85..d356e7b9b7e 100644 --- a/yarn-project/foundation/src/wasm/wasm/async_wasm_wrapper.ts +++ b/yarn-project/foundation/src/wasm/wasm/async_wasm_wrapper.ts @@ -8,12 +8,13 @@ export abstract class AsyncWasmWrapper extends WasmWrapper { protected asyncCallState = new AsyncCallState(); /** - * 20 pages by default. 20*2**16 \> 1mb stack size plus other overheads. + * 30 pages by default. 30*2**16 \> 1mb stack size plus other overheads. * 8192 maximum by default. 512mb. * @param initial - Initial memory pages. * @param maximum - Max memory pages. + * @returns Self. */ - public async init(initial = 20, maximum = 8192): Promise { + public async init(initial = 30, maximum = 8192): Promise { await super.init(initial, maximum); this.asyncCallState.init(this.wasm); return this; diff --git a/yarn-project/foundation/src/wasm/wasm/wasm_module.ts b/yarn-project/foundation/src/wasm/wasm/wasm_module.ts index b9d7a9dd5d1..8b083eb0cf6 100644 --- a/yarn-project/foundation/src/wasm/wasm/wasm_module.ts +++ b/yarn-project/foundation/src/wasm/wasm/wasm_module.ts @@ -44,10 +44,10 @@ export class WasmModule { /** * Initialize this wasm module. * @param wasmImportEnv - Linked to a module called "env". Functions implementations referenced from e.g. C++. - * @param initial - 20 pages by default. 20*2**16 \> 1mb stack size plus other overheads. + * @param initial - 30 pages by default. 30*2**16 \> 1mb stack size plus other overheads. * @param maximum - 8192 maximum by default. 512mb. */ - public async init(initial = 20, maximum = 8192) { + public async init(initial = 30, maximum = 8192) { this.debug( `initial mem: ${initial} pages, ${(initial * 2 ** 16) / (1024 * 1024)}mb. max mem: ${maximum} pages, ${ (maximum * 2 ** 16) / (1024 * 1024) diff --git a/yarn-project/foundation/src/wasm/wasm/wasm_wrapper.ts b/yarn-project/foundation/src/wasm/wasm/wasm_wrapper.ts index 73ccbe0abe3..c9cc727bc21 100644 --- a/yarn-project/foundation/src/wasm/wasm/wasm_wrapper.ts +++ b/yarn-project/foundation/src/wasm/wasm/wasm_wrapper.ts @@ -29,13 +29,13 @@ export abstract class WasmWrapper { constructor(private loggerName?: string) {} /** - * 20 pages by default. 20*2**16 \> 1mb stack size plus other overheads. + * 30 pages by default. 30*2**16 \> 1mb stack size plus other overheads. * 8192 maximum by default. 512mb. * @param initial - Initial memory pages. * @param maximum - Max memory pages. - * @returns Self + * @returns Self. */ - public async init(initial = 20, maximum = 8192): Promise { + public async init(initial = 30, maximum = 8192): Promise { let wasm: WasmModule; this.wasm = wasm = new WasmModule( await fetchCode(this.codePath), From 566c6ef8295b3c3aed444d0dc4db344ed011df3d Mon Sep 17 00:00:00 2001 From: ludamad Date: Mon, 10 Apr 2023 14:38:51 -0400 Subject: [PATCH 03/12] chore: build in yarn test --- yarn-project/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarn-project/package.json b/yarn-project/package.json index 07ecdc851ae..1f5a67d1665 100644 --- a/yarn-project/package.json +++ b/yarn-project/package.json @@ -7,7 +7,7 @@ "docs": "typedoc --out docs/dist && cd docs && yarn serve", "formatting": "yarn workspaces foreach -v run formatting", "formatting:fix": "yarn workspaces foreach -v run formatting:fix", - "test": "yarn workspaces foreach -v run test", + "test": "yarn build && yarn workspaces foreach -v run test", "build": "tsc -b tsconfig.dest.json", "build:dev": "tsc -b tsconfig.dest.json --watch", "clean": "yarn workspaces foreach -v run clean" From d01a615e1aa3013b9e05be5d6c26020b94ac2863 Mon Sep 17 00:00:00 2001 From: dbanks12 Date: Thu, 13 Apr 2023 13:47:49 +0000 Subject: [PATCH 04/12] bump circuits --- circuits | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circuits b/circuits index ffd6b2a271d..646beb3acac 160000 --- a/circuits +++ b/circuits @@ -1 +1 @@ -Subproject commit ffd6b2a271dffeb3a771fdca9181f80d659f0b44 +Subproject commit 646beb3acac5b9ba6a3f6a610ad5652743548210 From 33b99d847c8e82a1991aea9a706caeb2f1c7ee69 Mon Sep 17 00:00:00 2001 From: dbanks12 Date: Thu, 13 Apr 2023 15:37:04 +0000 Subject: [PATCH 05/12] add acirHash to PrivateCallData, bump circuits, fix primitives.wasm build/cmake, make sure circuits is built with USE_TURBO --- circuits | 2 +- yarn-project/aztec-rpc/src/account_state/account_state.ts | 5 +++-- .../aztec-rpc/src/aztec_rpc_server/aztec_rpc_server.ts | 3 ++- .../src/structs/__snapshots__/kernel.test.ts.snap | 1 + yarn-project/circuits.js/src/structs/kernel.ts | 2 ++ yarn-project/circuits.js/src/tests/factories.ts | 7 ++++--- yarn-project/kernel-prover/src/index.ts | 2 ++ 7 files changed, 15 insertions(+), 7 deletions(-) diff --git a/circuits b/circuits index 646beb3acac..86ba041e2ff 160000 --- a/circuits +++ b/circuits @@ -1 +1 @@ -Subproject commit 646beb3acac5b9ba6a3f6a610ad5652743548210 +Subproject commit 86ba041e2ff03179669f7486fe7bd112bcd282f1 diff --git a/yarn-project/aztec-rpc/src/account_state/account_state.ts b/yarn-project/aztec-rpc/src/account_state/account_state.ts index e650ecfda6b..f137539f155 100644 --- a/yarn-project/aztec-rpc/src/account_state/account_state.ts +++ b/yarn-project/aztec-rpc/src/account_state/account_state.ts @@ -2,7 +2,7 @@ import { AcirSimulator } from '@aztec/acir-simulator'; import { AztecNode } from '@aztec/aztec-node'; import { Grumpkin } from '@aztec/barretenberg.js/crypto'; import { KERNEL_NEW_COMMITMENTS_LENGTH, OldTreeRoots, TxRequest } from '@aztec/circuits.js'; -import { AztecAddress, Fr, Point, createDebugLogger } from '@aztec/foundation'; +import { AztecAddress, Fr, Point, keccak, createDebugLogger } from '@aztec/foundation'; import { INITIAL_L2_BLOCK_NUM } from '@aztec/l1-contracts'; import { L2BlockContext } from '@aztec/types'; import { UnverifiedData } from '@aztec/types'; @@ -63,6 +63,7 @@ export class AccountState { if (!functionDao) { throw new Error('Unknown function.'); } + const acirHash = keccak(Buffer.from(functionDao.bytecode, 'hex')); const oldRoots = new OldTreeRoots(Fr.ZERO, Fr.ZERO, Fr.ZERO, Fr.ZERO); // TODO - get old roots from the database/node @@ -76,7 +77,7 @@ export class AccountState { oldRoots, ); - return { contract, oldRoots, executionResult }; + return { contract, oldRoots, executionResult, acirHash }; } public createUnverifiedData(contract: AztecAddress, newNotes: { preimage: Fr[]; storageSlot: Fr }[]): UnverifiedData { diff --git a/yarn-project/aztec-rpc/src/aztec_rpc_server/aztec_rpc_server.ts b/yarn-project/aztec-rpc/src/aztec_rpc_server/aztec_rpc_server.ts index cf11fff6637..f366337304d 100644 --- a/yarn-project/aztec-rpc/src/aztec_rpc_server/aztec_rpc_server.ts +++ b/yarn-project/aztec-rpc/src/aztec_rpc_server/aztec_rpc_server.ts @@ -201,7 +201,7 @@ export class AztecRPCServer implements AztecRPCClient { public async createTx(txRequest: TxRequest, signature: EcdsaSignature) { const accountState = this.ensureAccount(txRequest.from); - const { executionResult, oldRoots, contract } = await accountState.simulate(txRequest); + const { executionResult, oldRoots, contract, acirHash } = await accountState.simulate(txRequest); this.log(`Executing Prover...`); const { publicInputs } = await this.kernelProver.prove( @@ -215,6 +215,7 @@ export class AztecRPCServer implements AztecRPCClient { (committment: Buffer) => { return this.getContractSiblingPath(committment); }, + acirHash, ); this.log(`Proof completed!`); diff --git a/yarn-project/circuits.js/src/structs/__snapshots__/kernel.test.ts.snap b/yarn-project/circuits.js/src/structs/__snapshots__/kernel.test.ts.snap index 48ed0d967d2..9e13822bd2e 100644 --- a/yarn-project/circuits.js/src/structs/__snapshots__/kernel.test.ts.snap +++ b/yarn-project/circuits.js/src/structs/__snapshots__/kernel.test.ts.snap @@ -459,6 +459,7 @@ leaf_index: 8225 sibling_path: [ 0x2021 0x2022 0x2023 0x2024 ] portal_contract_address: 0x4141414141414141414141414141414141414141 +acir_hash: 0x2061 " `; diff --git a/yarn-project/circuits.js/src/structs/kernel.ts b/yarn-project/circuits.js/src/structs/kernel.ts index 09f3af9d53e..42aee2cae25 100644 --- a/yarn-project/circuits.js/src/structs/kernel.ts +++ b/yarn-project/circuits.js/src/structs/kernel.ts @@ -299,6 +299,7 @@ export class PrivateCallData { public functionLeafMembershipWitness: MembershipWitness, public contractLeafMembershipWitness: MembershipWitness, public portalContractAddress: EthAddress, + public acirHash: Fr, ) { assertLength(this, 'privateCallStackPreimages', PRIVATE_CALL_STACK_LENGTH); } @@ -318,6 +319,7 @@ export class PrivateCallData { fields.functionLeafMembershipWitness, fields.contractLeafMembershipWitness, fields.portalContractAddress, + fields.acirHash, ] as const; } diff --git a/yarn-project/circuits.js/src/tests/factories.ts b/yarn-project/circuits.js/src/tests/factories.ts index cb7fd4ed344..3c94b69ed2b 100644 --- a/yarn-project/circuits.js/src/tests/factories.ts +++ b/yarn-project/circuits.js/src/tests/factories.ts @@ -188,11 +188,12 @@ export function makePrivateCallData(seed = 1): PrivateCallData { return PrivateCallData.from({ callStackItem: makeCallStackItem(seed), privateCallStackPreimages: range(PRIVATE_CALL_STACK_LENGTH, seed + 0x10).map(makeCallStackItem), - contractLeafMembershipWitness: makeMembershipWitness(CONTRACT_TREE_HEIGHT, seed + 0x20), - functionLeafMembershipWitness: makeMembershipWitness(FUNCTION_TREE_HEIGHT, seed + 0x30), - portalContractAddress: makeEthAddress(seed + 0x40), proof: makeDynamicSizeBuffer(16, seed + 0x50), vk: makeVerificationKey(), + functionLeafMembershipWitness: makeMembershipWitness(FUNCTION_TREE_HEIGHT, seed + 0x30), + contractLeafMembershipWitness: makeMembershipWitness(CONTRACT_TREE_HEIGHT, seed + 0x20), + portalContractAddress: makeEthAddress(seed + 0x40), + acirHash: fr(seed + 0x60), }); } diff --git a/yarn-project/kernel-prover/src/index.ts b/yarn-project/kernel-prover/src/index.ts index 95659001faa..4dd9df422db 100644 --- a/yarn-project/kernel-prover/src/index.ts +++ b/yarn-project/kernel-prover/src/index.ts @@ -37,6 +37,7 @@ export class KernelProver { oldRoots: OldTreeRoots, getFunctionTreeInfo: (callStackItem: PrivateCallStackItem) => Promise, getContractSiblingPath: (committment: Buffer) => Promise>, + acirHash: Buffer, ): Promise<{ publicInputs: PrivateKernelPublicInputs; proof: Buffer }> { const wasm = await CircuitsWasm.get(); // TODO: implement this @@ -63,6 +64,7 @@ export class KernelProver { functionTreeInfo.membershipWitness, contractLeafMembershipWitness, txRequest.txContext.contractDeploymentData.portalContractAddress, + Fr.fromBuffer(Buffer.alloc(32, 0)),//acirHash, // FIXME: https://github.com/AztecProtocol/aztec3-packages/issues/262 ); const previousKernelData: PreviousKernelData = await DummyPreviousKernelData.getDummyPreviousKernelData(wasm); From 2f9be2f8296a1ae98a7cf846a828f89a568e4244 Mon Sep 17 00:00:00 2001 From: dbanks12 Date: Thu, 13 Apr 2023 15:55:41 +0000 Subject: [PATCH 06/12] remove inherit from circuits.js package.json because it was removing timeout --- yarn-project/circuits.js/package.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/yarn-project/circuits.js/package.json b/yarn-project/circuits.js/package.json index f437b5a2355..c8cfdd085b5 100644 --- a/yarn-project/circuits.js/package.json +++ b/yarn-project/circuits.js/package.json @@ -24,9 +24,6 @@ "formatting:fix": "run -T prettier -w ./src", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --passWithNoTests --testTimeout=15000" }, - "inherits": [ - "../package.common.json" - ], "jest": { "preset": "ts-jest/presets/default-esm", "globals": { From b18ab3d1174732f6ef1c2586648069517012136f Mon Sep 17 00:00:00 2001 From: dbanks12 Date: Thu, 13 Apr 2023 16:24:50 +0000 Subject: [PATCH 07/12] revert circuits.js/package.json update circuits submodule now that it uses USE_TURBO in dockerfiles --- circuits | 2 +- yarn-project/circuits.js/package.json | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/circuits b/circuits index 86ba041e2ff..d155b90d97f 160000 --- a/circuits +++ b/circuits @@ -1 +1 @@ -Subproject commit 86ba041e2ff03179669f7486fe7bd112bcd282f1 +Subproject commit d155b90d97fb530a11bd37ef1a76d888fd73c186 diff --git a/yarn-project/circuits.js/package.json b/yarn-project/circuits.js/package.json index c8cfdd085b5..7d001bf1a40 100644 --- a/yarn-project/circuits.js/package.json +++ b/yarn-project/circuits.js/package.json @@ -22,8 +22,11 @@ "clean": "rm -rf ./dest .tsbuildinfo", "formatting": "run -T prettier --check ./src && run -T eslint ./src", "formatting:fix": "run -T prettier -w ./src", - "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --passWithNoTests --testTimeout=15000" + "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --passWithNoTests" }, + "inherits": [ + "../package.common.json" + ], "jest": { "preset": "ts-jest/presets/default-esm", "globals": { From 1c4c91dd197d254a1736a4858b6e0c4e0e6866c5 Mon Sep 17 00:00:00 2001 From: cheethas Date: Thu, 13 Apr 2023 16:38:37 +0000 Subject: [PATCH 08/12] fix: re-add timeout --- yarn-project/circuits.js/package.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/yarn-project/circuits.js/package.json b/yarn-project/circuits.js/package.json index 7d001bf1a40..c8cfdd085b5 100644 --- a/yarn-project/circuits.js/package.json +++ b/yarn-project/circuits.js/package.json @@ -22,11 +22,8 @@ "clean": "rm -rf ./dest .tsbuildinfo", "formatting": "run -T prettier --check ./src && run -T eslint ./src", "formatting:fix": "run -T prettier -w ./src", - "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --passWithNoTests" + "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --passWithNoTests --testTimeout=15000" }, - "inherits": [ - "../package.common.json" - ], "jest": { "preset": "ts-jest/presets/default-esm", "globals": { From e08e5971df2c40f90562d468ff984bc0380f6d6e Mon Sep 17 00:00:00 2001 From: dbanks12 Date: Thu, 13 Apr 2023 16:59:12 +0000 Subject: [PATCH 09/12] revert wasm memory bump --- yarn-project/foundation/src/wasm/wasm/async_wasm_wrapper.ts | 5 ++--- yarn-project/foundation/src/wasm/wasm/wasm_module.ts | 4 ++-- yarn-project/foundation/src/wasm/wasm/wasm_wrapper.ts | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/yarn-project/foundation/src/wasm/wasm/async_wasm_wrapper.ts b/yarn-project/foundation/src/wasm/wasm/async_wasm_wrapper.ts index d356e7b9b7e..2adfe0bab85 100644 --- a/yarn-project/foundation/src/wasm/wasm/async_wasm_wrapper.ts +++ b/yarn-project/foundation/src/wasm/wasm/async_wasm_wrapper.ts @@ -8,13 +8,12 @@ export abstract class AsyncWasmWrapper extends WasmWrapper { protected asyncCallState = new AsyncCallState(); /** - * 30 pages by default. 30*2**16 \> 1mb stack size plus other overheads. + * 20 pages by default. 20*2**16 \> 1mb stack size plus other overheads. * 8192 maximum by default. 512mb. * @param initial - Initial memory pages. * @param maximum - Max memory pages. - * @returns Self. */ - public async init(initial = 30, maximum = 8192): Promise { + public async init(initial = 20, maximum = 8192): Promise { await super.init(initial, maximum); this.asyncCallState.init(this.wasm); return this; diff --git a/yarn-project/foundation/src/wasm/wasm/wasm_module.ts b/yarn-project/foundation/src/wasm/wasm/wasm_module.ts index 8b083eb0cf6..b9d7a9dd5d1 100644 --- a/yarn-project/foundation/src/wasm/wasm/wasm_module.ts +++ b/yarn-project/foundation/src/wasm/wasm/wasm_module.ts @@ -44,10 +44,10 @@ export class WasmModule { /** * Initialize this wasm module. * @param wasmImportEnv - Linked to a module called "env". Functions implementations referenced from e.g. C++. - * @param initial - 30 pages by default. 30*2**16 \> 1mb stack size plus other overheads. + * @param initial - 20 pages by default. 20*2**16 \> 1mb stack size plus other overheads. * @param maximum - 8192 maximum by default. 512mb. */ - public async init(initial = 30, maximum = 8192) { + public async init(initial = 20, maximum = 8192) { this.debug( `initial mem: ${initial} pages, ${(initial * 2 ** 16) / (1024 * 1024)}mb. max mem: ${maximum} pages, ${ (maximum * 2 ** 16) / (1024 * 1024) diff --git a/yarn-project/foundation/src/wasm/wasm/wasm_wrapper.ts b/yarn-project/foundation/src/wasm/wasm/wasm_wrapper.ts index c9cc727bc21..73ccbe0abe3 100644 --- a/yarn-project/foundation/src/wasm/wasm/wasm_wrapper.ts +++ b/yarn-project/foundation/src/wasm/wasm/wasm_wrapper.ts @@ -29,13 +29,13 @@ export abstract class WasmWrapper { constructor(private loggerName?: string) {} /** - * 30 pages by default. 30*2**16 \> 1mb stack size plus other overheads. + * 20 pages by default. 20*2**16 \> 1mb stack size plus other overheads. * 8192 maximum by default. 512mb. * @param initial - Initial memory pages. * @param maximum - Max memory pages. - * @returns Self. + * @returns Self */ - public async init(initial = 30, maximum = 8192): Promise { + public async init(initial = 20, maximum = 8192): Promise { let wasm: WasmModule; this.wasm = wasm = new WasmModule( await fetchCode(this.codePath), From d7fd0c3c012c8cdd2e405ab94b556a222d16edfd Mon Sep 17 00:00:00 2001 From: dbanks12 Date: Thu, 13 Apr 2023 17:25:40 +0000 Subject: [PATCH 10/12] bump circuits --- circuits | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circuits b/circuits index d155b90d97f..c98b3c0a80c 160000 --- a/circuits +++ b/circuits @@ -1 +1 @@ -Subproject commit d155b90d97fb530a11bd37ef1a76d888fd73c186 +Subproject commit c98b3c0a80c3fd4700863b44501ea0c7885236e8 From 04b3940d7190e6c95bb52987a6e3565b8aa77160 Mon Sep 17 00:00:00 2001 From: dbanks12 Date: Thu, 13 Apr 2023 19:35:56 +0000 Subject: [PATCH 11/12] bump to latest circuits master now that PR with contract root / address fix is merged --- circuits | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circuits b/circuits index c98b3c0a80c..5ae96a0f8dc 160000 --- a/circuits +++ b/circuits @@ -1 +1 @@ -Subproject commit c98b3c0a80c3fd4700863b44501ea0c7885236e8 +Subproject commit 5ae96a0f8dc01618c0100903023c40904089985a From 5098be3aa10da071dd0bc84ab346c8f49cf79a52 Mon Sep 17 00:00:00 2001 From: dbanks12 Date: Thu, 13 Apr 2023 21:16:41 +0000 Subject: [PATCH 12/12] shouldn't need timeout... --- yarn-project/circuits.js/package.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/yarn-project/circuits.js/package.json b/yarn-project/circuits.js/package.json index c8cfdd085b5..7d001bf1a40 100644 --- a/yarn-project/circuits.js/package.json +++ b/yarn-project/circuits.js/package.json @@ -22,8 +22,11 @@ "clean": "rm -rf ./dest .tsbuildinfo", "formatting": "run -T prettier --check ./src && run -T eslint ./src", "formatting:fix": "run -T prettier -w ./src", - "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --passWithNoTests --testTimeout=15000" + "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --passWithNoTests" }, + "inherits": [ + "../package.common.json" + ], "jest": { "preset": "ts-jest/presets/default-esm", "globals": {