@aztec/pxe 3.0.0-canary.a9708bd → 3.0.0-devnet.2
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/README.md +5 -5
- package/dest/bin/check_oracle_version.js +18 -8
- package/dest/config/index.d.ts +8 -8
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +3 -3
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +82 -26
- package/dest/contract_function_simulator/execution_data_provider.d.ts +27 -38
- package/dest/contract_function_simulator/execution_data_provider.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.d.ts +2 -2
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +7 -4
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +16 -0
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -0
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +26 -0
- package/dest/contract_function_simulator/index.d.ts +3 -1
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +2 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +7 -3
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +1 -0
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +22 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.js +33 -0
- package/dest/contract_function_simulator/oracle/index.d.ts +1 -1
- package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/index.js +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +97 -0
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/interfaces.js +4 -0
- package/dest/contract_function_simulator/oracle/oracle.d.ts +12 -11
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +79 -76
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -2
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +6 -15
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +26 -10
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +69 -18
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +10 -22
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +33 -38
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +19 -55
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +1 -1
- package/dest/contract_function_simulator/pxe_oracle_interface.js +174 -187
- package/dest/entrypoints/client/bundle/index.d.ts +3 -1
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +2 -1
- package/dest/entrypoints/client/bundle/utils.d.ts +8 -8
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +8 -8
- package/dest/entrypoints/client/lazy/index.d.ts +3 -1
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +2 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +7 -7
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +7 -7
- package/dest/entrypoints/server/index.d.ts +3 -1
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +2 -1
- package/dest/entrypoints/server/utils.d.ts +4 -23
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +4 -25
- package/dest/{pxe_service/error_enriching.d.ts → error_enriching.d.ts} +1 -1
- package/dest/error_enriching.d.ts.map +1 -0
- package/dest/{pxe_service/error_enriching.js → error_enriching.js} +3 -0
- package/dest/oracle_version.d.ts +2 -2
- package/dest/oracle_version.js +2 -2
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.js +6 -6
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +7 -0
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +23 -18
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +2 -2
- package/dest/pxe.d.ts +233 -0
- package/dest/pxe.d.ts.map +1 -0
- package/dest/{pxe_service/pxe_service.js → pxe.js} +215 -214
- package/dest/storage/address_data_provider/address_data_provider.d.ts +1 -3
- package/dest/storage/address_data_provider/address_data_provider.d.ts.map +1 -1
- package/dest/storage/address_data_provider/address_data_provider.js +0 -3
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +1 -3
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +1 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.js +0 -4
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts +3 -4
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +1 -1
- package/dest/storage/contract_data_provider/contract_data_provider.js +0 -3
- package/dest/storage/index.d.ts +0 -1
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +0 -1
- package/dest/storage/note_data_provider/note_dao.d.ts +1 -1
- package/dest/storage/note_data_provider/note_dao.d.ts.map +1 -1
- package/dest/storage/note_data_provider/note_data_provider.d.ts +70 -7
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -1
- package/dest/storage/note_data_provider/note_data_provider.js +120 -72
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +1 -3
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +1 -1
- package/dest/storage/private_event_data_provider/private_event_data_provider.js +0 -3
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts +1 -3
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +1 -1
- package/dest/storage/sync_data_provider/sync_data_provider.js +0 -3
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +28 -6
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +1 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.js +46 -39
- package/dest/synchronizer/synchronizer.d.ts.map +1 -1
- package/dest/synchronizer/synchronizer.js +2 -3
- package/dest/tagging/constants.d.ts +2 -0
- package/dest/tagging/constants.d.ts.map +1 -0
- package/dest/tagging/constants.js +2 -0
- package/dest/tagging/index.d.ts +7 -0
- package/dest/tagging/index.d.ts.map +1 -0
- package/dest/tagging/index.js +5 -0
- package/dest/tagging/siloed_tag.d.ts +14 -0
- package/dest/tagging/siloed_tag.d.ts.map +1 -0
- package/dest/tagging/siloed_tag.js +20 -0
- package/dest/tagging/tag.d.ts +12 -0
- package/dest/tagging/tag.d.ts.map +1 -0
- package/dest/tagging/tag.js +17 -0
- package/dest/tagging/utils.d.ts +18 -0
- package/dest/tagging/utils.d.ts.map +1 -0
- package/dest/tagging/utils.js +24 -0
- package/package.json +19 -22
- package/src/bin/check_oracle_version.ts +23 -9
- package/src/config/index.ts +11 -10
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +128 -44
- package/src/contract_function_simulator/execution_data_provider.ts +29 -47
- package/src/contract_function_simulator/execution_note_cache.ts +11 -6
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +32 -0
- package/src/contract_function_simulator/index.ts +3 -1
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +8 -3
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/utility_context.ts +42 -0
- package/src/contract_function_simulator/oracle/index.ts +1 -1
- package/src/contract_function_simulator/oracle/interfaces.ts +160 -0
- package/src/contract_function_simulator/oracle/oracle.ts +102 -77
- package/src/contract_function_simulator/oracle/private_execution.ts +7 -15
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +106 -45
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +51 -76
- package/src/contract_function_simulator/pxe_oracle_interface.ts +199 -218
- package/src/entrypoints/client/bundle/index.ts +3 -1
- package/src/entrypoints/client/bundle/utils.ts +11 -19
- package/src/entrypoints/client/lazy/index.ts +3 -1
- package/src/entrypoints/client/lazy/utils.ts +10 -18
- package/src/entrypoints/server/index.ts +3 -1
- package/src/entrypoints/server/utils.ts +9 -39
- package/src/{pxe_service/error_enriching.ts → error_enriching.ts} +5 -1
- package/src/oracle_version.ts +2 -2
- package/src/private_kernel/hints/compute_tx_include_by_timestamp.ts +6 -6
- package/src/private_kernel/private_kernel_execution_prover.ts +35 -23
- package/src/{pxe_service/pxe_service.ts → pxe.ts} +230 -257
- package/src/storage/address_data_provider/address_data_provider.ts +1 -7
- package/src/storage/capsule_data_provider/capsule_data_provider.ts +1 -11
- package/src/storage/contract_data_provider/contract_data_provider.ts +3 -9
- package/src/storage/index.ts +0 -1
- package/src/storage/note_data_provider/note_dao.ts +1 -1
- package/src/storage/note_data_provider/note_data_provider.ts +142 -99
- package/src/storage/private_event_data_provider/private_event_data_provider.ts +1 -7
- package/src/storage/sync_data_provider/sync_data_provider.ts +1 -7
- package/src/storage/tagging_data_provider/tagging_data_provider.ts +52 -55
- package/src/synchronizer/synchronizer.ts +2 -3
- package/src/tagging/constants.ts +2 -0
- package/src/tagging/index.ts +6 -0
- package/src/tagging/siloed_tag.ts +22 -0
- package/src/tagging/tag.ts +16 -0
- package/src/tagging/utils.ts +31 -0
- package/dest/bin/index.d.ts +0 -3
- package/dest/bin/index.d.ts.map +0 -1
- package/dest/bin/index.js +0 -48
- package/dest/contract_function_simulator/oracle/typed_oracle.d.ts +0 -87
- package/dest/contract_function_simulator/oracle/typed_oracle.d.ts.map +0 -1
- package/dest/contract_function_simulator/oracle/typed_oracle.js +0 -146
- package/dest/contract_function_simulator/tagging_utils.d.ts +0 -17
- package/dest/contract_function_simulator/tagging_utils.d.ts.map +0 -1
- package/dest/contract_function_simulator/tagging_utils.js +0 -23
- package/dest/pxe_service/error_enriching.d.ts.map +0 -1
- package/dest/pxe_service/index.d.ts +0 -3
- package/dest/pxe_service/index.d.ts.map +0 -1
- package/dest/pxe_service/index.js +0 -2
- package/dest/pxe_service/pxe_service.d.ts +0 -100
- package/dest/pxe_service/pxe_service.d.ts.map +0 -1
- package/dest/storage/data_provider.d.ts +0 -4
- package/dest/storage/data_provider.d.ts.map +0 -1
- package/dest/storage/data_provider.js +0 -1
- package/dest/test/pxe_test_suite.d.ts +0 -3
- package/dest/test/pxe_test_suite.d.ts.map +0 -1
- package/dest/test/pxe_test_suite.js +0 -97
- package/src/bin/index.ts +0 -62
- package/src/contract_function_simulator/oracle/typed_oracle.ts +0 -289
- package/src/contract_function_simulator/tagging_utils.ts +0 -32
- package/src/pxe_service/index.ts +0 -2
- package/src/storage/data_provider.ts +0 -3
- package/src/test/pxe_test_suite.ts +0 -113
|
@@ -6,23 +6,23 @@ import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/prov
|
|
|
6
6
|
import { WASMSimulator } from '@aztec/simulator/client';
|
|
7
7
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
8
8
|
|
|
9
|
-
import type {
|
|
10
|
-
import {
|
|
9
|
+
import type { PXEConfig } from '../../../config/index.js';
|
|
10
|
+
import { PXE } from '../../../pxe.js';
|
|
11
11
|
import type { PXECreationOptions } from '../../pxe_creation_options.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* Create and start an
|
|
14
|
+
* Create and start an PXE instance with the given AztecNode.
|
|
15
15
|
* If no keyStore or database is provided, it will use KeyStore and MemoryDB as default values.
|
|
16
|
-
* Returns a Promise that resolves to the started
|
|
16
|
+
* Returns a Promise that resolves to the started PXE instance.
|
|
17
17
|
*
|
|
18
18
|
* @param aztecNode - The AztecNode instance to be used by the server.
|
|
19
|
-
* @param config - The PXE
|
|
20
|
-
* @param options - (Optional) Optional information for creating an
|
|
21
|
-
* @returns A Promise that resolves to the started
|
|
19
|
+
* @param config - The PXE Config to use
|
|
20
|
+
* @param options - (Optional) Optional information for creating an PXE.
|
|
21
|
+
* @returns A Promise that resolves to the started PXE instance.
|
|
22
22
|
*/
|
|
23
|
-
export async function
|
|
23
|
+
export async function createPXE(
|
|
24
24
|
aztecNode: AztecNode,
|
|
25
|
-
config:
|
|
25
|
+
config: PXEConfig,
|
|
26
26
|
options: PXECreationOptions = { loggers: {} },
|
|
27
27
|
) {
|
|
28
28
|
const logSuffix =
|
|
@@ -38,7 +38,7 @@ export async function createPXEService(
|
|
|
38
38
|
const configWithContracts = {
|
|
39
39
|
...config,
|
|
40
40
|
l1Contracts,
|
|
41
|
-
} as
|
|
41
|
+
} as PXEConfig;
|
|
42
42
|
|
|
43
43
|
const storeLogger = loggers.store ? loggers.store : createLogger('pxe:data:idb' + (logSuffix ? `:${logSuffix}` : ''));
|
|
44
44
|
|
|
@@ -53,14 +53,6 @@ export async function createPXEService(
|
|
|
53
53
|
const protocolContractsProvider = new BundledProtocolContractsProvider();
|
|
54
54
|
|
|
55
55
|
const pxeLogger = loggers.pxe ? loggers.pxe : createLogger('pxe:service' + (logSuffix ? `:${logSuffix}` : ''));
|
|
56
|
-
const pxe = await
|
|
57
|
-
aztecNode,
|
|
58
|
-
store,
|
|
59
|
-
prover,
|
|
60
|
-
simulator,
|
|
61
|
-
protocolContractsProvider,
|
|
62
|
-
config,
|
|
63
|
-
pxeLogger,
|
|
64
|
-
);
|
|
56
|
+
const pxe = await PXE.create(aztecNode, store, prover, simulator, protocolContractsProvider, config, pxeLogger);
|
|
65
57
|
return pxe;
|
|
66
58
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export * from '../../../
|
|
1
|
+
export * from '../../../pxe.js';
|
|
2
2
|
export * from '../../../config/index.js';
|
|
3
3
|
export * from '../../../storage/index.js';
|
|
4
|
+
export * from '../../../error_enriching.js';
|
|
4
5
|
export * from './utils.js';
|
|
5
6
|
export { PXEOracleInterface } from '../../../contract_function_simulator/pxe_oracle_interface.js';
|
|
7
|
+
export { type PXECreationOptions } from '../../pxe_creation_options.js';
|
|
@@ -6,22 +6,22 @@ import { LazyProtocolContractsProvider } from '@aztec/protocol-contracts/provide
|
|
|
6
6
|
import { WASMSimulator } from '@aztec/simulator/client';
|
|
7
7
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
8
8
|
|
|
9
|
-
import type {
|
|
10
|
-
import {
|
|
9
|
+
import type { PXEConfig } from '../../../config/index.js';
|
|
10
|
+
import { PXE } from '../../../pxe.js';
|
|
11
11
|
import type { PXECreationOptions } from '../../pxe_creation_options.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* Create and start an
|
|
15
|
-
* Returns a Promise that resolves to the started
|
|
14
|
+
* Create and start an PXE instance with the given AztecNode.
|
|
15
|
+
* Returns a Promise that resolves to the started PXE instance.
|
|
16
16
|
*
|
|
17
17
|
* @param aztecNode - The AztecNode instance to be used by the server.
|
|
18
|
-
* @param config - The PXE
|
|
18
|
+
* @param config - The PXE Config to use
|
|
19
19
|
* @param
|
|
20
|
-
* @returns A Promise that resolves to the started
|
|
20
|
+
* @returns A Promise that resolves to the started PXE instance.
|
|
21
21
|
*/
|
|
22
|
-
export async function
|
|
22
|
+
export async function createPXE(
|
|
23
23
|
aztecNode: AztecNode,
|
|
24
|
-
config:
|
|
24
|
+
config: PXEConfig,
|
|
25
25
|
options: PXECreationOptions = { loggers: {} },
|
|
26
26
|
) {
|
|
27
27
|
const logSuffix =
|
|
@@ -35,7 +35,7 @@ export async function createPXEService(
|
|
|
35
35
|
const configWithContracts = {
|
|
36
36
|
...config,
|
|
37
37
|
l1Contracts,
|
|
38
|
-
} as
|
|
38
|
+
} as PXEConfig;
|
|
39
39
|
|
|
40
40
|
const loggers = options.loggers ?? {};
|
|
41
41
|
|
|
@@ -53,14 +53,6 @@ export async function createPXEService(
|
|
|
53
53
|
const protocolContractsProvider = new LazyProtocolContractsProvider();
|
|
54
54
|
|
|
55
55
|
const pxeLogger = loggers.pxe ? loggers.pxe : createLogger('pxe:service' + (logSuffix ? `:${logSuffix}` : ''));
|
|
56
|
-
const pxe = await
|
|
57
|
-
aztecNode,
|
|
58
|
-
store,
|
|
59
|
-
prover,
|
|
60
|
-
simulator,
|
|
61
|
-
protocolContractsProvider,
|
|
62
|
-
config,
|
|
63
|
-
pxeLogger,
|
|
64
|
-
);
|
|
56
|
+
const pxe = await PXE.create(aztecNode, store, prover, simulator, protocolContractsProvider, config, pxeLogger);
|
|
65
57
|
return pxe;
|
|
66
58
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
export * from '../../
|
|
1
|
+
export * from '../../pxe.js';
|
|
2
2
|
export * from '../../config/index.js';
|
|
3
|
+
export * from '../../error_enriching.js';
|
|
3
4
|
export * from '../../storage/index.js';
|
|
4
5
|
export * from './utils.js';
|
|
5
6
|
export { PXEOracleInterface } from '../../contract_function_simulator/pxe_oracle_interface.js';
|
|
6
7
|
export { ORACLE_VERSION } from '../../oracle_version.js';
|
|
8
|
+
export { type PXECreationOptions } from '../pxe_creation_options.js';
|
|
@@ -12,52 +12,23 @@ import {
|
|
|
12
12
|
import { FileCircuitRecorder } from '@aztec/simulator/testing';
|
|
13
13
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
14
14
|
|
|
15
|
-
import type {
|
|
16
|
-
import {
|
|
15
|
+
import type { PXEConfig } from '../../config/index.js';
|
|
16
|
+
import { PXE } from '../../pxe.js';
|
|
17
17
|
import { PXE_DATA_SCHEMA_VERSION } from '../../storage/index.js';
|
|
18
18
|
import type { PXECreationOptions } from '../pxe_creation_options.js';
|
|
19
19
|
|
|
20
|
-
type PXEConfigWithoutDefaults = Omit<
|
|
21
|
-
PXEServiceConfig,
|
|
22
|
-
'l1Contracts' | 'l1ChainId' | 'l2BlockBatchSize' | 'rollupVersion'
|
|
23
|
-
>;
|
|
20
|
+
type PXEConfigWithoutDefaults = Omit<PXEConfig, 'l1Contracts' | 'l1ChainId' | 'l2BlockBatchSize' | 'rollupVersion'>;
|
|
24
21
|
|
|
25
|
-
|
|
26
|
-
* Create and start an PXEService instance with the given AztecNode and config.
|
|
27
|
-
*
|
|
28
|
-
* @param aztecNode - The AztecNode instance to be used by the server.
|
|
29
|
-
* @param config - The PXE Service Config to use
|
|
30
|
-
* @param useLogSuffix - Whether to add a randomly generated suffix to the PXE debug logs.
|
|
31
|
-
* @returns A Promise that resolves to the started PXEService instance.
|
|
32
|
-
*/
|
|
33
|
-
export function createPXEService(
|
|
22
|
+
export async function createPXE(
|
|
34
23
|
aztecNode: AztecNode,
|
|
35
24
|
config: PXEConfigWithoutDefaults,
|
|
36
25
|
options: PXECreationOptions = { loggers: {} },
|
|
37
26
|
) {
|
|
38
|
-
const simulator = new WASMSimulator();
|
|
39
27
|
const recorder = process.env.CIRCUIT_RECORD_DIR
|
|
40
28
|
? new FileCircuitRecorder(process.env.CIRCUIT_RECORD_DIR)
|
|
41
29
|
: new MemoryCircuitRecorder();
|
|
42
|
-
const
|
|
43
|
-
return createPXEServiceWithSimulator(aztecNode, simulatorWithRecorder, config, options);
|
|
44
|
-
}
|
|
30
|
+
const simulator = new SimulatorRecorderWrapper(new WASMSimulator(), recorder);
|
|
45
31
|
|
|
46
|
-
/**
|
|
47
|
-
* Create and start an PXEService instance with the given AztecNode, Simulator and config.
|
|
48
|
-
*
|
|
49
|
-
* @param aztecNode - The AztecNode instance to be used by the server.
|
|
50
|
-
* @param simulator - The Simulator to use
|
|
51
|
-
* @param config - The PXE Service Config to use
|
|
52
|
-
* @param useLogSuffix - Whether to add a randomly generated suffix to the PXE debug logs.
|
|
53
|
-
* @returns A Promise that resolves to the started PXEService instance.
|
|
54
|
-
*/
|
|
55
|
-
export async function createPXEServiceWithSimulator(
|
|
56
|
-
aztecNode: AztecNode,
|
|
57
|
-
simulator: CircuitSimulator,
|
|
58
|
-
config: PXEConfigWithoutDefaults,
|
|
59
|
-
options: PXECreationOptions = { loggers: {} },
|
|
60
|
-
) {
|
|
61
32
|
const logSuffix =
|
|
62
33
|
typeof options.useLogSuffix === 'boolean'
|
|
63
34
|
? options.useLogSuffix
|
|
@@ -67,7 +38,7 @@ export async function createPXEServiceWithSimulator(
|
|
|
67
38
|
const loggers = options.loggers ?? {};
|
|
68
39
|
|
|
69
40
|
const { l1ChainId, l1ContractAddresses: l1Contracts, rollupVersion } = await aztecNode.getNodeInfo();
|
|
70
|
-
const configWithContracts:
|
|
41
|
+
const configWithContracts: PXEConfig = {
|
|
71
42
|
...config,
|
|
72
43
|
l1Contracts,
|
|
73
44
|
l1ChainId,
|
|
@@ -92,7 +63,7 @@ export async function createPXEServiceWithSimulator(
|
|
|
92
63
|
const protocolContractsProvider = new BundledProtocolContractsProvider();
|
|
93
64
|
|
|
94
65
|
const pxeLogger = loggers.pxe ? loggers.pxe : createLogger('pxe:service' + (logSuffix ? `:${logSuffix}` : ''));
|
|
95
|
-
const pxe = await
|
|
66
|
+
const pxe = await PXE.create(
|
|
96
67
|
aztecNode,
|
|
97
68
|
options.store,
|
|
98
69
|
prover,
|
|
@@ -105,15 +76,14 @@ export async function createPXEServiceWithSimulator(
|
|
|
105
76
|
}
|
|
106
77
|
|
|
107
78
|
function createProver(
|
|
108
|
-
config: Pick<
|
|
79
|
+
config: Pick<PXEConfig, 'bbBinaryPath' | 'bbWorkingDirectory'>,
|
|
109
80
|
simulator: CircuitSimulator,
|
|
110
81
|
logger?: Logger,
|
|
111
82
|
) {
|
|
112
83
|
if (!config.bbBinaryPath || !config.bbWorkingDirectory) {
|
|
113
84
|
return new BBWASMBundlePrivateKernelProver(simulator, 16, logger);
|
|
114
85
|
} else {
|
|
115
|
-
const bbConfig = config as Required<Pick<
|
|
116
|
-
PXEServiceConfig;
|
|
86
|
+
const bbConfig = config as Required<Pick<PXEConfig, 'bbBinaryPath' | 'bbWorkingDirectory'>> & PXEConfig;
|
|
117
87
|
return BBNativePrivateKernelProver.new(
|
|
118
88
|
{ bbSkipCleanup: false, numConcurrentIVCVerifiers: 1, bbIVCConcurrency: 1, ...bbConfig },
|
|
119
89
|
simulator,
|
|
@@ -4,7 +4,7 @@ import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
|
4
4
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
5
|
import { type SimulationError, isNoirCallStackUnresolved } from '@aztec/stdlib/errors';
|
|
6
6
|
|
|
7
|
-
import type { ContractDataProvider } from '
|
|
7
|
+
import type { ContractDataProvider } from './storage/contract_data_provider/contract_data_provider.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Adds contract and function names to a simulation error, if they
|
|
@@ -76,6 +76,10 @@ export async function enrichPublicSimulationError(
|
|
|
76
76
|
const callStack = err.getCallStack();
|
|
77
77
|
const originalFailingFunction = callStack[callStack.length - 1];
|
|
78
78
|
|
|
79
|
+
if (!originalFailingFunction) {
|
|
80
|
+
throw new Error(`Original failing function not found when enriching public simulation, missing callstack`);
|
|
81
|
+
}
|
|
82
|
+
|
|
79
83
|
const artifact = await contractDataProvider.getPublicFunctionArtifact(originalFailingFunction.contractAddress);
|
|
80
84
|
if (!artifact) {
|
|
81
85
|
throw new Error(
|
package/src/oracle_version.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
///
|
|
5
5
|
/// @dev Whenever a contract function or Noir test is run, the `utilityAssertCompatibleOracleVersion` oracle is called
|
|
6
6
|
/// and if the oracle version is incompatible an error is thrown.
|
|
7
|
-
export const ORACLE_VERSION =
|
|
7
|
+
export const ORACLE_VERSION = 3;
|
|
8
8
|
|
|
9
9
|
/// This hash is computed as by hashing the Oracle interface and it is used to detect when the Oracle interface changes,
|
|
10
10
|
/// which in turn implies that you need to update the ORACLE_VERSION constant.
|
|
11
|
-
export const ORACLE_INTERFACE_HASH = '
|
|
11
|
+
export const ORACLE_INTERFACE_HASH = 'f9168ceb5a2227c148c5021ebffd4e2ca0da99885b87c5be3ee5ac0d8dd3d67c';
|
|
@@ -31,8 +31,8 @@ export function computeTxIncludeByTimestamp(
|
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
const
|
|
35
|
-
const maxTimestamp =
|
|
34
|
+
const anchorBlockTimestamp = previousKernel.constants.anchorBlockHeader.globalVariables.timestamp;
|
|
35
|
+
const maxTimestamp = anchorBlockTimestamp + BigInt(maxDuration);
|
|
36
36
|
const includeByTimestamp = previousKernel.includeByTimestamp;
|
|
37
37
|
|
|
38
38
|
// If the includeByTimestamp set during the tx execution is greater than or equal to the max allowed duration,
|
|
@@ -44,13 +44,13 @@ export function computeTxIncludeByTimestamp(
|
|
|
44
44
|
|
|
45
45
|
// Round it down to the nearest hour/min/second to reduce precision and avoid revealing the exact value.
|
|
46
46
|
// This makes it harder for others to infer what function calls may have been used to produce a specific timestamp.
|
|
47
|
-
const roundedTimestamp = roundTimestamp(
|
|
47
|
+
const roundedTimestamp = roundTimestamp(anchorBlockTimestamp, includeByTimestamp);
|
|
48
48
|
|
|
49
|
-
// The tx can't be published if the timestamp is the same or less than the
|
|
49
|
+
// The tx can't be published if the timestamp is the same or less than the anchor block's timestamp.
|
|
50
50
|
// Future blocks will have a greater timestamp, so the tx would never be included.
|
|
51
|
-
if (roundedTimestamp <=
|
|
51
|
+
if (roundedTimestamp <= anchorBlockTimestamp) {
|
|
52
52
|
throw new Error(
|
|
53
|
-
`Include-by timestamp must be greater than the
|
|
53
|
+
`Include-by timestamp must be greater than the anchor block timestamp. Anchor block timestamp: ${anchorBlockTimestamp}. Include-by timestamp: ${includeByTimestamp}.`,
|
|
54
54
|
);
|
|
55
55
|
}
|
|
56
56
|
|
|
@@ -4,9 +4,8 @@ import { createLogger } from '@aztec/foundation/log';
|
|
|
4
4
|
import { pushTestData } from '@aztec/foundation/testing';
|
|
5
5
|
import { Timer } from '@aztec/foundation/timer';
|
|
6
6
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
7
|
-
import {
|
|
7
|
+
import { ProtocolContractsList } from '@aztec/protocol-contracts';
|
|
8
8
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
9
|
-
import { computeContractAddressFromInstance } from '@aztec/stdlib/contract';
|
|
10
9
|
import type { PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
|
|
11
10
|
import {
|
|
12
11
|
HidingKernelToPublicPrivateInputs,
|
|
@@ -24,7 +23,7 @@ import {
|
|
|
24
23
|
type PrivateKernelTailCircuitPublicInputs,
|
|
25
24
|
PrivateVerificationKeyHints,
|
|
26
25
|
} from '@aztec/stdlib/kernel';
|
|
27
|
-
import { ClientIvcProof } from '@aztec/stdlib/proofs';
|
|
26
|
+
import { ClientIvcProof, ClientIvcProofWithPublicInputs } from '@aztec/stdlib/proofs';
|
|
28
27
|
import {
|
|
29
28
|
type PrivateCallExecutionResult,
|
|
30
29
|
type PrivateExecutionResult,
|
|
@@ -168,7 +167,7 @@ export class PrivateKernelExecutionProver {
|
|
|
168
167
|
const proofInput = new PrivateKernelInitCircuitPrivateInputs(
|
|
169
168
|
txRequest,
|
|
170
169
|
getVKTreeRoot(),
|
|
171
|
-
|
|
170
|
+
ProtocolContractsList,
|
|
172
171
|
privateCallData,
|
|
173
172
|
isPrivateOnlyTx,
|
|
174
173
|
executionResult.firstNullifier,
|
|
@@ -268,10 +267,10 @@ export class PrivateKernelExecutionProver {
|
|
|
268
267
|
// Use the aggregated includeByTimestamp set throughout the tx execution.
|
|
269
268
|
// TODO: Call `computeTxIncludeByTimestamp` to round the value down and reduce precision, improving privacy.
|
|
270
269
|
const includeByTimestampUpperBound = previousKernelData.publicInputs.includeByTimestamp;
|
|
271
|
-
const
|
|
272
|
-
if (includeByTimestampUpperBound <=
|
|
270
|
+
const anchorBlockTimestamp = previousKernelData.publicInputs.constants.anchorBlockHeader.globalVariables.timestamp;
|
|
271
|
+
if (includeByTimestampUpperBound <= anchorBlockTimestamp) {
|
|
273
272
|
throw new Error(
|
|
274
|
-
`Include-by timestamp must be greater than the
|
|
273
|
+
`Include-by timestamp must be greater than the anchor block timestamp. Anchor block timestamp: ${anchorBlockTimestamp}. Include-by timestamp: ${includeByTimestampUpperBound}.`,
|
|
275
274
|
);
|
|
276
275
|
}
|
|
277
276
|
|
|
@@ -281,8 +280,6 @@ export class PrivateKernelExecutionProver {
|
|
|
281
280
|
includeByTimestampUpperBound,
|
|
282
281
|
);
|
|
283
282
|
|
|
284
|
-
pushTestData('private-kernel-inputs-ordering', privateInputs);
|
|
285
|
-
|
|
286
283
|
const witgenTimer = new Timer();
|
|
287
284
|
const tailOutput = generateWitnesses
|
|
288
285
|
? await this.proofCreator.generateTailOutput(privateInputs)
|
|
@@ -355,8 +352,10 @@ export class PrivateKernelExecutionProver {
|
|
|
355
352
|
let provingTime;
|
|
356
353
|
if (!skipProofGeneration) {
|
|
357
354
|
const provingTimer = new Timer();
|
|
358
|
-
|
|
355
|
+
const proofWithPublicInputs = await this.proofCreator.createClientIvcProof(executionSteps);
|
|
359
356
|
provingTime = provingTimer.ms();
|
|
357
|
+
this.ensurePublicInputsMatch(proofWithPublicInputs, tailOutput.publicInputs);
|
|
358
|
+
clientIvcProof = proofWithPublicInputs.removePublicInputs();
|
|
360
359
|
} else {
|
|
361
360
|
clientIvcProof = ClientIvcProof.random();
|
|
362
361
|
}
|
|
@@ -369,6 +368,32 @@ export class PrivateKernelExecutionProver {
|
|
|
369
368
|
};
|
|
370
369
|
}
|
|
371
370
|
|
|
371
|
+
/**
|
|
372
|
+
* Checks that the public inputs of the civc proof match the public inputs of the tail circuit.
|
|
373
|
+
* This can only mismatch if there is a circuit / noir / bb bug.
|
|
374
|
+
* @param civcProof - The civc proof with public inputs.
|
|
375
|
+
* @param tailPublicInputs - The public inputs resulting from witness generation of the tail circuit.
|
|
376
|
+
*/
|
|
377
|
+
private ensurePublicInputsMatch(
|
|
378
|
+
civcProof: ClientIvcProofWithPublicInputs,
|
|
379
|
+
tailPublicInputs: PrivateKernelTailCircuitPublicInputs,
|
|
380
|
+
) {
|
|
381
|
+
const serializedCivcProofPublicInputs = civcProof.getPublicInputs();
|
|
382
|
+
const serializedTailPublicInputs = tailPublicInputs.publicInputs().toFields();
|
|
383
|
+
if (serializedCivcProofPublicInputs.length !== serializedTailPublicInputs.length) {
|
|
384
|
+
throw new Error(
|
|
385
|
+
`Public inputs length mismatch: ${serializedCivcProofPublicInputs.length} !== ${serializedTailPublicInputs.length}`,
|
|
386
|
+
);
|
|
387
|
+
}
|
|
388
|
+
if (
|
|
389
|
+
!serializedCivcProofPublicInputs.every((input: Fr, index: number) =>
|
|
390
|
+
input.equals(serializedTailPublicInputs[index]),
|
|
391
|
+
)
|
|
392
|
+
) {
|
|
393
|
+
throw new Error(`Public inputs mismatch between kernel and civc proof`);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
372
397
|
private async getVkData(verificationKey: VerificationKeyData) {
|
|
373
398
|
const previousVkMembershipWitness = await this.oracle.getVkMembershipWitness(verificationKey.keyAsFields);
|
|
374
399
|
return new VkData(
|
|
@@ -394,17 +419,6 @@ export class PrivateKernelExecutionProver {
|
|
|
394
419
|
const { artifactHash: contractClassArtifactHash, publicBytecodeCommitment: contractClassPublicBytecodeCommitment } =
|
|
395
420
|
await this.oracle.getContractClassIdPreimage(currentContractClassId);
|
|
396
421
|
|
|
397
|
-
// This will be the address computed in the kernel by the executed class. We need to provide non membership of it in the protocol contract tree.
|
|
398
|
-
// This would only be equal to contractAddress if the currentClassId is equal to the original class id (no update happened).
|
|
399
|
-
const computedAddress = await computeContractAddressFromInstance({
|
|
400
|
-
originalContractClassId: currentContractClassId,
|
|
401
|
-
saltedInitializationHash,
|
|
402
|
-
publicKeys,
|
|
403
|
-
});
|
|
404
|
-
|
|
405
|
-
const { lowLeaf: protocolContractLeaf, witness: protocolContractMembershipWitness } =
|
|
406
|
-
await getProtocolContractLeafAndMembershipWitness(contractAddress, computedAddress);
|
|
407
|
-
|
|
408
422
|
const updatedClassIdHints = await this.oracle.getUpdatedClassIdHints(contractAddress);
|
|
409
423
|
return PrivateCallData.from({
|
|
410
424
|
publicInputs,
|
|
@@ -415,8 +429,6 @@ export class PrivateKernelExecutionProver {
|
|
|
415
429
|
contractClassPublicBytecodeCommitment,
|
|
416
430
|
saltedInitializationHash,
|
|
417
431
|
functionLeafMembershipWitness,
|
|
418
|
-
protocolContractMembershipWitness,
|
|
419
|
-
protocolContractLeaf,
|
|
420
432
|
updatedClassIdHints,
|
|
421
433
|
}),
|
|
422
434
|
});
|