@aztec/bb.js 0.86.0-nightly.20250518 → 0.86.0-nightly.20250520
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/dest/browser/index.js +116 -116
- package/dest/browser/main.worker.js +116 -116
- package/dest/browser/thread.worker.js +116 -116
- package/dest/node/barretenberg/backend.d.ts.map +1 -1
- package/dest/node/barretenberg/backend.js +1 -1
- package/dest/node/barretenberg/index.d.ts.map +1 -1
- package/dest/node/barretenberg/index.js +1 -1
- package/dest/node/bigint-array/index.d.ts +1 -0
- package/dest/node/bigint-array/index.d.ts.map +1 -1
- package/dest/node/bindgen/mappings.js +2 -2
- package/dest/node/bindgen/typescript.js +1 -1
- package/dest/node/crs/net_crs.js +2 -2
- package/dest/node/main.js +1 -1
- package/dest/node/serialize/buffer_reader.d.ts.map +1 -1
- package/dest/node/serialize/buffer_reader.js +1 -1
- package/dest/node/types/fields.d.ts +1 -0
- package/dest/node/types/fields.d.ts.map +1 -1
- package/dest/node/types/fields.js +1 -1
- package/dest/node/types/point.d.ts +1 -0
- package/dest/node/types/point.d.ts.map +1 -1
- package/dest/node/types/point.js +1 -1
- package/dest/node-cjs/barretenberg/backend.d.ts.map +1 -1
- package/dest/node-cjs/barretenberg/backend.js +1 -1
- package/dest/node-cjs/barretenberg/index.d.ts.map +1 -1
- package/dest/node-cjs/barretenberg/index.js +1 -1
- package/dest/node-cjs/bigint-array/index.d.ts +1 -0
- package/dest/node-cjs/bigint-array/index.d.ts.map +1 -1
- package/dest/node-cjs/bindgen/mappings.js +2 -2
- package/dest/node-cjs/bindgen/typescript.js +1 -1
- package/dest/node-cjs/crs/net_crs.js +2 -2
- package/dest/node-cjs/main.js +1 -1
- package/dest/node-cjs/serialize/buffer_reader.d.ts.map +1 -1
- package/dest/node-cjs/serialize/buffer_reader.js +1 -1
- package/dest/node-cjs/types/fields.d.ts +1 -0
- package/dest/node-cjs/types/fields.d.ts.map +1 -1
- package/dest/node-cjs/types/fields.js +1 -1
- package/dest/node-cjs/types/point.d.ts +1 -0
- package/dest/node-cjs/types/point.d.ts.map +1 -1
- package/dest/node-cjs/types/point.js +1 -1
- package/package.json +6 -7
- package/src/barretenberg/backend.ts +24 -21
- package/src/barretenberg/index.ts +5 -1
- package/src/bindgen/mappings.ts +1 -1
- package/src/bindgen/typescript.ts +4 -4
- package/src/crs/net_crs.ts +1 -1
- package/src/index.html +1 -1
- package/src/main.ts +12 -12
- package/src/serialize/buffer_reader.ts +4 -1
- package/src/types/fields.ts +2 -2
- package/src/types/point.ts +4 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/bb.js",
|
|
3
3
|
"packageManager": "yarn@4.5.2",
|
|
4
|
-
"version": "0.86.0-nightly.
|
|
4
|
+
"version": "0.86.0-nightly.20250520",
|
|
5
5
|
"homepage": "https://github.com/AztecProtocol/aztec-packages/tree/master/barretenberg/ts",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
@@ -78,24 +78,23 @@
|
|
|
78
78
|
"@types/debug": "^4.1.7",
|
|
79
79
|
"@types/detect-node": "^2.0.0",
|
|
80
80
|
"@types/jest": "^29.4.0",
|
|
81
|
-
"@types/node": "^
|
|
81
|
+
"@types/node": "^22.15.17",
|
|
82
82
|
"@types/pako": "^2.0.3",
|
|
83
83
|
"@types/source-map-support": "^0.5.6",
|
|
84
|
-
"@typescript-eslint/eslint-plugin": "^5.54.1",
|
|
85
|
-
"@typescript-eslint/parser": "^5.54.1",
|
|
86
84
|
"buffer": "^6.0.3",
|
|
87
|
-
"eslint": "^
|
|
88
|
-
"eslint-config-prettier": "^
|
|
85
|
+
"eslint": "^9.26.0",
|
|
86
|
+
"eslint-config-prettier": "^10.1.5",
|
|
89
87
|
"html-webpack-plugin": "^5.6.3",
|
|
90
88
|
"idb-keyval": "^6.2.1",
|
|
91
89
|
"jest": "^29.5.0",
|
|
92
90
|
"node-polyfill-webpack-plugin": "^4.1.0",
|
|
93
|
-
"prettier": "^
|
|
91
|
+
"prettier": "^3.5.3",
|
|
94
92
|
"terser-webpack-plugin": "^5.3.14",
|
|
95
93
|
"ts-jest": "^29.1.0",
|
|
96
94
|
"ts-loader": "^9.4.2",
|
|
97
95
|
"ts-node": "^10.9.1",
|
|
98
96
|
"typescript": "5.4.5",
|
|
97
|
+
"typescript-eslint": "^8.32.1",
|
|
99
98
|
"webpack": "^5.99.6",
|
|
100
99
|
"webpack-cli": "^6.0.1",
|
|
101
100
|
"webpack-dev-server": "^5.2.1"
|
|
@@ -90,10 +90,10 @@ export class UltraHonkBackend {
|
|
|
90
90
|
const proveUltraHonk = options?.keccak
|
|
91
91
|
? this.api.acirProveUltraKeccakHonk.bind(this.api)
|
|
92
92
|
: options?.keccakZK
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
? this.api.acirProveUltraKeccakZKHonk.bind(this.api)
|
|
94
|
+
: options?.starknet
|
|
95
|
+
? this.api.acirProveUltraStarknetHonk.bind(this.api)
|
|
96
|
+
: this.api.acirProveUltraHonk.bind(this.api);
|
|
97
97
|
|
|
98
98
|
const proofWithPublicInputs = await proveUltraHonk(this.acirUncompressedBytecode, gunzip(compressedWitness));
|
|
99
99
|
|
|
@@ -101,10 +101,10 @@ export class UltraHonkBackend {
|
|
|
101
101
|
const writeVKUltraHonk = options?.keccak
|
|
102
102
|
? this.api.acirWriteVkUltraKeccakHonk.bind(this.api)
|
|
103
103
|
: options?.keccakZK
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
? this.api.acirWriteVkUltraKeccakZKHonk.bind(this.api)
|
|
105
|
+
: options?.starknet
|
|
106
|
+
? this.api.acirWriteVkUltraStarknetHonk.bind(this.api)
|
|
107
|
+
: this.api.acirWriteVkUltraHonk.bind(this.api);
|
|
108
108
|
|
|
109
109
|
const vk = await writeVKUltraHonk(this.acirUncompressedBytecode);
|
|
110
110
|
const vkAsFields = await this.api.acirVkAsFieldsUltraHonk(new RawBuffer(vk));
|
|
@@ -127,17 +127,17 @@ export class UltraHonkBackend {
|
|
|
127
127
|
const writeVkUltraHonk = options?.keccak
|
|
128
128
|
? this.api.acirWriteVkUltraKeccakHonk.bind(this.api)
|
|
129
129
|
: options?.keccakZK
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
? this.api.acirWriteVkUltraKeccakZKHonk.bind(this.api)
|
|
131
|
+
: options?.starknet
|
|
132
|
+
? this.api.acirWriteVkUltraStarknetHonk.bind(this.api)
|
|
133
|
+
: this.api.acirWriteVkUltraHonk.bind(this.api);
|
|
134
134
|
const verifyUltraHonk = options?.keccak
|
|
135
135
|
? this.api.acirVerifyUltraKeccakHonk.bind(this.api)
|
|
136
136
|
: options?.keccakZK
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
? this.api.acirVerifyUltraKeccakZKHonk.bind(this.api)
|
|
138
|
+
: options?.starknet
|
|
139
|
+
? this.api.acirVerifyUltraStarknetHonk.bind(this.api)
|
|
140
|
+
: this.api.acirVerifyUltraHonk.bind(this.api);
|
|
141
141
|
|
|
142
142
|
const vkBuf = await writeVkUltraHonk(this.acirUncompressedBytecode);
|
|
143
143
|
return await verifyUltraHonk(proof, new RawBuffer(vkBuf));
|
|
@@ -148,10 +148,10 @@ export class UltraHonkBackend {
|
|
|
148
148
|
return options?.keccak
|
|
149
149
|
? await this.api.acirWriteVkUltraKeccakHonk(this.acirUncompressedBytecode)
|
|
150
150
|
: options?.keccakZK
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
? await this.api.acirWriteVkUltraKeccakZKHonk(this.acirUncompressedBytecode)
|
|
152
|
+
: options?.starknet
|
|
153
|
+
? await this.api.acirWriteVkUltraStarknetHonk(this.acirUncompressedBytecode)
|
|
154
|
+
: await this.api.acirWriteVkUltraHonk(this.acirUncompressedBytecode);
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
/** @description Returns a solidity verifier */
|
|
@@ -242,7 +242,10 @@ export class AztecClientBackend {
|
|
|
242
242
|
|
|
243
243
|
protected api!: Barretenberg;
|
|
244
244
|
|
|
245
|
-
constructor(
|
|
245
|
+
constructor(
|
|
246
|
+
protected acirBuf: Uint8Array[],
|
|
247
|
+
protected options: BackendOptions = { threads: 1 },
|
|
248
|
+
) {}
|
|
246
249
|
|
|
247
250
|
/** @ignore */
|
|
248
251
|
private async instantiate(): Promise<void> {
|
|
@@ -40,7 +40,11 @@ export type CircuitOptions = {
|
|
|
40
40
|
export class Barretenberg extends BarretenbergApi {
|
|
41
41
|
private options: BackendOptions;
|
|
42
42
|
|
|
43
|
-
private constructor(
|
|
43
|
+
private constructor(
|
|
44
|
+
private worker: any,
|
|
45
|
+
wasm: BarretenbergWasmMainWorker,
|
|
46
|
+
options: BackendOptions,
|
|
47
|
+
) {
|
|
44
48
|
super(wasm);
|
|
45
49
|
this.options = options;
|
|
46
50
|
}
|
package/src/bindgen/mappings.ts
CHANGED
|
@@ -13,7 +13,7 @@ const typeMap: { [key: string]: string } = {
|
|
|
13
13
|
'fq::vec_in_buf': 'Fq[]',
|
|
14
14
|
'fq::vec_out_buf': 'Fq[]',
|
|
15
15
|
'const uint8_t *': 'Uint8Array',
|
|
16
|
-
|
|
16
|
+
uint8_vec_vec_in_buf: 'Uint8Array[]',
|
|
17
17
|
'uint8_t **': 'Uint8Array',
|
|
18
18
|
in_str_buf: 'string',
|
|
19
19
|
out_str_buf: 'string',
|
|
@@ -46,8 +46,8 @@ export class BarretenbergApi {
|
|
|
46
46
|
outArgs.length === 0
|
|
47
47
|
? 'void'
|
|
48
48
|
: outArgs.length === 1
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
? `${mapType(outArgs[0].type)}`
|
|
50
|
+
: `[${outArgs.map(a => mapType(a.type)).join(', ')}]`;
|
|
51
51
|
|
|
52
52
|
output += `
|
|
53
53
|
async ${toCamelCase(functionName)}(${parameters}): Promise<${returnType}> {
|
|
@@ -93,8 +93,8 @@ export class BarretenbergApiSync {
|
|
|
93
93
|
outArgs.length === 0
|
|
94
94
|
? 'void'
|
|
95
95
|
: outArgs.length === 1
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
? `${mapType(outArgs[0].type)}`
|
|
97
|
+
: `[${outArgs.map(a => mapType(a.type)).join(', ')}]`;
|
|
98
98
|
|
|
99
99
|
output += `
|
|
100
100
|
${toCamelCase(functionName)}(${parameters}): ${returnType} {
|
package/src/crs/net_crs.ts
CHANGED
|
@@ -152,7 +152,7 @@ export class NetGrumpkinCrs {
|
|
|
152
152
|
return new Response(new Uint8Array([]));
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
const g1End =
|
|
155
|
+
const g1End = this.numPoints * 64 - 1;
|
|
156
156
|
|
|
157
157
|
return await fetch('https://crs.aztec.network/grumpkin_g1.dat', {
|
|
158
158
|
headers: {
|
package/src/index.html
CHANGED
package/src/main.ts
CHANGED
|
@@ -400,10 +400,10 @@ export async function proveUltraHonk(
|
|
|
400
400
|
const acirProveUltraHonk = options?.keccak
|
|
401
401
|
? api.acirProveUltraKeccakHonk.bind(api)
|
|
402
402
|
: options?.keccakZK
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
403
|
+
? api.acirProveUltraKeccakZKHonk.bind(api)
|
|
404
|
+
: options?.starknet
|
|
405
|
+
? api.acirProveUltraStarknetHonk.bind(api)
|
|
406
|
+
: api.acirProveUltraHonk.bind(api);
|
|
407
407
|
const proof = await acirProveUltraHonk(bytecode, witness);
|
|
408
408
|
|
|
409
409
|
if (outputPath === '-') {
|
|
@@ -432,10 +432,10 @@ export async function writeVkUltraHonk(
|
|
|
432
432
|
const acirWriteVkUltraHonk = options?.keccak
|
|
433
433
|
? api.acirWriteVkUltraKeccakHonk.bind(api)
|
|
434
434
|
: options?.keccakZK
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
435
|
+
? api.acirWriteVkUltraKeccakZKHonk.bind(api)
|
|
436
|
+
: options?.starknet
|
|
437
|
+
? api.acirWriteVkUltraStarknetHonk.bind(api)
|
|
438
|
+
: api.acirWriteVkUltraHonk.bind(api);
|
|
439
439
|
const vk = await acirWriteVkUltraHonk(bytecode);
|
|
440
440
|
|
|
441
441
|
if (outputPath === '-') {
|
|
@@ -461,10 +461,10 @@ export async function verifyUltraHonk(
|
|
|
461
461
|
const acirVerifyUltraHonk = options?.keccak
|
|
462
462
|
? api.acirVerifyUltraKeccakHonk.bind(api)
|
|
463
463
|
: options?.keccakZK
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
464
|
+
? api.acirVerifyUltraKeccakZKHonk.bind(api)
|
|
465
|
+
: options?.starknet
|
|
466
|
+
? api.acirVerifyUltraStarknetHonk.bind(api)
|
|
467
|
+
: api.acirVerifyUltraHonk.bind(api);
|
|
468
468
|
const verified = await acirVerifyUltraHonk(
|
|
469
469
|
Uint8Array.from(readFileSync(proofPath)),
|
|
470
470
|
new RawBuffer(readFileSync(vkPath)),
|
package/src/types/fields.ts
CHANGED
|
@@ -26,8 +26,8 @@ export class Fr {
|
|
|
26
26
|
typeof value === 'bigint'
|
|
27
27
|
? value
|
|
28
28
|
: value instanceof Buffer
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
? buffer32BytesToBigIntBE(value)
|
|
30
|
+
: uint8ArrayToBigIntBE(value);
|
|
31
31
|
|
|
32
32
|
if (valueBigInt > Fr.MAX_VALUE) {
|
|
33
33
|
throw new Error(`Value 0x${valueBigInt.toString(16)} is greater or equal to field modulus.`);
|
package/src/types/point.ts
CHANGED
|
@@ -5,7 +5,10 @@ export class Point {
|
|
|
5
5
|
static SIZE_IN_BYTES = 64;
|
|
6
6
|
static EMPTY = new Point(Fr.ZERO, Fr.ZERO);
|
|
7
7
|
|
|
8
|
-
constructor(
|
|
8
|
+
constructor(
|
|
9
|
+
public readonly x: Fr,
|
|
10
|
+
public readonly y: Fr,
|
|
11
|
+
) {}
|
|
9
12
|
|
|
10
13
|
static random() {
|
|
11
14
|
// TODO: This is not a point on the curve!
|