@aztec/bb-prover 0.87.1 → 0.87.2-nightly.20250523
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/avm_proving_tests/avm_proving_tester.d.ts +3 -10
- package/dest/avm_proving_tests/avm_proving_tester.d.ts.map +1 -1
- package/dest/avm_proving_tests/avm_proving_tester.js +18 -62
- package/dest/bb/execute.d.ts +5 -24
- package/dest/bb/execute.d.ts.map +1 -1
- package/dest/bb/execute.js +16 -104
- package/dest/prover/server/bb_prover.d.ts +5 -5
- package/dest/prover/server/bb_prover.d.ts.map +1 -1
- package/dest/prover/server/bb_prover.js +22 -13
- package/dest/test/test_circuit_prover.d.ts +2 -2
- package/dest/test/test_circuit_prover.d.ts.map +1 -1
- package/dest/test/test_circuit_prover.js +2 -2
- package/dest/verification_key/verification_key_data.d.ts +6 -0
- package/dest/verification_key/verification_key_data.d.ts.map +1 -1
- package/dest/verification_key/verification_key_data.js +16 -16
- package/package.json +16 -16
- package/src/avm_proving_tests/avm_proving_tester.ts +30 -87
- package/src/bb/execute.ts +22 -123
- package/src/prover/server/bb_prover.ts +48 -30
- package/src/test/test_circuit_prover.ts +7 -5
- package/src/verification_key/verification_key_data.ts +20 -13
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED,
|
|
3
|
+
AVM_V2_VERIFICATION_KEY_LENGTH_IN_FIELDS_PADDED,
|
|
4
4
|
NESTED_RECURSIVE_PROOF_LENGTH,
|
|
5
5
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
6
6
|
RECURSIVE_PROOF_LENGTH,
|
|
@@ -302,14 +302,16 @@ export class TestCircuitProver implements ServerCircuitProver {
|
|
|
302
302
|
);
|
|
303
303
|
}
|
|
304
304
|
|
|
305
|
-
public getAvmProof(
|
|
305
|
+
public getAvmProof(
|
|
306
|
+
_inputs: AvmCircuitInputs,
|
|
307
|
+
): Promise<ProofAndVerificationKey<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>> {
|
|
306
308
|
// We can't simulate the AVM because we don't have enough context to do so (e.g., DBs).
|
|
307
309
|
// We just return an empty proof and VK data.
|
|
308
310
|
this.logger.debug('Skipping AVM simulation in TestCircuitProver.');
|
|
309
311
|
return this.applyDelay(ProvingRequestType.PUBLIC_VM, () =>
|
|
310
312
|
makeProofAndVerificationKey(
|
|
311
|
-
makeEmptyRecursiveProof(
|
|
312
|
-
VerificationKeyData.makeFake(
|
|
313
|
+
makeEmptyRecursiveProof(AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED),
|
|
314
|
+
VerificationKeyData.makeFake(AVM_V2_VERIFICATION_KEY_LENGTH_IN_FIELDS_PADDED),
|
|
313
315
|
),
|
|
314
316
|
);
|
|
315
317
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AVM_V2_VERIFICATION_KEY_LENGTH_IN_FIELDS_PADDED } from '@aztec/constants';
|
|
2
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
+
import { BufferReader } from '@aztec/foundation/serialize';
|
|
3
4
|
import { hashVK } from '@aztec/stdlib/hash';
|
|
4
5
|
import { VerificationKeyAsFields, VerificationKeyData } from '@aztec/stdlib/vks';
|
|
5
6
|
|
|
@@ -27,19 +28,25 @@ export async function extractVkData(vkDirectoryPath: string): Promise<Verificati
|
|
|
27
28
|
return new VerificationKeyData(vkAsFields, rawBinary);
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Reads the verification key data stored in a binary file at the specified directory location and parses into a VerificationKeyData.
|
|
33
|
+
* We do not assume any JSON file available but only the binary version, contrary to the above extractVkData() method.
|
|
34
|
+
* @param vkDirectoryPath - The directory containing the verification key binary data file.
|
|
35
|
+
* @returns The verification key data
|
|
36
|
+
*/
|
|
31
37
|
export async function extractAvmVkData(vkDirectoryPath: string): Promise<VerificationKeyData> {
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
const rawBinary = await fs.readFile(path.join(vkDirectoryPath, VK_FILENAME));
|
|
39
|
+
|
|
40
|
+
const numFields = rawBinary.length / Fr.SIZE_IN_BYTES;
|
|
41
|
+
assert(numFields <= AVM_V2_VERIFICATION_KEY_LENGTH_IN_FIELDS_PADDED, 'Invalid AVM verification key length');
|
|
42
|
+
const reader = BufferReader.asReader(rawBinary);
|
|
43
|
+
const fieldsArray = reader.readArray(numFields, Fr);
|
|
44
|
+
|
|
45
|
+
const fieldsArrayPadded = fieldsArray.concat(
|
|
46
|
+
Array(AVM_V2_VERIFICATION_KEY_LENGTH_IN_FIELDS_PADDED - fieldsArray.length).fill(new Fr(0)),
|
|
47
|
+
);
|
|
48
|
+
// Currently, we do not need the vk hash for the AVM as we are not adding in the vk tree.
|
|
49
|
+
const vkAsFields = new VerificationKeyAsFields(fieldsArrayPadded, new Fr(0));
|
|
43
50
|
const vk = new VerificationKeyData(vkAsFields, rawBinary);
|
|
44
51
|
return vk;
|
|
45
52
|
}
|