@aztec/ivc-integration 3.0.0-devnet.5 → 3.0.0-devnet.6-patch.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/app_creator.json +36 -36
- package/artifacts/app_reader.json +36 -36
- package/artifacts/keys/avm.vk +0 -0
- package/artifacts/keys/mock_hiding.ivc.vk +0 -0
- package/artifacts/keys/mock_rollup_root_verifier.sol +86 -83
- package/artifacts/mock_hiding.json +129 -129
- package/artifacts/mock_private_kernel_init.json +131 -131
- package/artifacts/mock_private_kernel_inner.json +132 -132
- package/artifacts/mock_private_kernel_reset.json +129 -129
- package/artifacts/mock_private_kernel_tail.json +129 -129
- package/artifacts/mock_rollup_root.json +65 -65
- package/artifacts/mock_rollup_tx_base_private.json +118 -118
- package/artifacts/mock_rollup_tx_base_public.json +118 -118
- package/artifacts/mock_rollup_tx_merge.json +116 -116
- package/dest/bb_working_directory.d.ts +1 -1
- package/dest/index.d.ts +1 -1
- package/dest/prove_native.d.ts +7 -7
- package/dest/prove_native.d.ts.map +1 -1
- package/dest/prove_native.js +17 -38
- package/dest/scripts/generate_declaration_files.d.ts +1 -1
- package/dest/scripts/generate_ts_from_abi.d.ts +1 -1
- package/dest/serve.d.ts +1 -1
- package/dest/serve.js +34 -17
- package/dest/types/index.d.ts +8 -8
- package/dest/types/index.d.ts.map +1 -1
- package/dest/types/index.js +4 -4
- package/dest/witgen.d.ts +4 -4
- package/dest/witgen.d.ts.map +1 -1
- package/dest/witgen.js +19 -4
- package/package.json +21 -23
- package/src/prove_native.ts +21 -56
- package/src/serve.ts +43 -16
- package/src/types/index.ts +9 -9
- package/src/witgen.ts +19 -3
- package/dest/prove_wasm.d.ts +0 -4
- package/dest/prove_wasm.d.ts.map +0 -1
- package/dest/prove_wasm.js +0 -38
- package/src/prove_wasm.ts +0 -57
package/src/types/index.ts
CHANGED
|
@@ -37,9 +37,9 @@ export type PrivateKernelPublicInputs = {
|
|
|
37
37
|
read_requests: FixedLengthArray<Field, 4>;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
export type
|
|
40
|
+
export type ChonkProofData = {
|
|
41
41
|
public_inputs: KernelPublicInputs;
|
|
42
|
-
proof: FixedLengthArray<Field,
|
|
42
|
+
proof: FixedLengthArray<Field, 1963>;
|
|
43
43
|
vk_data: VerificationKey<127>;
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -186,7 +186,7 @@ export type RollupPublicInputs = {
|
|
|
186
186
|
|
|
187
187
|
export type PreviousRollupData = {
|
|
188
188
|
base_or_merge_public_inputs: RollupPublicInputs;
|
|
189
|
-
proof: FixedLengthArray<Field,
|
|
189
|
+
proof: FixedLengthArray<Field, 531>;
|
|
190
190
|
vk: VerificationKey<115>;
|
|
191
191
|
}
|
|
192
192
|
|
|
@@ -292,7 +292,7 @@ export async function MockPrivateKernelTail(prev_kernel_public_inputs: PrivateKe
|
|
|
292
292
|
return returnValue as KernelPublicInputs;
|
|
293
293
|
}
|
|
294
294
|
export type MockRollupTxBasePublicInputType = {
|
|
295
|
-
|
|
295
|
+
chonk_proof_data: ChonkProofData;
|
|
296
296
|
verification_key: VerificationKey<1000>;
|
|
297
297
|
proof: FixedLengthArray<Field, 20000>;
|
|
298
298
|
public_inputs: AvmCircuitPublicInputs;
|
|
@@ -301,22 +301,22 @@ export type MockRollupTxBasePublicInputType = {
|
|
|
301
301
|
export type MockRollupTxBasePublicReturnType = RollupPublicInputs;
|
|
302
302
|
|
|
303
303
|
|
|
304
|
-
export async function MockRollupTxBasePublic(
|
|
304
|
+
export async function MockRollupTxBasePublic(chonk_proof_data: ChonkProofData, verification_key: VerificationKey<1000>, proof: FixedLengthArray<Field, 20000>, public_inputs: AvmCircuitPublicInputs, MockRollupTxBasePublic_circuit: CompiledCircuit, foreignCallHandler?: ForeignCallHandler): Promise<RollupPublicInputs> {
|
|
305
305
|
const program = new Noir(MockRollupTxBasePublic_circuit);
|
|
306
|
-
const args: InputMap = {
|
|
306
|
+
const args: InputMap = { chonk_proof_data, verification_key, proof, public_inputs };
|
|
307
307
|
const { returnValue } = await program.execute(args, foreignCallHandler);
|
|
308
308
|
return returnValue as RollupPublicInputs;
|
|
309
309
|
}
|
|
310
310
|
export type MockRollupTxBasePrivateInputType = {
|
|
311
|
-
|
|
311
|
+
chonk_proof_data: ChonkProofData;
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
export type MockRollupTxBasePrivateReturnType = RollupPublicInputs;
|
|
315
315
|
|
|
316
316
|
|
|
317
|
-
export async function MockRollupTxBasePrivate(
|
|
317
|
+
export async function MockRollupTxBasePrivate(chonk_proof_data: ChonkProofData, MockRollupTxBasePrivate_circuit: CompiledCircuit, foreignCallHandler?: ForeignCallHandler): Promise<RollupPublicInputs> {
|
|
318
318
|
const program = new Noir(MockRollupTxBasePrivate_circuit);
|
|
319
|
-
const args: InputMap = {
|
|
319
|
+
const args: InputMap = { chonk_proof_data };
|
|
320
320
|
const { returnValue } = await program.execute(args, foreignCallHandler);
|
|
321
321
|
return returnValue as RollupPublicInputs;
|
|
322
322
|
}
|
package/src/witgen.ts
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
MEGA_VK_LENGTH_IN_FIELDS,
|
|
5
5
|
} from '@aztec/constants';
|
|
6
6
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
7
|
-
import { Fr } from '@aztec/foundation/
|
|
7
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
8
8
|
import { applyStringFormatting, createLogger } from '@aztec/foundation/log';
|
|
9
9
|
import { type ForeignCallInput, type ForeignCallOutput, Noir } from '@aztec/noir-noir_js';
|
|
10
10
|
import type { AvmCircuitPublicInputs } from '@aztec/stdlib/avm';
|
|
@@ -12,6 +12,7 @@ import type { RecursiveProof } from '@aztec/stdlib/proofs';
|
|
|
12
12
|
import { VerificationKeyAsFields } from '@aztec/stdlib/vks';
|
|
13
13
|
|
|
14
14
|
import { strict as assert } from 'assert';
|
|
15
|
+
import { ungzip } from 'pako';
|
|
15
16
|
|
|
16
17
|
import MockAppCreatorCircuit from '../artifacts/app_creator.json' with { type: 'json' };
|
|
17
18
|
import MockAppReaderCircuit from '../artifacts/app_reader.json' with { type: 'json' };
|
|
@@ -251,7 +252,7 @@ export async function generateTestingIVCStack(
|
|
|
251
252
|
// A call to the reader app creates 1 read request. A reset kernel will be run if there are 2 read requests in the
|
|
252
253
|
// public inputs. All read requests must be cleared before running the tail kernel.
|
|
253
254
|
numReaderAppCalls: number,
|
|
254
|
-
): Promise<[
|
|
255
|
+
): Promise<[Uint8Array[], Uint8Array[], KernelPublicInputs, Uint8Array[]]> {
|
|
255
256
|
if (numCreatorAppCalls > 2) {
|
|
256
257
|
throw new Error('The creator app can only be called at most twice.');
|
|
257
258
|
}
|
|
@@ -368,7 +369,22 @@ export async function generateTestingIVCStack(
|
|
|
368
369
|
bytecodes.push(MockHidingCircuit.bytecode);
|
|
369
370
|
vks.push(MockHidingVk.keyAsBytes);
|
|
370
371
|
|
|
371
|
-
|
|
372
|
+
function base64ToUint8Array(base64: string): Uint8Array {
|
|
373
|
+
return Uint8Array.from(atob(base64), c => c.charCodeAt(0));
|
|
374
|
+
}
|
|
375
|
+
function hexToUint8Array(hex: string): Uint8Array {
|
|
376
|
+
const cleaned = hex.replace(/^0x/i, '');
|
|
377
|
+
const bytes = new Uint8Array(cleaned.length / 2);
|
|
378
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
379
|
+
bytes[i] = parseInt(cleaned.slice(i * 2, i * 2 + 2), 16);
|
|
380
|
+
}
|
|
381
|
+
return bytes;
|
|
382
|
+
}
|
|
383
|
+
const rawBytecodes = bytecodes.map(base64ToUint8Array).map((arr: Uint8Array) => ungzip(arr));
|
|
384
|
+
const rawWitnessStack = witnessStack.map((arr: Uint8Array) => ungzip(arr));
|
|
385
|
+
const rawVks = vks.map(hexToUint8Array);
|
|
386
|
+
|
|
387
|
+
return [rawBytecodes, rawWitnessStack, hidingWitnessGenResult.publicInputs, rawVks];
|
|
372
388
|
}
|
|
373
389
|
|
|
374
390
|
export function mapRecursiveProofToNoir<N extends number>(proof: RecursiveProof<N>): FixedLengthArray<string, N> {
|
package/dest/prove_wasm.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ClientIvcProofWithPublicInputs } from '@aztec/stdlib/proofs';
|
|
2
|
-
export declare function proveClientIVC(bytecodes: string[], witnessStack: Uint8Array[], vks: string[], threads?: number): Promise<ClientIvcProofWithPublicInputs>;
|
|
3
|
-
export declare function proveThenVerifyAztecClient(bytecodes: string[], witnessStack: Uint8Array[], vks: string[], threads?: number): Promise<boolean>;
|
|
4
|
-
//# sourceMappingURL=prove_wasm.d.ts.map
|
package/dest/prove_wasm.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prove_wasm.d.ts","sourceRoot":"","sources":["../src/prove_wasm.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AAWtE,wBAAsB,cAAc,CAClC,SAAS,EAAE,MAAM,EAAE,EACnB,YAAY,EAAE,UAAU,EAAE,EAC1B,GAAG,EAAE,MAAM,EAAE,EACb,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,8BAA8B,CAAC,CAezC;AAED,wBAAsB,0BAA0B,CAC9C,SAAS,EAAE,MAAM,EAAE,EACnB,YAAY,EAAE,UAAU,EAAE,EAC1B,GAAG,EAAE,MAAM,EAAE,EACb,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,CAAC,CAiBlB"}
|
package/dest/prove_wasm.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
-
import { ClientIvcProofWithPublicInputs } from '@aztec/stdlib/proofs';
|
|
3
|
-
import os from 'os';
|
|
4
|
-
import { ungzip } from 'pako';
|
|
5
|
-
const logger = createLogger('ivc-integration:prove_wasm');
|
|
6
|
-
function base64ToUint8Array(base64) {
|
|
7
|
-
return Uint8Array.from(atob(base64), (c)=>c.charCodeAt(0));
|
|
8
|
-
}
|
|
9
|
-
export async function proveClientIVC(bytecodes, witnessStack, vks, threads) {
|
|
10
|
-
const { AztecClientBackend } = await import('@aztec/bb.js');
|
|
11
|
-
const backend = new AztecClientBackend(bytecodes.map(base64ToUint8Array).map((arr)=>ungzip(arr)), {
|
|
12
|
-
threads: threads || Math.min(os.cpus().length, 16),
|
|
13
|
-
logger: logger.info,
|
|
14
|
-
wasmPath: process.env.BB_WASM_PATH
|
|
15
|
-
});
|
|
16
|
-
try {
|
|
17
|
-
const [proof] = await backend.prove(witnessStack.map((arr)=>ungzip(arr)), vks.map((hex)=>new Uint8Array(Buffer.from(hex, 'hex'))));
|
|
18
|
-
return ClientIvcProofWithPublicInputs.fromBufferArray(proof);
|
|
19
|
-
} finally{
|
|
20
|
-
await backend.destroy();
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export async function proveThenVerifyAztecClient(bytecodes, witnessStack, vks, threads) {
|
|
24
|
-
const { AztecClientBackend } = await import('@aztec/bb.js');
|
|
25
|
-
const backend = new AztecClientBackend(bytecodes.map(base64ToUint8Array).map((arr)=>ungzip(arr)), {
|
|
26
|
-
threads: threads || Math.min(os.cpus().length, 16),
|
|
27
|
-
logger: logger.info,
|
|
28
|
-
wasmPath: process.env.BB_WASM_PATH
|
|
29
|
-
});
|
|
30
|
-
try {
|
|
31
|
-
// These are optional - easier not to pass them.
|
|
32
|
-
const [_, msgpackProof, vk] = await backend.prove(witnessStack.map((arr)=>ungzip(arr)), vks.map((hex)=>new Uint8Array(Buffer.from(hex, 'hex'))));
|
|
33
|
-
const verified = await backend.verify(msgpackProof, vk);
|
|
34
|
-
return verified;
|
|
35
|
-
} finally{
|
|
36
|
-
await backend.destroy();
|
|
37
|
-
}
|
|
38
|
-
}
|
package/src/prove_wasm.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
-
import { ClientIvcProofWithPublicInputs } from '@aztec/stdlib/proofs';
|
|
3
|
-
|
|
4
|
-
import os from 'os';
|
|
5
|
-
import { ungzip } from 'pako';
|
|
6
|
-
|
|
7
|
-
const logger = createLogger('ivc-integration:prove_wasm');
|
|
8
|
-
|
|
9
|
-
function base64ToUint8Array(base64: string): Uint8Array {
|
|
10
|
-
return Uint8Array.from(atob(base64), c => c.charCodeAt(0));
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export async function proveClientIVC(
|
|
14
|
-
bytecodes: string[],
|
|
15
|
-
witnessStack: Uint8Array[],
|
|
16
|
-
vks: string[],
|
|
17
|
-
threads?: number,
|
|
18
|
-
): Promise<ClientIvcProofWithPublicInputs> {
|
|
19
|
-
const { AztecClientBackend } = await import('@aztec/bb.js');
|
|
20
|
-
const backend = new AztecClientBackend(
|
|
21
|
-
bytecodes.map(base64ToUint8Array).map((arr: Uint8Array) => ungzip(arr)),
|
|
22
|
-
{ threads: threads || Math.min(os.cpus().length, 16), logger: logger.info, wasmPath: process.env.BB_WASM_PATH },
|
|
23
|
-
);
|
|
24
|
-
try {
|
|
25
|
-
const [proof] = await backend.prove(
|
|
26
|
-
witnessStack.map((arr: Uint8Array) => ungzip(arr)),
|
|
27
|
-
vks.map(hex => new Uint8Array(Buffer.from(hex, 'hex'))),
|
|
28
|
-
);
|
|
29
|
-
return ClientIvcProofWithPublicInputs.fromBufferArray(proof);
|
|
30
|
-
} finally {
|
|
31
|
-
await backend.destroy();
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export async function proveThenVerifyAztecClient(
|
|
36
|
-
bytecodes: string[],
|
|
37
|
-
witnessStack: Uint8Array[],
|
|
38
|
-
vks: string[],
|
|
39
|
-
threads?: number,
|
|
40
|
-
): Promise<boolean> {
|
|
41
|
-
const { AztecClientBackend } = await import('@aztec/bb.js');
|
|
42
|
-
const backend = new AztecClientBackend(
|
|
43
|
-
bytecodes.map(base64ToUint8Array).map((arr: Uint8Array) => ungzip(arr)),
|
|
44
|
-
{ threads: threads || Math.min(os.cpus().length, 16), logger: logger.info, wasmPath: process.env.BB_WASM_PATH },
|
|
45
|
-
);
|
|
46
|
-
try {
|
|
47
|
-
// These are optional - easier not to pass them.
|
|
48
|
-
const [_, msgpackProof, vk] = await backend.prove(
|
|
49
|
-
witnessStack.map((arr: Uint8Array) => ungzip(arr)),
|
|
50
|
-
vks.map(hex => new Uint8Array(Buffer.from(hex, 'hex'))),
|
|
51
|
-
);
|
|
52
|
-
const verified = await backend.verify(msgpackProof, vk);
|
|
53
|
-
return verified;
|
|
54
|
-
} finally {
|
|
55
|
-
await backend.destroy();
|
|
56
|
-
}
|
|
57
|
-
}
|