@aztec/pxe 5.0.0-rc.2 → 5.0.1
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/block_synchronizer/block_synchronizer.d.ts +5 -3
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +7 -1
- package/dest/contract/contract_class_service.d.ts +31 -0
- package/dest/contract/contract_class_service.d.ts.map +1 -0
- package/dest/contract/contract_class_service.js +68 -0
- package/dest/{contract_sync → contract}/contract_sync_service.d.ts +7 -6
- package/dest/contract/contract_sync_service.d.ts.map +1 -0
- package/dest/{contract_sync → contract}/contract_sync_service.js +10 -30
- package/dest/contract/helpers.d.ts +7 -0
- package/dest/contract/helpers.d.ts.map +1 -0
- package/dest/contract/helpers.js +20 -0
- package/dest/contract_function_simulator/anchored_contract_data.d.ts +36 -0
- package/dest/contract_function_simulator/anchored_contract_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/anchored_contract_data.js +54 -0
- package/dest/contract_function_simulator/aztec_node_read_cache.d.ts +39 -0
- package/dest/contract_function_simulator/aztec_node_read_cache.d.ts.map +1 -0
- package/dest/contract_function_simulator/aztec_node_read_cache.js +60 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +9 -3
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +31 -14
- package/dest/contract_function_simulator/execution_note_cache.d.ts +3 -9
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +8 -28
- package/dest/contract_function_simulator/index.d.ts +4 -2
- 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/fact.d.ts +5 -5
- package/dest/contract_function_simulator/noir-structs/fact.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/fact.js +2 -2
- package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts +3 -3
- package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/fact_collection.js +3 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +7 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/pending_tagged_log.d.ts +11 -0
- package/dest/contract_function_simulator/noir-structs/pending_tagged_log.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/pending_tagged_log.js +4 -0
- package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts +2 -2
- package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/provided_secret.js +1 -1
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts +8 -1
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.js +17 -0
- package/dest/contract_function_simulator/oracle/acir_callback.d.ts +7 -2
- package/dest/contract_function_simulator/oracle/acir_callback.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/acir_callback.js +55 -11
- package/dest/contract_function_simulator/oracle/legacy_oracle_registry.d.ts +39 -0
- package/dest/contract_function_simulator/oracle/legacy_oracle_registry.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/legacy_oracle_registry.js +107 -0
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +11 -7
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle_registry.js +50 -10
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +48 -9
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.js +51 -30
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +10 -2
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +73 -32
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +23 -16
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +105 -60
- package/dest/debug/pxe_debug_utils.d.ts +2 -2
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.d.ts +2 -1
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +1 -0
- 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 +11 -5
- package/dest/entrypoints/client/lazy/index.d.ts +2 -1
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +1 -0
- 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 +11 -5
- package/dest/entrypoints/client/store.d.ts +14 -0
- package/dest/entrypoints/client/store.d.ts.map +1 -0
- package/dest/entrypoints/client/store.js +28 -0
- package/dest/entrypoints/server/index.d.ts +6 -2
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +4 -1
- package/dest/entrypoints/server/store.d.ts +18 -0
- package/dest/entrypoints/server/store.d.ts.map +1 -0
- package/dest/entrypoints/server/store.js +28 -0
- package/dest/entrypoints/server/utils.d.ts +1 -1
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +8 -2
- package/dest/error_enriching.d.ts +5 -3
- package/dest/error_enriching.d.ts.map +1 -1
- package/dest/error_enriching.js +12 -10
- package/dest/hooks/execution_hooks.d.ts +15 -4
- package/dest/hooks/execution_hooks.d.ts.map +1 -1
- package/dest/hooks/index.d.ts +3 -2
- package/dest/hooks/index.d.ts.map +1 -1
- package/dest/hooks/index.js +1 -0
- package/dest/hooks/resolve_custom_request.d.ts +23 -0
- package/dest/hooks/resolve_custom_request.d.ts.map +1 -0
- package/dest/hooks/resolve_custom_request.js +3 -0
- package/dest/hooks/resolve_tagging_secret_strategy.d.ts +10 -1
- package/dest/hooks/resolve_tagging_secret_strategy.d.ts.map +1 -1
- package/dest/hooks/resolve_tagging_secret_strategy.js +3 -3
- package/dest/logs/log_service.d.ts +5 -3
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +38 -17
- package/dest/notes/note_service.d.ts +1 -1
- package/dest/notes/note_service.js +1 -1
- package/dest/oracle_version.d.ts +2 -2
- package/dest/oracle_version.js +2 -2
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +6 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +17 -36
- package/dest/private_kernel/private_kernel_oracle.d.ts +4 -2
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +17 -5
- package/dest/pxe.d.ts +81 -46
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +138 -104
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts +1 -1
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts.map +1 -1
- package/dest/storage/backwards_compatibility_tests/schema_tests.js +31 -7
- package/dest/storage/contract_store/contract_store.d.ts +27 -24
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
- package/dest/storage/contract_store/contract_store.js +63 -74
- package/dest/storage/fact_store/fact_service.d.ts +6 -4
- package/dest/storage/fact_store/fact_service.d.ts.map +1 -1
- package/dest/storage/fact_store/fact_service.js +19 -4
- package/dest/storage/fact_store/fact_store.d.ts +1 -1
- package/dest/storage/fact_store/fact_store.js +1 -1
- package/dest/storage/fact_store/index.d.ts +2 -1
- package/dest/storage/fact_store/index.d.ts.map +1 -1
- package/dest/storage/fact_store/index.js +1 -0
- package/dest/storage/fact_store/origin_state.d.ts +57 -0
- package/dest/storage/fact_store/origin_state.d.ts.map +1 -0
- package/dest/storage/fact_store/origin_state.js +53 -0
- package/dest/storage/metadata.d.ts +2 -2
- package/dest/storage/metadata.d.ts.map +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/store_identity.d.ts +35 -0
- package/dest/storage/store_identity.d.ts.map +1 -0
- package/dest/storage/store_identity.js +44 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +19 -3
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.js +48 -11
- package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts +17 -6
- package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/tagging_secret_sources_store.js +24 -11
- package/dest/tagging/constants.d.ts +2 -2
- package/dest/tagging/constants.d.ts.map +1 -1
- package/dest/tagging/constants.js +18 -9
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +1 -1
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +1 -1
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +6 -2
- package/package.json +17 -17
- package/src/block_synchronizer/block_synchronizer.ts +9 -1
- package/src/contract/contract_class_service.ts +83 -0
- package/src/{contract_sync → contract}/contract_sync_service.ts +18 -37
- package/src/contract/helpers.ts +35 -0
- package/src/contract_function_simulator/anchored_contract_data.ts +74 -0
- package/src/contract_function_simulator/aztec_node_read_cache.ts +89 -0
- package/src/contract_function_simulator/contract_function_simulator.ts +56 -14
- package/src/contract_function_simulator/execution_note_cache.ts +7 -28
- package/src/contract_function_simulator/index.ts +7 -1
- package/src/contract_function_simulator/noir-structs/fact.ts +4 -4
- package/src/contract_function_simulator/noir-structs/fact_collection.ts +9 -4
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +6 -0
- package/src/contract_function_simulator/noir-structs/pending_tagged_log.ts +12 -0
- package/src/contract_function_simulator/noir-structs/provided_secret.ts +1 -1
- package/src/contract_function_simulator/noir-structs/resolved_tagging_strategy.ts +21 -0
- package/src/contract_function_simulator/oracle/acir_callback.ts +58 -12
- package/src/contract_function_simulator/oracle/legacy_oracle_registry.ts +147 -0
- package/src/contract_function_simulator/oracle/oracle_registry.ts +37 -7
- package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +49 -32
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +92 -41
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +149 -71
- package/src/debug/pxe_debug_utils.ts +1 -1
- package/src/entrypoints/client/bundle/index.ts +1 -0
- package/src/entrypoints/client/bundle/utils.ts +16 -4
- package/src/entrypoints/client/lazy/index.ts +1 -0
- package/src/entrypoints/client/lazy/utils.ts +16 -4
- package/src/entrypoints/client/store.ts +38 -0
- package/src/entrypoints/server/index.ts +6 -1
- package/src/entrypoints/server/store.ts +47 -0
- package/src/entrypoints/server/utils.ts +21 -7
- package/src/error_enriching.ts +26 -10
- package/src/hooks/execution_hooks.ts +14 -3
- package/src/hooks/index.ts +2 -0
- package/src/hooks/resolve_custom_request.ts +24 -0
- package/src/hooks/resolve_tagging_secret_strategy.ts +14 -0
- package/src/logs/log_service.ts +35 -11
- package/src/notes/note_service.ts +1 -1
- package/src/oracle_version.ts +2 -2
- package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +11 -1
- package/src/private_kernel/private_kernel_execution_prover.ts +22 -52
- package/src/private_kernel/private_kernel_oracle.ts +23 -4
- package/src/pxe.ts +212 -143
- package/src/storage/backwards_compatibility_tests/__snapshots__/AddressStore.json +6 -6
- package/src/storage/backwards_compatibility_tests/__snapshots__/ContractStore.json +1 -1
- package/src/storage/backwards_compatibility_tests/__snapshots__/KeyStore.json +12 -12
- package/src/storage/backwards_compatibility_tests/__snapshots__/RecipientTaggingStore.json +11 -3
- package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +12 -4
- package/src/storage/backwards_compatibility_tests/__snapshots__/TaggingSecretSourcesStore.json +3 -3
- package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +1 -1
- package/src/storage/backwards_compatibility_tests/schema_tests.ts +38 -4
- package/src/storage/contract_store/contract_store.ts +85 -92
- package/src/storage/fact_store/fact_service.ts +29 -5
- package/src/storage/fact_store/fact_store.ts +1 -1
- package/src/storage/fact_store/index.ts +10 -0
- package/src/storage/fact_store/origin_state.ts +75 -0
- package/src/storage/metadata.ts +1 -1
- package/src/storage/store_identity.ts +72 -0
- package/src/storage/tagging_store/sender_tagging_store.ts +62 -15
- package/src/storage/tagging_store/tagging_secret_sources_store.ts +36 -15
- package/src/tagging/constants.ts +19 -9
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +1 -1
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +6 -2
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +0 -6
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +0 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.js +0 -51
- package/dest/contract_sync/contract_sync_service.d.ts.map +0 -1
- package/dest/contract_sync/helpers.d.ts +0 -28
- package/dest/contract_sync/helpers.d.ts.map +0 -1
- package/dest/contract_sync/helpers.js +0 -48
- package/src/contract_function_simulator/proxied_contract_data_source.ts +0 -60
- package/src/contract_sync/helpers.ts +0 -79
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
+
import { type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
3
|
+
import { type AztecLMDBStoreV2, openStoreAt } from '@aztec/kv-store/lmdb-v2';
|
|
4
|
+
|
|
5
|
+
import { mkdir } from 'fs/promises';
|
|
6
|
+
import { join } from 'path';
|
|
7
|
+
|
|
8
|
+
import { storeIdentitySlug } from '../../storage/store_identity.js';
|
|
9
|
+
|
|
10
|
+
/** Location and identity inputs for opening an identity-partitioned PXE-side store. */
|
|
11
|
+
export type IdentityStoreConfig = {
|
|
12
|
+
dataDirectory: string;
|
|
13
|
+
/** Maximum LMDB map size in KB. When omitted, the kv-store default map size applies. */
|
|
14
|
+
dataStoreMapSizeKb?: number;
|
|
15
|
+
l1ChainId: number;
|
|
16
|
+
rollupAddress: EthAddress;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Opens the persistent LMDB store selected by `name` and identity triple `(l1ChainId, rollupAddress, schemaVersion)`.
|
|
21
|
+
* A store exists per identity: reopening with the same identity returns the same data, a different identity selects
|
|
22
|
+
* a different (possibly fresh) store. Callers wanting an ephemeral store use `openTmpStore` explicitly instead.
|
|
23
|
+
*/
|
|
24
|
+
export async function openStore(
|
|
25
|
+
name: string,
|
|
26
|
+
schemaVersion: number,
|
|
27
|
+
config: IdentityStoreConfig,
|
|
28
|
+
bindings?: LoggerBindings,
|
|
29
|
+
): Promise<AztecLMDBStoreV2> {
|
|
30
|
+
// Stores live under `<dataDirectory>/<name>-stores/<l1ChainId>-<rollupAddress>-v<schemaVersion>`, a sibling of the
|
|
31
|
+
// legacy `<dataDirectory>/<name>` directory: older binaries reset the legacy directory on a rollup mismatch, so
|
|
32
|
+
// per-identity stores must not nest inside it.
|
|
33
|
+
const subDir = join(
|
|
34
|
+
config.dataDirectory,
|
|
35
|
+
`${name}-stores`,
|
|
36
|
+
storeIdentitySlug({ l1ChainId: config.l1ChainId, rollupAddress: config.rollupAddress, schemaVersion }),
|
|
37
|
+
);
|
|
38
|
+
await mkdir(subDir, { recursive: true });
|
|
39
|
+
|
|
40
|
+
createLogger(`pxe:data:${name}`, bindings).info(`Opening ${name} data store (LMDB v2)`, {
|
|
41
|
+
storeName: name,
|
|
42
|
+
subDir,
|
|
43
|
+
dataStoreMapSizeKb: config.dataStoreMapSizeKb,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
return openStoreAt(subDir, config.dataStoreMapSizeKb, undefined, bindings);
|
|
47
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BBBundlePrivateKernelProver } from '@aztec/bb-prover/client/bundle';
|
|
2
2
|
import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
|
|
3
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
|
-
import {
|
|
4
|
+
import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
|
|
5
5
|
import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
|
|
6
6
|
import { WASMSimulator } from '@aztec/simulator/client';
|
|
7
7
|
import { MemoryCircuitRecorder, SimulatorRecorderWrapper } from '@aztec/simulator/server';
|
|
@@ -15,6 +15,7 @@ import type { PXEConfig } from '../../config/index.js';
|
|
|
15
15
|
import { PXE } from '../../pxe.js';
|
|
16
16
|
import { PXE_DATA_SCHEMA_VERSION } from '../../storage/index.js';
|
|
17
17
|
import { type PXECreationOptions, isPrivateKernelProver } from '../pxe_creation_options.js';
|
|
18
|
+
import { openStore } from './store.js';
|
|
18
19
|
|
|
19
20
|
type PXEConfigWithoutDefaults = Omit<
|
|
20
21
|
PXEConfig,
|
|
@@ -46,12 +47,25 @@ export async function createPXE(
|
|
|
46
47
|
|
|
47
48
|
if (!options.store) {
|
|
48
49
|
const storeLogger = loggers.store ?? createLogger('pxe:data:lmdb', { actor });
|
|
49
|
-
options.store =
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
options.store = configWithContracts.dataDirectory
|
|
51
|
+
? await openStore(
|
|
52
|
+
'pxe_data',
|
|
53
|
+
PXE_DATA_SCHEMA_VERSION,
|
|
54
|
+
{
|
|
55
|
+
dataDirectory: configWithContracts.dataDirectory,
|
|
56
|
+
dataStoreMapSizeKb: configWithContracts.dataStoreMapSizeKb,
|
|
57
|
+
l1ChainId,
|
|
58
|
+
rollupAddress: l1ContractAddresses.rollupAddress,
|
|
59
|
+
},
|
|
60
|
+
storeLogger.getBindings(),
|
|
61
|
+
)
|
|
62
|
+
: await openTmpStore(
|
|
63
|
+
'pxe_data',
|
|
64
|
+
true,
|
|
65
|
+
configWithContracts.dataStoreMapSizeKb,
|
|
66
|
+
undefined,
|
|
67
|
+
storeLogger.getBindings(),
|
|
68
|
+
);
|
|
55
69
|
}
|
|
56
70
|
const proverLogger = loggers.prover ?? createLogger('pxe:bb:native', { actor });
|
|
57
71
|
|
package/src/error_enriching.ts
CHANGED
|
@@ -3,7 +3,9 @@ import { resolveAssertionMessageFromRevertData, resolveOpcodeLocations } from '@
|
|
|
3
3
|
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
|
+
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
6
7
|
|
|
8
|
+
import type { ContractClassService } from './contract/contract_class_service.js';
|
|
7
9
|
import type { ContractStore } from './storage/contract_store/contract_store.js';
|
|
8
10
|
|
|
9
11
|
/**
|
|
@@ -11,7 +13,13 @@ import type { ContractStore } from './storage/contract_store/contract_store.js';
|
|
|
11
13
|
* can be found in the PXE database
|
|
12
14
|
* @param err - The error to enrich.
|
|
13
15
|
*/
|
|
14
|
-
export async function enrichSimulationError(
|
|
16
|
+
export async function enrichSimulationError(
|
|
17
|
+
err: SimulationError,
|
|
18
|
+
contractStore: ContractStore,
|
|
19
|
+
contractClassService: ContractClassService,
|
|
20
|
+
anchorHeader: BlockHeader,
|
|
21
|
+
logger: Logger,
|
|
22
|
+
) {
|
|
15
23
|
// Maps contract addresses to the set of function selectors that were in error.
|
|
16
24
|
// Map and Set do reference equality for their keys instead of value equality, so we store the string
|
|
17
25
|
// representation to get e.g. different contract address objects with the same address value to match.
|
|
@@ -30,13 +38,14 @@ export async function enrichSimulationError(err: SimulationError, contractStore:
|
|
|
30
38
|
await Promise.all(
|
|
31
39
|
[...mentionedFunctions.entries()].map(async ([contractAddress, fnSelectors]) => {
|
|
32
40
|
const parsedContractAddress = AztecAddress.fromStringUnsafe(contractAddress);
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
41
|
+
const classId = await contractClassService.getCurrentClassId(parsedContractAddress, anchorHeader);
|
|
42
|
+
const artifact = classId && (await contractStore.getContractArtifact(classId));
|
|
43
|
+
if (artifact) {
|
|
44
|
+
err.enrichWithContractName(parsedContractAddress, artifact.name);
|
|
36
45
|
// Map from function selector to function name. It uses a stringified key for the same reason as mentionedFunctions.
|
|
37
46
|
const selectorToNameMap: Map<string, string> = new Map();
|
|
38
47
|
await Promise.all(
|
|
39
|
-
|
|
48
|
+
artifact.functions.map(async fn => {
|
|
40
49
|
const selector = await FunctionSelector.fromNameAndParameters(fn);
|
|
41
50
|
selectorToNameMap.set(selector.toString(), fn.name);
|
|
42
51
|
}),
|
|
@@ -51,7 +60,7 @@ export async function enrichSimulationError(err: SimulationError, contractStore:
|
|
|
51
60
|
);
|
|
52
61
|
} else {
|
|
53
62
|
logger.warn(
|
|
54
|
-
`Could not find function artifact in contract ${
|
|
63
|
+
`Could not find function artifact in contract ${artifact.name} for function '${fnSelector}' when enriching error callstack`,
|
|
55
64
|
);
|
|
56
65
|
}
|
|
57
66
|
}
|
|
@@ -64,7 +73,13 @@ export async function enrichSimulationError(err: SimulationError, contractStore:
|
|
|
64
73
|
);
|
|
65
74
|
}
|
|
66
75
|
|
|
67
|
-
export async function enrichPublicSimulationError(
|
|
76
|
+
export async function enrichPublicSimulationError(
|
|
77
|
+
err: SimulationError,
|
|
78
|
+
contractStore: ContractStore,
|
|
79
|
+
contractClassService: ContractClassService,
|
|
80
|
+
anchorHeader: BlockHeader,
|
|
81
|
+
logger: Logger,
|
|
82
|
+
) {
|
|
68
83
|
const callStack = err.getCallStack();
|
|
69
84
|
const originalFailingFunction = callStack[callStack.length - 1];
|
|
70
85
|
|
|
@@ -72,7 +87,8 @@ export async function enrichPublicSimulationError(err: SimulationError, contract
|
|
|
72
87
|
throw new Error(`Original failing function not found when enriching public simulation, missing callstack`);
|
|
73
88
|
}
|
|
74
89
|
|
|
75
|
-
const
|
|
90
|
+
const classId = await contractClassService.getCurrentClassId(originalFailingFunction.contractAddress, anchorHeader);
|
|
91
|
+
const artifact = classId && (await contractStore.getPublicFunctionArtifact(classId));
|
|
76
92
|
if (!artifact) {
|
|
77
93
|
throw new Error(
|
|
78
94
|
`Artifact not found when enriching public simulation error. Contract address: ${originalFailingFunction.contractAddress}.`,
|
|
@@ -84,7 +100,7 @@ export async function enrichPublicSimulationError(err: SimulationError, contract
|
|
|
84
100
|
err.setOriginalMessage(err.getOriginalMessage() + `${assertionMessage}`);
|
|
85
101
|
}
|
|
86
102
|
|
|
87
|
-
const debugInfo = await contractStore.getPublicFunctionDebugMetadata(
|
|
103
|
+
const debugInfo = await contractStore.getPublicFunctionDebugMetadata(classId);
|
|
88
104
|
|
|
89
105
|
const noirCallStack = err.getNoirCallStack();
|
|
90
106
|
if (debugInfo) {
|
|
@@ -102,6 +118,6 @@ export async function enrichPublicSimulationError(err: SimulationError, contract
|
|
|
102
118
|
);
|
|
103
119
|
}
|
|
104
120
|
}
|
|
105
|
-
await enrichSimulationError(err, contractStore, logger);
|
|
121
|
+
await enrichSimulationError(err, contractStore, contractClassService, anchorHeader, logger);
|
|
106
122
|
}
|
|
107
123
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AuthorizeUtilityCall } from './authorize_utility_call.js';
|
|
2
|
+
import type { ResolveCustomRequest } from './resolve_custom_request.js';
|
|
2
3
|
import type { ResolveTaggingSecretStrategy } from './resolve_tagging_secret_strategy.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -28,8 +29,12 @@ import type { ResolveTaggingSecretStrategy } from './resolve_tagging_secret_stra
|
|
|
28
29
|
* ? { authorized: true }
|
|
29
30
|
* : { authorized: false, reason: 'Unknown target' };
|
|
30
31
|
* },
|
|
31
|
-
* //
|
|
32
|
-
*
|
|
32
|
+
* // Apply per-recipient policy: reach a known contact via their address keys (no onchain trace) and use a
|
|
33
|
+
* // non-interactive handshake for everyone else.
|
|
34
|
+
* resolveTaggingSecretStrategy: async ({ recipient }) =>
|
|
35
|
+
* knownContacts.has(recipient.toString())
|
|
36
|
+
* ? { type: 'address-derived' }
|
|
37
|
+
* : { type: 'non-interactive-handshake' },
|
|
33
38
|
* },
|
|
34
39
|
* });
|
|
35
40
|
* ```
|
|
@@ -39,10 +44,16 @@ export interface ExecutionHooks {
|
|
|
39
44
|
authorizeUtilityCall?: AuthorizeUtilityCall;
|
|
40
45
|
/**
|
|
41
46
|
* Resolves a message's tagging secret when none is already established for the sender/recipient pair, letting the
|
|
42
|
-
* wallet apply per-recipient policy. PXE applies a
|
|
47
|
+
* wallet apply per-recipient policy. PXE applies a default when absent.
|
|
43
48
|
* See {@link ResolveTaggingSecretStrategy} for the request shape and defaults.
|
|
44
49
|
*/
|
|
45
50
|
resolveTaggingSecretStrategy?: ResolveTaggingSecretStrategy;
|
|
51
|
+
/**
|
|
52
|
+
* Resolves a custom, caller-defined request a circuit cannot serve from local state. Any contract can issue one, so
|
|
53
|
+
* an implementor should verify both the request `kind` and the issuing contract (its address and class ID) before
|
|
54
|
+
* fulfilling it. Rejected when absent; see {@link ResolveCustomRequest}.
|
|
55
|
+
*/
|
|
56
|
+
resolveCustomRequest?: ResolveCustomRequest;
|
|
46
57
|
}
|
|
47
58
|
|
|
48
59
|
/**
|
package/src/hooks/index.ts
CHANGED
|
@@ -4,7 +4,9 @@ export type {
|
|
|
4
4
|
UtilityCallAuthorizationResponse,
|
|
5
5
|
} from './authorize_utility_call.js';
|
|
6
6
|
export { type ExecutionHooks, composeHooks } from './execution_hooks.js';
|
|
7
|
+
export { type CustomRequest, type ResolveCustomRequest } from './resolve_custom_request.js';
|
|
7
8
|
export {
|
|
9
|
+
DEFAULT_TAGGING_SECRET_STRATEGY,
|
|
8
10
|
type ResolveTaggingSecretStrategy,
|
|
9
11
|
type TaggingSecretStrategy,
|
|
10
12
|
type TaggingSecretStrategyRequest,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A custom, caller-defined request resolved via the {@link ResolveCustomRequest} hook. It carries no fixed meaning:
|
|
6
|
+
* `kind` selects the request type so one hook can serve many such types, and `payload` holds the opaque,
|
|
7
|
+
* request-specific arguments. The resolver answers by whatever means it needs (local state, a third party,
|
|
8
|
+
* offchain data).
|
|
9
|
+
*/
|
|
10
|
+
export type CustomRequest = {
|
|
11
|
+
/** The address of the contract issuing the request. */
|
|
12
|
+
contractAddress: AztecAddress;
|
|
13
|
+
/** The issuing contract's class ID, so resolvers can apply class-level (not just per-address) policy. */
|
|
14
|
+
contractClassId: Fr;
|
|
15
|
+
/** Discriminates the request type, letting one hook serve many such types. */
|
|
16
|
+
kind: Fr;
|
|
17
|
+
/** Opaque, request-specific arguments. */
|
|
18
|
+
payload: Fr[];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Hook resolving a {@link CustomRequest}. The resolver produces the response however it needs to.
|
|
23
|
+
*/
|
|
24
|
+
export type ResolveCustomRequest = (request: CustomRequest) => Promise<Fr[]>;
|
|
@@ -3,6 +3,9 @@ import type { Point } from '@aztec/foundation/curves/grumpkin';
|
|
|
3
3
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import type { AppTaggingSecretKind } from '@aztec/stdlib/logs';
|
|
5
5
|
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- only referenced by a {@link} doc tag
|
|
7
|
+
import type { ResolveCustomRequest } from './resolve_custom_request.js';
|
|
8
|
+
|
|
6
9
|
/**
|
|
7
10
|
* How a message's tagging secret is chosen: the wallet's strategy, returned by the `resolveTaggingSecretStrategy` hook
|
|
8
11
|
* when no onchain handshake has been registered for the sender/recipient pair. This is intent (plus, for an arbitrary
|
|
@@ -13,6 +16,14 @@ export type TaggingSecretStrategy =
|
|
|
13
16
|
/** Establish a fresh non-interactive handshake via the onchain registry; reveals the recipient onchain. */
|
|
14
17
|
type: 'non-interactive-handshake';
|
|
15
18
|
}
|
|
19
|
+
| {
|
|
20
|
+
/**
|
|
21
|
+
* Establish a fresh interactive handshake via the onchain registry. Reveals nothing about the recipient
|
|
22
|
+
* onchain, but requires the recipient to answer the registry's signed-authorization request (served through
|
|
23
|
+
* the {@link ResolveCustomRequest} hook), so the send fails when it cannot be served.
|
|
24
|
+
*/
|
|
25
|
+
type: 'interactive-handshake';
|
|
26
|
+
}
|
|
16
27
|
| {
|
|
17
28
|
/** Derive the secret from the sender's and recipient's address keys via ECDH. PXE computes and silos it. */
|
|
18
29
|
type: 'address-derived';
|
|
@@ -28,6 +39,9 @@ export type TaggingSecretStrategy =
|
|
|
28
39
|
secret: Point;
|
|
29
40
|
};
|
|
30
41
|
|
|
42
|
+
/** The strategy PXE applies to both delivery modes when no `resolveTaggingSecretStrategy` hook is configured. */
|
|
43
|
+
export const DEFAULT_TAGGING_SECRET_STRATEGY: TaggingSecretStrategy = { type: 'non-interactive-handshake' };
|
|
44
|
+
|
|
31
45
|
/** Information about the message delivery requesting a tagging secret strategy. */
|
|
32
46
|
export type TaggingSecretStrategyRequest = {
|
|
33
47
|
contractAddress: AztecAddress;
|
package/src/logs/log_service.ts
CHANGED
|
@@ -9,8 +9,8 @@ import type { CompleteAddress } from '@aztec/stdlib/contract';
|
|
|
9
9
|
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
10
10
|
import {
|
|
11
11
|
AppTaggingSecret,
|
|
12
|
+
AppTaggingSecretKind,
|
|
12
13
|
type LogResult,
|
|
13
|
-
type PendingTaggedLog,
|
|
14
14
|
SiloedTag,
|
|
15
15
|
computeSharedTaggingSecret,
|
|
16
16
|
} from '@aztec/stdlib/logs';
|
|
@@ -21,7 +21,10 @@ import {
|
|
|
21
21
|
LogSource,
|
|
22
22
|
} from '../contract_function_simulator/noir-structs/log_retrieval_request.js';
|
|
23
23
|
import type { LogRetrievalResponse } from '../contract_function_simulator/noir-structs/log_retrieval_response.js';
|
|
24
|
+
import type { PendingTaggedLog } from '../contract_function_simulator/noir-structs/pending_tagged_log.js';
|
|
25
|
+
import { ResolvedTx } from '../contract_function_simulator/noir-structs/resolved_tx.js';
|
|
24
26
|
import { AddressStore } from '../storage/address_store/address_store.js';
|
|
27
|
+
import { assertAllowedScope } from '../storage/allowed_scopes.js';
|
|
25
28
|
import type { RecipientTaggingStore } from '../storage/tagging_store/recipient_tagging_store.js';
|
|
26
29
|
import type { TaggingSecretSourcesStore } from '../storage/tagging_store/tagging_secret_sources_store.js';
|
|
27
30
|
import {
|
|
@@ -45,6 +48,7 @@ export class LogService {
|
|
|
45
48
|
private readonly recipientTaggingStore: RecipientTaggingStore,
|
|
46
49
|
private readonly taggingSecretSourcesStore: TaggingSecretSourcesStore,
|
|
47
50
|
private readonly addressStore: AddressStore,
|
|
51
|
+
private readonly scopes: AztecAddress[],
|
|
48
52
|
private readonly jobId: string,
|
|
49
53
|
bindings?: LoggerBindings,
|
|
50
54
|
) {
|
|
@@ -176,6 +180,9 @@ export class LogService {
|
|
|
176
180
|
txHash: log.txHash,
|
|
177
181
|
uniqueNoteHashesInTx: noteHashes,
|
|
178
182
|
firstNullifierInTx: nullifiers[0],
|
|
183
|
+
blockNumber: log.blockNumber,
|
|
184
|
+
blockTimestamp: log.blockTimestamp,
|
|
185
|
+
blockHash: log.blockHash,
|
|
179
186
|
};
|
|
180
187
|
}
|
|
181
188
|
|
|
@@ -184,6 +191,8 @@ export class LogService {
|
|
|
184
191
|
recipient: AztecAddress,
|
|
185
192
|
providedSecrets: AppTaggingSecret[],
|
|
186
193
|
): Promise<PendingTaggedLog[]> {
|
|
194
|
+
assertAllowedScope(recipient, this.scopes);
|
|
195
|
+
|
|
187
196
|
this.log.verbose(
|
|
188
197
|
`Fetching tagged logs for contract ${contractAddress.toString()} and recipient ${recipient.toString()}`,
|
|
189
198
|
);
|
|
@@ -216,17 +225,17 @@ export class LogService {
|
|
|
216
225
|
}
|
|
217
226
|
return {
|
|
218
227
|
log: log.logData,
|
|
219
|
-
context:
|
|
228
|
+
context: new ResolvedTx(log.txHash, noteHashes, nullifiers[0], log.blockNumber, log.blockHash.toFr()),
|
|
220
229
|
};
|
|
221
230
|
});
|
|
222
231
|
}
|
|
223
232
|
|
|
224
233
|
/**
|
|
225
234
|
* Computes the tagging secrets PXE can enumerate for a recipient: one per known sender (via ECDH) plus any
|
|
226
|
-
* pre-shared
|
|
227
|
-
*
|
|
228
|
-
* are unavailable. App-supplied secrets (e.g.
|
|
229
|
-
* through here.
|
|
235
|
+
* pre-shared secrets registered directly for the recipient. Each registered secret is scanned under the tag
|
|
236
|
+
* streams its kind can back. Deriving the sender-based secrets requires the recipient's address preimage and keys,
|
|
237
|
+
* so returns an empty array when those are unavailable. App-supplied secrets (e.g. derived from discovered
|
|
238
|
+
* handshakes) are handled separately by the caller and do not go through here.
|
|
230
239
|
*/
|
|
231
240
|
async #getPointDerivedSecrets(contractAddress: AztecAddress, recipient: AztecAddress): Promise<AppTaggingSecret[]> {
|
|
232
241
|
const recipientCompleteAddress = await this.addressStore.getCompleteAddress(recipient);
|
|
@@ -238,11 +247,26 @@ export class LogService {
|
|
|
238
247
|
}
|
|
239
248
|
const recipientIvsk = await this.keyStore.getMasterIncomingViewingSecretKey(recipient);
|
|
240
249
|
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
];
|
|
245
|
-
return Promise.all(
|
|
250
|
+
const [senderPoints, registeredSecrets] = await Promise.all([
|
|
251
|
+
this.#getSecretsForSenders(recipientCompleteAddress, recipientIvsk),
|
|
252
|
+
this.taggingSecretSourcesStore.getSharedSecretsForRecipient(recipient),
|
|
253
|
+
]);
|
|
254
|
+
return Promise.all([
|
|
255
|
+
...senderPoints.map(secret => AppTaggingSecret.computeDirectional(secret, contractAddress, recipient)),
|
|
256
|
+
...registeredSecrets.flatMap(({ kind, secret }) => {
|
|
257
|
+
switch (kind) {
|
|
258
|
+
case 'arbitrary-secret':
|
|
259
|
+
return [AppTaggingSecret.computeDirectional(secret, contractAddress, recipient)];
|
|
260
|
+
case 'handshake':
|
|
261
|
+
// A handshake-backed sender tags messages with the bare app-siloed secret, one tag domain per delivery
|
|
262
|
+
// mode.
|
|
263
|
+
return [
|
|
264
|
+
AppTaggingSecret.computeAppSiloed(secret, contractAddress, AppTaggingSecretKind.UNCONSTRAINED),
|
|
265
|
+
AppTaggingSecret.computeAppSiloed(secret, contractAddress, AppTaggingSecretKind.CONSTRAINED),
|
|
266
|
+
];
|
|
267
|
+
}
|
|
268
|
+
}),
|
|
269
|
+
]);
|
|
246
270
|
}
|
|
247
271
|
|
|
248
272
|
async #getSecretsForSenders(
|
|
@@ -26,7 +26,7 @@ export class NoteService {
|
|
|
26
26
|
*
|
|
27
27
|
* @param owner - The owner of the notes. If undefined, returns notes for all known owners.
|
|
28
28
|
* @param status - The status of notes to fetch.
|
|
29
|
-
* @param scopes - The accounts whose notes we can access in this call.
|
|
29
|
+
* @param scopes - The accounts whose notes we can access in this call. An empty list matches no notes.
|
|
30
30
|
*/
|
|
31
31
|
public async getNotes(
|
|
32
32
|
contractAddress: AztecAddress,
|
package/src/oracle_version.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
/// if AZTEC_NR_MINOR > PXE_MINOR because if a contract is updated to use a newer Aztec.nr dependency without actually
|
|
12
12
|
/// using any of the new oracles then there is no reason to throw.
|
|
13
13
|
export const ORACLE_VERSION_MAJOR = 30;
|
|
14
|
-
export const ORACLE_VERSION_MINOR =
|
|
14
|
+
export const ORACLE_VERSION_MINOR = 8;
|
|
15
15
|
|
|
16
16
|
/// This hash is computed from the `ORACLE_REGISTRY` declaration (each oracle's name, ordered parameter names and
|
|
17
17
|
/// types, and return type) and is used to detect when the oracle interface changes. When it does, you need to either:
|
|
@@ -19,4 +19,4 @@ export const ORACLE_VERSION_MINOR = 1;
|
|
|
19
19
|
/// - increment only `ORACLE_VERSION_MINOR` if the change is additive (a new oracle was added).
|
|
20
20
|
///
|
|
21
21
|
/// These constants must be kept in sync between this file and `noir-projects/aztec-nr/aztec/src/oracle/version.nr`.
|
|
22
|
-
export const ORACLE_INTERFACE_HASH = '
|
|
22
|
+
export const ORACLE_INTERFACE_HASH = 'b302a8e65d37043c0a0dc08a39895603122dce334843f0442462edb3f56e32e2';
|
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
findPrivateKernelResetDimensions,
|
|
36
36
|
getNoteHashReadRequestResetActions,
|
|
37
37
|
getNullifierReadRequestResetActions,
|
|
38
|
+
kernelStateIsForPublic,
|
|
38
39
|
privateKernelResetDimensionNames,
|
|
39
40
|
} from '@aztec/stdlib/kernel';
|
|
40
41
|
import { type PrivateCallExecutionResult, collectNested } from '@aztec/stdlib/tx';
|
|
@@ -138,10 +139,19 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
138
139
|
// The dimensions found must be big enough to reset all values, i.e. empty remainder.
|
|
139
140
|
const allowRemainder = isInner;
|
|
140
141
|
|
|
142
|
+
// Terminal reset picks from the finalTail / finalTailToPublic catalogs; mid-tx resets always
|
|
143
|
+
// use the inner catalog. The public/private decision must match `kernelStateIsForPublic` - the
|
|
144
|
+
// same predicate the circuit inputs and the orchestrator use.
|
|
145
|
+
const mode = isInner
|
|
146
|
+
? ('inner' as const)
|
|
147
|
+
: kernelStateIsForPublic(this.previousKernel)
|
|
148
|
+
? ('finalTailToPublic' as const)
|
|
149
|
+
: ('finalTail' as const);
|
|
150
|
+
|
|
141
151
|
const dimensions = findPrivateKernelResetDimensions(
|
|
142
152
|
this.requestedDimensions,
|
|
143
153
|
privateKernelResetDimensionsConfig,
|
|
144
|
-
|
|
154
|
+
mode,
|
|
145
155
|
allowRemainder,
|
|
146
156
|
);
|
|
147
157
|
|
|
@@ -24,8 +24,8 @@ import {
|
|
|
24
24
|
PrivateKernelInner2CircuitPrivateInputs,
|
|
25
25
|
PrivateKernelInner3CircuitPrivateInputs,
|
|
26
26
|
PrivateKernelInnerCircuitPrivateInputs,
|
|
27
|
+
PrivateKernelResetTailCircuitPrivateInputs,
|
|
27
28
|
type PrivateKernelSimulateOutput,
|
|
28
|
-
PrivateKernelTailCircuitPrivateInputs,
|
|
29
29
|
type PrivateKernelTailCircuitPublicInputs,
|
|
30
30
|
PrivateVerificationKeyHints,
|
|
31
31
|
type UpdatedClassIdHints,
|
|
@@ -170,7 +170,6 @@ export class PrivateKernelExecutionProver {
|
|
|
170
170
|
previousOutput: output,
|
|
171
171
|
txRequest,
|
|
172
172
|
isPrivateOnlyTx,
|
|
173
|
-
firstNullifierHint: executionResult.firstNullifier,
|
|
174
173
|
minRevertibleSideEffectCounter,
|
|
175
174
|
executionSteps,
|
|
176
175
|
generateWitnesses,
|
|
@@ -179,7 +178,8 @@ export class PrivateKernelExecutionProver {
|
|
|
179
178
|
firstIteration = false;
|
|
180
179
|
}
|
|
181
180
|
|
|
182
|
-
//
|
|
181
|
+
// Terminal reset+tail. The final reset must be performed exactly once because each tx has at
|
|
182
|
+
// least one nullifier that requires siloing, and siloing cannot be done multiple times.
|
|
183
183
|
const finalResetBuilder = new PrivateKernelResetPrivateInputsBuilder(
|
|
184
184
|
output,
|
|
185
185
|
[],
|
|
@@ -187,29 +187,9 @@ export class PrivateKernelExecutionProver {
|
|
|
187
187
|
splitCounter,
|
|
188
188
|
);
|
|
189
189
|
if (!finalResetBuilder.needsReset()) {
|
|
190
|
-
//
|
|
191
|
-
// siloing, and siloing cannot be done multiple times.
|
|
192
|
-
// While, in theory, it might be possible to silo note hashes first and then run another reset to silo nullifiers
|
|
193
|
-
// and/or private logs, we currently don't have standalone dimensions for the arrays that require siloing. As a
|
|
194
|
-
// result, all necessary siloing must be done together in a single reset.
|
|
190
|
+
// Siloing for note hashes, nullifiers, and private logs is dimensioned as one terminal reset.
|
|
195
191
|
// Refer to the possible combinations of dimensions in private_kernel_reset_config.json.
|
|
196
192
|
throw new Error('Nothing to reset for the final reset.');
|
|
197
|
-
} else {
|
|
198
|
-
const witgenTimer = new Timer();
|
|
199
|
-
const privateInputs = await finalResetBuilder.build(this.oracle);
|
|
200
|
-
output = generateWitnesses
|
|
201
|
-
? await this.proofCreator.generateResetOutput(privateInputs)
|
|
202
|
-
: await this.proofCreator.simulateReset(privateInputs);
|
|
203
|
-
|
|
204
|
-
executionSteps.push({
|
|
205
|
-
functionName: 'private_kernel_reset',
|
|
206
|
-
bytecode: output.bytecode,
|
|
207
|
-
witness: output.outputWitness,
|
|
208
|
-
vk: output.verificationKey.keyAsBytes,
|
|
209
|
-
timings: {
|
|
210
|
-
witgen: witgenTimer.ms(),
|
|
211
|
-
},
|
|
212
|
-
});
|
|
213
193
|
}
|
|
214
194
|
|
|
215
195
|
if (output.publicInputs.feePayer.isZero() && skipFeeEnforcement) {
|
|
@@ -218,34 +198,35 @@ export class PrivateKernelExecutionProver {
|
|
|
218
198
|
}
|
|
219
199
|
output.publicInputs.feePayer = new AztecAddress(Fr.MAX_FIELD_VALUE);
|
|
220
200
|
}
|
|
221
|
-
// Private tail.
|
|
222
|
-
const vkData = await this.getVkData(output.verificationKey);
|
|
223
|
-
const previousKernelData = new PrivateKernelData(output.publicInputs, vkData);
|
|
224
|
-
|
|
225
|
-
this.log.debug(
|
|
226
|
-
`Calling private kernel tail with hwm ${previousKernelData.publicInputs.minRevertibleSideEffectCounter}`,
|
|
227
|
-
);
|
|
228
201
|
|
|
229
202
|
// TODO: Enable padding once we better understand the final amounts to pad to.
|
|
230
203
|
const paddedSideEffectAmounts = PaddedSideEffectAmounts.empty();
|
|
231
204
|
|
|
232
205
|
// Round the aggregated expirationTimestamp down to reduce precision and avoid leaking which private
|
|
233
206
|
// functions were called via their exact expiration offsets.
|
|
234
|
-
const expirationTimestampUpperBound = computeTxExpirationTimestamp(
|
|
235
|
-
|
|
236
|
-
const
|
|
237
|
-
|
|
207
|
+
const expirationTimestampUpperBound = computeTxExpirationTimestamp(output.publicInputs);
|
|
208
|
+
|
|
209
|
+
const resetInputs = await finalResetBuilder.build(this.oracle);
|
|
210
|
+
const mergedInputs = new PrivateKernelResetTailCircuitPrivateInputs(
|
|
211
|
+
resetInputs.previousKernel,
|
|
212
|
+
resetInputs.paddedSideEffects,
|
|
213
|
+
resetInputs.hints,
|
|
214
|
+
resetInputs.dimensions,
|
|
238
215
|
paddedSideEffectAmounts,
|
|
239
216
|
expirationTimestampUpperBound,
|
|
240
217
|
);
|
|
241
218
|
|
|
219
|
+
this.log.debug(
|
|
220
|
+
`Calling terminal private kernel reset+tail (${mergedInputs.isForPublic() ? 'to-public' : 'to-rollup'}) with hwm ${output.publicInputs.minRevertibleSideEffectCounter}`,
|
|
221
|
+
);
|
|
222
|
+
|
|
242
223
|
const witgenTimer = new Timer();
|
|
243
224
|
const tailOutput = generateWitnesses
|
|
244
|
-
? await this.proofCreator.
|
|
245
|
-
: await this.proofCreator.
|
|
225
|
+
? await this.proofCreator.generateResetTailOutput(mergedInputs)
|
|
226
|
+
: await this.proofCreator.simulateResetTail(mergedInputs);
|
|
246
227
|
|
|
247
228
|
executionSteps.push({
|
|
248
|
-
functionName: '
|
|
229
|
+
functionName: mergedInputs.isForPublic() ? 'private_kernel_reset_tail_to_public' : 'private_kernel_reset_tail',
|
|
249
230
|
bytecode: tailOutput.bytecode,
|
|
250
231
|
witness: tailOutput.outputWitness,
|
|
251
232
|
vk: tailOutput.verificationKey.keyAsBytes,
|
|
@@ -457,7 +438,6 @@ export class PrivateKernelExecutionProver {
|
|
|
457
438
|
previousOutput: PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>;
|
|
458
439
|
txRequest: TxRequest;
|
|
459
440
|
isPrivateOnlyTx: boolean;
|
|
460
|
-
firstNullifierHint: Fr;
|
|
461
441
|
minRevertibleSideEffectCounter: number;
|
|
462
442
|
executionSteps: PrivateExecutionStep[];
|
|
463
443
|
generateWitnesses: boolean;
|
|
@@ -468,7 +448,6 @@ export class PrivateKernelExecutionProver {
|
|
|
468
448
|
previousOutput,
|
|
469
449
|
txRequest,
|
|
470
450
|
isPrivateOnlyTx,
|
|
471
|
-
firstNullifierHint,
|
|
472
451
|
minRevertibleSideEffectCounter,
|
|
473
452
|
executionSteps,
|
|
474
453
|
generateWitnesses,
|
|
@@ -488,12 +467,9 @@ export class PrivateKernelExecutionProver {
|
|
|
488
467
|
ProtocolContractsList,
|
|
489
468
|
apps[0],
|
|
490
469
|
isPrivateOnlyTx,
|
|
491
|
-
firstNullifierHint,
|
|
492
470
|
minRevertibleSideEffectCounter,
|
|
493
471
|
);
|
|
494
|
-
this.log.debug(
|
|
495
|
-
`Calling private kernel init with isPrivateOnly ${isPrivateOnlyTx} and firstNullifierHint ${proofInput.firstNullifierHint}`,
|
|
496
|
-
);
|
|
472
|
+
this.log.debug(`Calling private kernel init with isPrivateOnly ${isPrivateOnlyTx}`);
|
|
497
473
|
pushTestData('private-kernel-inputs-init', proofInput);
|
|
498
474
|
output = generateWitnesses
|
|
499
475
|
? await this.proofCreator.generateInitOutput(proofInput)
|
|
@@ -509,12 +485,9 @@ export class PrivateKernelExecutionProver {
|
|
|
509
485
|
apps[0],
|
|
510
486
|
apps[1],
|
|
511
487
|
isPrivateOnlyTx,
|
|
512
|
-
firstNullifierHint,
|
|
513
488
|
minRevertibleSideEffectCounter,
|
|
514
489
|
);
|
|
515
|
-
this.log.debug(
|
|
516
|
-
`Calling private kernel init_2 with isPrivateOnly ${isPrivateOnlyTx} and firstNullifierHint ${proofInput.firstNullifierHint}`,
|
|
517
|
-
);
|
|
490
|
+
this.log.debug(`Calling private kernel init_2 with isPrivateOnly ${isPrivateOnlyTx}`);
|
|
518
491
|
pushTestData('private-kernel-inputs-init-2', proofInput);
|
|
519
492
|
output = generateWitnesses
|
|
520
493
|
? await this.proofCreator.generateInit2Output(proofInput)
|
|
@@ -531,12 +504,9 @@ export class PrivateKernelExecutionProver {
|
|
|
531
504
|
apps[1],
|
|
532
505
|
apps[2],
|
|
533
506
|
isPrivateOnlyTx,
|
|
534
|
-
firstNullifierHint,
|
|
535
507
|
minRevertibleSideEffectCounter,
|
|
536
508
|
);
|
|
537
|
-
this.log.debug(
|
|
538
|
-
`Calling private kernel init_3 with isPrivateOnly ${isPrivateOnlyTx} and firstNullifierHint ${proofInput.firstNullifierHint}`,
|
|
539
|
-
);
|
|
509
|
+
this.log.debug(`Calling private kernel init_3 with isPrivateOnly ${isPrivateOnlyTx}`);
|
|
540
510
|
pushTestData('private-kernel-inputs-init-3', proofInput);
|
|
541
511
|
output = generateWitnesses
|
|
542
512
|
? await this.proofCreator.generateInit3Output(proofInput)
|