@aztec/pxe 3.0.0-canary.a9708bd → 3.0.0-devnet.20251212
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.d.ts +1 -1
- package/dest/bin/check_oracle_version.js +110 -10
- package/dest/config/index.d.ts +9 -17
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +10 -16
- package/dest/config/package_info.d.ts +1 -1
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +6 -6
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +97 -42
- package/dest/contract_function_simulator/execution_data_provider.d.ts +40 -57
- package/dest/contract_function_simulator/execution_data_provider.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.d.ts +11 -9
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +28 -17
- 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/hashed_values_cache.d.ts +2 -2
- package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -1
- 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/event_validation_request.d.ts +2 -2
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +2 -2
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +3 -3
- 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 +8 -4
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +6 -3
- 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 +12 -3
- 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 +2 -2
- 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 +104 -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/message_load_oracle_inputs.d.ts +2 -4
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +10 -4
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +10 -5
- package/dest/contract_function_simulator/oracle/oracle.d.ts +17 -15
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +101 -81
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +6 -5
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +7 -16
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +34 -22
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +89 -25
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +23 -33
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +38 -42
- package/dest/contract_function_simulator/pick_notes.d.ts +2 -2
- package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
- package/dest/contract_function_simulator/pick_notes.js +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
- package/dest/contract_function_simulator/proxied_node.d.ts +1 -1
- package/dest/contract_function_simulator/proxied_node.d.ts.map +1 -1
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +34 -68
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +1 -1
- package/dest/contract_function_simulator/pxe_oracle_interface.js +220 -208
- package/dest/entrypoints/client/bundle/index.d.ts +4 -2
- 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 +9 -9
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +12 -12
- package/dest/entrypoints/client/lazy/index.d.ts +4 -2
- 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 +8 -8
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +11 -11
- package/dest/entrypoints/pxe_creation_options.d.ts +3 -1
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +4 -2
- 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 +5 -24
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +9 -41
- package/dest/error_enriching.d.ts +11 -0
- package/dest/error_enriching.d.ts.map +1 -0
- package/dest/{pxe_service/error_enriching.js → error_enriching.js} +3 -0
- package/dest/events/index.d.ts +2 -0
- package/dest/events/index.d.ts.map +1 -0
- package/dest/events/index.js +1 -0
- package/dest/events/private_event_filter_validator.d.ts +8 -0
- package/dest/events/private_event_filter_validator.d.ts.map +1 -0
- package/dest/events/private_event_filter_validator.js +39 -0
- package/dest/oracle_version.d.ts +3 -3
- package/dest/oracle_version.js +2 -2
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +3 -3
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -1
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +7 -7
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +1 -1
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.js +6 -6
- package/dest/private_kernel/hints/index.d.ts +1 -1
- package/dest/private_kernel/index.d.ts +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +9 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +38 -32
- package/dest/private_kernel/private_kernel_oracle.d.ts +3 -2
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +8 -7
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -1
- package/dest/pxe.d.ts +240 -0
- package/dest/pxe.d.ts.map +1 -0
- package/dest/{pxe_service/pxe_service.js → pxe.js} +227 -241
- package/dest/storage/address_data_provider/address_data_provider.d.ts +2 -4
- 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/address_data_provider/index.d.ts +1 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +3 -5
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +1 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.js +1 -5
- package/dest/storage/capsule_data_provider/index.d.ts +1 -1
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts +6 -17
- 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 -15
- package/dest/storage/contract_data_provider/index.d.ts +1 -1
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts +1 -1
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +1 -1
- package/dest/storage/contract_data_provider/private_functions_tree.js +1 -1
- package/dest/storage/index.d.ts +1 -2
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +0 -1
- package/dest/storage/metadata.d.ts +1 -1
- package/dest/storage/note_data_provider/index.d.ts +2 -2
- package/dest/storage/note_data_provider/index.d.ts.map +1 -1
- package/dest/storage/note_data_provider/index.js +1 -1
- package/dest/storage/note_data_provider/note_data_provider.d.ts +75 -11
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -1
- package/dest/storage/note_data_provider/note_data_provider.js +143 -81
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +31 -17
- 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 +47 -28
- package/dest/storage/sync_data_provider/index.d.ts +1 -1
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts +4 -5
- 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/index.d.ts +1 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +29 -7
- 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/index.d.ts +1 -1
- package/dest/synchronizer/synchronizer.d.ts +3 -2
- package/dest/synchronizer/synchronizer.d.ts.map +1 -1
- package/dest/synchronizer/synchronizer.js +4 -4
- 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 +22 -24
- package/src/bin/check_oracle_version.ts +134 -10
- package/src/config/index.ts +18 -32
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +151 -62
- package/src/contract_function_simulator/execution_data_provider.ts +47 -65
- package/src/contract_function_simulator/execution_note_cache.ts +33 -17
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +32 -0
- package/src/contract_function_simulator/hashed_values_cache.ts +1 -1
- package/src/contract_function_simulator/index.ts +3 -1
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +10 -5
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +14 -2
- 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 +176 -0
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +1 -1
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +21 -5
- package/src/contract_function_simulator/oracle/oracle.ts +135 -80
- package/src/contract_function_simulator/oracle/private_execution.ts +10 -17
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +123 -49
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +68 -80
- package/src/contract_function_simulator/pick_notes.ts +1 -1
- package/src/contract_function_simulator/pxe_oracle_interface.ts +291 -271
- package/src/entrypoints/client/bundle/index.ts +3 -1
- package/src/entrypoints/client/bundle/utils.ts +15 -23
- package/src/entrypoints/client/lazy/index.ts +3 -1
- package/src/entrypoints/client/lazy/utils.ts +14 -22
- package/src/entrypoints/pxe_creation_options.ts +2 -0
- package/src/entrypoints/server/index.ts +3 -1
- package/src/entrypoints/server/utils.ts +12 -56
- package/src/{pxe_service/error_enriching.ts → error_enriching.ts} +5 -1
- package/src/events/index.ts +1 -0
- package/src/events/private_event_filter_validator.ts +47 -0
- package/src/oracle_version.ts +2 -2
- package/src/private_kernel/hints/build_private_kernel_reset_private_inputs.ts +5 -9
- package/src/private_kernel/hints/compute_tx_include_by_timestamp.ts +6 -6
- package/src/private_kernel/private_kernel_execution_prover.ts +51 -43
- package/src/private_kernel/private_kernel_oracle.ts +2 -1
- package/src/private_kernel/private_kernel_oracle_impl.ts +4 -3
- package/src/{pxe_service/pxe_service.ts → pxe.ts} +256 -308
- package/src/storage/address_data_provider/address_data_provider.ts +1 -7
- package/src/storage/capsule_data_provider/capsule_data_provider.ts +2 -12
- package/src/storage/contract_data_provider/contract_data_provider.ts +4 -27
- package/src/storage/contract_data_provider/private_functions_tree.ts +1 -1
- package/src/storage/index.ts +0 -1
- package/src/storage/note_data_provider/index.ts +1 -1
- package/src/storage/note_data_provider/note_data_provider.ts +171 -109
- package/src/storage/private_event_data_provider/private_event_data_provider.ts +69 -41
- package/src/storage/sync_data_provider/sync_data_provider.ts +3 -8
- package/src/storage/tagging_data_provider/tagging_data_provider.ts +52 -55
- package/src/synchronizer/synchronizer.ts +4 -4
- 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 +0 -11
- 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/storage/note_data_provider/note_dao.d.ts +0 -100
- package/dest/storage/note_data_provider/note_dao.d.ts.map +0 -1
- package/dest/storage/note_data_provider/note_dao.js +0 -102
- 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/storage/note_data_provider/note_dao.ts +0 -154
- package/src/test/pxe_test_suite.ts +0 -113
|
@@ -1,25 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { Aes128 } from '@aztec/foundation/crypto/aes128';
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import { Point } from '@aztec/foundation/curves/grumpkin';
|
|
5
|
+
import { LogLevels, applyStringFormatting, createLogger } from '@aztec/foundation/log';
|
|
4
6
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
5
7
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
8
|
import type { CompleteAddress, ContractInstance } from '@aztec/stdlib/contract';
|
|
7
9
|
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
8
10
|
import type { KeyValidationRequest } from '@aztec/stdlib/kernel';
|
|
9
|
-
import { IndexedTaggingSecret } from '@aztec/stdlib/logs';
|
|
10
11
|
import type { NoteStatus } from '@aztec/stdlib/note';
|
|
11
12
|
import { type MerkleTreeId, type NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
12
13
|
import type { BlockHeader, Capsule } from '@aztec/stdlib/tx';
|
|
13
|
-
import type { UInt64 } from '@aztec/stdlib/types';
|
|
14
14
|
|
|
15
15
|
import type { ExecutionDataProvider } from '../execution_data_provider.js';
|
|
16
|
+
import { UtilityContext } from '../noir-structs/utility_context.js';
|
|
16
17
|
import { pickNotes } from '../pick_notes.js';
|
|
17
|
-
import {
|
|
18
|
+
import type { IMiscOracle, IUtilityExecutionOracle, NoteData } from './interfaces.js';
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* The oracle for an execution of utility contract functions.
|
|
21
22
|
*/
|
|
22
|
-
export class UtilityExecutionOracle
|
|
23
|
+
export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOracle {
|
|
24
|
+
isMisc = true as const;
|
|
25
|
+
isUtility = true as const;
|
|
26
|
+
|
|
27
|
+
private aztecNrDebugLog = createLogger('aztec-nr:debug_log');
|
|
28
|
+
|
|
23
29
|
constructor(
|
|
24
30
|
protected readonly contractAddress: AztecAddress,
|
|
25
31
|
/** List of transient auth witnesses to be used during this simulation */
|
|
@@ -28,36 +34,25 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
28
34
|
protected readonly executionDataProvider: ExecutionDataProvider,
|
|
29
35
|
protected log = createLogger('simulator:client_view_context'),
|
|
30
36
|
protected readonly scopes?: AztecAddress[],
|
|
31
|
-
) {
|
|
32
|
-
super();
|
|
33
|
-
}
|
|
37
|
+
) {}
|
|
34
38
|
|
|
35
|
-
public
|
|
39
|
+
public utilityAssertCompatibleOracleVersion(version: number): void {
|
|
36
40
|
this.executionDataProvider.assertCompatibleOracleVersion(version);
|
|
37
41
|
}
|
|
38
42
|
|
|
39
|
-
public
|
|
43
|
+
public utilityGetRandomField(): Fr {
|
|
40
44
|
return Fr.random();
|
|
41
45
|
}
|
|
42
46
|
|
|
43
|
-
public
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return Promise.resolve(this.contractAddress);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
public override utilityGetChainId(): Promise<Fr> {
|
|
56
|
-
return Promise.resolve(this.executionDataProvider.getChainId().then(id => new Fr(id)));
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
public override utilityGetVersion(): Promise<Fr> {
|
|
60
|
-
return Promise.resolve(this.executionDataProvider.getVersion().then(v => new Fr(v)));
|
|
47
|
+
public async utilityGetUtilityContext(): Promise<UtilityContext> {
|
|
48
|
+
const blockHeader = await this.executionDataProvider.getAnchorBlockHeader();
|
|
49
|
+
return UtilityContext.from({
|
|
50
|
+
blockNumber: blockHeader.globalVariables.blockNumber,
|
|
51
|
+
timestamp: blockHeader.globalVariables.timestamp,
|
|
52
|
+
contractAddress: this.contractAddress,
|
|
53
|
+
version: blockHeader.globalVariables.version,
|
|
54
|
+
chainId: blockHeader.globalVariables.chainId,
|
|
55
|
+
});
|
|
61
56
|
}
|
|
62
57
|
|
|
63
58
|
/**
|
|
@@ -66,7 +61,7 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
66
61
|
* @returns A Promise that resolves to nullifier keys.
|
|
67
62
|
* @throws If the keys are not registered in the key store.
|
|
68
63
|
*/
|
|
69
|
-
public
|
|
64
|
+
public utilityGetKeyValidationRequest(pkMHash: Fr): Promise<KeyValidationRequest> {
|
|
70
65
|
return this.executionDataProvider.getKeyValidationRequest(pkMHash, this.contractAddress);
|
|
71
66
|
}
|
|
72
67
|
|
|
@@ -77,7 +72,7 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
77
72
|
* @param leafValue - The leaf value
|
|
78
73
|
* @returns The index and sibling path concatenated [index, sibling_path]
|
|
79
74
|
*/
|
|
80
|
-
public
|
|
75
|
+
public utilityGetMembershipWitness(blockNumber: BlockNumber, treeId: MerkleTreeId, leafValue: Fr): Promise<Fr[]> {
|
|
81
76
|
return this.executionDataProvider.getMembershipWitness(blockNumber, treeId, leafValue);
|
|
82
77
|
}
|
|
83
78
|
|
|
@@ -87,8 +82,8 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
87
82
|
* @param nullifier - Nullifier we try to find witness for.
|
|
88
83
|
* @returns The nullifier membership witness (if found).
|
|
89
84
|
*/
|
|
90
|
-
public
|
|
91
|
-
blockNumber:
|
|
85
|
+
public async utilityGetNullifierMembershipWitness(
|
|
86
|
+
blockNumber: BlockNumber,
|
|
92
87
|
nullifier: Fr,
|
|
93
88
|
): Promise<NullifierMembershipWitness | undefined> {
|
|
94
89
|
return await this.executionDataProvider.getNullifierMembershipWitness(blockNumber, nullifier);
|
|
@@ -103,8 +98,8 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
103
98
|
* list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
|
|
104
99
|
* we are trying to prove non-inclusion for.
|
|
105
100
|
*/
|
|
106
|
-
public
|
|
107
|
-
blockNumber:
|
|
101
|
+
public async utilityGetLowNullifierMembershipWitness(
|
|
102
|
+
blockNumber: BlockNumber,
|
|
108
103
|
nullifier: Fr,
|
|
109
104
|
): Promise<NullifierMembershipWitness | undefined> {
|
|
110
105
|
return await this.executionDataProvider.getLowNullifierMembershipWitness(blockNumber, nullifier);
|
|
@@ -116,8 +111,8 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
116
111
|
* @param leafSlot - The slot of the public data tree to get the witness for.
|
|
117
112
|
* @returns - The witness
|
|
118
113
|
*/
|
|
119
|
-
public
|
|
120
|
-
blockNumber:
|
|
114
|
+
public async utilityGetPublicDataWitness(
|
|
115
|
+
blockNumber: BlockNumber,
|
|
121
116
|
leafSlot: Fr,
|
|
122
117
|
): Promise<PublicDataWitness | undefined> {
|
|
123
118
|
return await this.executionDataProvider.getPublicDataWitness(blockNumber, leafSlot);
|
|
@@ -128,12 +123,12 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
128
123
|
* @param blockNumber - The number of a block of which to get the block header.
|
|
129
124
|
* @returns Block extracted from a block with block number `blockNumber`.
|
|
130
125
|
*/
|
|
131
|
-
public
|
|
126
|
+
public async utilityGetBlockHeader(blockNumber: BlockNumber): Promise<BlockHeader | undefined> {
|
|
132
127
|
const block = await this.executionDataProvider.getBlock(blockNumber);
|
|
133
128
|
if (!block) {
|
|
134
129
|
return undefined;
|
|
135
130
|
}
|
|
136
|
-
return block.
|
|
131
|
+
return block.getBlockHeader();
|
|
137
132
|
}
|
|
138
133
|
|
|
139
134
|
/**
|
|
@@ -142,7 +137,7 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
142
137
|
* @returns A complete address associated with the input address.
|
|
143
138
|
* @throws An error if the account is not registered in the database.
|
|
144
139
|
*/
|
|
145
|
-
public
|
|
140
|
+
public utilityGetPublicKeysAndPartialAddress(account: AztecAddress): Promise<CompleteAddress> {
|
|
146
141
|
return this.executionDataProvider.getCompleteAddress(account);
|
|
147
142
|
}
|
|
148
143
|
|
|
@@ -151,7 +146,7 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
151
146
|
* @param address - Address.
|
|
152
147
|
* @returns A contract instance.
|
|
153
148
|
*/
|
|
154
|
-
public
|
|
149
|
+
public utilityGetContractInstance(address: AztecAddress): Promise<ContractInstance> {
|
|
155
150
|
return this.executionDataProvider.getContractInstance(address);
|
|
156
151
|
}
|
|
157
152
|
|
|
@@ -161,7 +156,7 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
161
156
|
* @param messageHash - Hash of the message to authenticate.
|
|
162
157
|
* @returns Authentication witness for the requested message hash.
|
|
163
158
|
*/
|
|
164
|
-
public
|
|
159
|
+
public utilityGetAuthWitness(messageHash: Fr): Promise<Fr[] | undefined> {
|
|
165
160
|
return Promise.resolve(this.authWitnesses.find(w => w.requestHash.equals(messageHash))?.witness);
|
|
166
161
|
}
|
|
167
162
|
|
|
@@ -174,6 +169,7 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
174
169
|
* Real notes coming from DB will have a leafIndex which
|
|
175
170
|
* represents their index in the note hash tree.
|
|
176
171
|
*
|
|
172
|
+
* @param owner - The owner of the notes. If undefined, returns notes for all owners.
|
|
177
173
|
* @param storageSlot - The storage slot.
|
|
178
174
|
* @param numSelects - The number of valid selects in selectBy and selectValues.
|
|
179
175
|
* @param selectBy - An array of indices of the fields to selects.
|
|
@@ -186,7 +182,8 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
186
182
|
* @param status - The status of notes to fetch.
|
|
187
183
|
* @returns Array of note data.
|
|
188
184
|
*/
|
|
189
|
-
public
|
|
185
|
+
public async utilityGetNotes(
|
|
186
|
+
owner: AztecAddress | undefined,
|
|
190
187
|
storageSlot: Fr,
|
|
191
188
|
numSelects: number,
|
|
192
189
|
selectByIndexes: number[],
|
|
@@ -202,7 +199,13 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
202
199
|
offset: number,
|
|
203
200
|
status: NoteStatus,
|
|
204
201
|
): Promise<NoteData[]> {
|
|
205
|
-
const dbNotes = await this.executionDataProvider.getNotes(
|
|
202
|
+
const dbNotes = await this.executionDataProvider.getNotes(
|
|
203
|
+
this.contractAddress,
|
|
204
|
+
owner,
|
|
205
|
+
storageSlot,
|
|
206
|
+
status,
|
|
207
|
+
this.scopes,
|
|
208
|
+
);
|
|
206
209
|
return pickNotes<NoteData>(dbNotes, {
|
|
207
210
|
selects: selectByIndexes.slice(0, numSelects).map((index, i) => ({
|
|
208
211
|
selector: { index, offset: selectByOffsets[i], length: selectByLengths[i] },
|
|
@@ -223,7 +226,7 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
223
226
|
* @param innerNullifier - The inner nullifier.
|
|
224
227
|
* @returns A boolean indicating whether the nullifier exists in the tree or not.
|
|
225
228
|
*/
|
|
226
|
-
public
|
|
229
|
+
public async utilityCheckNullifierExists(innerNullifier: Fr) {
|
|
227
230
|
const nullifier = await siloNullifier(this.contractAddress, innerNullifier!);
|
|
228
231
|
const index = await this.executionDataProvider.getNullifierIndex(nullifier);
|
|
229
232
|
return index !== undefined;
|
|
@@ -237,7 +240,7 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
237
240
|
* @dev Contract address and secret are only used to compute the nullifier to get non-nullified messages
|
|
238
241
|
* @returns The l1 to l2 membership witness (index of message in the tree and sibling path).
|
|
239
242
|
*/
|
|
240
|
-
public
|
|
243
|
+
public async utilityGetL1ToL2MembershipWitness(contractAddress: AztecAddress, messageHash: Fr, secret: Fr) {
|
|
241
244
|
return await this.executionDataProvider.getL1ToL2MembershipWitness(contractAddress, messageHash, secret);
|
|
242
245
|
}
|
|
243
246
|
|
|
@@ -248,10 +251,10 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
248
251
|
* @param blockNumber - The block number to read storage at.
|
|
249
252
|
* @param numberOfElements - Number of elements to read from the starting storage slot.
|
|
250
253
|
*/
|
|
251
|
-
public
|
|
254
|
+
public async utilityStorageRead(
|
|
252
255
|
contractAddress: AztecAddress,
|
|
253
256
|
startStorageSlot: Fr,
|
|
254
|
-
blockNumber:
|
|
257
|
+
blockNumber: BlockNumber,
|
|
255
258
|
numberOfElements: number,
|
|
256
259
|
) {
|
|
257
260
|
const values = [];
|
|
@@ -267,32 +270,21 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
267
270
|
return values;
|
|
268
271
|
}
|
|
269
272
|
|
|
270
|
-
public
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
* Includes the next index to be used used for tagging with this secret.
|
|
277
|
-
* For this to work, the ivsk_m of the sender must be known.
|
|
278
|
-
* @param sender - The address sending the note
|
|
279
|
-
* @param recipient - The address receiving the note
|
|
280
|
-
* @returns A tagging secret that can be used to tag notes.
|
|
281
|
-
*/
|
|
282
|
-
public override async utilityGetIndexedTaggingSecretAsSender(
|
|
283
|
-
sender: AztecAddress,
|
|
284
|
-
recipient: AztecAddress,
|
|
285
|
-
): Promise<IndexedTaggingSecret> {
|
|
286
|
-
return await this.executionDataProvider.getIndexedTaggingSecretAsSender(this.contractAddress, sender, recipient);
|
|
273
|
+
public utilityDebugLog(level: number, message: string, fields: Fr[]): void {
|
|
274
|
+
if (!LogLevels[level]) {
|
|
275
|
+
throw new Error(`Invalid debug log level: ${level}`);
|
|
276
|
+
}
|
|
277
|
+
const levelName = LogLevels[level];
|
|
278
|
+
this.aztecNrDebugLog[levelName](`${applyStringFormatting(message, fields)}`);
|
|
287
279
|
}
|
|
288
280
|
|
|
289
|
-
public
|
|
281
|
+
public async utilityFetchTaggedLogs(pendingTaggedLogArrayBaseSlot: Fr) {
|
|
290
282
|
await this.executionDataProvider.syncTaggedLogs(this.contractAddress, pendingTaggedLogArrayBaseSlot, this.scopes);
|
|
291
283
|
|
|
292
|
-
await this.executionDataProvider.
|
|
284
|
+
await this.executionDataProvider.syncNoteNullifiers(this.contractAddress);
|
|
293
285
|
}
|
|
294
286
|
|
|
295
|
-
public
|
|
287
|
+
public async utilityValidateEnqueuedNotesAndEvents(
|
|
296
288
|
contractAddress: AztecAddress,
|
|
297
289
|
noteValidationRequestsArrayBaseSlot: Fr,
|
|
298
290
|
eventValidationRequestsArrayBaseSlot: Fr,
|
|
@@ -309,7 +301,7 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
309
301
|
);
|
|
310
302
|
}
|
|
311
303
|
|
|
312
|
-
public
|
|
304
|
+
public async utilityBulkRetrieveLogs(
|
|
313
305
|
contractAddress: AztecAddress,
|
|
314
306
|
logRetrievalRequestsArrayBaseSlot: Fr,
|
|
315
307
|
logRetrievalResponsesArrayBaseSlot: Fr,
|
|
@@ -326,7 +318,7 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
326
318
|
);
|
|
327
319
|
}
|
|
328
320
|
|
|
329
|
-
public
|
|
321
|
+
public utilityStoreCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[]): Promise<void> {
|
|
330
322
|
if (!contractAddress.equals(this.contractAddress)) {
|
|
331
323
|
// TODO(#10727): instead of this check that this.contractAddress is allowed to access the external DB
|
|
332
324
|
throw new Error(`Contract ${contractAddress} is not allowed to access ${this.contractAddress}'s PXE DB`);
|
|
@@ -334,7 +326,7 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
334
326
|
return this.executionDataProvider.storeCapsule(this.contractAddress, slot, capsule);
|
|
335
327
|
}
|
|
336
328
|
|
|
337
|
-
public
|
|
329
|
+
public async utilityLoadCapsule(contractAddress: AztecAddress, slot: Fr): Promise<Fr[] | null> {
|
|
338
330
|
if (!contractAddress.equals(this.contractAddress)) {
|
|
339
331
|
// TODO(#10727): instead of this check that this.contractAddress is allowed to access the external DB
|
|
340
332
|
throw new Error(`Contract ${contractAddress} is not allowed to access ${this.contractAddress}'s PXE DB`);
|
|
@@ -346,7 +338,7 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
346
338
|
);
|
|
347
339
|
}
|
|
348
340
|
|
|
349
|
-
public
|
|
341
|
+
public utilityDeleteCapsule(contractAddress: AztecAddress, slot: Fr): Promise<void> {
|
|
350
342
|
if (!contractAddress.equals(this.contractAddress)) {
|
|
351
343
|
// TODO(#10727): instead of this check that this.contractAddress is allowed to access the external DB
|
|
352
344
|
throw new Error(`Contract ${contractAddress} is not allowed to access ${this.contractAddress}'s PXE DB`);
|
|
@@ -354,7 +346,7 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
354
346
|
return this.executionDataProvider.deleteCapsule(this.contractAddress, slot);
|
|
355
347
|
}
|
|
356
348
|
|
|
357
|
-
public
|
|
349
|
+
public utilityCopyCapsule(
|
|
358
350
|
contractAddress: AztecAddress,
|
|
359
351
|
srcSlot: Fr,
|
|
360
352
|
dstSlot: Fr,
|
|
@@ -368,16 +360,12 @@ export class UtilityExecutionOracle extends TypedOracle {
|
|
|
368
360
|
}
|
|
369
361
|
|
|
370
362
|
// TODO(#11849): consider replacing this oracle with a pure Noir implementation of aes decryption.
|
|
371
|
-
public
|
|
363
|
+
public utilityAes128Decrypt(ciphertext: Buffer, iv: Buffer, symKey: Buffer): Promise<Buffer> {
|
|
372
364
|
const aes128 = new Aes128();
|
|
373
365
|
return aes128.decryptBufferCBC(ciphertext, iv, symKey);
|
|
374
366
|
}
|
|
375
367
|
|
|
376
|
-
public
|
|
368
|
+
public utilityGetSharedSecret(address: AztecAddress, ephPk: Point): Promise<Point> {
|
|
377
369
|
return this.executionDataProvider.getSharedSecret(address, ephPk);
|
|
378
370
|
}
|
|
379
|
-
|
|
380
|
-
public override utilityEmitOffchainEffect(_data: Fr[]): Promise<void> {
|
|
381
|
-
return Promise.reject(new Error('Cannot emit offchain effects from a utility function'));
|
|
382
|
-
}
|
|
383
371
|
}
|