@aztec/pxe 0.80.0 → 0.82.0
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/server/utils.d.ts +15 -7
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +17 -9
- package/dest/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.d.ts +2 -2
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -0
- package/dest/private_kernel/hints/index.d.ts.map +1 -0
- package/dest/private_kernel/index.d.ts +3 -0
- package/dest/private_kernel/index.d.ts.map +1 -0
- package/dest/private_kernel/index.js +2 -0
- package/dest/{kernel_prover/kernel_prover.d.ts → private_kernel/private_kernel_execution_prover.d.ts} +13 -14
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -0
- package/dest/{kernel_prover/kernel_prover.js → private_kernel/private_kernel_execution_prover.js} +64 -64
- package/dest/{kernel_prover/proving_data_oracle.d.ts → private_kernel/private_kernel_oracle.d.ts} +17 -28
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -0
- package/dest/private_kernel/private_kernel_oracle.js +4 -0
- package/dest/{kernel_oracle/index.d.ts → private_kernel/private_kernel_oracle_impl.d.ts} +5 -5
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -0
- package/dest/{kernel_oracle/index.js → private_kernel/private_kernel_oracle_impl.js} +2 -2
- package/dest/pxe_oracle_interface/pxe_oracle_interface.d.ts +14 -22
- package/dest/pxe_oracle_interface/pxe_oracle_interface.d.ts.map +1 -1
- package/dest/pxe_oracle_interface/pxe_oracle_interface.js +51 -107
- package/dest/pxe_service/pxe_service.d.ts +13 -27
- package/dest/pxe_service/pxe_service.d.ts.map +1 -1
- package/dest/pxe_service/pxe_service.js +213 -241
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts +2 -2
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +1 -1
- package/dest/storage/contract_data_provider/contract_data_provider.js +6 -1
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts +2 -2
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +1 -1
- package/dest/storage/index.d.ts +1 -2
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +1 -2
- package/dest/storage/metadata.d.ts +2 -0
- package/dest/storage/metadata.d.ts.map +1 -0
- package/dest/storage/metadata.js +1 -0
- package/dest/storage/note_data_provider/note_dao.d.ts +9 -13
- package/dest/storage/note_data_provider/note_dao.d.ts.map +1 -1
- package/dest/storage/note_data_provider/note_dao.js +11 -15
- package/dest/storage/note_data_provider/note_data_provider.d.ts +2 -2
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -1
- package/dest/storage/note_data_provider/note_data_provider.js +18 -19
- package/dest/synchronizer/synchronizer.js +1 -1
- package/package.json +15 -15
- package/src/config/package_info.ts +1 -1
- package/src/entrypoints/server/utils.ts +25 -11
- package/src/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.ts +4 -4
- package/src/private_kernel/index.ts +2 -0
- package/src/{kernel_prover/kernel_prover.ts → private_kernel/private_kernel_execution_prover.ts} +76 -71
- package/src/{kernel_prover/proving_data_oracle.ts → private_kernel/private_kernel_oracle.ts} +17 -29
- package/src/{kernel_oracle/index.ts → private_kernel/private_kernel_oracle_impl.ts} +6 -5
- package/src/pxe_oracle_interface/pxe_oracle_interface.ts +77 -153
- package/src/pxe_service/pxe_service.ts +289 -310
- package/src/storage/contract_data_provider/contract_data_provider.ts +11 -2
- package/src/storage/contract_data_provider/private_functions_tree.ts +2 -2
- package/src/storage/index.ts +1 -3
- package/src/storage/metadata.ts +1 -0
- package/src/storage/note_data_provider/note_dao.ts +9 -18
- package/src/storage/note_data_provider/note_data_provider.ts +22 -28
- package/src/synchronizer/synchronizer.ts +1 -1
- package/dest/kernel_oracle/index.d.ts.map +0 -1
- package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
- package/dest/kernel_prover/hints/index.d.ts.map +0 -1
- package/dest/kernel_prover/index.d.ts +0 -3
- package/dest/kernel_prover/index.d.ts.map +0 -1
- package/dest/kernel_prover/index.js +0 -2
- package/dest/kernel_prover/kernel_prover.d.ts.map +0 -1
- package/dest/kernel_prover/proving_data_oracle.d.ts.map +0 -1
- package/dest/kernel_prover/proving_data_oracle.js +0 -4
- package/dest/note_decryption_utils/add_public_values_to_payload.d.ts +0 -11
- package/dest/note_decryption_utils/add_public_values_to_payload.d.ts.map +0 -1
- package/dest/note_decryption_utils/add_public_values_to_payload.js +0 -47
- package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts +0 -11
- package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts.map +0 -1
- package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.js +0 -20
- package/dest/storage/auth_witness_data_provider/index.d.ts +0 -2
- package/dest/storage/auth_witness_data_provider/index.d.ts.map +0 -1
- package/dest/storage/auth_witness_data_provider/index.js +0 -1
- package/src/kernel_prover/index.ts +0 -2
- package/src/note_decryption_utils/add_public_values_to_payload.ts +0 -64
- package/src/storage/auth_witness_data_provider/auth_witness_data_provider.ts +0 -34
- package/src/storage/auth_witness_data_provider/index.ts +0 -1
- /package/dest/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.js +0 -0
- /package/dest/{kernel_prover → private_kernel}/hints/index.d.ts +0 -0
- /package/dest/{kernel_prover → private_kernel}/hints/index.js +0 -0
- /package/src/{kernel_prover → private_kernel}/hints/index.ts +0 -0
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type SimulationProvider } from '@aztec/simulator/client';
|
|
2
|
+
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
2
3
|
import type { PXEServiceConfig } from '../../config/index.js';
|
|
3
4
|
import { PXEService } from '../../pxe_service/pxe_service.js';
|
|
4
5
|
/**
|
|
5
|
-
* Create and start an PXEService instance with the given AztecNode.
|
|
6
|
-
* If no keyStore or database is provided, it will use KeyStore and MemoryDB as default values.
|
|
7
|
-
* Returns a Promise that resolves to the started PXEService instance.
|
|
6
|
+
* Create and start an PXEService instance with the given AztecNode and config.
|
|
8
7
|
*
|
|
9
8
|
* @param aztecNode - The AztecNode instance to be used by the server.
|
|
10
9
|
* @param config - The PXE Service Config to use
|
|
11
|
-
* @param useLogSuffix -
|
|
12
|
-
* @param proofCreator - An optional proof creator to use in place of any other configuration
|
|
10
|
+
* @param useLogSuffix - Whether to add a randomly generated suffix to the PXE debug logs.
|
|
13
11
|
* @returns A Promise that resolves to the started PXEService instance.
|
|
14
12
|
*/
|
|
15
|
-
export declare function createPXEService(aztecNode: AztecNode, config: PXEServiceConfig, useLogSuffix?: string | boolean | undefined
|
|
13
|
+
export declare function createPXEService(aztecNode: AztecNode, config: PXEServiceConfig, useLogSuffix?: string | boolean | undefined): Promise<PXEService>;
|
|
14
|
+
/**
|
|
15
|
+
* Create and start an PXEService instance with the given AztecNode, SimulationProvider and config.
|
|
16
|
+
*
|
|
17
|
+
* @param aztecNode - The AztecNode instance to be used by the server.
|
|
18
|
+
* @param simulationProvider - The SimulationProvider to use
|
|
19
|
+
* @param config - The PXE Service Config to use
|
|
20
|
+
* @param useLogSuffix - Whether to add a randomly generated suffix to the PXE debug logs.
|
|
21
|
+
* @returns A Promise that resolves to the started PXEService instance.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createPXEServiceWithSimulationProvider(aztecNode: AztecNode, simulationProvider: SimulationProvider, config: PXEServiceConfig, useLogSuffix?: string | boolean | undefined): Promise<PXEService>;
|
|
16
24
|
//# 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":"AAMA,OAAO,EAAE,KAAK,kBAAkB,EAAiB,MAAM,yBAAyB,CAAC;AACjF,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;AAG9D;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,gBAAgB,EACxB,YAAY,GAAE,MAAM,GAAG,OAAO,GAAG,SAAqB,uBAIvD;AAED;;;;;;;;GAQG;AACH,wBAAsB,sCAAsC,CAC1D,SAAS,EAAE,SAAS,EACpB,kBAAkB,EAAE,kBAAkB,EACtC,MAAM,EAAE,gBAAgB,EACxB,YAAY,GAAE,MAAM,GAAG,OAAO,GAAG,SAAqB,uBA8BvD"}
|
|
@@ -6,18 +6,27 @@ import { createStore } from '@aztec/kv-store/lmdb-v2';
|
|
|
6
6
|
import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
|
|
7
7
|
import { WASMSimulator } from '@aztec/simulator/client';
|
|
8
8
|
import { PXEService } from '../../pxe_service/pxe_service.js';
|
|
9
|
-
import { PXE_DATA_SCHEMA_VERSION } from '
|
|
9
|
+
import { PXE_DATA_SCHEMA_VERSION } from '../../storage/index.js';
|
|
10
10
|
/**
|
|
11
|
-
* Create and start an PXEService instance with the given AztecNode.
|
|
12
|
-
* If no keyStore or database is provided, it will use KeyStore and MemoryDB as default values.
|
|
13
|
-
* Returns a Promise that resolves to the started PXEService instance.
|
|
11
|
+
* Create and start an PXEService instance with the given AztecNode and config.
|
|
14
12
|
*
|
|
15
13
|
* @param aztecNode - The AztecNode instance to be used by the server.
|
|
16
14
|
* @param config - The PXE Service Config to use
|
|
17
|
-
* @param useLogSuffix -
|
|
18
|
-
* @param proofCreator - An optional proof creator to use in place of any other configuration
|
|
15
|
+
* @param useLogSuffix - Whether to add a randomly generated suffix to the PXE debug logs.
|
|
19
16
|
* @returns A Promise that resolves to the started PXEService instance.
|
|
20
|
-
*/ export
|
|
17
|
+
*/ export function createPXEService(aztecNode, config, useLogSuffix = undefined) {
|
|
18
|
+
const simulationProvider = new WASMSimulator();
|
|
19
|
+
return createPXEServiceWithSimulationProvider(aztecNode, simulationProvider, config, useLogSuffix);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Create and start an PXEService instance with the given AztecNode, SimulationProvider and config.
|
|
23
|
+
*
|
|
24
|
+
* @param aztecNode - The AztecNode instance to be used by the server.
|
|
25
|
+
* @param simulationProvider - The SimulationProvider to use
|
|
26
|
+
* @param config - The PXE Service Config to use
|
|
27
|
+
* @param useLogSuffix - Whether to add a randomly generated suffix to the PXE debug logs.
|
|
28
|
+
* @returns A Promise that resolves to the started PXEService instance.
|
|
29
|
+
*/ export async function createPXEServiceWithSimulationProvider(aztecNode, simulationProvider, config, useLogSuffix = undefined) {
|
|
21
30
|
const logSuffix = typeof useLogSuffix === 'boolean' ? useLogSuffix ? randomBytes(3).toString('hex') : undefined : useLogSuffix;
|
|
22
31
|
const l1Contracts = await aztecNode.getL1ContractAddresses();
|
|
23
32
|
const configWithContracts = {
|
|
@@ -25,8 +34,7 @@ import { PXE_DATA_SCHEMA_VERSION } from './index.js';
|
|
|
25
34
|
l1Contracts
|
|
26
35
|
};
|
|
27
36
|
const store = await createStore('pxe_data', PXE_DATA_SCHEMA_VERSION, configWithContracts, createLogger('pxe:data:lmdb'));
|
|
28
|
-
const
|
|
29
|
-
const prover = proofCreator ?? await createProver(config, simulationProvider, logSuffix);
|
|
37
|
+
const prover = await createProver(config, simulationProvider, logSuffix);
|
|
30
38
|
const protocolContractsProvider = new BundledProtocolContractsProvider();
|
|
31
39
|
const pxe = await PXEService.create(aztecNode, store, prover, simulationProvider, protocolContractsProvider, config, logSuffix);
|
|
32
40
|
return pxe;
|
package/dest/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.d.ts
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type PrivateKernelCircuitPublicInputs, PrivateKernelResetCircuitPrivateInputs, type PrivateKernelSimulateOutput } from '@aztec/stdlib/kernel';
|
|
2
2
|
import { type PrivateCallExecutionResult } from '@aztec/stdlib/tx';
|
|
3
|
-
import type {
|
|
3
|
+
import type { PrivateKernelOracle } from '../private_kernel_oracle.js';
|
|
4
4
|
export declare class PrivateKernelResetPrivateInputsBuilder {
|
|
5
5
|
private previousKernelOutput;
|
|
6
6
|
private executionStack;
|
|
@@ -15,7 +15,7 @@ export declare class PrivateKernelResetPrivateInputsBuilder {
|
|
|
15
15
|
private requestedDimensions;
|
|
16
16
|
constructor(previousKernelOutput: PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>, executionStack: PrivateCallExecutionResult[], noteHashNullifierCounterMap: Map<number, number>, validationRequestsSplitCounter: number);
|
|
17
17
|
needsReset(): boolean;
|
|
18
|
-
build(oracle:
|
|
18
|
+
build(oracle: PrivateKernelOracle, noteHashLeafIndexMap: Map<bigint, bigint>): Promise<PrivateKernelResetCircuitPrivateInputs>;
|
|
19
19
|
private reduceReadRequestStates;
|
|
20
20
|
private needsResetNoteHashReadRequests;
|
|
21
21
|
private needsResetNullifierReadRequests;
|
|
@@ -0,0 +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":"AAgBA,OAAO,EAGL,KAAK,gCAAgC,EAErC,sCAAsC,EAGtC,KAAK,2BAA2B,EAkBjC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,0BAA0B,EAAiB,MAAM,kBAAkB,CAAC;AAElF,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;IAgElF,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/private_kernel/hints/index.ts"],"names":[],"mappings":"AAAA,cAAc,gDAAgD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/private_kernel/index.ts"],"names":[],"mappings":"AAAA,cAAc,sCAAsC,CAAC;AACrD,cAAc,4BAA4B,CAAC"}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import type { PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
|
|
2
|
-
import { type
|
|
2
|
+
import { type PrivateKernelExecutionProofOutput, type PrivateKernelTailCircuitPublicInputs } from '@aztec/stdlib/kernel';
|
|
3
3
|
import { type PrivateExecutionResult, TxRequest } from '@aztec/stdlib/tx';
|
|
4
|
-
import type {
|
|
5
|
-
export
|
|
4
|
+
import type { PrivateKernelOracle } from './private_kernel_oracle.js';
|
|
5
|
+
export interface PrivateKernelExecutionProverConfig {
|
|
6
6
|
simulate: boolean;
|
|
7
7
|
skipFeeEnforcement: boolean;
|
|
8
|
-
|
|
9
|
-
}
|
|
8
|
+
profileMode: 'gates' | 'execution-steps' | 'full' | 'none';
|
|
9
|
+
}
|
|
10
10
|
/**
|
|
11
|
-
* The
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* The PrivateKernelSequencer class is responsible for taking a transaction request and sequencing the
|
|
12
|
+
* the execution of the private functions within, sequenced with private kernel "glue" to check protocol rules.
|
|
13
|
+
* The result can be a client IVC proof of the private transaction portion, or just a simulation that can e.g.
|
|
14
|
+
* inform state tree updates.
|
|
15
15
|
*/
|
|
16
|
-
export declare class
|
|
16
|
+
export declare class PrivateKernelExecutionProver {
|
|
17
17
|
private oracle;
|
|
18
18
|
private proofCreator;
|
|
19
19
|
private fakeProofs;
|
|
20
20
|
private log;
|
|
21
|
-
constructor(oracle:
|
|
21
|
+
constructor(oracle: PrivateKernelOracle, proofCreator: PrivateKernelProver, fakeProofs?: boolean);
|
|
22
22
|
/**
|
|
23
23
|
* Generate a proof for a given transaction request and execution result.
|
|
24
24
|
* The function iterates through the nested executions in the execution result, creates private call data,
|
|
@@ -29,10 +29,9 @@ export declare class KernelProver {
|
|
|
29
29
|
* @param executionResult - The execution result object containing nested executions and preimages.
|
|
30
30
|
* @param profile - Set true to profile the gate count for each circuit
|
|
31
31
|
* @returns A Promise that resolves to a KernelProverOutput object containing proof, public inputs, and output notes.
|
|
32
|
-
* TODO(#7368) this should be refactored to not recreate the ACIR bytecode now that it operates on a program stack
|
|
33
32
|
*/
|
|
34
|
-
|
|
33
|
+
proveWithKernels(txRequest: TxRequest, executionResult: PrivateExecutionResult, { simulate, skipFeeEnforcement, profileMode }?: PrivateKernelExecutionProverConfig): Promise<PrivateKernelExecutionProofOutput<PrivateKernelTailCircuitPublicInputs>>;
|
|
35
34
|
private createPrivateCallData;
|
|
36
35
|
private isPrivateOnly;
|
|
37
36
|
}
|
|
38
|
-
//# sourceMappingURL=
|
|
37
|
+
//# sourceMappingURL=private_kernel_execution_prover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private_kernel_execution_prover.d.ts","sourceRoot":"","sources":["../../src/private_kernel/private_kernel_execution_prover.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAKL,KAAK,iCAAiC,EAKtC,KAAK,oCAAoC,EAE1C,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAEL,KAAK,sBAAsB,EAC3B,SAAS,EAMV,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;YAiNrE,qBAAqB;IA4CnC,OAAO,CAAC,aAAa;CAYtB"}
|
package/dest/{kernel_prover/kernel_prover.js → private_kernel/private_kernel_execution_prover.js}
RENAMED
|
@@ -15,18 +15,18 @@ import { ClientIvcProof } from '@aztec/stdlib/proofs';
|
|
|
15
15
|
import { collectEnqueuedPublicFunctionCalls, collectNoteHashLeafIndexMap, collectNoteHashNullifierCounterMap, collectPublicTeardownFunctionCall, getFinalMinRevertibleSideEffectCounter } from '@aztec/stdlib/tx';
|
|
16
16
|
import { VerificationKeyAsFields } from '@aztec/stdlib/vks';
|
|
17
17
|
import { PrivateKernelResetPrivateInputsBuilder } from './hints/build_private_kernel_reset_private_inputs.js';
|
|
18
|
-
const
|
|
18
|
+
const NULL_SIMULATE_OUTPUT = {
|
|
19
19
|
publicInputs: PrivateKernelCircuitPublicInputs.empty(),
|
|
20
20
|
verificationKey: VerificationKeyAsFields.makeEmpty(CLIENT_IVC_VERIFICATION_KEY_LENGTH_IN_FIELDS),
|
|
21
21
|
outputWitness: new Map(),
|
|
22
22
|
bytecode: Buffer.from([])
|
|
23
23
|
};
|
|
24
24
|
/**
|
|
25
|
-
* The
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*/ export class
|
|
25
|
+
* The PrivateKernelSequencer class is responsible for taking a transaction request and sequencing the
|
|
26
|
+
* the execution of the private functions within, sequenced with private kernel "glue" to check protocol rules.
|
|
27
|
+
* The result can be a client IVC proof of the private transaction portion, or just a simulation that can e.g.
|
|
28
|
+
* inform state tree updates.
|
|
29
|
+
*/ export class PrivateKernelExecutionProver {
|
|
30
30
|
oracle;
|
|
31
31
|
proofCreator;
|
|
32
32
|
fakeProofs;
|
|
@@ -35,7 +35,7 @@ const NULL_PROVE_OUTPUT = {
|
|
|
35
35
|
this.oracle = oracle;
|
|
36
36
|
this.proofCreator = proofCreator;
|
|
37
37
|
this.fakeProofs = fakeProofs;
|
|
38
|
-
this.log = createLogger('pxe:kernel-prover');
|
|
38
|
+
this.log = createLogger('pxe:private-kernel-execution-prover');
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* Generate a proof for a given transaction request and execution result.
|
|
@@ -47,50 +47,37 @@ const NULL_PROVE_OUTPUT = {
|
|
|
47
47
|
* @param executionResult - The execution result object containing nested executions and preimages.
|
|
48
48
|
* @param profile - Set true to profile the gate count for each circuit
|
|
49
49
|
* @returns A Promise that resolves to a KernelProverOutput object containing proof, public inputs, and output notes.
|
|
50
|
-
|
|
51
|
-
*/ async prove(txRequest, executionResult, { simulate, skipFeeEnforcement, profile } = {
|
|
50
|
+
*/ async proveWithKernels(txRequest, executionResult, { simulate, skipFeeEnforcement, profileMode } = {
|
|
52
51
|
simulate: false,
|
|
53
52
|
skipFeeEnforcement: false,
|
|
54
|
-
|
|
53
|
+
profileMode: 'none'
|
|
55
54
|
}) {
|
|
56
55
|
const skipProofGeneration = this.fakeProofs || simulate;
|
|
57
|
-
const generateWitnesses = !skipProofGeneration ||
|
|
56
|
+
const generateWitnesses = !skipProofGeneration || profileMode !== 'none';
|
|
58
57
|
const timer = new Timer();
|
|
59
58
|
const isPrivateOnlyTx = this.isPrivateOnly(executionResult);
|
|
60
59
|
const executionStack = [
|
|
61
60
|
executionResult.entrypoint
|
|
62
61
|
];
|
|
63
62
|
let firstIteration = true;
|
|
64
|
-
let output =
|
|
65
|
-
const
|
|
66
|
-
const addGateCount = async (circuitName, bytecode)=>{
|
|
67
|
-
const gateCount = await this.proofCreator.computeGateCountForCircuit(bytecode, circuitName);
|
|
68
|
-
gateCounts.push({
|
|
69
|
-
circuitName,
|
|
70
|
-
gateCount
|
|
71
|
-
});
|
|
72
|
-
this.log.debug(`Gate count for ${circuitName} - ${gateCount}`);
|
|
73
|
-
};
|
|
63
|
+
let output = NULL_SIMULATE_OUTPUT;
|
|
64
|
+
const executionSteps = [];
|
|
74
65
|
const noteHashLeafIndexMap = collectNoteHashLeafIndexMap(executionResult);
|
|
75
66
|
const noteHashNullifierCounterMap = collectNoteHashNullifierCounterMap(executionResult);
|
|
76
67
|
const enqueuedPublicFunctions = collectEnqueuedPublicFunctionCalls(executionResult);
|
|
77
68
|
const hasPublicCalls = enqueuedPublicFunctions.length > 0 || !collectPublicTeardownFunctionCall(executionResult).isEmpty();
|
|
78
69
|
const validationRequestsSplitCounter = hasPublicCalls ? getFinalMinRevertibleSideEffectCounter(executionResult) : 0;
|
|
79
|
-
// vector of gzipped bincode acirs
|
|
80
|
-
const acirs = [];
|
|
81
|
-
const witnessStack = [];
|
|
82
70
|
while(executionStack.length){
|
|
83
71
|
if (!firstIteration) {
|
|
84
72
|
let resetBuilder = new PrivateKernelResetPrivateInputsBuilder(output, executionStack, noteHashNullifierCounterMap, validationRequestsSplitCounter);
|
|
85
73
|
while(resetBuilder.needsReset()){
|
|
86
74
|
const privateInputs = await resetBuilder.build(this.oracle, noteHashLeafIndexMap);
|
|
87
|
-
output =
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
75
|
+
output = simulate ? await this.proofCreator.simulateReset(privateInputs) : await this.proofCreator.generateResetOutput(privateInputs);
|
|
76
|
+
executionSteps.push({
|
|
77
|
+
functionName: 'private_kernel_reset',
|
|
78
|
+
bytecode: output.bytecode,
|
|
79
|
+
witness: output.outputWitness
|
|
80
|
+
});
|
|
94
81
|
resetBuilder = new PrivateKernelResetPrivateInputsBuilder(output, executionStack, noteHashNullifierCounterMap, validationRequestsSplitCounter);
|
|
95
82
|
}
|
|
96
83
|
}
|
|
@@ -99,35 +86,33 @@ const NULL_PROVE_OUTPUT = {
|
|
|
99
86
|
...currentExecution.nestedExecutions
|
|
100
87
|
].reverse());
|
|
101
88
|
const functionName = await this.oracle.getDebugFunctionName(currentExecution.publicInputs.callContext.contractAddress, currentExecution.publicInputs.callContext.functionSelector);
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
await addGateCount(functionName, currentExecution.acir);
|
|
108
|
-
}
|
|
89
|
+
executionSteps.push({
|
|
90
|
+
functionName: functionName,
|
|
91
|
+
bytecode: currentExecution.acir,
|
|
92
|
+
witness: currentExecution.partialWitness
|
|
93
|
+
});
|
|
109
94
|
const privateCallData = await this.createPrivateCallData(currentExecution);
|
|
110
95
|
if (firstIteration) {
|
|
111
96
|
const proofInput = new PrivateKernelInitCircuitPrivateInputs(txRequest, getVKTreeRoot(), protocolContractTreeRoot, privateCallData, isPrivateOnlyTx, executionResult.firstNullifier);
|
|
112
97
|
this.log.debug(`Calling private kernel init with isPrivateOnly ${isPrivateOnlyTx} and firstNullifierHint ${proofInput.firstNullifierHint}`);
|
|
113
98
|
pushTestData('private-kernel-inputs-init', proofInput);
|
|
114
99
|
output = generateWitnesses ? await this.proofCreator.generateInitOutput(proofInput) : await this.proofCreator.simulateInit(proofInput);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
100
|
+
executionSteps.push({
|
|
101
|
+
functionName: 'private_kernel_init',
|
|
102
|
+
bytecode: output.bytecode,
|
|
103
|
+
witness: output.outputWitness
|
|
104
|
+
});
|
|
120
105
|
} else {
|
|
121
106
|
const previousVkMembershipWitness = await this.oracle.getVkMembershipWitness(output.verificationKey);
|
|
122
107
|
const previousKernelData = new PrivateKernelData(output.publicInputs, output.verificationKey, Number(previousVkMembershipWitness.leafIndex), assertLength(previousVkMembershipWitness.siblingPath, VK_TREE_HEIGHT));
|
|
123
108
|
const proofInput = new PrivateKernelInnerCircuitPrivateInputs(previousKernelData, privateCallData);
|
|
124
109
|
pushTestData('private-kernel-inputs-inner', proofInput);
|
|
125
110
|
output = generateWitnesses ? await this.proofCreator.generateInnerOutput(proofInput) : await this.proofCreator.simulateInner(proofInput);
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
111
|
+
executionSteps.push({
|
|
112
|
+
functionName: 'private_kernel_inner',
|
|
113
|
+
bytecode: output.bytecode,
|
|
114
|
+
witness: output.outputWitness
|
|
115
|
+
});
|
|
131
116
|
}
|
|
132
117
|
firstIteration = false;
|
|
133
118
|
}
|
|
@@ -136,11 +121,11 @@ const NULL_PROVE_OUTPUT = {
|
|
|
136
121
|
while(resetBuilder.needsReset()){
|
|
137
122
|
const privateInputs = await resetBuilder.build(this.oracle, noteHashLeafIndexMap);
|
|
138
123
|
output = generateWitnesses ? await this.proofCreator.generateResetOutput(privateInputs) : await this.proofCreator.simulateReset(privateInputs);
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
124
|
+
executionSteps.push({
|
|
125
|
+
functionName: 'private_kernel_reset',
|
|
126
|
+
bytecode: output.bytecode,
|
|
127
|
+
witness: output.outputWitness
|
|
128
|
+
});
|
|
144
129
|
resetBuilder = new PrivateKernelResetPrivateInputsBuilder(output, [], noteHashNullifierCounterMap, validationRequestsSplitCounter);
|
|
145
130
|
}
|
|
146
131
|
if (output.publicInputs.feePayer.isZero() && skipFeeEnforcement) {
|
|
@@ -156,25 +141,40 @@ const NULL_PROVE_OUTPUT = {
|
|
|
156
141
|
const privateInputs = new PrivateKernelTailCircuitPrivateInputs(previousKernelData);
|
|
157
142
|
pushTestData('private-kernel-inputs-ordering', privateInputs);
|
|
158
143
|
const tailOutput = generateWitnesses ? await this.proofCreator.generateTailOutput(privateInputs) : await this.proofCreator.simulateTail(privateInputs);
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
144
|
+
executionSteps.push({
|
|
145
|
+
functionName: 'private_kernel_tail',
|
|
146
|
+
bytecode: tailOutput.bytecode,
|
|
147
|
+
witness: tailOutput.outputWitness
|
|
148
|
+
});
|
|
149
|
+
if (profileMode == 'gates' || profileMode == 'full') {
|
|
150
|
+
for (const entry of executionSteps){
|
|
151
|
+
const gateCount = await this.proofCreator.computeGateCountForCircuit(entry.bytecode, entry.functionName);
|
|
152
|
+
entry.gateCount = gateCount;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (profileMode === 'gates') {
|
|
156
|
+
for (const entry of executionSteps){
|
|
157
|
+
// These buffers are often a few megabytes in size - prevent accidentally serializing them if not requested.
|
|
158
|
+
entry.bytecode = Buffer.from([]);
|
|
159
|
+
entry.witness = new Map();
|
|
160
|
+
}
|
|
166
161
|
}
|
|
167
162
|
if (generateWitnesses) {
|
|
168
163
|
this.log.info(`Private kernel witness generation took ${timer.ms()}ms`);
|
|
169
164
|
}
|
|
165
|
+
let clientIvcProof;
|
|
170
166
|
// TODO(#7368) how do we 'bincode' encode these inputs?
|
|
171
167
|
if (!skipProofGeneration) {
|
|
172
|
-
|
|
173
|
-
tailOutput.clientIvcProof = ivcProof;
|
|
168
|
+
clientIvcProof = await this.proofCreator.createClientIvcProof(executionSteps);
|
|
174
169
|
} else {
|
|
175
|
-
|
|
170
|
+
clientIvcProof = ClientIvcProof.random();
|
|
176
171
|
}
|
|
177
|
-
return
|
|
172
|
+
return {
|
|
173
|
+
publicInputs: tailOutput.publicInputs,
|
|
174
|
+
executionSteps,
|
|
175
|
+
clientIvcProof,
|
|
176
|
+
verificationKey: tailOutput.verificationKey
|
|
177
|
+
};
|
|
178
178
|
}
|
|
179
179
|
async createPrivateCallData({ publicInputs, vk: vkAsBuffer }) {
|
|
180
180
|
const { contractAddress, functionSelector } = publicInputs.callContext;
|
package/dest/{kernel_prover/proving_data_oracle.d.ts → private_kernel/private_kernel_oracle.d.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FUNCTION_TREE_HEIGHT, NOTE_HASH_TREE_HEIGHT, VK_TREE_HEIGHT } from '@aztec/constants';
|
|
2
2
|
import type { Fr, GrumpkinScalar, Point } from '@aztec/foundation/fields';
|
|
3
|
-
import
|
|
3
|
+
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
4
4
|
import type { FunctionSelector } from '@aztec/stdlib/abi';
|
|
5
5
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
6
|
import { UpdatedClassIdHints } from '@aztec/stdlib/kernel';
|
|
@@ -8,10 +8,10 @@ import type { PublicKeys } from '@aztec/stdlib/keys';
|
|
|
8
8
|
import type { NullifierMembershipWitness } from '@aztec/stdlib/trees';
|
|
9
9
|
import type { VerificationKeyAsFields } from '@aztec/stdlib/vks';
|
|
10
10
|
/**
|
|
11
|
-
* Provides functionality
|
|
12
|
-
*
|
|
11
|
+
* Provides functionality needed by the private kernel for interacting with our state trees.
|
|
12
|
+
* This is either PrivateKernelOracleImpl, or a mocked test implementation.
|
|
13
13
|
*/
|
|
14
|
-
export interface
|
|
14
|
+
export interface PrivateKernelOracle {
|
|
15
15
|
/** Retrieves the preimage of a contract address from the registered contract instances db. */
|
|
16
16
|
getContractAddressPreimage(address: AztecAddress): Promise<{
|
|
17
17
|
saltedInitializationHash: Fr;
|
|
@@ -26,37 +26,23 @@ export interface ProvingDataOracle {
|
|
|
26
26
|
privateFunctionsRoot: Fr;
|
|
27
27
|
}>;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
30
|
-
* The function membership witness represents a proof that the function belongs to the specified contract.
|
|
31
|
-
* Throws an error if the contract address or function selector is unknown.
|
|
32
|
-
*
|
|
33
|
-
* @param contractClassId - The id of the class.
|
|
34
|
-
* @param selector - The function selector.
|
|
35
|
-
* @returns A promise that resolves with the MembershipWitness instance for the specified contract's function.
|
|
29
|
+
* Returns a membership witness with the sibling path and leaf index in our private functions tree.
|
|
36
30
|
*/
|
|
37
31
|
getFunctionMembershipWitness(contractClassId: Fr, selector: FunctionSelector): Promise<MembershipWitness<typeof FUNCTION_TREE_HEIGHT>>;
|
|
38
32
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* which is a placeholder implementation until a concrete membership witness calculation
|
|
42
|
-
* is implemented.
|
|
43
|
-
*
|
|
44
|
-
* @param vk - The VerificationKey for which the membership witness is needed.
|
|
45
|
-
* @returns A Promise that resolves to the MembershipWitness instance.
|
|
33
|
+
* Returns a membership witness with the sibling path and leaf index in our protocol VK indexed merkle tree.
|
|
34
|
+
* Used to validate the previous kernel's verification key.
|
|
46
35
|
*/
|
|
47
36
|
getVkMembershipWitness(vk: VerificationKeyAsFields): Promise<MembershipWitness<typeof VK_TREE_HEIGHT>>;
|
|
48
37
|
/**
|
|
49
|
-
*
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
*
|
|
38
|
+
* Returns a membership witness with the sibling path and leaf index in our private function indexed merkle tree.
|
|
39
|
+
*/ getNoteHashMembershipWitness(leafIndex: bigint): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT>>;
|
|
40
|
+
/**
|
|
41
|
+
* Returns a membership witness with the sibling path and leaf index in our nullifier indexed merkle tree.
|
|
53
42
|
*/
|
|
54
|
-
getNoteHashMembershipWitness(leafIndex: bigint): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT>>;
|
|
55
43
|
getNullifierMembershipWitness(nullifier: Fr): Promise<NullifierMembershipWitness | undefined>;
|
|
56
44
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* @returns the root of the note hash tree.
|
|
45
|
+
* Returns the root of our note hash merkle tree.
|
|
60
46
|
*/
|
|
61
47
|
getNoteHashTreeRoot(): Promise<Fr>;
|
|
62
48
|
/**
|
|
@@ -67,7 +53,10 @@ export interface ProvingDataOracle {
|
|
|
67
53
|
* @dev Used when feeding the sk_m to the kernel circuit for keys verification.
|
|
68
54
|
*/
|
|
69
55
|
getMasterSecretKey(masterPublicKey: Point): Promise<GrumpkinScalar>;
|
|
56
|
+
/** Use debug data to get the function name corresponding to a selector. */
|
|
70
57
|
getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string | undefined>;
|
|
58
|
+
/** Returns a membership witness and leaf index to our public data indexed merkle tree,
|
|
59
|
+
* along with an associated SharedMutable containing the class ID to update. */
|
|
71
60
|
getUpdatedClassIdHints(contractAddress: AztecAddress): Promise<UpdatedClassIdHints>;
|
|
72
61
|
}
|
|
73
|
-
//# sourceMappingURL=
|
|
62
|
+
//# sourceMappingURL=private_kernel_oracle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private_kernel_oracle.d.ts","sourceRoot":"","sources":["../../src/private_kernel/private_kernel_oracle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,KAAK,EAAE,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEjE;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,8FAA8F;IAC9F,0BAA0B,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC;QACzD,wBAAwB,EAAE,EAAE,CAAC;QAC7B,UAAU,EAAE,UAAU,CAAC;QACvB,sBAAsB,EAAE,EAAE,CAAC;QAC3B,uBAAuB,EAAE,EAAE,CAAC;KAC7B,CAAC,CAAC;IAEH,kFAAkF;IAClF,0BAA0B,CACxB,eAAe,EAAE,EAAE,GAClB,OAAO,CAAC;QAAE,YAAY,EAAE,EAAE,CAAC;QAAC,wBAAwB,EAAE,EAAE,CAAC;QAAC,oBAAoB,EAAE,EAAE,CAAA;KAAE,CAAC,CAAC;IAEzF;;OAEG;IACH,4BAA4B,CAC1B,eAAe,EAAE,EAAE,EACnB,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC;IAE3D;;;OAGG;IACH,sBAAsB,CAAC,EAAE,EAAE,uBAAuB,GAAG,OAAO,CAAC,iBAAiB,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC;IAEvG;;OAEG,CAAC,4BAA4B,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC;IAE9G;;OAEG;IACH,6BAA6B,CAAC,SAAS,EAAE,EAAE,GAAG,OAAO,CAAC,0BAA0B,GAAG,SAAS,CAAC,CAAC;IAC9F;;OAEG;IACH,mBAAmB,IAAI,OAAO,CAAC,EAAE,CAAC,CAAC;IAEnC;;;;;;OAMG;IACH,kBAAkB,CAAC,eAAe,EAAE,KAAK,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAEpE,2EAA2E;IAC3E,oBAAoB,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAE7G;mFAC+E;IAC/E,sBAAsB,CAAC,eAAe,EAAE,YAAY,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACrF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NOTE_HASH_TREE_HEIGHT } from '@aztec/constants';
|
|
2
2
|
import type { Fr, GrumpkinScalar, Point } from '@aztec/foundation/fields';
|
|
3
3
|
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
4
4
|
import type { KeyStore } from '@aztec/key-store';
|
|
@@ -9,12 +9,12 @@ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
|
9
9
|
import { UpdatedClassIdHints } from '@aztec/stdlib/kernel';
|
|
10
10
|
import type { NullifierMembershipWitness } from '@aztec/stdlib/trees';
|
|
11
11
|
import type { VerificationKeyAsFields } from '@aztec/stdlib/vks';
|
|
12
|
-
import type { ContractDataProvider } from '../storage/
|
|
13
|
-
import type {
|
|
12
|
+
import type { ContractDataProvider } from '../storage/index.js';
|
|
13
|
+
import type { PrivateKernelOracle } from './private_kernel_oracle.js';
|
|
14
14
|
/**
|
|
15
15
|
* A data oracle that provides information needed for simulating a transaction.
|
|
16
16
|
*/
|
|
17
|
-
export declare class
|
|
17
|
+
export declare class PrivateKernelOracleImpl implements PrivateKernelOracle {
|
|
18
18
|
private contractDataProvider;
|
|
19
19
|
private keyStore;
|
|
20
20
|
private node;
|
|
@@ -42,4 +42,4 @@ export declare class KernelOracle implements ProvingDataOracle {
|
|
|
42
42
|
getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string>;
|
|
43
43
|
getUpdatedClassIdHints(contractAddress: AztecAddress): Promise<UpdatedClassIdHints>;
|
|
44
44
|
}
|
|
45
|
-
//# sourceMappingURL=
|
|
45
|
+
//# sourceMappingURL=private_kernel_oracle_impl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private_kernel_oracle_impl.d.ts","sourceRoot":"","sources":["../../src/private_kernel/private_kernel_oracle_impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAA2C,MAAM,kBAAkB,CAAC;AAClG,OAAO,KAAK,EAAE,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAG1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAItE;;GAEG;AAEH,qBAAa,uBAAwB,YAAW,mBAAmB;IAE/D,OAAO,CAAC,oBAAoB;IAC5B,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,GAAG;gBAJH,oBAAoB,EAAE,oBAAoB,EAC1C,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,SAAS,EACf,WAAW,GAAE,aAAwB,EACrC,GAAG,yCAAoC;IAGpC,0BAA0B,CAAC,OAAO,EAAE,YAAY;;;;;;;;;;;IAQhD,0BAA0B,CAAC,eAAe,EAAE,EAAE;IAK9C,4BAA4B,CAAC,eAAe,EAAE,EAAE,EAAE,QAAQ,EAAE,gBAAgB;IAIlF,sBAAsB,CAAC,EAAE,EAAE,uBAAuB;IAKnD,4BAA4B,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,OAAO,qBAAqB,CAAC,CAAC;IAS/G,6BAA6B,CAAC,SAAS,EAAE,EAAE,GAAG,OAAO,CAAC,0BAA0B,GAAG,SAAS,CAAC;IAIvF,mBAAmB,IAAI,OAAO,CAAC,EAAE,CAAC;IAQjC,kBAAkB,CAAC,eAAe,EAAE,KAAK,GAAG,OAAO,CAAC,cAAc,CAAC;IAInE,oBAAoB,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC;IAI1F,sBAAsB,CAAC,eAAe,EAAE,YAAY,GAAG,OAAO,CAAC,mBAAmB,CAAC;CA6BjG"}
|
|
@@ -11,7 +11,7 @@ import { SharedMutableValues, SharedMutableValuesWithHash } from '@aztec/stdlib/
|
|
|
11
11
|
// It should be fixed at the time the proof is being simulated. I.e., it should be the same as the value defined in the constant data.
|
|
12
12
|
/**
|
|
13
13
|
* A data oracle that provides information needed for simulating a transaction.
|
|
14
|
-
*/ export class
|
|
14
|
+
*/ export class PrivateKernelOracleImpl {
|
|
15
15
|
contractDataProvider;
|
|
16
16
|
keyStore;
|
|
17
17
|
node;
|
|
@@ -65,7 +65,7 @@ import { SharedMutableValues, SharedMutableValuesWithHash } from '@aztec/stdlib/
|
|
|
65
65
|
async getUpdatedClassIdHints(contractAddress) {
|
|
66
66
|
const { sharedMutableSlot, sharedMutableHashSlot } = await SharedMutableValuesWithHash.getContractUpdateSlots(contractAddress);
|
|
67
67
|
const hashLeafSlot = await computePublicDataTreeLeafSlot(ProtocolContractAddress.ContractInstanceDeployer, sharedMutableHashSlot);
|
|
68
|
-
const updatedClassIdWitness = await this.node.
|
|
68
|
+
const updatedClassIdWitness = await this.node.getPublicDataWitness(this.blockNumber, hashLeafSlot);
|
|
69
69
|
if (!updatedClassIdWitness) {
|
|
70
70
|
throw new Error(`No public data tree witness found for ${hashLeafSlot}`);
|
|
71
71
|
}
|