@aztec/pxe 0.0.1-commit.f146247c → 0.0.1-commit.f224bb98b
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/access_scopes.d.ts +9 -0
- package/dest/access_scopes.d.ts.map +1 -0
- package/dest/access_scopes.js +6 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts +4 -2
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +7 -1
- package/dest/config/index.d.ts +2 -2
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +1 -1
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +54 -28
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +177 -71
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +5 -5
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +3 -3
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +2 -3
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +5 -4
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -3
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +2 -4
- 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 +3 -5
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +48 -45
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.d.ts +43 -44
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +148 -98
- package/dest/contract_function_simulator/oracle/private_execution.js +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +55 -68
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +99 -73
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +66 -44
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +101 -83
- package/dest/contract_logging.d.ts +22 -0
- package/dest/contract_logging.d.ts.map +1 -0
- package/dest/contract_logging.js +23 -0
- package/dest/contract_sync/contract_sync_service.d.ts +43 -0
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
- package/dest/contract_sync/contract_sync_service.js +97 -0
- package/dest/contract_sync/helpers.d.ts +29 -0
- package/dest/contract_sync/helpers.d.ts.map +1 -0
- package/dest/contract_sync/{index.js → helpers.js} +13 -12
- package/dest/debug/pxe_debug_utils.d.ts +14 -10
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +16 -15
- package/dest/entrypoints/client/bundle/index.d.ts +4 -1
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +3 -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 +9 -1
- package/dest/entrypoints/client/lazy/index.d.ts +4 -1
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +3 -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 +9 -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 +3 -1
- package/dest/entrypoints/server/utils.js +9 -1
- package/dest/logs/log_service.d.ts +3 -2
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +11 -18
- package/dest/notes/note_service.d.ts +4 -3
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +3 -2
- package/dest/notes_filter.d.ts +25 -0
- package/dest/notes_filter.d.ts.map +1 -0
- package/dest/notes_filter.js +4 -0
- package/dest/oracle_version.d.ts +2 -2
- package/dest/oracle_version.js +3 -3
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
- package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
- package/dest/private_kernel/hints/index.d.ts +1 -1
- package/dest/private_kernel/hints/index.js +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +4 -3
- 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 +129 -68
- package/dest/private_kernel/hints/test_utils.d.ts +122 -0
- package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
- package/dest/private_kernel/hints/test_utils.js +203 -0
- 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 +19 -11
- package/dest/private_kernel/private_kernel_oracle.d.ts +6 -2
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +7 -3
- package/dest/pxe.d.ts +71 -24
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +100 -64
- package/dest/storage/contract_store/contract_store.d.ts +42 -15
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
- package/dest/storage/contract_store/contract_store.js +145 -69
- package/dest/storage/note_store/note_store.d.ts +3 -3
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +6 -4
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +6 -6
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +5 -5
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.js +4 -4
- package/dest/tagging/get_all_logs_by_tags.d.ts +1 -1
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
- package/dest/tagging/get_all_logs_by_tags.js +17 -3
- package/dest/tagging/index.d.ts +2 -2
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +4 -5
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +7 -7
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +6 -7
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +12 -11
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +4 -8
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +3 -6
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +4 -7
- 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 +14 -15
- package/package.json +25 -16
- package/src/access_scopes.ts +9 -0
- package/src/block_synchronizer/block_synchronizer.ts +6 -0
- package/src/config/index.ts +1 -1
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +326 -131
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +5 -5
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +8 -5
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -4
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +3 -6
- package/src/contract_function_simulator/oracle/interfaces.ts +48 -54
- package/src/contract_function_simulator/oracle/oracle.ts +146 -139
- package/src/contract_function_simulator/oracle/private_execution.ts +1 -1
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +126 -164
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +149 -91
- package/src/contract_logging.ts +39 -0
- package/src/contract_sync/contract_sync_service.ts +152 -0
- package/src/contract_sync/{index.ts → helpers.ts} +21 -21
- package/src/debug/pxe_debug_utils.ts +48 -18
- package/src/entrypoints/client/bundle/index.ts +3 -0
- package/src/entrypoints/client/bundle/utils.ts +9 -1
- package/src/entrypoints/client/lazy/index.ts +3 -0
- package/src/entrypoints/client/lazy/utils.ts +9 -1
- package/src/entrypoints/server/index.ts +3 -1
- package/src/entrypoints/server/utils.ts +7 -7
- package/src/logs/log_service.ts +18 -25
- package/src/notes/note_service.ts +4 -3
- package/src/notes_filter.ts +26 -0
- package/src/oracle_version.ts +3 -3
- package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
- package/src/private_kernel/hints/index.ts +1 -1
- package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +164 -117
- package/src/private_kernel/hints/test_utils.ts +325 -0
- package/src/private_kernel/private_kernel_execution_prover.ts +19 -12
- package/src/private_kernel/private_kernel_oracle.ts +7 -7
- package/src/pxe.ts +184 -113
- package/src/storage/contract_store/contract_store.ts +174 -75
- package/src/storage/note_store/note_store.ts +12 -5
- package/src/storage/tagging_store/recipient_tagging_store.ts +9 -5
- package/src/storage/tagging_store/sender_tagging_store.ts +8 -8
- package/src/tagging/get_all_logs_by_tags.ts +28 -4
- package/src/tagging/index.ts +1 -1
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +7 -10
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +10 -15
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +4 -9
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +11 -20
- package/dest/contract_sync/index.d.ts +0 -23
- package/dest/contract_sync/index.d.ts.map +0 -1
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
|
@@ -48,11 +48,11 @@ export class UnavailableOracleError extends Error {
|
|
|
48
48
|
];
|
|
49
49
|
// Get all the oracle function names
|
|
50
50
|
const oracleNames = Object.getOwnPropertyNames(Oracle.prototype).filter((name)=>!excludedProps.includes(name));
|
|
51
|
-
// Validate oracle names - these must be prefixed with either "
|
|
51
|
+
// Validate oracle names - these must be prefixed with either "aztec_prv_" or "aztec_utl_" to indicate their scope
|
|
52
52
|
// and must correspond to a function on the Oracle class.
|
|
53
53
|
oracleNames.forEach((name)=>{
|
|
54
|
-
if (!name.startsWith('
|
|
55
|
-
throw new Error(`Oracle function "${name}" must be prefixed with either "
|
|
54
|
+
if (!name.startsWith('aztec_prv_') && !name.startsWith('aztec_utl_')) {
|
|
55
|
+
throw new Error(`Oracle function "${name}" must be prefixed with either "aztec_prv_" or "aztec_utl_" to indicate its scope`);
|
|
56
56
|
}
|
|
57
57
|
const method = this[name];
|
|
58
58
|
if (typeof method !== 'function') {
|
|
@@ -66,36 +66,43 @@ export class UnavailableOracleError extends Error {
|
|
|
66
66
|
return acc;
|
|
67
67
|
}, {});
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
// eslint-disable-next-line camelcase
|
|
70
|
+
aztec_utl_assertCompatibleOracleVersion([version]) {
|
|
71
|
+
this.handlerAsMisc().assertCompatibleOracleVersion(Fr.fromString(version).toNumber());
|
|
71
72
|
return Promise.resolve([]);
|
|
72
73
|
}
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
// eslint-disable-next-line camelcase
|
|
75
|
+
aztec_utl_getRandomField() {
|
|
76
|
+
const val = this.handlerAsMisc().getRandomField();
|
|
75
77
|
return Promise.resolve([
|
|
76
78
|
toACVMField(val)
|
|
77
79
|
]);
|
|
78
80
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
// eslint-disable-next-line camelcase
|
|
82
|
+
aztec_prv_storeInExecutionCache(values, [hash]) {
|
|
83
|
+
this.handlerAsPrivate().storeInExecutionCache(values.map(Fr.fromString), Fr.fromString(hash));
|
|
81
84
|
return Promise.resolve([]);
|
|
82
85
|
}
|
|
83
|
-
|
|
84
|
-
|
|
86
|
+
// eslint-disable-next-line camelcase
|
|
87
|
+
async aztec_prv_loadFromExecutionCache([returnsHash]) {
|
|
88
|
+
const values = await this.handlerAsPrivate().loadFromExecutionCache(Fr.fromString(returnsHash));
|
|
85
89
|
return [
|
|
86
90
|
values.map(toACVMField)
|
|
87
91
|
];
|
|
88
92
|
}
|
|
89
|
-
|
|
90
|
-
|
|
93
|
+
// eslint-disable-next-line camelcase
|
|
94
|
+
aztec_utl_getUtilityContext() {
|
|
95
|
+
const context = this.handlerAsUtility().getUtilityContext();
|
|
91
96
|
return Promise.resolve(context.toNoirRepresentation());
|
|
92
97
|
}
|
|
93
|
-
|
|
94
|
-
|
|
98
|
+
// eslint-disable-next-line camelcase
|
|
99
|
+
async aztec_utl_getKeyValidationRequest([pkMHash]) {
|
|
100
|
+
const keyValidationRequest = await this.handlerAsUtility().getKeyValidationRequest(Fr.fromString(pkMHash));
|
|
95
101
|
return keyValidationRequest.toFields().map(toACVMField);
|
|
96
102
|
}
|
|
97
|
-
|
|
98
|
-
|
|
103
|
+
// eslint-disable-next-line camelcase
|
|
104
|
+
async aztec_utl_getContractInstance([address]) {
|
|
105
|
+
const instance = await this.handlerAsUtility().getContractInstance(AztecAddress.fromField(Fr.fromString(address)));
|
|
99
106
|
return [
|
|
100
107
|
instance.salt,
|
|
101
108
|
instance.deployer,
|
|
@@ -104,62 +111,69 @@ export class UnavailableOracleError extends Error {
|
|
|
104
111
|
...instance.publicKeys.toFields()
|
|
105
112
|
].map(toACVMField);
|
|
106
113
|
}
|
|
107
|
-
|
|
114
|
+
// eslint-disable-next-line camelcase
|
|
115
|
+
async aztec_utl_getNoteHashMembershipWitness([anchorBlockHash], [noteHash]) {
|
|
108
116
|
const parsedAnchorBlockHash = BlockHash.fromString(anchorBlockHash);
|
|
109
117
|
const parsedNoteHash = Fr.fromString(noteHash);
|
|
110
|
-
const witness = await this.handlerAsUtility().
|
|
118
|
+
const witness = await this.handlerAsUtility().getNoteHashMembershipWitness(parsedAnchorBlockHash, parsedNoteHash);
|
|
111
119
|
if (!witness) {
|
|
112
120
|
throw new Error(`Note hash ${noteHash} not found in the note hash tree at anchor block hash ${parsedAnchorBlockHash.toString()}.`);
|
|
113
121
|
}
|
|
114
122
|
return witness.toNoirRepresentation();
|
|
115
123
|
}
|
|
116
|
-
|
|
124
|
+
// eslint-disable-next-line camelcase
|
|
125
|
+
async aztec_utl_getBlockHashMembershipWitness([anchorBlockHash], [blockHash]) {
|
|
117
126
|
const parsedAnchorBlockHash = BlockHash.fromString(anchorBlockHash);
|
|
118
127
|
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
119
|
-
const witness = await this.handlerAsUtility().
|
|
128
|
+
const witness = await this.handlerAsUtility().getBlockHashMembershipWitness(parsedAnchorBlockHash, parsedBlockHash);
|
|
120
129
|
if (!witness) {
|
|
121
130
|
throw new Error(`Block hash ${parsedBlockHash.toString()} not found in the archive tree at anchor block ${parsedAnchorBlockHash.toString()}.`);
|
|
122
131
|
}
|
|
123
132
|
return witness.toNoirRepresentation();
|
|
124
133
|
}
|
|
125
|
-
|
|
134
|
+
// eslint-disable-next-line camelcase
|
|
135
|
+
async aztec_utl_getNullifierMembershipWitness([blockHash], [nullifier]) {
|
|
126
136
|
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
127
137
|
const parsedNullifier = Fr.fromString(nullifier);
|
|
128
|
-
const witness = await this.handlerAsUtility().
|
|
138
|
+
const witness = await this.handlerAsUtility().getNullifierMembershipWitness(parsedBlockHash, parsedNullifier);
|
|
129
139
|
if (!witness) {
|
|
130
140
|
throw new Error(`Nullifier witness not found for nullifier ${parsedNullifier} at block hash ${parsedBlockHash.toString()}.`);
|
|
131
141
|
}
|
|
132
142
|
return witness.toNoirRepresentation();
|
|
133
143
|
}
|
|
134
|
-
|
|
144
|
+
// eslint-disable-next-line camelcase
|
|
145
|
+
async aztec_utl_getLowNullifierMembershipWitness([blockHash], [nullifier]) {
|
|
135
146
|
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
136
147
|
const parsedNullifier = Fr.fromString(nullifier);
|
|
137
|
-
const witness = await this.handlerAsUtility().
|
|
148
|
+
const witness = await this.handlerAsUtility().getLowNullifierMembershipWitness(parsedBlockHash, parsedNullifier);
|
|
138
149
|
if (!witness) {
|
|
139
150
|
throw new Error(`Low nullifier witness not found for nullifier ${parsedNullifier} at block hash ${parsedBlockHash.toString()}.`);
|
|
140
151
|
}
|
|
141
152
|
return witness.toNoirRepresentation();
|
|
142
153
|
}
|
|
143
|
-
|
|
154
|
+
// eslint-disable-next-line camelcase
|
|
155
|
+
async aztec_utl_getPublicDataWitness([blockHash], [leafSlot]) {
|
|
144
156
|
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
145
157
|
const parsedLeafSlot = Fr.fromString(leafSlot);
|
|
146
|
-
const witness = await this.handlerAsUtility().
|
|
158
|
+
const witness = await this.handlerAsUtility().getPublicDataWitness(parsedBlockHash, parsedLeafSlot);
|
|
147
159
|
if (!witness) {
|
|
148
160
|
throw new Error(`Public data witness not found for slot ${parsedLeafSlot} at block hash ${parsedBlockHash.toString()}.`);
|
|
149
161
|
}
|
|
150
162
|
return witness.toNoirRepresentation();
|
|
151
163
|
}
|
|
152
|
-
|
|
164
|
+
// eslint-disable-next-line camelcase
|
|
165
|
+
async aztec_utl_getBlockHeader([blockNumber]) {
|
|
153
166
|
const parsedBlockNumber = Fr.fromString(blockNumber).toNumber();
|
|
154
|
-
const header = await this.handlerAsUtility().
|
|
167
|
+
const header = await this.handlerAsUtility().getBlockHeader(BlockNumber(parsedBlockNumber));
|
|
155
168
|
if (!header) {
|
|
156
169
|
throw new Error(`Block header not found for block ${parsedBlockNumber}.`);
|
|
157
170
|
}
|
|
158
171
|
return header.toFields().map(toACVMField);
|
|
159
172
|
}
|
|
160
|
-
|
|
173
|
+
// eslint-disable-next-line camelcase
|
|
174
|
+
async aztec_utl_getAuthWitness([messageHash]) {
|
|
161
175
|
const messageHashField = Fr.fromString(messageHash);
|
|
162
|
-
const witness = await this.handlerAsUtility().
|
|
176
|
+
const witness = await this.handlerAsUtility().getAuthWitness(messageHashField);
|
|
163
177
|
if (!witness) {
|
|
164
178
|
throw new Error(`Unknown auth witness for message hash ${messageHashField}`);
|
|
165
179
|
}
|
|
@@ -167,20 +181,34 @@ export class UnavailableOracleError extends Error {
|
|
|
167
181
|
witness.map(toACVMField)
|
|
168
182
|
];
|
|
169
183
|
}
|
|
170
|
-
|
|
184
|
+
// eslint-disable-next-line camelcase
|
|
185
|
+
async aztec_utl_tryGetPublicKeysAndPartialAddress([address]) {
|
|
171
186
|
const parsedAddress = AztecAddress.fromField(Fr.fromString(address));
|
|
172
|
-
const
|
|
173
|
-
return
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
187
|
+
const result = await this.handlerAsUtility().tryGetPublicKeysAndPartialAddress(parsedAddress);
|
|
188
|
+
// We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
|
|
189
|
+
// with two fields: `some` (a boolean) and `value` (a field array in this case).
|
|
190
|
+
if (result === undefined) {
|
|
191
|
+
// No data was found so we set `some` to 0 and pad `value` with zeros get the correct return size.
|
|
192
|
+
return [
|
|
193
|
+
toACVMField(0),
|
|
194
|
+
Array(13).fill(toACVMField(0))
|
|
195
|
+
];
|
|
196
|
+
} else {
|
|
197
|
+
// Data was found so we set `some` to 1 and return it along with `value`.
|
|
198
|
+
return [
|
|
199
|
+
toACVMField(1),
|
|
200
|
+
[
|
|
201
|
+
...result.publicKeys.toFields(),
|
|
202
|
+
result.partialAddress
|
|
203
|
+
].map(toACVMField)
|
|
204
|
+
];
|
|
205
|
+
}
|
|
179
206
|
}
|
|
180
|
-
|
|
207
|
+
// eslint-disable-next-line camelcase
|
|
208
|
+
async aztec_utl_getNotes([ownerSome], [ownerValue], [storageSlot], [numSelects], selectByIndexes, selectByOffsets, selectByLengths, selectValues, selectComparators, sortByIndexes, sortByOffsets, sortByLengths, sortOrder, [limit], [offset], [status], [maxNotes], [packedHintedNoteLength]) {
|
|
181
209
|
// Parse Option<AztecAddress>: ownerSome is 0 for None, 1 for Some
|
|
182
210
|
const owner = Fr.fromString(ownerSome).toNumber() === 1 ? AztecAddress.fromString(ownerValue) : undefined;
|
|
183
|
-
const noteDatas = await this.handlerAsUtility().
|
|
211
|
+
const noteDatas = await this.handlerAsUtility().getNotes(owner, Fr.fromString(storageSlot), +numSelects, selectByIndexes.map((s)=>+s), selectByOffsets.map((s)=>+s), selectByLengths.map((s)=>+s), selectValues.map(Fr.fromString), selectComparators.map((s)=>+s), sortByIndexes.map((s)=>+s), sortByOffsets.map((s)=>+s), sortByLengths.map((s)=>+s), sortOrder.map((s)=>+s), +limit, +offset, +status);
|
|
184
212
|
const returnDataAsArrayOfPackedHintedNotes = noteDatas.map((noteData)=>packAsHintedNote({
|
|
185
213
|
contractAddress: noteData.contractAddress,
|
|
186
214
|
owner: noteData.owner,
|
|
@@ -195,57 +223,67 @@ export class UnavailableOracleError extends Error {
|
|
|
195
223
|
// At last we convert the array of arrays to a bounded vec of arrays
|
|
196
224
|
return arrayOfArraysToBoundedVecOfArrays(returnDataAsArrayOfACVMFieldArrays, +maxNotes, +packedHintedNoteLength);
|
|
197
225
|
}
|
|
198
|
-
|
|
199
|
-
|
|
226
|
+
// eslint-disable-next-line camelcase
|
|
227
|
+
aztec_prv_notifyCreatedNote([owner], [storageSlot], [randomness], [noteTypeId], note, [noteHash], [counter]) {
|
|
228
|
+
this.handlerAsPrivate().notifyCreatedNote(AztecAddress.fromString(owner), Fr.fromString(storageSlot), Fr.fromString(randomness), NoteSelector.fromField(Fr.fromString(noteTypeId)), note.map(Fr.fromString), Fr.fromString(noteHash), +counter);
|
|
200
229
|
return Promise.resolve([]);
|
|
201
230
|
}
|
|
202
|
-
|
|
203
|
-
|
|
231
|
+
// eslint-disable-next-line camelcase
|
|
232
|
+
async aztec_prv_notifyNullifiedNote([innerNullifier], [noteHash], [counter]) {
|
|
233
|
+
await this.handlerAsPrivate().notifyNullifiedNote(Fr.fromString(innerNullifier), Fr.fromString(noteHash), +counter);
|
|
204
234
|
return [];
|
|
205
235
|
}
|
|
206
|
-
|
|
207
|
-
|
|
236
|
+
// eslint-disable-next-line camelcase
|
|
237
|
+
async aztec_prv_notifyCreatedNullifier([innerNullifier]) {
|
|
238
|
+
await this.handlerAsPrivate().notifyCreatedNullifier(Fr.fromString(innerNullifier));
|
|
208
239
|
return [];
|
|
209
240
|
}
|
|
210
|
-
|
|
211
|
-
|
|
241
|
+
// eslint-disable-next-line camelcase
|
|
242
|
+
async aztec_prv_isNullifierPending([innerNullifier], [contractAddress]) {
|
|
243
|
+
const isPending = await this.handlerAsPrivate().isNullifierPending(Fr.fromString(innerNullifier), AztecAddress.fromString(contractAddress));
|
|
212
244
|
return [
|
|
213
245
|
toACVMField(isPending)
|
|
214
246
|
];
|
|
215
247
|
}
|
|
216
|
-
|
|
217
|
-
|
|
248
|
+
// eslint-disable-next-line camelcase
|
|
249
|
+
async aztec_utl_checkNullifierExists([innerNullifier]) {
|
|
250
|
+
const exists = await this.handlerAsUtility().checkNullifierExists(Fr.fromString(innerNullifier));
|
|
218
251
|
return [
|
|
219
252
|
toACVMField(exists)
|
|
220
253
|
];
|
|
221
254
|
}
|
|
222
|
-
|
|
223
|
-
|
|
255
|
+
// eslint-disable-next-line camelcase
|
|
256
|
+
async aztec_utl_getL1ToL2MembershipWitness([contractAddress], [messageHash], [secret]) {
|
|
257
|
+
const message = await this.handlerAsUtility().getL1ToL2MembershipWitness(AztecAddress.fromString(contractAddress), Fr.fromString(messageHash), Fr.fromString(secret));
|
|
224
258
|
return message.toNoirRepresentation();
|
|
225
259
|
}
|
|
226
|
-
|
|
227
|
-
|
|
260
|
+
// eslint-disable-next-line camelcase
|
|
261
|
+
async aztec_utl_storageRead([blockHash], [contractAddress], [startStorageSlot], [numberOfElements]) {
|
|
262
|
+
const values = await this.handlerAsUtility().storageRead(BlockHash.fromString(blockHash), new AztecAddress(Fr.fromString(contractAddress)), Fr.fromString(startStorageSlot), +numberOfElements);
|
|
228
263
|
return [
|
|
229
264
|
values.map(toACVMField)
|
|
230
265
|
];
|
|
231
266
|
}
|
|
232
|
-
|
|
267
|
+
// eslint-disable-next-line camelcase
|
|
268
|
+
aztec_prv_notifyCreatedContractClassLog([contractAddress], message, [length], [counter]) {
|
|
233
269
|
const logFields = new ContractClassLogFields(message.map(Fr.fromString));
|
|
234
270
|
const log = new ContractClassLog(new AztecAddress(Fr.fromString(contractAddress)), logFields, +length);
|
|
235
|
-
this.handlerAsPrivate().
|
|
271
|
+
this.handlerAsPrivate().notifyCreatedContractClassLog(log, +counter);
|
|
236
272
|
return Promise.resolve([]);
|
|
237
273
|
}
|
|
238
|
-
|
|
274
|
+
// eslint-disable-next-line camelcase
|
|
275
|
+
async aztec_utl_log(level, message, _ignoredFieldsSize, fields) {
|
|
239
276
|
const levelFr = Fr.fromString(level[0]);
|
|
240
277
|
const messageStr = message.map((acvmField)=>String.fromCharCode(Fr.fromString(acvmField).toNumber())).join('');
|
|
241
278
|
const fieldsFr = fields.map(Fr.fromString);
|
|
242
|
-
this.handlerAsMisc().
|
|
243
|
-
return
|
|
279
|
+
await this.handlerAsMisc().log(levelFr.toNumber(), messageStr, fieldsFr);
|
|
280
|
+
return [];
|
|
244
281
|
}
|
|
245
282
|
// This function's name is directly hardcoded in `circuit_recorder.ts`. Don't forget to update it there if you
|
|
246
283
|
// change the name here.
|
|
247
|
-
|
|
248
|
-
|
|
284
|
+
// eslint-disable-next-line camelcase
|
|
285
|
+
async aztec_prv_callPrivateFunction([contractAddress], [functionSelector], [argsHash], [sideEffectCounter], [isStaticCall]) {
|
|
286
|
+
const { endSideEffectCounter, returnsHash } = await this.handlerAsPrivate().callPrivateFunction(AztecAddress.fromField(Fr.fromString(contractAddress)), FunctionSelector.fromField(Fr.fromString(functionSelector)), Fr.fromString(argsHash), Fr.fromString(sideEffectCounter).toNumber(), Fr.fromString(isStaticCall).toBool());
|
|
249
287
|
return [
|
|
250
288
|
[
|
|
251
289
|
endSideEffectCounter,
|
|
@@ -253,48 +291,53 @@ export class UnavailableOracleError extends Error {
|
|
|
253
291
|
].map(toACVMField)
|
|
254
292
|
];
|
|
255
293
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}
|
|
260
|
-
async privateNotifySetPublicTeardownFunctionCall([contractAddress], [calldataHash], [sideEffectCounter], [isStaticCall]) {
|
|
261
|
-
await this.handlerAsPrivate().privateNotifySetPublicTeardownFunctionCall(AztecAddress.fromString(contractAddress), Fr.fromString(calldataHash), Fr.fromString(sideEffectCounter).toNumber(), Fr.fromString(isStaticCall).toBool());
|
|
294
|
+
// eslint-disable-next-line camelcase
|
|
295
|
+
async aztec_prv_validatePublicCalldata([calldataHash]) {
|
|
296
|
+
await this.handlerAsPrivate().validatePublicCalldata(Fr.fromString(calldataHash));
|
|
262
297
|
return [];
|
|
263
298
|
}
|
|
264
|
-
|
|
265
|
-
|
|
299
|
+
// eslint-disable-next-line camelcase
|
|
300
|
+
async aztec_prv_notifyRevertiblePhaseStart([minRevertibleSideEffectCounter]) {
|
|
301
|
+
await this.handlerAsPrivate().notifyRevertiblePhaseStart(Fr.fromString(minRevertibleSideEffectCounter).toNumber());
|
|
266
302
|
return Promise.resolve([]);
|
|
267
303
|
}
|
|
268
|
-
|
|
269
|
-
|
|
304
|
+
// eslint-disable-next-line camelcase
|
|
305
|
+
async aztec_prv_inRevertiblePhase([sideEffectCounter]) {
|
|
306
|
+
const isRevertible = await this.handlerAsPrivate().inRevertiblePhase(Fr.fromString(sideEffectCounter).toNumber());
|
|
270
307
|
return Promise.resolve([
|
|
271
308
|
toACVMField(isRevertible)
|
|
272
309
|
]);
|
|
273
310
|
}
|
|
274
|
-
|
|
275
|
-
|
|
311
|
+
// eslint-disable-next-line camelcase
|
|
312
|
+
async aztec_prv_getNextAppTagAsSender([sender], [recipient]) {
|
|
313
|
+
const tag = await this.handlerAsPrivate().getNextAppTagAsSender(AztecAddress.fromString(sender), AztecAddress.fromString(recipient));
|
|
276
314
|
return [
|
|
277
315
|
toACVMField(tag.value)
|
|
278
316
|
];
|
|
279
317
|
}
|
|
280
|
-
|
|
281
|
-
|
|
318
|
+
// eslint-disable-next-line camelcase
|
|
319
|
+
async aztec_utl_fetchTaggedLogs([pendingTaggedLogArrayBaseSlot]) {
|
|
320
|
+
await this.handlerAsUtility().fetchTaggedLogs(Fr.fromString(pendingTaggedLogArrayBaseSlot));
|
|
282
321
|
return [];
|
|
283
322
|
}
|
|
284
|
-
|
|
285
|
-
|
|
323
|
+
// eslint-disable-next-line camelcase
|
|
324
|
+
async aztec_utl_validateAndStoreEnqueuedNotesAndEvents([contractAddress], [noteValidationRequestsArrayBaseSlot], [eventValidationRequestsArrayBaseSlot], [maxNotePackedLen], [maxEventSerializedLen]) {
|
|
325
|
+
await this.handlerAsUtility().validateAndStoreEnqueuedNotesAndEvents(AztecAddress.fromString(contractAddress), Fr.fromString(noteValidationRequestsArrayBaseSlot), Fr.fromString(eventValidationRequestsArrayBaseSlot), Fr.fromString(maxNotePackedLen).toNumber(), Fr.fromString(maxEventSerializedLen).toNumber());
|
|
286
326
|
return [];
|
|
287
327
|
}
|
|
288
|
-
|
|
289
|
-
|
|
328
|
+
// eslint-disable-next-line camelcase
|
|
329
|
+
async aztec_utl_bulkRetrieveLogs([contractAddress], [logRetrievalRequestsArrayBaseSlot], [logRetrievalResponsesArrayBaseSlot]) {
|
|
330
|
+
await this.handlerAsUtility().bulkRetrieveLogs(AztecAddress.fromString(contractAddress), Fr.fromString(logRetrievalRequestsArrayBaseSlot), Fr.fromString(logRetrievalResponsesArrayBaseSlot));
|
|
290
331
|
return [];
|
|
291
332
|
}
|
|
292
|
-
|
|
293
|
-
|
|
333
|
+
// eslint-disable-next-line camelcase
|
|
334
|
+
async aztec_utl_storeCapsule([contractAddress], [slot], capsule) {
|
|
335
|
+
await this.handlerAsUtility().storeCapsule(AztecAddress.fromField(Fr.fromString(contractAddress)), Fr.fromString(slot), capsule.map(Fr.fromString));
|
|
294
336
|
return [];
|
|
295
337
|
}
|
|
296
|
-
|
|
297
|
-
|
|
338
|
+
// eslint-disable-next-line camelcase
|
|
339
|
+
async aztec_utl_loadCapsule([contractAddress], [slot], [tSize]) {
|
|
340
|
+
const values = await this.handlerAsUtility().loadCapsule(AztecAddress.fromField(Fr.fromString(contractAddress)), Fr.fromString(slot));
|
|
298
341
|
// We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
|
|
299
342
|
// with two fields: `some` (a boolean) and `value` (a field array in this case).
|
|
300
343
|
if (values === null) {
|
|
@@ -311,35 +354,41 @@ export class UnavailableOracleError extends Error {
|
|
|
311
354
|
];
|
|
312
355
|
}
|
|
313
356
|
}
|
|
314
|
-
|
|
315
|
-
|
|
357
|
+
// eslint-disable-next-line camelcase
|
|
358
|
+
async aztec_utl_deleteCapsule([contractAddress], [slot]) {
|
|
359
|
+
await this.handlerAsUtility().deleteCapsule(AztecAddress.fromField(Fr.fromString(contractAddress)), Fr.fromString(slot));
|
|
316
360
|
return [];
|
|
317
361
|
}
|
|
318
|
-
|
|
319
|
-
|
|
362
|
+
// eslint-disable-next-line camelcase
|
|
363
|
+
async aztec_utl_copyCapsule([contractAddress], [srcSlot], [dstSlot], [numEntries]) {
|
|
364
|
+
await this.handlerAsUtility().copyCapsule(AztecAddress.fromField(Fr.fromString(contractAddress)), Fr.fromString(srcSlot), Fr.fromString(dstSlot), Fr.fromString(numEntries).toNumber());
|
|
320
365
|
return [];
|
|
321
366
|
}
|
|
322
|
-
|
|
367
|
+
// eslint-disable-next-line camelcase
|
|
368
|
+
async aztec_utl_aes128Decrypt(ciphertextBVecStorage, [ciphertextLength], iv, symKey) {
|
|
323
369
|
const ciphertext = fromUintBoundedVec(ciphertextBVecStorage, ciphertextLength, 8);
|
|
324
370
|
const ivBuffer = fromUintArray(iv, 8);
|
|
325
371
|
const symKeyBuffer = fromUintArray(symKey, 8);
|
|
326
|
-
const plaintext = await this.handlerAsUtility().
|
|
372
|
+
const plaintext = await this.handlerAsUtility().aes128Decrypt(ciphertext, ivBuffer, symKeyBuffer);
|
|
327
373
|
return bufferToBoundedVec(plaintext, ciphertextBVecStorage.length);
|
|
328
374
|
}
|
|
329
|
-
|
|
330
|
-
|
|
375
|
+
// eslint-disable-next-line camelcase
|
|
376
|
+
async aztec_utl_getSharedSecret([address], [ephPKField0], [ephPKField1], [ephPKField2]) {
|
|
377
|
+
const secret = await this.handlerAsUtility().getSharedSecret(AztecAddress.fromField(Fr.fromString(address)), Point.fromFields([
|
|
331
378
|
ephPKField0,
|
|
332
379
|
ephPKField1,
|
|
333
380
|
ephPKField2
|
|
334
381
|
].map(Fr.fromString)));
|
|
335
382
|
return secret.toFields().map(toACVMField);
|
|
336
383
|
}
|
|
337
|
-
|
|
338
|
-
|
|
384
|
+
// eslint-disable-next-line camelcase
|
|
385
|
+
async aztec_utl_emitOffchainEffect(data) {
|
|
386
|
+
await this.handlerAsPrivate().emitOffchainEffect(data.map(Fr.fromString));
|
|
339
387
|
return [];
|
|
340
388
|
}
|
|
341
|
-
|
|
342
|
-
|
|
389
|
+
// eslint-disable-next-line camelcase
|
|
390
|
+
async aztec_prv_getSenderForTags() {
|
|
391
|
+
const sender = await this.handlerAsPrivate().getSenderForTags();
|
|
343
392
|
// Return [1, address] for Some(address), [0, 0] for None
|
|
344
393
|
return sender ? [
|
|
345
394
|
toACVMField(1n),
|
|
@@ -349,8 +398,9 @@ export class UnavailableOracleError extends Error {
|
|
|
349
398
|
toACVMField(0n)
|
|
350
399
|
];
|
|
351
400
|
}
|
|
352
|
-
|
|
353
|
-
|
|
401
|
+
// eslint-disable-next-line camelcase
|
|
402
|
+
async aztec_prv_setSenderForTags([senderForTags]) {
|
|
403
|
+
await this.handlerAsPrivate().setSenderForTags(AztecAddress.fromField(Fr.fromString(senderForTags)));
|
|
354
404
|
return [];
|
|
355
405
|
}
|
|
356
406
|
}
|
|
@@ -45,7 +45,7 @@ import { Oracle } from './oracle.js';
|
|
|
45
45
|
appCircuitName: functionName
|
|
46
46
|
});
|
|
47
47
|
const contractClassLogs = privateExecutionOracle.getContractClassLogs();
|
|
48
|
-
const rawReturnValues = await privateExecutionOracle.
|
|
48
|
+
const rawReturnValues = await privateExecutionOracle.loadFromExecutionCache(publicInputs.returnsHash);
|
|
49
49
|
const newNotes = privateExecutionOracle.getNewNotes();
|
|
50
50
|
const noteHashNullifierCounterMap = privateExecutionOracle.getNoteHashNullifierCounterMap();
|
|
51
51
|
const offchainEffects = privateExecutionOracle.getOffchainEffects();
|