@aztec/pxe 3.0.0-canary.a9708bd → 3.0.0-devnet.2-patch.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/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 +21 -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 +20 -11
- package/dest/entrypoints/pxe_creation_options.d.ts +5 -2
- 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 +17 -45
- 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 +21 -23
- package/src/entrypoints/client/lazy/index.ts +3 -1
- package/src/entrypoints/client/lazy/utils.ts +20 -23
- package/src/entrypoints/pxe_creation_options.ts +4 -1
- package/src/entrypoints/server/index.ts +3 -1
- package/src/entrypoints/server/utils.ts +20 -68
- 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,18 +1,19 @@
|
|
|
1
1
|
import type { L1_TO_L2_MSG_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
2
|
+
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
3
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import type { Point } from '@aztec/foundation/curves/grumpkin';
|
|
5
|
+
import type { FunctionArtifactWithContractName, FunctionSelector } from '@aztec/stdlib/abi';
|
|
4
6
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
7
|
import type { L2Block } from '@aztec/stdlib/block';
|
|
6
8
|
import type { CompleteAddress, ContractInstance } from '@aztec/stdlib/contract';
|
|
7
9
|
import type { KeyValidationRequest } from '@aztec/stdlib/kernel';
|
|
8
|
-
import {
|
|
10
|
+
import type { DirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
|
|
9
11
|
import type { NoteStatus } from '@aztec/stdlib/note';
|
|
10
12
|
import { type MerkleTreeId, type NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
11
13
|
import type { BlockHeader, NodeStats } from '@aztec/stdlib/tx';
|
|
12
|
-
import type { UInt64 } from '@aztec/stdlib/types';
|
|
13
14
|
|
|
15
|
+
import type { NoteData } from './oracle/interfaces.js';
|
|
14
16
|
import type { MessageLoadOracleInputs } from './oracle/message_load_oracle_inputs.js';
|
|
15
|
-
import type { NoteData } from './oracle/typed_oracle.js';
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Error thrown when a contract is not found in the database.
|
|
@@ -75,6 +76,7 @@ export interface ExecutionDataProvider {
|
|
|
75
76
|
* Returns an object containing an array of note data.
|
|
76
77
|
*
|
|
77
78
|
* @param contractAddress - The contract address of the notes.
|
|
79
|
+
* @param owner - The owner of the notes. If undefined, returns notes for all owners.
|
|
78
80
|
* @param storageSlot - The storage slot of the notes.
|
|
79
81
|
* @param status - The status of notes to fetch.
|
|
80
82
|
* @param scopes - The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
@@ -82,6 +84,7 @@ export interface ExecutionDataProvider {
|
|
|
82
84
|
*/
|
|
83
85
|
getNotes(
|
|
84
86
|
contractAddress: AztecAddress,
|
|
87
|
+
owner: AztecAddress | undefined,
|
|
85
88
|
storageSlot: Fr,
|
|
86
89
|
status: NoteStatus,
|
|
87
90
|
scopes?: AztecAddress[],
|
|
@@ -107,16 +110,6 @@ export interface ExecutionDataProvider {
|
|
|
107
110
|
*/
|
|
108
111
|
getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string>;
|
|
109
112
|
|
|
110
|
-
/**
|
|
111
|
-
* Retrieves the artifact of a specified function within a given contract.
|
|
112
|
-
* The function is identified by its name, which is unique within a contract.
|
|
113
|
-
*
|
|
114
|
-
* @param contractAddress - The AztecAddress representing the contract containing the function.
|
|
115
|
-
* @param functionName - The name of the function.
|
|
116
|
-
* @returns The corresponding function's artifact as an object.
|
|
117
|
-
*/
|
|
118
|
-
getFunctionArtifactByName(contractAddress: AztecAddress, functionName: string): Promise<FunctionArtifact | undefined>;
|
|
119
|
-
|
|
120
113
|
/**
|
|
121
114
|
* Gets the index of a nullifier in the nullifier tree.
|
|
122
115
|
* @param nullifier - The nullifier.
|
|
@@ -146,11 +139,12 @@ export interface ExecutionDataProvider {
|
|
|
146
139
|
): Promise<MessageLoadOracleInputs<typeof L1_TO_L2_MSG_TREE_HEIGHT>>;
|
|
147
140
|
|
|
148
141
|
/**
|
|
149
|
-
* Retrieve the latest block header synchronized by the
|
|
150
|
-
*
|
|
151
|
-
*
|
|
142
|
+
* Retrieve the latest block header synchronized by the execution data provider. This block header is referred
|
|
143
|
+
* to as the anchor block header in Aztec terminology and it defines the state that is used during private function
|
|
144
|
+
* execution.
|
|
145
|
+
* @returns The anchor block header.
|
|
152
146
|
*/
|
|
153
|
-
|
|
147
|
+
getAnchorBlockHeader(): Promise<BlockHeader>;
|
|
154
148
|
|
|
155
149
|
/**
|
|
156
150
|
* Fetches the index and sibling path of a leaf at a given block from a given tree.
|
|
@@ -159,7 +153,7 @@ export interface ExecutionDataProvider {
|
|
|
159
153
|
* @param leafValue - The leaf value
|
|
160
154
|
* @returns The index and sibling path concatenated [index, sibling_path]
|
|
161
155
|
*/
|
|
162
|
-
getMembershipWitness(blockNumber:
|
|
156
|
+
getMembershipWitness(blockNumber: BlockNumber, treeId: MerkleTreeId, leafValue: Fr): Promise<Fr[]>;
|
|
163
157
|
|
|
164
158
|
/**
|
|
165
159
|
* Returns a nullifier membership witness for a given nullifier at a given block.
|
|
@@ -167,7 +161,10 @@ export interface ExecutionDataProvider {
|
|
|
167
161
|
* @param nullifier - Nullifier we try to find witness for.
|
|
168
162
|
* @returns The nullifier membership witness (if found).
|
|
169
163
|
*/
|
|
170
|
-
getNullifierMembershipWitness(
|
|
164
|
+
getNullifierMembershipWitness(
|
|
165
|
+
blockNumber: BlockNumber,
|
|
166
|
+
nullifier: Fr,
|
|
167
|
+
): Promise<NullifierMembershipWitness | undefined>;
|
|
171
168
|
|
|
172
169
|
/**
|
|
173
170
|
* Returns a low nullifier membership witness for a given nullifier at a given block.
|
|
@@ -178,14 +175,17 @@ export interface ExecutionDataProvider {
|
|
|
178
175
|
* list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
|
|
179
176
|
* we are trying to prove non-inclusion for.
|
|
180
177
|
*/
|
|
181
|
-
getLowNullifierMembershipWitness(
|
|
178
|
+
getLowNullifierMembershipWitness(
|
|
179
|
+
blockNumber: BlockNumber,
|
|
180
|
+
nullifier: Fr,
|
|
181
|
+
): Promise<NullifierMembershipWitness | undefined>;
|
|
182
182
|
|
|
183
183
|
/**
|
|
184
184
|
* Returns a witness for a given slot of the public data tree at a given block.
|
|
185
185
|
* @param blockNumber - The block number at which to get the witness.
|
|
186
186
|
* @param leafSlot - The slot of the public data in the public data tree.
|
|
187
187
|
*/
|
|
188
|
-
getPublicDataWitness(blockNumber:
|
|
188
|
+
getPublicDataWitness(blockNumber: BlockNumber, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
|
|
189
189
|
|
|
190
190
|
/**
|
|
191
191
|
* Gets the storage value at the given contract storage slot.
|
|
@@ -199,14 +199,14 @@ export interface ExecutionDataProvider {
|
|
|
199
199
|
* @returns Storage value at the given contract slot.
|
|
200
200
|
* @throws If the contract is not deployed.
|
|
201
201
|
*/
|
|
202
|
-
getPublicStorageAt(blockNumber:
|
|
202
|
+
getPublicStorageAt(blockNumber: BlockNumber, contract: AztecAddress, slot: Fr): Promise<Fr>;
|
|
203
203
|
|
|
204
204
|
/**
|
|
205
205
|
* Fetch a block corresponding to the given block number.
|
|
206
206
|
* @param blockNumber - The block number of a block to fetch.
|
|
207
207
|
* @returns - The block corresponding to the given block number. Undefined if it does not exist.
|
|
208
208
|
*/
|
|
209
|
-
getBlock(blockNumber:
|
|
209
|
+
getBlock(blockNumber: BlockNumber): Promise<L2Block | undefined>;
|
|
210
210
|
|
|
211
211
|
/**
|
|
212
212
|
* Assert that the oracle version is compatible with the expected version.
|
|
@@ -215,54 +215,36 @@ export interface ExecutionDataProvider {
|
|
|
215
215
|
assertCompatibleOracleVersion(version: number): void;
|
|
216
216
|
|
|
217
217
|
/**
|
|
218
|
-
*
|
|
219
|
-
* @returns The block number.
|
|
220
|
-
*/
|
|
221
|
-
getBlockNumber(): Promise<number>;
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* Fetches the timestamp of the latest block synchronized by the node.
|
|
225
|
-
* @returns The timestamp.
|
|
226
|
-
*/
|
|
227
|
-
getTimestamp(): Promise<UInt64>;
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Fetches the current chain id.
|
|
231
|
-
* @returns The chain id.
|
|
232
|
-
*/
|
|
233
|
-
getChainId(): Promise<number>;
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Fetches the current chain id.
|
|
237
|
-
* @returns The chain id.
|
|
238
|
-
*/
|
|
239
|
-
getVersion(): Promise<number>;
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Returns the tagging secret for a given sender and recipient pair. For this to work, the ivsk_m of the sender must be known.
|
|
243
|
-
* Includes the next index to be used used for tagging with this secret.
|
|
218
|
+
* Calculates the directional app tagging secret for a given contract, sender and recipient.
|
|
244
219
|
* @param contractAddress - The contract address to silo the secret for
|
|
245
220
|
* @param sender - The address sending the note
|
|
246
221
|
* @param recipient - The address receiving the note
|
|
247
|
-
* @returns
|
|
222
|
+
* @returns The directional app tagging secret
|
|
248
223
|
*/
|
|
249
|
-
|
|
224
|
+
calculateDirectionalAppTaggingSecret(
|
|
250
225
|
contractAddress: AztecAddress,
|
|
251
226
|
sender: AztecAddress,
|
|
252
227
|
recipient: AztecAddress,
|
|
253
|
-
): Promise<
|
|
228
|
+
): Promise<DirectionalAppTaggingSecret>;
|
|
254
229
|
|
|
255
230
|
/**
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
* @param
|
|
259
|
-
*
|
|
231
|
+
* Updates the local index of the shared tagging secret of a (sender, recipient, contract) tuple if a log with
|
|
232
|
+
* a larger index is found from the node.
|
|
233
|
+
* @param secret - The secret that's unique for (sender, recipient, contract) tuple while the direction
|
|
234
|
+
* of sender -> recipient matters.
|
|
235
|
+
* @param contractAddress - The address of the contract that the logs are tagged for. Needs to be provided to store
|
|
236
|
+
* because the function performs second round of siloing which is necessary because kernels do it as well (they silo
|
|
237
|
+
* first field of the private log which corresponds to the tag).
|
|
260
238
|
*/
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
239
|
+
syncTaggedLogsAsSender(secret: DirectionalAppTaggingSecret, contractAddress: AztecAddress): Promise<void>;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Returns the last used index when sending a log with a given secret.
|
|
243
|
+
* @param secret - The directional app tagging secret.
|
|
244
|
+
* @returns The last used index for the given directional app tagging secret, or undefined if we never sent a log
|
|
245
|
+
* from this sender to a recipient in a given contract (implicitly included in the secret).
|
|
246
|
+
*/
|
|
247
|
+
getLastUsedIndexAsSender(secret: DirectionalAppTaggingSecret): Promise<number | undefined>;
|
|
266
248
|
|
|
267
249
|
/**
|
|
268
250
|
* Synchronizes the private logs tagged with scoped addresses and all the senders in the address book. Stores the found
|
|
@@ -301,9 +283,9 @@ export interface ExecutionDataProvider {
|
|
|
301
283
|
): Promise<void>;
|
|
302
284
|
|
|
303
285
|
/**
|
|
304
|
-
*
|
|
286
|
+
* Looks for nullifiers of active contract notes and marks them as nullified in the db if a nullifier is found.
|
|
305
287
|
*/
|
|
306
|
-
|
|
288
|
+
syncNoteNullifiers(contractAddress: AztecAddress): Promise<void>;
|
|
307
289
|
|
|
308
290
|
/**
|
|
309
291
|
* Stores arbitrary information in a per-contract non-volatile database, which can later be retrieved with `loadCapsule`.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
3
|
import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
|
|
4
4
|
|
|
5
|
-
import type { NoteData } from './oracle/
|
|
5
|
+
import type { NoteData } from './oracle/interfaces.js';
|
|
6
6
|
|
|
7
7
|
interface PendingNote {
|
|
8
8
|
note: NoteData;
|
|
@@ -44,9 +44,9 @@ export class ExecutionNoteCache {
|
|
|
44
44
|
* We don't need to use the tx request hash for nonces if another non revertible nullifier is emitted.
|
|
45
45
|
* In that case we disable injecting the tx request hash as a nullifier.
|
|
46
46
|
*/
|
|
47
|
-
private
|
|
47
|
+
private usedProtocolNullifierForNonces = true;
|
|
48
48
|
|
|
49
|
-
constructor(private readonly
|
|
49
|
+
constructor(private readonly protocolNullifier: Fr) {}
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Enters the revertible phase of the transaction.
|
|
@@ -60,12 +60,11 @@ export class ExecutionNoteCache {
|
|
|
60
60
|
}
|
|
61
61
|
this.inRevertiblePhase = true;
|
|
62
62
|
this.minRevertibleSideEffectCounter = minRevertibleSideEffectCounter;
|
|
63
|
-
|
|
64
|
-
let nonceGenerator = this.txRequestHash;
|
|
63
|
+
let nonceGenerator = this.protocolNullifier;
|
|
65
64
|
const nullifiers = this.getAllNullifiers();
|
|
66
65
|
if (nullifiers.length > 0) {
|
|
67
66
|
nonceGenerator = new Fr(nullifiers[0]);
|
|
68
|
-
this.
|
|
67
|
+
this.usedProtocolNullifierForNonces = false;
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
// The existing pending notes are all non-revertible.
|
|
@@ -92,14 +91,22 @@ export class ExecutionNoteCache {
|
|
|
92
91
|
updatedNotes.forEach(n => this.#addNote(n));
|
|
93
92
|
}
|
|
94
93
|
|
|
94
|
+
public isSideEffectCounterRevertible(sideEffectCounter: number): boolean {
|
|
95
|
+
if (!this.inRevertiblePhase) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
return sideEffectCounter >= this.minRevertibleSideEffectCounter;
|
|
99
|
+
}
|
|
100
|
+
|
|
95
101
|
public finish() {
|
|
96
|
-
// If we never entered the revertible phase, we need to use the
|
|
102
|
+
// If we never entered the revertible phase, we need to use the protocol nullifier to compute the nonces for the
|
|
103
|
+
// notes if no nullifiers have been emitted.
|
|
97
104
|
if (!this.inRevertiblePhase) {
|
|
98
|
-
this.
|
|
105
|
+
this.usedProtocolNullifierForNonces = this.getAllNullifiers().length === 0;
|
|
99
106
|
}
|
|
100
107
|
// If we entered the revertible phase, the nonce generator was decided based on wether or not a nullifier was emitted before entering.
|
|
101
108
|
return {
|
|
102
|
-
|
|
109
|
+
usedProtocolNullifierForNonces: this.usedProtocolNullifierForNonces,
|
|
103
110
|
};
|
|
104
111
|
}
|
|
105
112
|
|
|
@@ -126,7 +133,7 @@ export class ExecutionNoteCache {
|
|
|
126
133
|
* transaction (and thus not a new note).
|
|
127
134
|
*/
|
|
128
135
|
public async nullifyNote(contractAddress: AztecAddress, innerNullifier: Fr, noteHash: Fr) {
|
|
129
|
-
const siloedNullifier = await siloNullifier(contractAddress, innerNullifier);
|
|
136
|
+
const siloedNullifier = (await siloNullifier(contractAddress, innerNullifier)).toBigInt();
|
|
130
137
|
let nullifiedNoteHashCounter: number | undefined = undefined;
|
|
131
138
|
// Find and remove the matching new note and log(s) if the emitted noteHash is not empty.
|
|
132
139
|
if (!noteHash.isEmpty()) {
|
|
@@ -158,7 +165,7 @@ export class ExecutionNoteCache {
|
|
|
158
165
|
* @param innerNullifier
|
|
159
166
|
*/
|
|
160
167
|
public async nullifierCreated(contractAddress: AztecAddress, innerNullifier: Fr) {
|
|
161
|
-
const siloedNullifier = await siloNullifier(contractAddress, innerNullifier);
|
|
168
|
+
const siloedNullifier = (await siloNullifier(contractAddress, innerNullifier)).toBigInt();
|
|
162
169
|
this.recordNullifier(contractAddress, siloedNullifier);
|
|
163
170
|
}
|
|
164
171
|
|
|
@@ -166,11 +173,15 @@ export class ExecutionNoteCache {
|
|
|
166
173
|
* Return notes created up to current point in execution.
|
|
167
174
|
* If a nullifier for a note in this list is emitted, the note will be deleted.
|
|
168
175
|
* @param contractAddress - Contract address of the notes.
|
|
176
|
+
* @param owner - Owner of the notes. If undefined, returns all notes regardless of owner.
|
|
169
177
|
* @param storageSlot - Storage slot of the notes.
|
|
170
178
|
**/
|
|
171
|
-
public getNotes(contractAddress: AztecAddress, storageSlot: Fr) {
|
|
179
|
+
public getNotes(contractAddress: AztecAddress, owner: AztecAddress | undefined, storageSlot: Fr) {
|
|
172
180
|
const notes = this.noteMap.get(contractAddress.toBigInt()) ?? [];
|
|
173
|
-
return notes
|
|
181
|
+
return notes
|
|
182
|
+
.filter(n => owner === undefined || n.note.owner.equals(owner))
|
|
183
|
+
.filter(n => n.note.storageSlot.equals(storageSlot))
|
|
184
|
+
.map(n => n.note);
|
|
174
185
|
}
|
|
175
186
|
|
|
176
187
|
/**
|
|
@@ -208,10 +219,15 @@ export class ExecutionNoteCache {
|
|
|
208
219
|
return [...this.allNullifiers].map(n => new Fr(n));
|
|
209
220
|
}
|
|
210
221
|
|
|
211
|
-
recordNullifier(contractAddress: AztecAddress, siloedNullifier:
|
|
222
|
+
recordNullifier(contractAddress: AztecAddress, siloedNullifier: bigint) {
|
|
212
223
|
const nullifiers = this.getNullifiers(contractAddress);
|
|
213
|
-
|
|
224
|
+
|
|
225
|
+
if (nullifiers.has(siloedNullifier)) {
|
|
226
|
+
throw new Error(`Duplicate siloed nullifier ${siloedNullifier} emitted by contract ${contractAddress}`);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
nullifiers.add(siloedNullifier);
|
|
214
230
|
this.nullifierMap.set(contractAddress.toBigInt(), nullifiers);
|
|
215
|
-
this.allNullifiers.add(siloedNullifier
|
|
231
|
+
this.allNullifiers.add(siloedNullifier);
|
|
216
232
|
}
|
|
217
233
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DirectionalAppTaggingSecret, type PreTag } from '@aztec/stdlib/logs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A map that stores the tagging index for a given directional app tagging secret.
|
|
5
|
+
* Note: The directional app tagging secret is unique for a (sender, recipient, contract) tuple while the direction
|
|
6
|
+
* of sender -> recipient matters.
|
|
7
|
+
*/
|
|
8
|
+
export class ExecutionTaggingIndexCache {
|
|
9
|
+
private taggingIndexMap: Map<string, number> = new Map();
|
|
10
|
+
|
|
11
|
+
public getLastUsedIndex(secret: DirectionalAppTaggingSecret): number | undefined {
|
|
12
|
+
return this.taggingIndexMap.get(secret.toString());
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public setLastUsedIndex(secret: DirectionalAppTaggingSecret, index: number) {
|
|
16
|
+
const currentValue = this.taggingIndexMap.get(secret.toString());
|
|
17
|
+
if (currentValue !== undefined && currentValue !== index - 1) {
|
|
18
|
+
throw new Error(`Invalid tagging index update. Current value: ${currentValue}, new value: ${index}`);
|
|
19
|
+
}
|
|
20
|
+
this.taggingIndexMap.set(secret.toString(), index);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Returns the pre tags that were used in this execution (and that need to be stored in the db).
|
|
25
|
+
*/
|
|
26
|
+
public getUsedPreTags(): PreTag[] {
|
|
27
|
+
return Array.from(this.taggingIndexMap.entries()).map(([secret, index]) => ({
|
|
28
|
+
secret: DirectionalAppTaggingSecret.fromString(secret),
|
|
29
|
+
index,
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { ExecutionNoteCache } from './execution_note_cache.js';
|
|
2
|
+
export { ExecutionTaggingIndexCache } from './execution_tagging_index_cache.js';
|
|
2
3
|
export { HashedValuesCache } from './hashed_values_cache.js';
|
|
3
4
|
export { pickNotes } from './pick_notes.js';
|
|
4
|
-
export {
|
|
5
|
+
export type { NoteData, IMiscOracle, IUtilityExecutionOracle, IPrivateExecutionOracle } from './oracle/interfaces.js';
|
|
5
6
|
export { MessageLoadOracleInputs } from './oracle/message_load_oracle_inputs.js';
|
|
6
7
|
export { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
7
8
|
export { PrivateExecutionOracle } from './oracle/private_execution_oracle.js';
|
|
@@ -9,3 +10,4 @@ export { Oracle } from './oracle/oracle.js';
|
|
|
9
10
|
export { executePrivateFunction, extractPrivateCircuitPublicInputs } from './oracle/private_execution.js';
|
|
10
11
|
export { generateSimulatedProvingResult } from './contract_function_simulator.js';
|
|
11
12
|
export { packAsRetrievedNote } from './oracle/note_packing_utils.js';
|
|
13
|
+
export { UtilityContext } from './noir-structs/utility_context.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { FieldReader } from '@aztec/foundation/serialize';
|
|
3
3
|
import { EventSelector } from '@aztec/stdlib/abi';
|
|
4
4
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { MAX_NOTE_HASHES_PER_TX, PRIVATE_LOG_CIPHERTEXT_LEN
|
|
1
|
+
import { MAX_NOTE_HASHES_PER_TX, PRIVATE_LOG_CIPHERTEXT_LEN } from '@aztec/constants';
|
|
2
2
|
import { range } from '@aztec/foundation/array';
|
|
3
|
-
import { Fr } from '@aztec/foundation/
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
4
|
import type { TxHash } from '@aztec/stdlib/tx';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
import { MAX_NOTE_PACKED_LEN } from './note_validation_request.js';
|
|
7
|
+
|
|
8
|
+
const MAX_PUBLIC_LOG_LEN_FOR_NOTE_COMPLETION = MAX_NOTE_PACKED_LEN;
|
|
9
|
+
const MAX_LOG_CONTENT_LEN = Math.max(MAX_PUBLIC_LOG_LEN_FOR_NOTE_COMPLETION, PRIVATE_LOG_CIPHERTEXT_LEN);
|
|
7
10
|
|
|
8
11
|
/**
|
|
9
12
|
* Intermediate struct used to perform batch log retrieval by PXE. The `utilityBulkRetrieveLogs` oracle stores values of this
|
|
@@ -19,7 +22,9 @@ export class LogRetrievalResponse {
|
|
|
19
22
|
|
|
20
23
|
toFields(): Fr[] {
|
|
21
24
|
return [
|
|
22
|
-
|
|
25
|
+
// We need to trim the payload since public logs can be larger than MAX_LOG_CONTENT_LEN.
|
|
26
|
+
// This is currently not a problem since this class is only used with public logs for note completion.
|
|
27
|
+
...serializeBoundedVec(this.logPayload.slice(0, MAX_LOG_CONTENT_LEN), MAX_LOG_CONTENT_LEN),
|
|
23
28
|
this.txHash.hash,
|
|
24
29
|
...serializeBoundedVec(this.uniqueNoteHashesInTx, MAX_NOTE_HASHES_PER_TX),
|
|
25
30
|
this.firstNullifierInTx,
|
|
@@ -37,7 +42,7 @@ export class LogRetrievalResponse {
|
|
|
37
42
|
return range(serializationLen).map(_ => Fr.zero());
|
|
38
43
|
}
|
|
39
44
|
|
|
40
|
-
static toSerializedOption(response
|
|
45
|
+
static toSerializedOption(response: LogRetrievalResponse | null): Fr[] {
|
|
41
46
|
if (response) {
|
|
42
47
|
return [new Fr(1), ...response.toFields()];
|
|
43
48
|
} else {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { FieldReader } from '@aztec/foundation/serialize';
|
|
3
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import { TxHash } from '@aztec/stdlib/tx';
|
|
5
5
|
|
|
6
6
|
// TODO(#14617): should we compute this from constants? This value is aztec-nr specific.
|
|
7
|
-
const MAX_NOTE_PACKED_LEN =
|
|
7
|
+
export const MAX_NOTE_PACKED_LEN = 10;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Intermediate struct used to perform batch note validation by PXE. The `utilityValidateEnqueuedNotesAndEvents` oracle
|
|
@@ -13,7 +13,9 @@ const MAX_NOTE_PACKED_LEN = 12;
|
|
|
13
13
|
export class NoteValidationRequest {
|
|
14
14
|
constructor(
|
|
15
15
|
public contractAddress: AztecAddress,
|
|
16
|
+
public owner: AztecAddress,
|
|
16
17
|
public storageSlot: Fr,
|
|
18
|
+
public randomness: Fr,
|
|
17
19
|
public noteNonce: Fr,
|
|
18
20
|
public content: Fr[],
|
|
19
21
|
public noteHash: Fr,
|
|
@@ -26,7 +28,9 @@ export class NoteValidationRequest {
|
|
|
26
28
|
const reader = FieldReader.asReader(fields);
|
|
27
29
|
|
|
28
30
|
const contractAddress = AztecAddress.fromField(reader.readField());
|
|
31
|
+
const owner = AztecAddress.fromField(reader.readField());
|
|
29
32
|
const storageSlot = reader.readField();
|
|
33
|
+
const randomness = reader.readField();
|
|
30
34
|
const noteNonce = reader.readField();
|
|
31
35
|
|
|
32
36
|
const contentStorage = reader.readFieldArray(MAX_NOTE_PACKED_LEN);
|
|
@@ -38,9 +42,17 @@ export class NoteValidationRequest {
|
|
|
38
42
|
const txHash = TxHash.fromField(reader.readField());
|
|
39
43
|
const recipient = AztecAddress.fromField(reader.readField());
|
|
40
44
|
|
|
45
|
+
if (reader.remainingFields() !== 0) {
|
|
46
|
+
throw new Error(
|
|
47
|
+
`Error converting array of fields to NoteValidationRequest. Hint: check that MAX_NOTE_PACKED_LEN is consistent with private_notes::MAX_NOTE_PACKED_LEN in Aztec-nr.`,
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
41
51
|
return new NoteValidationRequest(
|
|
42
52
|
contractAddress,
|
|
53
|
+
owner,
|
|
43
54
|
storageSlot,
|
|
55
|
+
randomness,
|
|
44
56
|
noteNonce,
|
|
45
57
|
content,
|
|
46
58
|
noteHash,
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import type { FieldsOf } from '@aztec/foundation/types';
|
|
3
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
+
import type { UInt64 } from '@aztec/stdlib/types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* TypeScript counterpart of utility_context.nr. Used only as a return value for the utilityGetUtilityContext oracle.
|
|
8
|
+
*/
|
|
9
|
+
export class UtilityContext {
|
|
10
|
+
private constructor(
|
|
11
|
+
public readonly blockNumber: number,
|
|
12
|
+
public readonly timestamp: UInt64,
|
|
13
|
+
public readonly contractAddress: AztecAddress,
|
|
14
|
+
public readonly version: Fr,
|
|
15
|
+
public readonly chainId: Fr,
|
|
16
|
+
) {}
|
|
17
|
+
|
|
18
|
+
static from(fields: FieldsOf<UtilityContext>) {
|
|
19
|
+
return new UtilityContext(
|
|
20
|
+
fields.blockNumber,
|
|
21
|
+
fields.timestamp,
|
|
22
|
+
fields.contractAddress,
|
|
23
|
+
fields.version,
|
|
24
|
+
fields.chainId,
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Returns a representation of the utility context as expected by intrinsic Noir deserialization.
|
|
30
|
+
* The order of the fields has to be the same as the order of the fields in the utility_context.nr.
|
|
31
|
+
*/
|
|
32
|
+
public toNoirRepresentation(): (string | string[])[] {
|
|
33
|
+
// TODO(#12874): remove the stupid as string conversion by modifying ForeignCallOutput type in acvm.js
|
|
34
|
+
return [
|
|
35
|
+
new Fr(this.blockNumber).toString() as string,
|
|
36
|
+
new Fr(this.timestamp).toString() as string,
|
|
37
|
+
this.contractAddress.toString() as string,
|
|
38
|
+
this.version.toString() as string,
|
|
39
|
+
this.chainId.toString() as string,
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
}
|