@aztec/pxe 0.87.2 → 0.87.3-nightly.20250528
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/config/package_info.js +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +9 -3
- package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +9 -3
- package/dest/entrypoints/{client/pxe_creation_options.d.ts → pxe_creation_options.d.ts} +4 -1
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -0
- package/dest/entrypoints/server/utils.d.ts +3 -3
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +23 -15
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -1
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +8 -4
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +11 -8
- package/dest/pxe_service/pxe_service.d.ts.map +1 -1
- package/dest/pxe_service/pxe_service.js +12 -7
- package/package.json +15 -15
- package/src/config/package_info.ts +1 -1
- package/src/entrypoints/client/bundle/utils.ts +22 -14
- package/src/entrypoints/client/lazy/utils.ts +23 -10
- package/src/entrypoints/{client/pxe_creation_options.ts → pxe_creation_options.ts} +4 -1
- package/src/entrypoints/server/utils.ts +38 -20
- package/src/private_kernel/hints/build_private_kernel_reset_private_inputs.ts +9 -4
- package/src/private_kernel/private_kernel_execution_prover.ts +12 -10
- package/src/pxe_service/pxe_service.ts +11 -6
- package/dest/entrypoints/client/pxe_creation_options.d.ts.map +0 -1
- /package/dest/entrypoints/{client/pxe_creation_options.js → pxe_creation_options.js} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
2
2
|
import type { PXEServiceConfig } from '../../../config/index.js';
|
|
3
3
|
import { PXEService } from '../../../pxe_service/pxe_service.js';
|
|
4
|
-
import type { PXECreationOptions } from '
|
|
4
|
+
import type { PXECreationOptions } from '../../pxe_creation_options.js';
|
|
5
5
|
/**
|
|
6
6
|
* Create and start an PXEService instance with the given AztecNode.
|
|
7
7
|
* If no keyStore or database is provided, it will use KeyStore and MemoryDB as default values.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/entrypoints/client/bundle/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/entrypoints/client/bundle/utils.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAExE;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,gBAAgB,EACxB,OAAO,GAAE,kBAAoC,uBAyC9C"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BBWASMBundlePrivateKernelProver } from '@aztec/bb-prover/client/wasm/bundle';
|
|
2
|
+
import { randomBytes } from '@aztec/foundation/crypto';
|
|
2
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
4
|
import { createStore } from '@aztec/kv-store/indexeddb';
|
|
4
5
|
import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
|
|
@@ -16,16 +17,21 @@ import { PXEService } from '../../../pxe_service/pxe_service.js';
|
|
|
16
17
|
*/ export async function createPXEService(aztecNode, config, options = {
|
|
17
18
|
loggers: {}
|
|
18
19
|
}) {
|
|
20
|
+
const logSuffix = typeof options.useLogSuffix === 'boolean' ? options.useLogSuffix ? randomBytes(3).toString('hex') : undefined : options.useLogSuffix;
|
|
21
|
+
const loggers = options.loggers ?? {};
|
|
19
22
|
const l1Contracts = await aztecNode.getL1ContractAddresses();
|
|
20
23
|
const configWithContracts = {
|
|
21
24
|
...config,
|
|
22
25
|
l1Contracts,
|
|
23
26
|
l2BlockBatchSize: 200
|
|
24
27
|
};
|
|
25
|
-
const
|
|
28
|
+
const storeLogger = loggers.store ? loggers.store : createLogger('pxe:data:idb' + (logSuffix ? `:${logSuffix}` : ''));
|
|
29
|
+
const store = options.store ?? await createStore('pxe_data', configWithContracts, storeLogger);
|
|
26
30
|
const simulationProvider = new WASMSimulator();
|
|
27
|
-
const
|
|
31
|
+
const proverLogger = loggers.prover ? loggers.prover : createLogger('pxe:bb:wasm:bundle' + (logSuffix ? `:${logSuffix}` : ''));
|
|
32
|
+
const prover = options.prover ?? new BBWASMBundlePrivateKernelProver(simulationProvider, 16, proverLogger);
|
|
28
33
|
const protocolContractsProvider = new BundledProtocolContractsProvider();
|
|
29
|
-
const
|
|
34
|
+
const pxeLogger = loggers.pxe ? loggers.pxe : createLogger('pxe:service' + (logSuffix ? `:${logSuffix}` : ''));
|
|
35
|
+
const pxe = await PXEService.create(aztecNode, store, prover, simulationProvider, protocolContractsProvider, config, pxeLogger);
|
|
30
36
|
return pxe;
|
|
31
37
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
2
2
|
import type { PXEServiceConfig } from '../../../config/index.js';
|
|
3
3
|
import { PXEService } from '../../../pxe_service/pxe_service.js';
|
|
4
|
-
import type { PXECreationOptions } from '
|
|
4
|
+
import type { PXECreationOptions } from '../../pxe_creation_options.js';
|
|
5
5
|
/**
|
|
6
6
|
* Create and start an PXEService instance with the given AztecNode.
|
|
7
7
|
* Returns a Promise that resolves to the started PXEService instance.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/entrypoints/client/lazy/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/entrypoints/client/lazy/utils.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAExE;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,gBAAgB,EACxB,OAAO,GAAE,kBAAoC,uBA0C9C"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BBWASMLazyPrivateKernelProver } from '@aztec/bb-prover/client/wasm/lazy';
|
|
2
|
+
import { randomBytes } from '@aztec/foundation/crypto';
|
|
2
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
4
|
import { createStore } from '@aztec/kv-store/indexeddb';
|
|
4
5
|
import { LazyProtocolContractsProvider } from '@aztec/protocol-contracts/providers/lazy';
|
|
@@ -15,16 +16,21 @@ import { PXEService } from '../../../pxe_service/pxe_service.js';
|
|
|
15
16
|
*/ export async function createPXEService(aztecNode, config, options = {
|
|
16
17
|
loggers: {}
|
|
17
18
|
}) {
|
|
19
|
+
const logSuffix = typeof options.useLogSuffix === 'boolean' ? options.useLogSuffix ? randomBytes(3).toString('hex') : undefined : options.useLogSuffix;
|
|
18
20
|
const l1Contracts = await aztecNode.getL1ContractAddresses();
|
|
19
21
|
const configWithContracts = {
|
|
20
22
|
...config,
|
|
21
23
|
l2BlockBatchSize: 200,
|
|
22
24
|
l1Contracts
|
|
23
25
|
};
|
|
24
|
-
const
|
|
26
|
+
const loggers = options.loggers ?? {};
|
|
27
|
+
const storeLogger = loggers.store ? loggers.store : createLogger('pxe:data:idb' + (logSuffix ? `:${logSuffix}` : ''));
|
|
28
|
+
const store = options.store ?? await createStore('pxe_data', configWithContracts, storeLogger);
|
|
25
29
|
const simulationProvider = new WASMSimulator();
|
|
26
|
-
const
|
|
30
|
+
const proverLogger = loggers.prover ? loggers.prover : createLogger('pxe:bb:wasm:bundle' + (logSuffix ? `:${logSuffix}` : ''));
|
|
31
|
+
const prover = options.prover ?? new BBWASMLazyPrivateKernelProver(simulationProvider, 16, proverLogger);
|
|
27
32
|
const protocolContractsProvider = new LazyProtocolContractsProvider();
|
|
28
|
-
const
|
|
33
|
+
const pxeLogger = loggers.pxe ? loggers.pxe : createLogger('pxe:service' + (logSuffix ? `:${logSuffix}` : ''));
|
|
34
|
+
const pxe = await PXEService.create(aztecNode, store, prover, simulationProvider, protocolContractsProvider, config, pxeLogger);
|
|
29
35
|
return pxe;
|
|
30
36
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { Logger } from '@aztec/foundation/log';
|
|
2
|
+
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
2
3
|
import type { PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
|
|
3
4
|
export type PXECreationOptions = {
|
|
4
|
-
loggers
|
|
5
|
+
loggers?: {
|
|
5
6
|
store?: Logger;
|
|
6
7
|
pxe?: Logger;
|
|
7
8
|
prover?: Logger;
|
|
8
9
|
};
|
|
10
|
+
useLogSuffix?: boolean | string;
|
|
9
11
|
prover?: PrivateKernelProver;
|
|
12
|
+
store?: AztecAsyncKVStore;
|
|
10
13
|
};
|
|
11
14
|
//# sourceMappingURL=pxe_creation_options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pxe_creation_options.d.ts","sourceRoot":"","sources":["../../src/entrypoints/pxe_creation_options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5D,YAAY,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAChC,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,KAAK,CAAC,EAAE,iBAAiB,CAAC;CAC3B,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
2
1
|
import { type SimulationProvider } from '@aztec/simulator/client';
|
|
3
2
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
4
3
|
import type { PXEServiceConfig } from '../../config/index.js';
|
|
5
4
|
import { PXEService } from '../../pxe_service/pxe_service.js';
|
|
5
|
+
import type { PXECreationOptions } from '../pxe_creation_options.js';
|
|
6
6
|
/**
|
|
7
7
|
* Create and start an PXEService instance with the given AztecNode and config.
|
|
8
8
|
*
|
|
@@ -11,7 +11,7 @@ import { PXEService } from '../../pxe_service/pxe_service.js';
|
|
|
11
11
|
* @param useLogSuffix - Whether to add a randomly generated suffix to the PXE debug logs.
|
|
12
12
|
* @returns A Promise that resolves to the started PXEService instance.
|
|
13
13
|
*/
|
|
14
|
-
export declare function createPXEService(aztecNode: AztecNode, config: PXEServiceConfig,
|
|
14
|
+
export declare function createPXEService(aztecNode: AztecNode, config: PXEServiceConfig, options?: PXECreationOptions): Promise<PXEService>;
|
|
15
15
|
/**
|
|
16
16
|
* Create and start an PXEService instance with the given AztecNode, SimulationProvider and config.
|
|
17
17
|
*
|
|
@@ -21,5 +21,5 @@ export declare function createPXEService(aztecNode: AztecNode, config: PXEServic
|
|
|
21
21
|
* @param useLogSuffix - Whether to add a randomly generated suffix to the PXE debug logs.
|
|
22
22
|
* @returns A Promise that resolves to the started PXEService instance.
|
|
23
23
|
*/
|
|
24
|
-
export declare function createPXEServiceWithSimulationProvider(aztecNode: AztecNode, simulationProvider: SimulationProvider, config: PXEServiceConfig,
|
|
24
|
+
export declare function createPXEServiceWithSimulationProvider(aztecNode: AztecNode, simulationProvider: SimulationProvider, config: PXEServiceConfig, options?: PXECreationOptions): Promise<PXEService>;
|
|
25
25
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/server/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/server/utils.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,kBAAkB,EAGxB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAE9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,gBAAgB,EACxB,OAAO,GAAE,kBAAoC,uBAQ9C;AAED;;;;;;;;GAQG;AACH,wBAAsB,sCAAsC,CAC1D,SAAS,EAAE,SAAS,EACpB,kBAAkB,EAAE,kBAAkB,EACtC,MAAM,EAAE,gBAAgB,EACxB,OAAO,GAAE,kBAAoC,uBA4C9C"}
|
|
@@ -3,8 +3,8 @@ import { BBWASMBundlePrivateKernelProver } from '@aztec/bb-prover/client/wasm/bu
|
|
|
3
3
|
import { randomBytes } from '@aztec/foundation/crypto';
|
|
4
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
5
5
|
import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
|
|
6
|
-
import { WASMSimulator } from '@aztec/simulator/client';
|
|
7
|
-
import {
|
|
6
|
+
import { MemoryCircuitRecorder, SimulationProviderRecorderWrapper, WASMSimulator } from '@aztec/simulator/client';
|
|
7
|
+
import { FileCircuitRecorder } from '@aztec/simulator/testing';
|
|
8
8
|
import { PXEService } from '../../pxe_service/pxe_service.js';
|
|
9
9
|
import { PXE_DATA_SCHEMA_VERSION } from '../../storage/index.js';
|
|
10
10
|
/**
|
|
@@ -14,10 +14,13 @@ import { PXE_DATA_SCHEMA_VERSION } from '../../storage/index.js';
|
|
|
14
14
|
* @param config - The PXE Service Config to use
|
|
15
15
|
* @param useLogSuffix - Whether to add a randomly generated suffix to the PXE debug logs.
|
|
16
16
|
* @returns A Promise that resolves to the started PXEService instance.
|
|
17
|
-
*/ export function createPXEService(aztecNode, config,
|
|
17
|
+
*/ export function createPXEService(aztecNode, config, options = {
|
|
18
|
+
loggers: {}
|
|
19
|
+
}) {
|
|
18
20
|
const simulationProvider = new WASMSimulator();
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
+
const recorder = process.env.CIRCUIT_RECORD_DIR ? new FileCircuitRecorder(process.env.CIRCUIT_RECORD_DIR) : new MemoryCircuitRecorder();
|
|
22
|
+
const simulationProviderWithRecorder = new SimulationProviderRecorderWrapper(simulationProvider, recorder);
|
|
23
|
+
return createPXEServiceWithSimulationProvider(aztecNode, simulationProviderWithRecorder, config, options);
|
|
21
24
|
}
|
|
22
25
|
/**
|
|
23
26
|
* Create and start an PXEService instance with the given AztecNode, SimulationProvider and config.
|
|
@@ -27,34 +30,39 @@ import { PXE_DATA_SCHEMA_VERSION } from '../../storage/index.js';
|
|
|
27
30
|
* @param config - The PXE Service Config to use
|
|
28
31
|
* @param useLogSuffix - Whether to add a randomly generated suffix to the PXE debug logs.
|
|
29
32
|
* @returns A Promise that resolves to the started PXEService instance.
|
|
30
|
-
*/ export async function createPXEServiceWithSimulationProvider(aztecNode, simulationProvider, config,
|
|
31
|
-
|
|
33
|
+
*/ export async function createPXEServiceWithSimulationProvider(aztecNode, simulationProvider, config, options = {
|
|
34
|
+
loggers: {}
|
|
35
|
+
}) {
|
|
36
|
+
const logSuffix = typeof options.useLogSuffix === 'boolean' ? options.useLogSuffix ? randomBytes(3).toString('hex') : undefined : options.useLogSuffix;
|
|
37
|
+
const loggers = options.loggers ?? {};
|
|
32
38
|
const l1Contracts = await aztecNode.getL1ContractAddresses();
|
|
33
39
|
const configWithContracts = {
|
|
34
40
|
...config,
|
|
35
41
|
l1Contracts,
|
|
36
42
|
l2BlockBatchSize: 200
|
|
37
43
|
};
|
|
38
|
-
if (!store) {
|
|
44
|
+
if (!options.store) {
|
|
39
45
|
// TODO once https://github.com/AztecProtocol/aztec-packages/issues/13656 is fixed, we can remove this and always
|
|
40
46
|
// import the lmdb-v2 version
|
|
41
47
|
const { createStore } = await import('@aztec/kv-store/lmdb-v2');
|
|
42
|
-
|
|
48
|
+
const storeLogger = loggers.store ? loggers.store : createLogger('pxe:data:lmdb' + (logSuffix ? `:${logSuffix}` : ''));
|
|
49
|
+
options.store = await createStore('pxe_data', PXE_DATA_SCHEMA_VERSION, configWithContracts, storeLogger);
|
|
43
50
|
}
|
|
44
|
-
const
|
|
51
|
+
const proverLogger = loggers.prover ? loggers.prover : createLogger('pxe:bb:native' + (logSuffix ? `:${logSuffix}` : ''));
|
|
52
|
+
const prover = await createProver(config, simulationProvider, proverLogger);
|
|
45
53
|
const protocolContractsProvider = new BundledProtocolContractsProvider();
|
|
46
|
-
const
|
|
54
|
+
const pxeLogger = loggers.pxe ? loggers.pxe : createLogger('pxe:service' + (logSuffix ? `:${logSuffix}` : ''));
|
|
55
|
+
const pxe = await PXEService.create(aztecNode, options.store, prover, simulationProvider, protocolContractsProvider, config, pxeLogger);
|
|
47
56
|
return pxe;
|
|
48
57
|
}
|
|
49
|
-
function createProver(config, simulationProvider,
|
|
58
|
+
function createProver(config, simulationProvider, logger) {
|
|
50
59
|
if (!config.bbBinaryPath || !config.bbWorkingDirectory) {
|
|
51
|
-
return new BBWASMBundlePrivateKernelProver(simulationProvider, 16);
|
|
60
|
+
return new BBWASMBundlePrivateKernelProver(simulationProvider, 16, logger);
|
|
52
61
|
} else {
|
|
53
62
|
const bbConfig = config;
|
|
54
|
-
const log = createLogger('pxe:bb-native-prover' + (logSuffix ? `:${logSuffix}` : ''));
|
|
55
63
|
return BBNativePrivateKernelProver.new({
|
|
56
64
|
bbSkipCleanup: false,
|
|
57
65
|
...bbConfig
|
|
58
|
-
}, simulationProvider,
|
|
66
|
+
}, simulationProvider, logger);
|
|
59
67
|
}
|
|
60
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build_private_kernel_reset_private_inputs.d.ts","sourceRoot":"","sources":["../../../src/private_kernel/hints/build_private_kernel_reset_private_inputs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build_private_kernel_reset_private_inputs.d.ts","sourceRoot":"","sources":["../../../src/private_kernel/hints/build_private_kernel_reset_private_inputs.ts"],"names":[],"mappings":"AAeA,OAAO,EAIL,KAAK,gCAAgC,EAErC,sCAAsC,EAGtC,KAAK,2BAA2B,EAkBjC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,0BAA0B,EAAiB,MAAM,kBAAkB,CAAC;AAGlF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAiDvE,qBAAa,sCAAsC;IAY/C,OAAO,CAAC,oBAAoB;IAC5B,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,2BAA2B;IACnC,OAAO,CAAC,8BAA8B;IAdxC,OAAO,CAAC,cAAc,CAAmC;IAEzD,OAAO,CAAC,aAAa,CAAC,CAA6B;IAEnD,OAAO,CAAC,mBAAmB,CAAoE;IAC/F,OAAO,CAAC,oBAAoB,CAAoE;IAChG,OAAO,CAAC,gBAAgB,CAAC,CAAS;IAClC,OAAO,CAAC,uBAAuB,CAA8D;IAC7F,OAAO,CAAC,mBAAmB,CAA+B;gBAGhD,oBAAoB,EAAE,2BAA2B,CAAC,gCAAgC,CAAC,EACnF,cAAc,EAAE,0BAA0B,EAAE,EAC5C,2BAA2B,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAChD,8BAA8B,EAAE,MAAM;IAahD,UAAU,IAAI,OAAO;IAwBf,KAAK,CAAC,MAAM,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;IAsElF,OAAO,CAAC,uBAAuB;IA2B/B,OAAO,CAAC,8BAA8B;IAoDtC,OAAO,CAAC,+BAA+B;IAoDvC,OAAO,CAAC,uBAAuB;IAiB/B,OAAO,CAAC,uBAAuB;IA6E/B,OAAO,CAAC,mBAAmB;IAY3B,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,oBAAoB;CAmB7B"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { MAX_KEY_VALIDATION_REQUESTS_PER_TX, MAX_NOTE_HASHES_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX, MAX_PRIVATE_LOGS_PER_TX, NULLIFIER_TREE_HEIGHT
|
|
1
|
+
import { MAX_KEY_VALIDATION_REQUESTS_PER_TX, MAX_NOTE_HASHES_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX, MAX_PRIVATE_LOGS_PER_TX, NULLIFIER_TREE_HEIGHT } from '@aztec/constants';
|
|
2
2
|
import { makeTuple } from '@aztec/foundation/array';
|
|
3
3
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
4
4
|
import { assertLength } from '@aztec/foundation/serialize';
|
|
5
5
|
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
6
6
|
import { privateKernelResetDimensionsConfig } from '@aztec/noir-protocol-circuits-types/client';
|
|
7
|
-
import { KeyValidationHint, PrivateKernelData, PrivateKernelResetCircuitPrivateInputs, PrivateKernelResetDimensions, PrivateKernelResetHints, ReadRequestResetStates, ReadRequestState, ScopedNoteHash, ScopedNullifier, ScopedReadRequest, TransientDataIndexHint, buildNoteHashReadRequestHintsFromResetStates, buildNullifierReadRequestHintsFromResetStates, buildTransientDataHints, countAccumulatedItems, findPrivateKernelResetDimensions, getNonEmptyItems, getNoteHashReadRequestResetStates, getNullifierReadRequestResetStates, privateKernelResetDimensionNames } from '@aztec/stdlib/kernel';
|
|
7
|
+
import { KeyValidationHint, PaddedSideEffects, PrivateKernelData, PrivateKernelResetCircuitPrivateInputs, PrivateKernelResetDimensions, PrivateKernelResetHints, ReadRequestResetStates, ReadRequestState, ScopedNoteHash, ScopedNullifier, ScopedReadRequest, TransientDataIndexHint, buildNoteHashReadRequestHintsFromResetStates, buildNullifierReadRequestHintsFromResetStates, buildTransientDataHints, countAccumulatedItems, findPrivateKernelResetDimensions, getNonEmptyItems, getNoteHashReadRequestResetStates, getNullifierReadRequestResetStates, privateKernelResetDimensionNames } from '@aztec/stdlib/kernel';
|
|
8
8
|
import { collectNested } from '@aztec/stdlib/tx';
|
|
9
|
+
import { VkData } from '@aztec/stdlib/vks';
|
|
9
10
|
function collectNestedReadRequests(executionStack, extractReadRequests) {
|
|
10
11
|
return collectNested(executionStack, (executionResult)=>{
|
|
11
12
|
const nonEmptyReadRequests = getNonEmptyItems(extractReadRequests(executionResult));
|
|
@@ -97,10 +98,13 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
97
98
|
const allowRemainder = isInner;
|
|
98
99
|
const dimensions = findPrivateKernelResetDimensions(this.requestedDimensions, privateKernelResetDimensionsConfig, isInner, allowRemainder);
|
|
99
100
|
const previousVkMembershipWitness = await oracle.getVkMembershipWitness(this.previousKernelOutput.verificationKey.keyAsFields);
|
|
100
|
-
const
|
|
101
|
+
const vkData = new VkData(this.previousKernelOutput.verificationKey, Number(previousVkMembershipWitness.leafIndex), previousVkMembershipWitness.siblingPath);
|
|
102
|
+
const previousKernelData = new PrivateKernelData(this.previousKernelOutput.publicInputs, vkData);
|
|
101
103
|
this.reduceReadRequestStates(this.noteHashResetStates, dimensions.NOTE_HASH_PENDING_AMOUNT, dimensions.NOTE_HASH_SETTLED_AMOUNT);
|
|
102
104
|
this.reduceReadRequestStates(this.nullifierResetStates, dimensions.NULLIFIER_PENDING_AMOUNT, dimensions.NULLIFIER_SETTLED_AMOUNT);
|
|
103
|
-
|
|
105
|
+
// TODO: Enable padding when we have a better idea what are the final amounts we should pad to.
|
|
106
|
+
const paddedSideEffects = PaddedSideEffects.empty();
|
|
107
|
+
return new PrivateKernelResetCircuitPrivateInputs(previousKernelData, paddedSideEffects, new PrivateKernelResetHints(await buildNoteHashReadRequestHintsFromResetStates(oracle, this.previousKernel.validationRequests.noteHashReadRequests, this.previousKernel.end.noteHashes, this.noteHashResetStates, noteHashLeafIndexMap), await buildNullifierReadRequestHintsFromResetStates({
|
|
104
108
|
getNullifierMembershipWitness: getNullifierMembershipWitnessResolver(oracle)
|
|
105
109
|
}, this.previousKernel.validationRequests.nullifierReadRequests, this.nullifierResetStates), await getMasterSecretKeysAndAppKeyGenerators(this.previousKernel.validationRequests.scopedKeyValidationRequestsAndGenerators, oracle), this.transientDataIndexHints, this.validationRequestsSplitCounter), dimensions);
|
|
106
110
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private_kernel_execution_prover.d.ts","sourceRoot":"","sources":["../../src/private_kernel/private_kernel_execution_prover.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"private_kernel_execution_prover.d.ts","sourceRoot":"","sources":["../../src/private_kernel/private_kernel_execution_prover.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAML,KAAK,iCAAiC,EAKtC,KAAK,oCAAoC,EAE1C,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAEL,KAAK,sBAAsB,EAC3B,SAAS,EAIV,MAAM,kBAAkB,CAAC;AAI1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAStE,MAAM,WAAW,kCAAkC;IACjD,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,WAAW,EAAE,OAAO,GAAG,iBAAiB,GAAG,MAAM,GAAG,MAAM,CAAC;CAC5D;AAED;;;;;GAKG;AACH,qBAAa,4BAA4B;IAIrC,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,UAAU;IALpB,OAAO,CAAC,GAAG,CAAuD;gBAGxD,MAAM,EAAE,mBAAmB,EAC3B,YAAY,EAAE,mBAAmB,EACjC,UAAU,UAAQ;IAG5B;;;;;;;;;;OAUG;IACG,gBAAgB,CACpB,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,sBAAsB,EACvC,EAAE,QAAQ,EAAE,kBAAkB,EAAE,WAAW,EAAE,GAAE,kCAI9C,GACA,OAAO,CAAC,iCAAiC,CAAC,oCAAoC,CAAC,CAAC;YAuPrE,qBAAqB;CA2CpC"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { VK_TREE_HEIGHT } from '@aztec/constants';
|
|
2
1
|
import { vkAsFieldsMegaHonk } from '@aztec/foundation/crypto';
|
|
3
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
5
|
-
import { assertLength } from '@aztec/foundation/serialize';
|
|
6
4
|
import { pushTestData } from '@aztec/foundation/testing';
|
|
7
5
|
import { Timer } from '@aztec/foundation/timer';
|
|
8
6
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
@@ -10,10 +8,10 @@ import { getProtocolContractLeafAndMembershipWitness, protocolContractTreeRoot }
|
|
|
10
8
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
11
9
|
import { computeContractAddressFromInstance } from '@aztec/stdlib/contract';
|
|
12
10
|
import { hashVK } from '@aztec/stdlib/hash';
|
|
13
|
-
import { PrivateCallData, PrivateKernelCircuitPublicInputs, PrivateKernelData, PrivateKernelInitCircuitPrivateInputs, PrivateKernelInnerCircuitPrivateInputs, PrivateKernelTailCircuitPrivateInputs, PrivateVerificationKeyHints } from '@aztec/stdlib/kernel';
|
|
11
|
+
import { PaddedSideEffectAmounts, PrivateCallData, PrivateKernelCircuitPublicInputs, PrivateKernelData, PrivateKernelInitCircuitPrivateInputs, PrivateKernelInnerCircuitPrivateInputs, PrivateKernelTailCircuitPrivateInputs, PrivateVerificationKeyHints } from '@aztec/stdlib/kernel';
|
|
14
12
|
import { ClientIvcProof } from '@aztec/stdlib/proofs';
|
|
15
13
|
import { collectNoteHashLeafIndexMap, collectNoteHashNullifierCounterMap, getFinalMinRevertibleSideEffectCounter } from '@aztec/stdlib/tx';
|
|
16
|
-
import { VerificationKeyAsFields, VerificationKeyData } from '@aztec/stdlib/vks';
|
|
14
|
+
import { VerificationKeyAsFields, VerificationKeyData, VkData } from '@aztec/stdlib/vks';
|
|
17
15
|
import { PrivateKernelResetPrivateInputsBuilder } from './hints/build_private_kernel_reset_private_inputs.js';
|
|
18
16
|
const NULL_SIMULATE_OUTPUT = {
|
|
19
17
|
publicInputs: PrivateKernelCircuitPublicInputs.empty(),
|
|
@@ -95,7 +93,8 @@ const NULL_SIMULATE_OUTPUT = {
|
|
|
95
93
|
witness: currentExecution.partialWitness,
|
|
96
94
|
vk: currentExecution.vk,
|
|
97
95
|
timings: {
|
|
98
|
-
witgen: currentExecution.profileResult?.timings.witgen ?? 0
|
|
96
|
+
witgen: currentExecution.profileResult?.timings.witgen ?? 0,
|
|
97
|
+
oracles: currentExecution.profileResult?.timings.oracles
|
|
99
98
|
}
|
|
100
99
|
});
|
|
101
100
|
const privateCallData = await this.createPrivateCallData(currentExecution);
|
|
@@ -116,7 +115,8 @@ const NULL_SIMULATE_OUTPUT = {
|
|
|
116
115
|
});
|
|
117
116
|
} else {
|
|
118
117
|
const previousVkMembershipWitness = await this.oracle.getVkMembershipWitness(output.verificationKey.keyAsFields);
|
|
119
|
-
const
|
|
118
|
+
const vkData = new VkData(output.verificationKey, Number(previousVkMembershipWitness.leafIndex), previousVkMembershipWitness.siblingPath);
|
|
119
|
+
const previousKernelData = new PrivateKernelData(output.publicInputs, vkData);
|
|
120
120
|
const proofInput = new PrivateKernelInnerCircuitPrivateInputs(previousKernelData, privateCallData);
|
|
121
121
|
pushTestData('private-kernel-inputs-inner', proofInput);
|
|
122
122
|
const witgenTimer = new Timer();
|
|
@@ -158,9 +158,12 @@ const NULL_SIMULATE_OUTPUT = {
|
|
|
158
158
|
}
|
|
159
159
|
// Private tail.
|
|
160
160
|
const previousVkMembershipWitness = await this.oracle.getVkMembershipWitness(output.verificationKey.keyAsFields);
|
|
161
|
-
const
|
|
161
|
+
const vkData = new VkData(output.verificationKey, Number(previousVkMembershipWitness.leafIndex), previousVkMembershipWitness.siblingPath);
|
|
162
|
+
const previousKernelData = new PrivateKernelData(output.publicInputs, vkData);
|
|
162
163
|
this.log.debug(`Calling private kernel tail with hwm ${previousKernelData.publicInputs.minRevertibleSideEffectCounter}`);
|
|
163
|
-
|
|
164
|
+
// TODO: Enable padding when we have a better what are the final amounts we should pad to.
|
|
165
|
+
const paddedSideEffectAmounts = PaddedSideEffectAmounts.empty();
|
|
166
|
+
const privateInputs = new PrivateKernelTailCircuitPrivateInputs(previousKernelData, paddedSideEffectAmounts);
|
|
164
167
|
pushTestData('private-kernel-inputs-ordering', privateInputs);
|
|
165
168
|
const witgenTimer = new Timer();
|
|
166
169
|
const tailOutput = generateWitnesses ? await this.proofCreator.generateTailOutput(privateInputs) : await this.proofCreator.simulateTail(privateInputs);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pxe_service.d.ts","sourceRoot":"","sources":["../../src/pxe_service/pxe_service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAEL,KAAK,yBAAyB,EAE/B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAiB,KAAK,kBAAkB,EAAsB,MAAM,yBAAyB,CAAC;AACrG,OAAO,EACL,KAAK,gBAAgB,EAQtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EACL,eAAe,EACf,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,KAAK,QAAQ,EACb,KAAK,cAAc,EAGpB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,KAAK,EACV,SAAS,EACT,uBAAuB,EACvB,4BAA4B,EAC5B,qBAAqB,EACrB,GAAG,EACH,OAAO,EACP,mBAAmB,EACpB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,KAAK,WAAW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BAAuB,EACzC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,YAAY,EAAE,GACzB,OAAO,CAAC,CAAC,EAAE,CAAC;IAuBT,eAAe,CAAC,CAAC,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IA6BxG,iBAAiB;CAGxB"}
|
|
@@ -459,9 +459,10 @@ import { enrichPublicSimulationError, enrichSimulationError } from './error_enri
|
|
|
459
459
|
profileMode: 'none'
|
|
460
460
|
});
|
|
461
461
|
const totalTime = totalTimer.ms();
|
|
462
|
-
const perFunction = executionSteps.map(({ functionName, timings: { witgen } })=>({
|
|
462
|
+
const perFunction = executionSteps.map(({ functionName, timings: { witgen, oracles } })=>({
|
|
463
463
|
functionName,
|
|
464
|
-
time: witgen
|
|
464
|
+
time: witgen,
|
|
465
|
+
oracles
|
|
465
466
|
}));
|
|
466
467
|
const timings = {
|
|
467
468
|
total: totalTime,
|
|
@@ -504,10 +505,13 @@ import { enrichPublicSimulationError, enrichSimulationError } from './error_enri
|
|
|
504
505
|
profileMode
|
|
505
506
|
});
|
|
506
507
|
const totalTime = totalTimer.ms();
|
|
507
|
-
const perFunction = executionSteps.map(({ functionName, timings: { witgen } })=>
|
|
508
|
+
const perFunction = executionSteps.map(({ functionName, timings: { witgen, oracles } })=>{
|
|
509
|
+
return {
|
|
508
510
|
functionName,
|
|
509
|
-
time: witgen
|
|
510
|
-
|
|
511
|
+
time: witgen,
|
|
512
|
+
oracles
|
|
513
|
+
};
|
|
514
|
+
});
|
|
511
515
|
// Gate computation is time is not relevant for profiling, so we subtract it from the total time.
|
|
512
516
|
const gateCountComputationTime = executionSteps.reduce((acc, { timings })=>acc + (timings.gateCount ?? 0), 0) ?? 0;
|
|
513
517
|
const timings = {
|
|
@@ -573,9 +577,10 @@ import { enrichPublicSimulationError, enrichSimulationError } from './error_enri
|
|
|
573
577
|
}
|
|
574
578
|
const txHash = await simulatedTx.getTxHash();
|
|
575
579
|
const totalTime = totalTimer.ms();
|
|
576
|
-
const perFunction = executionSteps.map(({ functionName, timings: { witgen } })=>({
|
|
580
|
+
const perFunction = executionSteps.map(({ functionName, timings: { witgen, oracles } })=>({
|
|
577
581
|
functionName,
|
|
578
|
-
time: witgen
|
|
582
|
+
time: witgen,
|
|
583
|
+
oracles
|
|
579
584
|
}));
|
|
580
585
|
const timings = {
|
|
581
586
|
total: totalTime,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/pxe",
|
|
3
|
-
"version": "0.87.
|
|
3
|
+
"version": "0.87.3-nightly.20250528",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": "./dest/entrypoints/server/index.js",
|
|
@@ -57,19 +57,19 @@
|
|
|
57
57
|
]
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@aztec/bb-prover": "0.87.
|
|
61
|
-
"@aztec/bb.js": "0.87.
|
|
62
|
-
"@aztec/builder": "0.87.
|
|
63
|
-
"@aztec/constants": "0.87.
|
|
64
|
-
"@aztec/ethereum": "0.87.
|
|
65
|
-
"@aztec/foundation": "0.87.
|
|
66
|
-
"@aztec/key-store": "0.87.
|
|
67
|
-
"@aztec/kv-store": "0.87.
|
|
68
|
-
"@aztec/noir-protocol-circuits-types": "0.87.
|
|
69
|
-
"@aztec/noir-types": "0.87.
|
|
70
|
-
"@aztec/protocol-contracts": "0.87.
|
|
71
|
-
"@aztec/simulator": "0.87.
|
|
72
|
-
"@aztec/stdlib": "0.87.
|
|
60
|
+
"@aztec/bb-prover": "0.87.3-nightly.20250528",
|
|
61
|
+
"@aztec/bb.js": "0.87.3-nightly.20250528",
|
|
62
|
+
"@aztec/builder": "0.87.3-nightly.20250528",
|
|
63
|
+
"@aztec/constants": "0.87.3-nightly.20250528",
|
|
64
|
+
"@aztec/ethereum": "0.87.3-nightly.20250528",
|
|
65
|
+
"@aztec/foundation": "0.87.3-nightly.20250528",
|
|
66
|
+
"@aztec/key-store": "0.87.3-nightly.20250528",
|
|
67
|
+
"@aztec/kv-store": "0.87.3-nightly.20250528",
|
|
68
|
+
"@aztec/noir-protocol-circuits-types": "0.87.3-nightly.20250528",
|
|
69
|
+
"@aztec/noir-types": "0.87.3-nightly.20250528",
|
|
70
|
+
"@aztec/protocol-contracts": "0.87.3-nightly.20250528",
|
|
71
|
+
"@aztec/simulator": "0.87.3-nightly.20250528",
|
|
72
|
+
"@aztec/stdlib": "0.87.3-nightly.20250528",
|
|
73
73
|
"koa": "^2.16.1",
|
|
74
74
|
"koa-router": "^12.0.0",
|
|
75
75
|
"lodash.omit": "^4.5.0",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"viem": "2.23.7"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
|
-
"@aztec/noir-test-contracts.js": "0.87.
|
|
81
|
+
"@aztec/noir-test-contracts.js": "0.87.3-nightly.20250528",
|
|
82
82
|
"@jest/globals": "^29.5.0",
|
|
83
83
|
"@types/jest": "^29.5.0",
|
|
84
84
|
"@types/lodash.omit": "^4.5.7",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BBWASMBundlePrivateKernelProver } from '@aztec/bb-prover/client/wasm/bundle';
|
|
2
|
+
import { randomBytes } from '@aztec/foundation/crypto';
|
|
2
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
4
|
import { createStore } from '@aztec/kv-store/indexeddb';
|
|
4
5
|
import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
|
|
@@ -7,7 +8,7 @@ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
|
7
8
|
|
|
8
9
|
import type { PXEServiceConfig } from '../../../config/index.js';
|
|
9
10
|
import { PXEService } from '../../../pxe_service/pxe_service.js';
|
|
10
|
-
import type { PXECreationOptions } from '
|
|
11
|
+
import type { PXECreationOptions } from '../../pxe_creation_options.js';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Create and start an PXEService instance with the given AztecNode.
|
|
@@ -24,6 +25,15 @@ export async function createPXEService(
|
|
|
24
25
|
config: PXEServiceConfig,
|
|
25
26
|
options: PXECreationOptions = { loggers: {} },
|
|
26
27
|
) {
|
|
28
|
+
const logSuffix =
|
|
29
|
+
typeof options.useLogSuffix === 'boolean'
|
|
30
|
+
? options.useLogSuffix
|
|
31
|
+
? randomBytes(3).toString('hex')
|
|
32
|
+
: undefined
|
|
33
|
+
: options.useLogSuffix;
|
|
34
|
+
|
|
35
|
+
const loggers = options.loggers ?? {};
|
|
36
|
+
|
|
27
37
|
const l1Contracts = await aztecNode.getL1ContractAddresses();
|
|
28
38
|
const configWithContracts = {
|
|
29
39
|
...config,
|
|
@@ -31,21 +41,19 @@ export async function createPXEService(
|
|
|
31
41
|
l2BlockBatchSize: 200,
|
|
32
42
|
} as PXEServiceConfig;
|
|
33
43
|
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
options.loggers.store ?? createLogger('pxe:data:indexeddb'),
|
|
38
|
-
);
|
|
44
|
+
const storeLogger = loggers.store ? loggers.store : createLogger('pxe:data:idb' + (logSuffix ? `:${logSuffix}` : ''));
|
|
45
|
+
|
|
46
|
+
const store = options.store ?? (await createStore('pxe_data', configWithContracts, storeLogger));
|
|
39
47
|
|
|
40
48
|
const simulationProvider = new WASMSimulator();
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
options.loggers.prover ?? createLogger('bb:wasm:bundle'),
|
|
47
|
-
);
|
|
49
|
+
const proverLogger = loggers.prover
|
|
50
|
+
? loggers.prover
|
|
51
|
+
: createLogger('pxe:bb:wasm:bundle' + (logSuffix ? `:${logSuffix}` : ''));
|
|
52
|
+
|
|
53
|
+
const prover = options.prover ?? new BBWASMBundlePrivateKernelProver(simulationProvider, 16, proverLogger);
|
|
48
54
|
const protocolContractsProvider = new BundledProtocolContractsProvider();
|
|
55
|
+
|
|
56
|
+
const pxeLogger = loggers.pxe ? loggers.pxe : createLogger('pxe:service' + (logSuffix ? `:${logSuffix}` : ''));
|
|
49
57
|
const pxe = await PXEService.create(
|
|
50
58
|
aztecNode,
|
|
51
59
|
store,
|
|
@@ -53,7 +61,7 @@ export async function createPXEService(
|
|
|
53
61
|
simulationProvider,
|
|
54
62
|
protocolContractsProvider,
|
|
55
63
|
config,
|
|
56
|
-
|
|
64
|
+
pxeLogger,
|
|
57
65
|
);
|
|
58
66
|
return pxe;
|
|
59
67
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BBWASMLazyPrivateKernelProver } from '@aztec/bb-prover/client/wasm/lazy';
|
|
2
|
+
import { randomBytes } from '@aztec/foundation/crypto';
|
|
2
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
4
|
import { createStore } from '@aztec/kv-store/indexeddb';
|
|
4
5
|
import { LazyProtocolContractsProvider } from '@aztec/protocol-contracts/providers/lazy';
|
|
@@ -7,7 +8,7 @@ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
|
7
8
|
|
|
8
9
|
import type { PXEServiceConfig } from '../../../config/index.js';
|
|
9
10
|
import { PXEService } from '../../../pxe_service/pxe_service.js';
|
|
10
|
-
import type { PXECreationOptions } from '
|
|
11
|
+
import type { PXECreationOptions } from '../../pxe_creation_options.js';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Create and start an PXEService instance with the given AztecNode.
|
|
@@ -23,6 +24,13 @@ export async function createPXEService(
|
|
|
23
24
|
config: PXEServiceConfig,
|
|
24
25
|
options: PXECreationOptions = { loggers: {} },
|
|
25
26
|
) {
|
|
27
|
+
const logSuffix =
|
|
28
|
+
typeof options.useLogSuffix === 'boolean'
|
|
29
|
+
? options.useLogSuffix
|
|
30
|
+
? randomBytes(3).toString('hex')
|
|
31
|
+
: undefined
|
|
32
|
+
: options.useLogSuffix;
|
|
33
|
+
|
|
26
34
|
const l1Contracts = await aztecNode.getL1ContractAddresses();
|
|
27
35
|
const configWithContracts = {
|
|
28
36
|
...config,
|
|
@@ -30,17 +38,22 @@ export async function createPXEService(
|
|
|
30
38
|
l1Contracts,
|
|
31
39
|
} as PXEServiceConfig;
|
|
32
40
|
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
);
|
|
41
|
+
const loggers = options.loggers ?? {};
|
|
42
|
+
|
|
43
|
+
const storeLogger = loggers.store ? loggers.store : createLogger('pxe:data:idb' + (logSuffix ? `:${logSuffix}` : ''));
|
|
44
|
+
|
|
45
|
+
const store = options.store ?? (await createStore('pxe_data', configWithContracts, storeLogger));
|
|
38
46
|
|
|
39
47
|
const simulationProvider = new WASMSimulator();
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
48
|
+
const proverLogger = loggers.prover
|
|
49
|
+
? loggers.prover
|
|
50
|
+
: createLogger('pxe:bb:wasm:bundle' + (logSuffix ? `:${logSuffix}` : ''));
|
|
51
|
+
|
|
52
|
+
const prover = options.prover ?? new BBWASMLazyPrivateKernelProver(simulationProvider, 16, proverLogger);
|
|
53
|
+
|
|
43
54
|
const protocolContractsProvider = new LazyProtocolContractsProvider();
|
|
55
|
+
|
|
56
|
+
const pxeLogger = loggers.pxe ? loggers.pxe : createLogger('pxe:service' + (logSuffix ? `:${logSuffix}` : ''));
|
|
44
57
|
const pxe = await PXEService.create(
|
|
45
58
|
aztecNode,
|
|
46
59
|
store,
|
|
@@ -48,7 +61,7 @@ export async function createPXEService(
|
|
|
48
61
|
simulationProvider,
|
|
49
62
|
protocolContractsProvider,
|
|
50
63
|
config,
|
|
51
|
-
|
|
64
|
+
pxeLogger,
|
|
52
65
|
);
|
|
53
66
|
return pxe;
|
|
54
67
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { Logger } from '@aztec/foundation/log';
|
|
2
|
+
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
2
3
|
import type { PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
|
|
3
4
|
|
|
4
5
|
export type PXECreationOptions = {
|
|
5
|
-
loggers
|
|
6
|
+
loggers?: { store?: Logger; pxe?: Logger; prover?: Logger };
|
|
7
|
+
useLogSuffix?: boolean | string;
|
|
6
8
|
prover?: PrivateKernelProver;
|
|
9
|
+
store?: AztecAsyncKVStore;
|
|
7
10
|
};
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { BBNativePrivateKernelProver } from '@aztec/bb-prover/client/native';
|
|
2
2
|
import { BBWASMBundlePrivateKernelProver } from '@aztec/bb-prover/client/wasm/bundle';
|
|
3
3
|
import { randomBytes } from '@aztec/foundation/crypto';
|
|
4
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
5
|
-
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
4
|
+
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
6
5
|
import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
|
|
7
|
-
import {
|
|
8
|
-
|
|
6
|
+
import {
|
|
7
|
+
MemoryCircuitRecorder,
|
|
8
|
+
type SimulationProvider,
|
|
9
|
+
SimulationProviderRecorderWrapper,
|
|
10
|
+
WASMSimulator,
|
|
11
|
+
} from '@aztec/simulator/client';
|
|
12
|
+
import { FileCircuitRecorder } from '@aztec/simulator/testing';
|
|
9
13
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
10
14
|
|
|
11
15
|
import type { PXEServiceConfig } from '../../config/index.js';
|
|
12
16
|
import { PXEService } from '../../pxe_service/pxe_service.js';
|
|
13
17
|
import { PXE_DATA_SCHEMA_VERSION } from '../../storage/index.js';
|
|
18
|
+
import type { PXECreationOptions } from '../pxe_creation_options.js';
|
|
14
19
|
|
|
15
20
|
/**
|
|
16
21
|
* Create and start an PXEService instance with the given AztecNode and config.
|
|
@@ -23,12 +28,14 @@ import { PXE_DATA_SCHEMA_VERSION } from '../../storage/index.js';
|
|
|
23
28
|
export function createPXEService(
|
|
24
29
|
aztecNode: AztecNode,
|
|
25
30
|
config: PXEServiceConfig,
|
|
26
|
-
|
|
27
|
-
store?: AztecAsyncKVStore,
|
|
31
|
+
options: PXECreationOptions = { loggers: {} },
|
|
28
32
|
) {
|
|
29
33
|
const simulationProvider = new WASMSimulator();
|
|
30
|
-
const
|
|
31
|
-
|
|
34
|
+
const recorder = process.env.CIRCUIT_RECORD_DIR
|
|
35
|
+
? new FileCircuitRecorder(process.env.CIRCUIT_RECORD_DIR)
|
|
36
|
+
: new MemoryCircuitRecorder();
|
|
37
|
+
const simulationProviderWithRecorder = new SimulationProviderRecorderWrapper(simulationProvider, recorder);
|
|
38
|
+
return createPXEServiceWithSimulationProvider(aztecNode, simulationProviderWithRecorder, config, options);
|
|
32
39
|
}
|
|
33
40
|
|
|
34
41
|
/**
|
|
@@ -44,11 +51,15 @@ export async function createPXEServiceWithSimulationProvider(
|
|
|
44
51
|
aztecNode: AztecNode,
|
|
45
52
|
simulationProvider: SimulationProvider,
|
|
46
53
|
config: PXEServiceConfig,
|
|
47
|
-
|
|
48
|
-
store?: AztecAsyncKVStore,
|
|
54
|
+
options: PXECreationOptions = { loggers: {} },
|
|
49
55
|
) {
|
|
50
56
|
const logSuffix =
|
|
51
|
-
typeof useLogSuffix === 'boolean'
|
|
57
|
+
typeof options.useLogSuffix === 'boolean'
|
|
58
|
+
? options.useLogSuffix
|
|
59
|
+
? randomBytes(3).toString('hex')
|
|
60
|
+
: undefined
|
|
61
|
+
: options.useLogSuffix;
|
|
62
|
+
const loggers = options.loggers ?? {};
|
|
52
63
|
|
|
53
64
|
const l1Contracts = await aztecNode.getL1ContractAddresses();
|
|
54
65
|
const configWithContracts = {
|
|
@@ -57,34 +68,41 @@ export async function createPXEServiceWithSimulationProvider(
|
|
|
57
68
|
l2BlockBatchSize: 200,
|
|
58
69
|
} as PXEServiceConfig;
|
|
59
70
|
|
|
60
|
-
if (!store) {
|
|
71
|
+
if (!options.store) {
|
|
61
72
|
// TODO once https://github.com/AztecProtocol/aztec-packages/issues/13656 is fixed, we can remove this and always
|
|
62
73
|
// import the lmdb-v2 version
|
|
63
74
|
const { createStore } = await import('@aztec/kv-store/lmdb-v2');
|
|
64
|
-
|
|
75
|
+
const storeLogger = loggers.store
|
|
76
|
+
? loggers.store
|
|
77
|
+
: createLogger('pxe:data:lmdb' + (logSuffix ? `:${logSuffix}` : ''));
|
|
78
|
+
options.store = await createStore('pxe_data', PXE_DATA_SCHEMA_VERSION, configWithContracts, storeLogger);
|
|
65
79
|
}
|
|
80
|
+
const proverLogger = loggers.prover
|
|
81
|
+
? loggers.prover
|
|
82
|
+
: createLogger('pxe:bb:native' + (logSuffix ? `:${logSuffix}` : ''));
|
|
66
83
|
|
|
67
|
-
const prover = await createProver(config, simulationProvider,
|
|
84
|
+
const prover = await createProver(config, simulationProvider, proverLogger);
|
|
68
85
|
const protocolContractsProvider = new BundledProtocolContractsProvider();
|
|
86
|
+
|
|
87
|
+
const pxeLogger = loggers.pxe ? loggers.pxe : createLogger('pxe:service' + (logSuffix ? `:${logSuffix}` : ''));
|
|
69
88
|
const pxe = await PXEService.create(
|
|
70
89
|
aztecNode,
|
|
71
|
-
store,
|
|
90
|
+
options.store,
|
|
72
91
|
prover,
|
|
73
92
|
simulationProvider,
|
|
74
93
|
protocolContractsProvider,
|
|
75
94
|
config,
|
|
76
|
-
|
|
95
|
+
pxeLogger,
|
|
77
96
|
);
|
|
78
97
|
return pxe;
|
|
79
98
|
}
|
|
80
99
|
|
|
81
|
-
function createProver(config: PXEServiceConfig, simulationProvider: SimulationProvider,
|
|
100
|
+
function createProver(config: PXEServiceConfig, simulationProvider: SimulationProvider, logger?: Logger) {
|
|
82
101
|
if (!config.bbBinaryPath || !config.bbWorkingDirectory) {
|
|
83
|
-
return new BBWASMBundlePrivateKernelProver(simulationProvider, 16);
|
|
102
|
+
return new BBWASMBundlePrivateKernelProver(simulationProvider, 16, logger);
|
|
84
103
|
} else {
|
|
85
104
|
const bbConfig = config as Required<Pick<PXEServiceConfig, 'bbBinaryPath' | 'bbWorkingDirectory'>> &
|
|
86
105
|
PXEServiceConfig;
|
|
87
|
-
|
|
88
|
-
return BBNativePrivateKernelProver.new({ bbSkipCleanup: false, ...bbConfig }, simulationProvider, log);
|
|
106
|
+
return BBNativePrivateKernelProver.new({ bbSkipCleanup: false, ...bbConfig }, simulationProvider, logger);
|
|
89
107
|
}
|
|
90
108
|
}
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
MAX_NULLIFIER_READ_REQUESTS_PER_TX,
|
|
7
7
|
MAX_PRIVATE_LOGS_PER_TX,
|
|
8
8
|
NULLIFIER_TREE_HEIGHT,
|
|
9
|
-
VK_TREE_HEIGHT,
|
|
10
9
|
} from '@aztec/constants';
|
|
11
10
|
import { makeTuple } from '@aztec/foundation/array';
|
|
12
11
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
@@ -16,6 +15,7 @@ import { MembershipWitness } from '@aztec/foundation/trees';
|
|
|
16
15
|
import { privateKernelResetDimensionsConfig } from '@aztec/noir-protocol-circuits-types/client';
|
|
17
16
|
import {
|
|
18
17
|
KeyValidationHint,
|
|
18
|
+
PaddedSideEffects,
|
|
19
19
|
type PrivateCircuitPublicInputs,
|
|
20
20
|
type PrivateKernelCircuitPublicInputs,
|
|
21
21
|
PrivateKernelData,
|
|
@@ -42,6 +42,7 @@ import {
|
|
|
42
42
|
privateKernelResetDimensionNames,
|
|
43
43
|
} from '@aztec/stdlib/kernel';
|
|
44
44
|
import { type PrivateCallExecutionResult, collectNested } from '@aztec/stdlib/tx';
|
|
45
|
+
import { VkData } from '@aztec/stdlib/vks';
|
|
45
46
|
|
|
46
47
|
import type { PrivateKernelOracle } from '../private_kernel_oracle.js';
|
|
47
48
|
|
|
@@ -166,12 +167,12 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
166
167
|
const previousVkMembershipWitness = await oracle.getVkMembershipWitness(
|
|
167
168
|
this.previousKernelOutput.verificationKey.keyAsFields,
|
|
168
169
|
);
|
|
169
|
-
const
|
|
170
|
-
this.previousKernelOutput.publicInputs,
|
|
170
|
+
const vkData = new VkData(
|
|
171
171
|
this.previousKernelOutput.verificationKey,
|
|
172
172
|
Number(previousVkMembershipWitness.leafIndex),
|
|
173
|
-
|
|
173
|
+
previousVkMembershipWitness.siblingPath,
|
|
174
174
|
);
|
|
175
|
+
const previousKernelData = new PrivateKernelData(this.previousKernelOutput.publicInputs, vkData);
|
|
175
176
|
|
|
176
177
|
this.reduceReadRequestStates(
|
|
177
178
|
this.noteHashResetStates,
|
|
@@ -184,8 +185,12 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
184
185
|
dimensions.NULLIFIER_SETTLED_AMOUNT,
|
|
185
186
|
);
|
|
186
187
|
|
|
188
|
+
// TODO: Enable padding when we have a better idea what are the final amounts we should pad to.
|
|
189
|
+
const paddedSideEffects = PaddedSideEffects.empty();
|
|
190
|
+
|
|
187
191
|
return new PrivateKernelResetCircuitPrivateInputs(
|
|
188
192
|
previousKernelData,
|
|
193
|
+
paddedSideEffects,
|
|
189
194
|
new PrivateKernelResetHints(
|
|
190
195
|
await buildNoteHashReadRequestHintsFromResetStates(
|
|
191
196
|
oracle,
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { VK_TREE_HEIGHT } from '@aztec/constants';
|
|
2
1
|
import { vkAsFieldsMegaHonk } from '@aztec/foundation/crypto';
|
|
3
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
5
|
-
import { assertLength } from '@aztec/foundation/serialize';
|
|
6
4
|
import { pushTestData } from '@aztec/foundation/testing';
|
|
7
5
|
import { Timer } from '@aztec/foundation/timer';
|
|
8
6
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
@@ -12,6 +10,7 @@ import { computeContractAddressFromInstance } from '@aztec/stdlib/contract';
|
|
|
12
10
|
import { hashVK } from '@aztec/stdlib/hash';
|
|
13
11
|
import type { PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
|
|
14
12
|
import {
|
|
13
|
+
PaddedSideEffectAmounts,
|
|
15
14
|
PrivateCallData,
|
|
16
15
|
type PrivateExecutionStep,
|
|
17
16
|
PrivateKernelCircuitPublicInputs,
|
|
@@ -33,7 +32,7 @@ import {
|
|
|
33
32
|
collectNoteHashNullifierCounterMap,
|
|
34
33
|
getFinalMinRevertibleSideEffectCounter,
|
|
35
34
|
} from '@aztec/stdlib/tx';
|
|
36
|
-
import { VerificationKeyAsFields, VerificationKeyData } from '@aztec/stdlib/vks';
|
|
35
|
+
import { VerificationKeyAsFields, VerificationKeyData, VkData } from '@aztec/stdlib/vks';
|
|
37
36
|
|
|
38
37
|
import { PrivateKernelResetPrivateInputsBuilder } from './hints/build_private_kernel_reset_private_inputs.js';
|
|
39
38
|
import type { PrivateKernelOracle } from './private_kernel_oracle.js';
|
|
@@ -154,6 +153,7 @@ export class PrivateKernelExecutionProver {
|
|
|
154
153
|
vk: currentExecution.vk,
|
|
155
154
|
timings: {
|
|
156
155
|
witgen: currentExecution.profileResult?.timings.witgen ?? 0,
|
|
156
|
+
oracles: currentExecution.profileResult?.timings.oracles,
|
|
157
157
|
},
|
|
158
158
|
});
|
|
159
159
|
|
|
@@ -192,12 +192,12 @@ export class PrivateKernelExecutionProver {
|
|
|
192
192
|
const previousVkMembershipWitness = await this.oracle.getVkMembershipWitness(
|
|
193
193
|
output.verificationKey.keyAsFields,
|
|
194
194
|
);
|
|
195
|
-
const
|
|
196
|
-
output.publicInputs,
|
|
195
|
+
const vkData = new VkData(
|
|
197
196
|
output.verificationKey,
|
|
198
197
|
Number(previousVkMembershipWitness.leafIndex),
|
|
199
|
-
|
|
198
|
+
previousVkMembershipWitness.siblingPath,
|
|
200
199
|
);
|
|
200
|
+
const previousKernelData = new PrivateKernelData(output.publicInputs, vkData);
|
|
201
201
|
const proofInput = new PrivateKernelInnerCircuitPrivateInputs(previousKernelData, privateCallData);
|
|
202
202
|
|
|
203
203
|
pushTestData('private-kernel-inputs-inner', proofInput);
|
|
@@ -259,18 +259,20 @@ export class PrivateKernelExecutionProver {
|
|
|
259
259
|
}
|
|
260
260
|
// Private tail.
|
|
261
261
|
const previousVkMembershipWitness = await this.oracle.getVkMembershipWitness(output.verificationKey.keyAsFields);
|
|
262
|
-
const
|
|
263
|
-
output.publicInputs,
|
|
262
|
+
const vkData = new VkData(
|
|
264
263
|
output.verificationKey,
|
|
265
264
|
Number(previousVkMembershipWitness.leafIndex),
|
|
266
|
-
|
|
265
|
+
previousVkMembershipWitness.siblingPath,
|
|
267
266
|
);
|
|
267
|
+
const previousKernelData = new PrivateKernelData(output.publicInputs, vkData);
|
|
268
268
|
|
|
269
269
|
this.log.debug(
|
|
270
270
|
`Calling private kernel tail with hwm ${previousKernelData.publicInputs.minRevertibleSideEffectCounter}`,
|
|
271
271
|
);
|
|
272
272
|
|
|
273
|
-
|
|
273
|
+
// TODO: Enable padding when we have a better what are the final amounts we should pad to.
|
|
274
|
+
const paddedSideEffectAmounts = PaddedSideEffectAmounts.empty();
|
|
275
|
+
const privateInputs = new PrivateKernelTailCircuitPrivateInputs(previousKernelData, paddedSideEffectAmounts);
|
|
274
276
|
|
|
275
277
|
pushTestData('private-kernel-inputs-ordering', privateInputs);
|
|
276
278
|
|
|
@@ -679,9 +679,10 @@ export class PXEService implements PXE {
|
|
|
679
679
|
|
|
680
680
|
const totalTime = totalTimer.ms();
|
|
681
681
|
|
|
682
|
-
const perFunction = executionSteps.map(({ functionName, timings: { witgen } }) => ({
|
|
682
|
+
const perFunction = executionSteps.map(({ functionName, timings: { witgen, oracles } }) => ({
|
|
683
683
|
functionName,
|
|
684
684
|
time: witgen,
|
|
685
|
+
oracles,
|
|
685
686
|
}));
|
|
686
687
|
|
|
687
688
|
const timings: ProvingTimings = {
|
|
@@ -746,10 +747,13 @@ export class PXEService implements PXE {
|
|
|
746
747
|
|
|
747
748
|
const totalTime = totalTimer.ms();
|
|
748
749
|
|
|
749
|
-
const perFunction = executionSteps.map(({ functionName, timings: { witgen } }) =>
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
750
|
+
const perFunction = executionSteps.map(({ functionName, timings: { witgen, oracles } }) => {
|
|
751
|
+
return {
|
|
752
|
+
functionName,
|
|
753
|
+
time: witgen,
|
|
754
|
+
oracles,
|
|
755
|
+
};
|
|
756
|
+
});
|
|
753
757
|
|
|
754
758
|
// Gate computation is time is not relevant for profiling, so we subtract it from the total time.
|
|
755
759
|
const gateCountComputationTime =
|
|
@@ -849,9 +853,10 @@ export class PXEService implements PXE {
|
|
|
849
853
|
|
|
850
854
|
const totalTime = totalTimer.ms();
|
|
851
855
|
|
|
852
|
-
const perFunction = executionSteps.map(({ functionName, timings: { witgen } }) => ({
|
|
856
|
+
const perFunction = executionSteps.map(({ functionName, timings: { witgen, oracles } }) => ({
|
|
853
857
|
functionName,
|
|
854
858
|
time: witgen,
|
|
859
|
+
oracles,
|
|
855
860
|
}));
|
|
856
861
|
|
|
857
862
|
const timings: SimulationTimings = {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pxe_creation_options.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/client/pxe_creation_options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3D,MAAM,CAAC,EAAE,mBAAmB,CAAC;CAC9B,CAAC"}
|
|
File without changes
|