@aztec/pxe 0.0.1-commit.e0f15ab9b → 0.0.1-commit.e304674f1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/block_synchronizer/block_synchronizer.d.ts +1 -1
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +6 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +3 -4
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +4 -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 +2 -5
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +2 -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 +2 -5
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +19 -19
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts +1 -1
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.js +18 -22
- package/dest/contract_function_simulator/oracle/oracle.d.ts +38 -19
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +60 -39
- package/dest/contract_function_simulator/oracle/private_execution.js +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +7 -8
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +16 -7
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +30 -29
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +115 -79
- package/dest/contract_function_simulator/pick_notes.d.ts +1 -1
- package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
- package/dest/contract_function_simulator/pick_notes.js +9 -2
- package/dest/contract_logging.d.ts +9 -4
- package/dest/contract_logging.d.ts.map +1 -1
- package/dest/contract_logging.js +21 -6
- package/dest/contract_sync/contract_sync_service.d.ts +3 -4
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -1
- package/dest/contract_sync/contract_sync_service.js +12 -22
- package/dest/contract_sync/helpers.d.ts +2 -3
- package/dest/contract_sync/helpers.d.ts.map +1 -1
- package/dest/contract_sync/helpers.js +7 -2
- package/dest/debug/pxe_debug_utils.d.ts +3 -3
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.d.ts +1 -2
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +0 -1
- package/dest/entrypoints/client/bundle/utils.d.ts +2 -2
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +2 -2
- package/dest/entrypoints/client/lazy/index.d.ts +1 -2
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +0 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +2 -2
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +2 -2
- package/dest/entrypoints/pxe_creation_options.d.ts +3 -1
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/pxe_creation_options.js +3 -1
- package/dest/entrypoints/server/index.d.ts +1 -2
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +0 -1
- package/dest/entrypoints/server/utils.d.ts +2 -2
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +2 -2
- package/dest/events/event_service.d.ts +3 -2
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +16 -4
- package/dest/logs/log_service.d.ts +6 -7
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +32 -30
- package/dest/messages/message_context_service.d.ts +3 -3
- package/dest/messages/message_context_service.d.ts.map +1 -1
- package/dest/messages/message_context_service.js +3 -3
- package/dest/notes/note_service.d.ts +4 -5
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +14 -5
- package/dest/notes_filter.d.ts +2 -3
- package/dest/notes_filter.d.ts.map +1 -1
- package/dest/oracle_version.d.ts +2 -2
- package/dest/oracle_version.js +2 -2
- package/dest/pxe.d.ts +4 -5
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +6 -4
- package/dest/storage/capsule_store/capsule_service.d.ts +21 -0
- package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -0
- package/dest/storage/capsule_store/capsule_service.js +50 -0
- package/dest/storage/capsule_store/capsule_store.d.ts +9 -9
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -1
- package/dest/storage/capsule_store/capsule_store.js +33 -28
- package/dest/storage/capsule_store/index.d.ts +2 -1
- package/dest/storage/capsule_store/index.d.ts.map +1 -1
- package/dest/storage/capsule_store/index.js +1 -0
- package/dest/storage/metadata.d.ts +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/note_store/note_store.d.ts +1 -1
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +2 -2
- package/package.json +16 -16
- package/src/block_synchronizer/block_synchronizer.ts +6 -0
- package/src/contract_function_simulator/contract_function_simulator.ts +6 -6
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +0 -3
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +0 -3
- package/src/contract_function_simulator/oracle/interfaces.ts +26 -17
- package/src/contract_function_simulator/oracle/legacy_oracle_mappings.ts +13 -50
- package/src/contract_function_simulator/oracle/oracle.ts +79 -33
- package/src/contract_function_simulator/oracle/private_execution.ts +1 -1
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +19 -10
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +204 -91
- package/src/contract_function_simulator/pick_notes.ts +9 -2
- package/src/contract_logging.ts +18 -5
- package/src/contract_sync/contract_sync_service.ts +32 -43
- package/src/contract_sync/helpers.ts +4 -4
- package/src/debug/pxe_debug_utils.ts +3 -3
- package/src/entrypoints/client/bundle/index.ts +0 -1
- package/src/entrypoints/client/bundle/utils.ts +2 -3
- package/src/entrypoints/client/lazy/index.ts +0 -1
- package/src/entrypoints/client/lazy/utils.ts +2 -3
- package/src/entrypoints/pxe_creation_options.ts +7 -0
- package/src/entrypoints/server/index.ts +0 -1
- package/src/entrypoints/server/utils.ts +2 -3
- package/src/events/event_service.ts +17 -4
- package/src/logs/log_service.ts +63 -48
- package/src/messages/message_context_service.ts +3 -4
- package/src/notes/note_service.ts +18 -8
- package/src/notes_filter.ts +1 -3
- package/src/oracle_version.ts +2 -2
- package/src/pxe.ts +11 -10
- package/src/storage/capsule_store/capsule_service.ts +90 -0
- package/src/storage/capsule_store/capsule_store.ts +34 -26
- package/src/storage/capsule_store/index.ts +1 -0
- package/src/storage/metadata.ts +1 -1
- package/src/storage/note_store/note_store.ts +2 -5
- package/dest/access_scopes.d.ts +0 -9
- package/dest/access_scopes.d.ts.map +0 -1
- package/dest/access_scopes.js +0 -6
- package/dest/contract_function_simulator/noir-structs/message_tx_context.d.ts +0 -16
- package/dest/contract_function_simulator/noir-structs/message_tx_context.d.ts.map +0 -1
- package/dest/contract_function_simulator/noir-structs/message_tx_context.js +0 -57
- package/src/access_scopes.ts +0 -9
- package/src/contract_function_simulator/noir-structs/message_tx_context.ts +0 -55
|
@@ -3,10 +3,11 @@ import { createLogger } from '@aztec/foundation/log';
|
|
|
3
3
|
export class CapsuleStore {
|
|
4
4
|
storeName = 'capsule';
|
|
5
5
|
#store;
|
|
6
|
-
// Arbitrary data stored by contracts. Key is computed as `${contractAddress}:${key}
|
|
6
|
+
// Arbitrary data stored by contracts. Key is computed as `${contractAddress}:${scope}:${key}`, using the zero
|
|
7
|
+
// address for the global scope.
|
|
7
8
|
#capsules;
|
|
8
|
-
// jobId => `${contractAddress}:${key}` => capsule data
|
|
9
|
-
// when `#stagedCapsules.get('some-job-id').get('${some-contract-address
|
|
9
|
+
// jobId => `${contractAddress}:${scope}:${key}` => capsule data
|
|
10
|
+
// when `#stagedCapsules.get('some-job-id').get('${some-contract-address}:${some-scope}:${some-key}') === null`,
|
|
10
11
|
// it signals that the capsule was deleted during the job, so it needs to be deleted on commit
|
|
11
12
|
#stagedCapsules;
|
|
12
13
|
logger;
|
|
@@ -101,8 +102,8 @@ export class CapsuleStore {
|
|
|
101
102
|
* @remarks A capsule is a "blob" of data that is passed to the contract through an oracle. It works similarly
|
|
102
103
|
* to public contract storage in that it's indexed by the contract address and storage slot but instead of the global
|
|
103
104
|
* network state it's backed by local PXE db.
|
|
104
|
-
*/
|
|
105
|
-
const dbSlotKey = dbSlotToKey(contractAddress, slot);
|
|
105
|
+
*/ setCapsule(contractAddress, slot, capsule, jobId, scope) {
|
|
106
|
+
const dbSlotKey = dbSlotToKey(contractAddress, slot, scope);
|
|
106
107
|
// A store overrides any pre-existing data on the slot
|
|
107
108
|
this.#setOnStage(jobId, dbSlotKey, Buffer.concat(capsule.map((value)=>value.toBuffer())));
|
|
108
109
|
}
|
|
@@ -111,8 +112,8 @@ export class CapsuleStore {
|
|
|
111
112
|
* @param contractAddress - The contract address under which the data is scoped.
|
|
112
113
|
* @param slot - The slot in the database to read.
|
|
113
114
|
* @returns The stored data or `null` if no data is stored under the slot.
|
|
114
|
-
*/ async
|
|
115
|
-
const dataBuffer = await this.#getFromStage(jobId, dbSlotToKey(contractAddress, slot));
|
|
115
|
+
*/ async getCapsule(contractAddress, slot, jobId, scope) {
|
|
116
|
+
const dataBuffer = await this.#getFromStage(jobId, dbSlotToKey(contractAddress, slot, scope));
|
|
116
117
|
if (!dataBuffer) {
|
|
117
118
|
this.logger.trace(`Data not found for contract ${contractAddress.toString()} and slot ${slot.toString()}`);
|
|
118
119
|
return null;
|
|
@@ -127,9 +128,9 @@ export class CapsuleStore {
|
|
|
127
128
|
* Deletes data in the per-contract non-volatile database. Does nothing if no data was present.
|
|
128
129
|
* @param contractAddress - The contract address under which the data is scoped.
|
|
129
130
|
* @param slot - The slot in the database to delete.
|
|
130
|
-
*/ deleteCapsule(contractAddress, slot, jobId) {
|
|
131
|
+
*/ deleteCapsule(contractAddress, slot, jobId, scope) {
|
|
131
132
|
// When we commit this, we will interpret null as a deletion, so we'll propagate the delete to the KV store
|
|
132
|
-
this.#deleteOnStage(jobId, dbSlotToKey(contractAddress, slot));
|
|
133
|
+
this.#deleteOnStage(jobId, dbSlotToKey(contractAddress, slot, scope));
|
|
133
134
|
}
|
|
134
135
|
/**
|
|
135
136
|
* Copies a number of contiguous entries in the per-contract non-volatile database. This allows for efficient data
|
|
@@ -141,7 +142,7 @@ export class CapsuleStore {
|
|
|
141
142
|
* @param srcSlot - The first slot to copy from.
|
|
142
143
|
* @param dstSlot - The first slot to copy to.
|
|
143
144
|
* @param numEntries - The number of entries to copy.
|
|
144
|
-
*/ copyCapsule(contractAddress, srcSlot, dstSlot, numEntries, jobId) {
|
|
145
|
+
*/ copyCapsule(contractAddress, srcSlot, dstSlot, numEntries, jobId, scope) {
|
|
145
146
|
// This transactional context gives us "copy atomicity":
|
|
146
147
|
// there shouldn't be concurrent writes to what's being copied here.
|
|
147
148
|
// Equally important: this in practice is expected to perform thousands of DB operations
|
|
@@ -156,8 +157,8 @@ export class CapsuleStore {
|
|
|
156
157
|
indexes.reverse();
|
|
157
158
|
}
|
|
158
159
|
for (const i of indexes){
|
|
159
|
-
const currentSrcSlot = dbSlotToKey(contractAddress, srcSlot.add(new Fr(i)));
|
|
160
|
-
const currentDstSlot = dbSlotToKey(contractAddress, dstSlot.add(new Fr(i)));
|
|
160
|
+
const currentSrcSlot = dbSlotToKey(contractAddress, srcSlot.add(new Fr(i)), scope);
|
|
161
|
+
const currentDstSlot = dbSlotToKey(contractAddress, dstSlot.add(new Fr(i)), scope);
|
|
161
162
|
const toCopy = await this.#getFromStage(jobId, currentSrcSlot);
|
|
162
163
|
if (!toCopy) {
|
|
163
164
|
throw new Error(`Attempted to copy empty slot ${currentSrcSlot} for contract ${contractAddress.toString()}`);
|
|
@@ -173,7 +174,7 @@ export class CapsuleStore {
|
|
|
173
174
|
* @param contractAddress - The contract address that owns the capsule array
|
|
174
175
|
* @param baseSlot - The slot where the array length is stored
|
|
175
176
|
* @param content - Array of capsule data to append
|
|
176
|
-
*/ appendToCapsuleArray(contractAddress, baseSlot, content, jobId) {
|
|
177
|
+
*/ appendToCapsuleArray(contractAddress, baseSlot, content, jobId, scope) {
|
|
177
178
|
// We wrap this in a transaction to serialize concurrent calls from Promise.all.
|
|
178
179
|
// Without this, concurrent appends to the same array could race: both read length=0,
|
|
179
180
|
// both write at the same slots, one overwrites the other.
|
|
@@ -181,21 +182,21 @@ export class CapsuleStore {
|
|
|
181
182
|
// and not using a transaction here would heavily impact performance.
|
|
182
183
|
return this.#store.transactionAsync(async ()=>{
|
|
183
184
|
// Load current length, defaulting to 0 if not found
|
|
184
|
-
const lengthData = await this.
|
|
185
|
+
const lengthData = await this.getCapsule(contractAddress, baseSlot, jobId, scope);
|
|
185
186
|
const currentLength = lengthData ? lengthData[0].toNumber() : 0;
|
|
186
187
|
// Store each capsule at consecutive slots after baseSlot + 1 + currentLength
|
|
187
188
|
for(let i = 0; i < content.length; i++){
|
|
188
189
|
const nextSlot = arraySlot(baseSlot, currentLength + i);
|
|
189
|
-
this.
|
|
190
|
+
this.setCapsule(contractAddress, nextSlot, content[i], jobId, scope);
|
|
190
191
|
}
|
|
191
192
|
// Update length to include all new capsules
|
|
192
193
|
const newLength = currentLength + content.length;
|
|
193
|
-
this.
|
|
194
|
+
this.setCapsule(contractAddress, baseSlot, [
|
|
194
195
|
new Fr(newLength)
|
|
195
|
-
], jobId);
|
|
196
|
+
], jobId, scope);
|
|
196
197
|
});
|
|
197
198
|
}
|
|
198
|
-
readCapsuleArray(contractAddress, baseSlot, jobId) {
|
|
199
|
+
readCapsuleArray(contractAddress, baseSlot, jobId, scope) {
|
|
199
200
|
// I'm leaving this transactional context here though because I'm assuming this
|
|
200
201
|
// gives us "read array atomicity": there shouldn't be concurrent writes to what's being copied
|
|
201
202
|
// here.
|
|
@@ -203,12 +204,12 @@ export class CapsuleStore {
|
|
|
203
204
|
// of jobs: different calls running concurrently on the same contract may cause trouble.
|
|
204
205
|
return this.#store.transactionAsync(async ()=>{
|
|
205
206
|
// Load length, defaulting to 0 if not found
|
|
206
|
-
const maybeLength = await this.
|
|
207
|
+
const maybeLength = await this.getCapsule(contractAddress, baseSlot, jobId, scope);
|
|
207
208
|
const length = maybeLength ? maybeLength[0].toBigInt() : 0n;
|
|
208
209
|
const values = [];
|
|
209
210
|
// Read each capsule at consecutive slots after baseSlot
|
|
210
211
|
for(let i = 0; i < length; i++){
|
|
211
|
-
const currentValue = await this.
|
|
212
|
+
const currentValue = await this.getCapsule(contractAddress, arraySlot(baseSlot, i), jobId, scope);
|
|
212
213
|
if (currentValue == undefined) {
|
|
213
214
|
throw new Error(`Expected non-empty value at capsule array in base slot ${baseSlot} at index ${i} for contract ${contractAddress}`);
|
|
214
215
|
}
|
|
@@ -217,7 +218,7 @@ export class CapsuleStore {
|
|
|
217
218
|
return values;
|
|
218
219
|
});
|
|
219
220
|
}
|
|
220
|
-
setCapsuleArray(contractAddress, baseSlot, content, jobId) {
|
|
221
|
+
setCapsuleArray(contractAddress, baseSlot, content, jobId, scope) {
|
|
221
222
|
// This transactional context in theory isn't so critical now because we aren't
|
|
222
223
|
// writing to DB so if there's exceptions midway and it blows up, no visible impact
|
|
223
224
|
// to persistent storage will happen.
|
|
@@ -228,25 +229,29 @@ export class CapsuleStore {
|
|
|
228
229
|
// of jobs: different calls running concurrently on the same contract may cause trouble.
|
|
229
230
|
return this.#store.transactionAsync(async ()=>{
|
|
230
231
|
// Load current length, defaulting to 0 if not found
|
|
231
|
-
const maybeLength = await this.
|
|
232
|
+
const maybeLength = await this.getCapsule(contractAddress, baseSlot, jobId, scope);
|
|
232
233
|
const originalLength = maybeLength ? maybeLength[0].toNumber() : 0;
|
|
233
234
|
// Set the new length
|
|
234
|
-
this.
|
|
235
|
+
this.setCapsule(contractAddress, baseSlot, [
|
|
235
236
|
new Fr(content.length)
|
|
236
|
-
], jobId);
|
|
237
|
+
], jobId, scope);
|
|
237
238
|
// Store the new content, possibly overwriting existing values
|
|
238
239
|
for(let i = 0; i < content.length; i++){
|
|
239
|
-
this.
|
|
240
|
+
this.setCapsule(contractAddress, arraySlot(baseSlot, i), content[i], jobId, scope);
|
|
240
241
|
}
|
|
241
242
|
// Clear any stragglers
|
|
242
243
|
for(let i = content.length; i < originalLength; i++){
|
|
243
|
-
this.deleteCapsule(contractAddress, arraySlot(baseSlot, i), jobId);
|
|
244
|
+
this.deleteCapsule(contractAddress, arraySlot(baseSlot, i), jobId, scope);
|
|
244
245
|
}
|
|
245
246
|
});
|
|
246
247
|
}
|
|
247
248
|
}
|
|
248
|
-
function dbSlotToKey(contractAddress, slot) {
|
|
249
|
-
return
|
|
249
|
+
function dbSlotToKey(contractAddress, slot, scope) {
|
|
250
|
+
return [
|
|
251
|
+
contractAddress.toString(),
|
|
252
|
+
scope.toString(),
|
|
253
|
+
slot.toString()
|
|
254
|
+
].join(':');
|
|
250
255
|
}
|
|
251
256
|
function arraySlot(baseSlot, index) {
|
|
252
257
|
return baseSlot.add(new Fr(1)).add(new Fr(index));
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
export { CapsuleService } from './capsule_service.js';
|
|
1
2
|
export { CapsuleStore } from './capsule_store.js';
|
|
2
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL2NhcHN1bGVfc3RvcmUvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQ3RELE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/capsule_store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/capsule_store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const PXE_DATA_SCHEMA_VERSION =
|
|
1
|
+
export declare const PXE_DATA_SCHEMA_VERSION = 5;
|
|
2
2
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWV0YWRhdGEuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zdG9yYWdlL21ldGFkYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGVBQU8sTUFBTSx1QkFBdUIsSUFBSSxDQUFDIn0=
|
package/dest/storage/metadata.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PXE_DATA_SCHEMA_VERSION =
|
|
1
|
+
export const PXE_DATA_SCHEMA_VERSION = 5;
|
|
@@ -80,4 +80,4 @@ export declare class NoteStore implements StagedStore {
|
|
|
80
80
|
commit(jobId: string): Promise<void>;
|
|
81
81
|
discardStaged(jobId: string): Promise<void>;
|
|
82
82
|
}
|
|
83
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
83
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm90ZV9zdG9yZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0b3JhZ2Uvbm90ZV9zdG9yZS9ub3RlX3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLEVBQUUsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBQ3BELE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFxQyxNQUFNLGlCQUFpQixDQUFDO0FBQzVGLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBQ3ZELE9BQU8sRUFBRSxPQUFPLEVBQWMsTUFBTSxvQkFBb0IsQ0FBQztBQUV6RCxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSwwQ0FBMEMsQ0FBQztBQUM1RSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUd6RDs7Ozs7SUFLSTtBQUNKLHFCQUFhLFNBQVUsWUFBVyxXQUFXOztJQUMzQyxRQUFRLENBQUMsU0FBUyxFQUFFLE1BQU0sQ0FBVTtJQStCcEMsWUFBWSxLQUFLLEVBQUUsaUJBQWlCLEVBUW5DO0lBRUQ7Ozs7Ozs7OztPQVNHO0lBQ0ksUUFBUSxDQUFDLEtBQUssRUFBRSxPQUFPLEVBQUUsRUFBRSxLQUFLLEVBQUUsWUFBWSxFQUFFLEtBQUssRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLElBQUksRUFBRSxDQUFDLENBYXJGO0lBY0Q7Ozs7Ozs7Ozs7T0FVRztJQUNILFFBQVEsQ0FBQyxNQUFNLEVBQUUsV0FBVyxFQUFFLEtBQUssRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLE9BQU8sRUFBRSxDQUFDLENBNkYvRDtJQUVEOzs7Ozs7Ozs7Ozs7OztPQWNHO0lBQ0gsZUFBZSxDQUFDLFVBQVUsRUFBRSxXQUFXLENBQUMsRUFBRSxDQUFDLEVBQUUsRUFBRSxLQUFLLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxPQUFPLEVBQUUsQ0FBQyxDQXlDaEY7SUFFRDs7Ozs7Ozs7Ozs7T0FXRztJQUNVLFFBQVEsQ0FBQyxXQUFXLEVBQUUsTUFBTSxFQUFFLGtCQUFrQixFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBTXBGO0lBNkVEOzs7Ozs7Ozs7T0FTRztJQUNHLE1BQU0sQ0FBQyxLQUFLLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FVekM7SUFFRCxhQUFhLENBQUMsS0FBSyxFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBRzFDO0NBa0NGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"note_store.d.ts","sourceRoot":"","sources":["../../../src/storage/note_store/note_store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAqC,MAAM,iBAAiB,CAAC;AAC5F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAc,MAAM,oBAAoB,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGzD;;;;;IAKI;AACJ,qBAAa,SAAU,YAAW,WAAW;;IAC3C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAU;IA+BpC,YAAY,KAAK,EAAE,iBAAiB,EAQnC;IAED;;;;;;;;;OASG;IACI,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAarF;IAcD;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"note_store.d.ts","sourceRoot":"","sources":["../../../src/storage/note_store/note_store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAqC,MAAM,iBAAiB,CAAC;AAC5F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAc,MAAM,oBAAoB,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGzD;;;;;IAKI;AACJ,qBAAa,SAAU,YAAW,WAAW;;IAC3C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAU;IA+BpC,YAAY,KAAK,EAAE,iBAAiB,EAQnC;IAED;;;;;;;;;OASG;IACI,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAarF;IAcD;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CA6F/D;IAED;;;;;;;;;;;;;;OAcG;IACH,eAAe,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAyChF;IAED;;;;;;;;;;;OAWG;IACU,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMpF;IA6ED;;;;;;;;;OASG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAUzC;IAED,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAG1C;CAkCF"}
|
|
@@ -75,7 +75,7 @@ import { StoredNote } from './stored_note.js';
|
|
|
75
75
|
* @returns Filtered and deduplicated notes (a note might be present in multiple scopes - we ensure it is only
|
|
76
76
|
* returned once if this is the case)
|
|
77
77
|
*/ getNotes(filter, jobId) {
|
|
78
|
-
if (filter.scopes
|
|
78
|
+
if (filter.scopes.length === 0) {
|
|
79
79
|
return Promise.resolve([]);
|
|
80
80
|
}
|
|
81
81
|
return this.#store.transactionAsync(async ()=>{
|
|
@@ -135,7 +135,7 @@ import { StoredNote } from './stored_note.js';
|
|
|
135
135
|
if (filter.siloedNullifier && !note.noteDao.siloedNullifier.equals(filter.siloedNullifier)) {
|
|
136
136
|
continue;
|
|
137
137
|
}
|
|
138
|
-
if (
|
|
138
|
+
if (note.scopes.intersection(new Set(filter.scopes.map((s)=>s.toString()))).size === 0) {
|
|
139
139
|
continue;
|
|
140
140
|
}
|
|
141
141
|
foundNotes.set(note.noteDao.siloedNullifier.toString(), note.noteDao);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/pxe",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.e304674f1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"typedocOptions": {
|
|
6
6
|
"entryPoints": [
|
|
@@ -70,19 +70,19 @@
|
|
|
70
70
|
]
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
74
|
-
"@aztec/bb.js": "0.0.1-commit.
|
|
75
|
-
"@aztec/builder": "0.0.1-commit.
|
|
76
|
-
"@aztec/constants": "0.0.1-commit.
|
|
77
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
78
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
79
|
-
"@aztec/key-store": "0.0.1-commit.
|
|
80
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
81
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
82
|
-
"@aztec/noir-types": "0.0.1-commit.
|
|
83
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
84
|
-
"@aztec/simulator": "0.0.1-commit.
|
|
85
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
73
|
+
"@aztec/bb-prover": "0.0.1-commit.e304674f1",
|
|
74
|
+
"@aztec/bb.js": "0.0.1-commit.e304674f1",
|
|
75
|
+
"@aztec/builder": "0.0.1-commit.e304674f1",
|
|
76
|
+
"@aztec/constants": "0.0.1-commit.e304674f1",
|
|
77
|
+
"@aztec/ethereum": "0.0.1-commit.e304674f1",
|
|
78
|
+
"@aztec/foundation": "0.0.1-commit.e304674f1",
|
|
79
|
+
"@aztec/key-store": "0.0.1-commit.e304674f1",
|
|
80
|
+
"@aztec/kv-store": "0.0.1-commit.e304674f1",
|
|
81
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.e304674f1",
|
|
82
|
+
"@aztec/noir-types": "0.0.1-commit.e304674f1",
|
|
83
|
+
"@aztec/protocol-contracts": "0.0.1-commit.e304674f1",
|
|
84
|
+
"@aztec/simulator": "0.0.1-commit.e304674f1",
|
|
85
|
+
"@aztec/stdlib": "0.0.1-commit.e304674f1",
|
|
86
86
|
"koa": "^2.16.1",
|
|
87
87
|
"koa-router": "^13.1.1",
|
|
88
88
|
"lodash.omit": "^4.5.0",
|
|
@@ -91,8 +91,8 @@
|
|
|
91
91
|
"viem": "npm:@aztec/viem@2.38.2"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
|
-
"@aztec/noir-test-contracts.js": "0.0.1-commit.
|
|
95
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
94
|
+
"@aztec/noir-test-contracts.js": "0.0.1-commit.e304674f1",
|
|
95
|
+
"@aztec/world-state": "0.0.1-commit.e304674f1",
|
|
96
96
|
"@jest/globals": "^30.0.0",
|
|
97
97
|
"@types/jest": "^30.0.0",
|
|
98
98
|
"@types/lodash.omit": "^4.5.7",
|
|
@@ -77,6 +77,8 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
|
|
|
77
77
|
const blockHeader = await this.node.getBlockHeader(BlockNumber(event.block.number));
|
|
78
78
|
if (blockHeader) {
|
|
79
79
|
await this.updateAnchorBlockHeader(blockHeader);
|
|
80
|
+
} else {
|
|
81
|
+
this.log.warn(`Block header not found for proven block ${event.block.number}, skipping anchor update`);
|
|
80
82
|
}
|
|
81
83
|
}
|
|
82
84
|
break;
|
|
@@ -86,6 +88,8 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
|
|
|
86
88
|
const blockHeader = await this.node.getBlockHeader(BlockNumber(event.block.number));
|
|
87
89
|
if (blockHeader) {
|
|
88
90
|
await this.updateAnchorBlockHeader(blockHeader);
|
|
91
|
+
} else {
|
|
92
|
+
this.log.warn(`Block header not found for finalized block ${event.block.number}, skipping anchor update`);
|
|
89
93
|
}
|
|
90
94
|
}
|
|
91
95
|
break;
|
|
@@ -152,6 +156,8 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
|
|
|
152
156
|
}
|
|
153
157
|
|
|
154
158
|
this.log.debug(`Syncing PXE with the node`);
|
|
159
|
+
// Capture the promise locally so we always await the exact promise we created, even if this.isSyncing is modified
|
|
160
|
+
// between assignment and await (e.g. due to future refactors introducing a yield point).
|
|
155
161
|
const isSyncing = this.doSync();
|
|
156
162
|
this.isSyncing = isSyncing;
|
|
157
163
|
try {
|
|
@@ -89,10 +89,10 @@ import {
|
|
|
89
89
|
getFinalMinRevertibleSideEffectCounter,
|
|
90
90
|
} from '@aztec/stdlib/tx';
|
|
91
91
|
|
|
92
|
-
import type { AccessScopes } from '../access_scopes.js';
|
|
93
92
|
import type { ContractSyncService } from '../contract_sync/contract_sync_service.js';
|
|
94
93
|
import type { MessageContextService } from '../messages/message_context_service.js';
|
|
95
94
|
import type { AddressStore } from '../storage/address_store/address_store.js';
|
|
95
|
+
import { CapsuleService } from '../storage/capsule_store/capsule_service.js';
|
|
96
96
|
import type { CapsuleStore } from '../storage/capsule_store/capsule_store.js';
|
|
97
97
|
import type { ContractStore } from '../storage/contract_store/contract_store.js';
|
|
98
98
|
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
@@ -122,7 +122,7 @@ export type ContractSimulatorRunOpts = {
|
|
|
122
122
|
/** The address used as a tagging sender when emitting private logs. */
|
|
123
123
|
senderForTags?: AztecAddress;
|
|
124
124
|
/** The accounts whose notes we can access in this call. */
|
|
125
|
-
scopes:
|
|
125
|
+
scopes: AztecAddress[];
|
|
126
126
|
/** The job ID for staged writes. */
|
|
127
127
|
jobId: string;
|
|
128
128
|
};
|
|
@@ -245,7 +245,7 @@ export class ContractFunctionSimulator {
|
|
|
245
245
|
senderTaggingStore: this.senderTaggingStore,
|
|
246
246
|
recipientTaggingStore: this.recipientTaggingStore,
|
|
247
247
|
senderAddressBookStore: this.senderAddressBookStore,
|
|
248
|
-
|
|
248
|
+
capsuleService: new CapsuleService(this.capsuleStore, scopes),
|
|
249
249
|
privateEventStore: this.privateEventStore,
|
|
250
250
|
messageContextService: this.messageContextService,
|
|
251
251
|
contractSyncService: this.contractSyncService,
|
|
@@ -284,7 +284,7 @@ export class ContractFunctionSimulator {
|
|
|
284
284
|
);
|
|
285
285
|
const publicFunctionsCalldata = await Promise.all(
|
|
286
286
|
publicCallRequests.map(async r => {
|
|
287
|
-
const calldata = await privateExecutionOracle.
|
|
287
|
+
const calldata = await privateExecutionOracle.getHashPreimage(r.calldataHash);
|
|
288
288
|
return new HashedValues(calldata, r.calldataHash);
|
|
289
289
|
}),
|
|
290
290
|
);
|
|
@@ -319,7 +319,7 @@ export class ContractFunctionSimulator {
|
|
|
319
319
|
call: FunctionCall,
|
|
320
320
|
authwits: AuthWitness[],
|
|
321
321
|
anchorBlockHeader: BlockHeader,
|
|
322
|
-
scopes:
|
|
322
|
+
scopes: AztecAddress[],
|
|
323
323
|
jobId: string,
|
|
324
324
|
): Promise<{ result: Fr[]; offchainEffects: OffchainEffect[] }> {
|
|
325
325
|
const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
|
|
@@ -340,7 +340,7 @@ export class ContractFunctionSimulator {
|
|
|
340
340
|
aztecNode: this.aztecNode,
|
|
341
341
|
recipientTaggingStore: this.recipientTaggingStore,
|
|
342
342
|
senderAddressBookStore: this.senderAddressBookStore,
|
|
343
|
-
|
|
343
|
+
capsuleService: new CapsuleService(this.capsuleStore, scopes),
|
|
344
344
|
privateEventStore: this.privateEventStore,
|
|
345
345
|
messageContextService: this.messageContextService,
|
|
346
346
|
contractSyncService: this.contractSyncService,
|
|
@@ -16,7 +16,6 @@ export class EventValidationRequest {
|
|
|
16
16
|
public serializedEvent: Fr[],
|
|
17
17
|
public eventCommitment: Fr,
|
|
18
18
|
public txHash: TxHash,
|
|
19
|
-
public recipient: AztecAddress,
|
|
20
19
|
) {}
|
|
21
20
|
|
|
22
21
|
static fromFields(fields: Fr[], maxEventSerializedLen: number): EventValidationRequest {
|
|
@@ -33,7 +32,6 @@ export class EventValidationRequest {
|
|
|
33
32
|
|
|
34
33
|
const eventCommitment = reader.readField();
|
|
35
34
|
const txHash = TxHash.fromField(reader.readField());
|
|
36
|
-
const recipient = AztecAddress.fromField(reader.readField());
|
|
37
35
|
|
|
38
36
|
if (reader.remainingFields() !== 0) {
|
|
39
37
|
throw new Error(
|
|
@@ -48,7 +46,6 @@ export class EventValidationRequest {
|
|
|
48
46
|
serializedEvent,
|
|
49
47
|
eventCommitment,
|
|
50
48
|
txHash,
|
|
51
|
-
recipient,
|
|
52
49
|
);
|
|
53
50
|
}
|
|
54
51
|
}
|
|
@@ -18,7 +18,6 @@ export class NoteValidationRequest {
|
|
|
18
18
|
public noteHash: Fr,
|
|
19
19
|
public nullifier: Fr,
|
|
20
20
|
public txHash: TxHash,
|
|
21
|
-
public recipient: AztecAddress,
|
|
22
21
|
) {}
|
|
23
22
|
|
|
24
23
|
static fromFields(fields: Fr[], maxNotePackedLen: number): NoteValidationRequest {
|
|
@@ -37,7 +36,6 @@ export class NoteValidationRequest {
|
|
|
37
36
|
const noteHash = reader.readField();
|
|
38
37
|
const nullifier = reader.readField();
|
|
39
38
|
const txHash = TxHash.fromField(reader.readField());
|
|
40
|
-
const recipient = AztecAddress.fromField(reader.readField());
|
|
41
39
|
|
|
42
40
|
if (reader.remainingFields() !== 0) {
|
|
43
41
|
throw new Error(
|
|
@@ -55,7 +53,6 @@ export class NoteValidationRequest {
|
|
|
55
53
|
noteHash,
|
|
56
54
|
nullifier,
|
|
57
55
|
txHash,
|
|
58
|
-
recipient,
|
|
59
56
|
);
|
|
60
57
|
}
|
|
61
58
|
}
|
|
@@ -86,7 +86,7 @@ export interface IUtilityExecutionOracle {
|
|
|
86
86
|
nullifier: Fr,
|
|
87
87
|
): Promise<NullifierMembershipWitness | undefined>;
|
|
88
88
|
getBlockHeader(blockNumber: BlockNumber): Promise<BlockHeader | undefined>;
|
|
89
|
-
|
|
89
|
+
getPublicKeysAndPartialAddress(
|
|
90
90
|
account: AztecAddress,
|
|
91
91
|
): Promise<{ publicKeys: PublicKeys; partialAddress: PartialAddress } | undefined>;
|
|
92
92
|
getAuthWitness(messageHash: Fr): Promise<Fr[] | undefined>;
|
|
@@ -107,43 +107,52 @@ export interface IUtilityExecutionOracle {
|
|
|
107
107
|
offset: number,
|
|
108
108
|
status: NoteStatus,
|
|
109
109
|
): Promise<NoteData[]>;
|
|
110
|
-
|
|
110
|
+
doesNullifierExist(innerNullifier: Fr): Promise<boolean>;
|
|
111
111
|
getL1ToL2MembershipWitness(
|
|
112
112
|
contractAddress: AztecAddress,
|
|
113
113
|
messageHash: Fr,
|
|
114
114
|
secret: Fr,
|
|
115
115
|
): Promise<MessageLoadOracleInputs<typeof L1_TO_L2_MSG_TREE_HEIGHT>>;
|
|
116
|
-
|
|
116
|
+
getFromPublicStorage(
|
|
117
117
|
anchorBlockHash: BlockHash,
|
|
118
118
|
contractAddress: AztecAddress,
|
|
119
119
|
startStorageSlot: Fr,
|
|
120
120
|
numberOfElements: number,
|
|
121
121
|
): Promise<Fr[]>;
|
|
122
|
-
|
|
122
|
+
getPendingTaggedLogs(pendingTaggedLogArrayBaseSlot: Fr, scope: AztecAddress): Promise<void>;
|
|
123
123
|
validateAndStoreEnqueuedNotesAndEvents(
|
|
124
124
|
contractAddress: AztecAddress,
|
|
125
125
|
noteValidationRequestsArrayBaseSlot: Fr,
|
|
126
126
|
eventValidationRequestsArrayBaseSlot: Fr,
|
|
127
127
|
maxNotePackedLen: number,
|
|
128
128
|
maxEventSerializedLen: number,
|
|
129
|
+
scope: AztecAddress,
|
|
129
130
|
): Promise<void>;
|
|
130
|
-
|
|
131
|
+
getLogsByTag(
|
|
131
132
|
contractAddress: AztecAddress,
|
|
132
133
|
logRetrievalRequestsArrayBaseSlot: Fr,
|
|
133
134
|
logRetrievalResponsesArrayBaseSlot: Fr,
|
|
135
|
+
scope: AztecAddress,
|
|
134
136
|
): Promise<void>;
|
|
135
|
-
|
|
137
|
+
getMessageContextsByTxHash(
|
|
136
138
|
contractAddress: AztecAddress,
|
|
137
139
|
messageContextRequestsArrayBaseSlot: Fr,
|
|
138
140
|
messageContextResponsesArrayBaseSlot: Fr,
|
|
141
|
+
scope: AztecAddress,
|
|
139
142
|
): Promise<void>;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
deleteCapsule(contractAddress: AztecAddress, key: Fr):
|
|
143
|
-
copyCapsule(
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
setCapsule(contractAddress: AztecAddress, key: Fr, capsule: Fr[], scope: AztecAddress): void;
|
|
144
|
+
getCapsule(contractAddress: AztecAddress, key: Fr, scope: AztecAddress): Promise<Fr[] | null>;
|
|
145
|
+
deleteCapsule(contractAddress: AztecAddress, key: Fr, scope: AztecAddress): void;
|
|
146
|
+
copyCapsule(
|
|
147
|
+
contractAddress: AztecAddress,
|
|
148
|
+
srcKey: Fr,
|
|
149
|
+
dstKey: Fr,
|
|
150
|
+
numEntries: number,
|
|
151
|
+
scope: AztecAddress,
|
|
152
|
+
): Promise<void>;
|
|
153
|
+
decryptAes128(ciphertext: Buffer, iv: Buffer, symKey: Buffer): Promise<Buffer>;
|
|
154
|
+
getSharedSecret(address: AztecAddress, ephPk: Point, contractAddress: AztecAddress): Promise<Fr>;
|
|
155
|
+
setContractSyncCacheInvalid(contractAddress: AztecAddress, scopes: AztecAddress[]): void;
|
|
147
156
|
emitOffchainEffect(data: Fr[]): Promise<void>;
|
|
148
157
|
}
|
|
149
158
|
|
|
@@ -154,8 +163,8 @@ export interface IUtilityExecutionOracle {
|
|
|
154
163
|
export interface IPrivateExecutionOracle {
|
|
155
164
|
isPrivate: true;
|
|
156
165
|
|
|
157
|
-
|
|
158
|
-
|
|
166
|
+
setHashPreimage(values: Fr[], hash: Fr): void;
|
|
167
|
+
getHashPreimage(hash: Fr): Promise<Fr[]>;
|
|
159
168
|
notifyCreatedNote(
|
|
160
169
|
owner: AztecAddress,
|
|
161
170
|
storageSlot: Fr,
|
|
@@ -176,9 +185,9 @@ export interface IPrivateExecutionOracle {
|
|
|
176
185
|
sideEffectCounter: number,
|
|
177
186
|
isStaticCall: boolean,
|
|
178
187
|
): Promise<{ endSideEffectCounter: Fr; returnsHash: Fr }>;
|
|
179
|
-
|
|
188
|
+
assertValidPublicCalldata(calldataHash: Fr): Promise<void>;
|
|
180
189
|
notifyRevertiblePhaseStart(minRevertibleSideEffectCounter: number): Promise<void>;
|
|
181
|
-
|
|
190
|
+
isExecutionInRevertiblePhase(sideEffectCounter: number): Promise<boolean>;
|
|
182
191
|
getSenderForTags(): Promise<AztecAddress | undefined>;
|
|
183
192
|
setSenderForTags(senderForTags: AztecAddress): Promise<void>;
|
|
184
193
|
getNextAppTagAsSender(sender: AztecAddress, recipient: AztecAddress): Promise<Tag>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { toACVMField } from '@aztec/simulator/client';
|
|
2
2
|
import type { ACIRCallback, ACVMField } from '@aztec/simulator/client';
|
|
3
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
4
|
|
|
4
5
|
import type { Oracle } from './oracle.js';
|
|
5
6
|
|
|
@@ -23,11 +24,12 @@ export function buildLegacyOracleCallbacks(oracle: Oracle): ACIRCallback {
|
|
|
23
24
|
contractAddress: ACVMField[],
|
|
24
25
|
slot: ACVMField[],
|
|
25
26
|
tSize: ACVMField[],
|
|
26
|
-
): Promise<(ACVMField | ACVMField[])[]> =>
|
|
27
|
+
): Promise<(ACVMField | ACVMField[])[]> =>
|
|
28
|
+
oracle.aztec_utl_getCapsule(contractAddress, slot, tSize, [toACVMField(AztecAddress.ZERO)]),
|
|
27
29
|
privateStoreInExecutionCache: (values: ACVMField[], hash: ACVMField[]): Promise<ACVMField[]> =>
|
|
28
|
-
oracle.
|
|
30
|
+
oracle.aztec_prv_setHashPreimage(values, hash),
|
|
29
31
|
privateLoadFromExecutionCache: (returnsHash: ACVMField[]): Promise<ACVMField[][]> =>
|
|
30
|
-
oracle.
|
|
32
|
+
oracle.aztec_prv_getHashPreimage(returnsHash),
|
|
31
33
|
privateCallPrivateFunction: (
|
|
32
34
|
contractAddress: ACVMField[],
|
|
33
35
|
functionSelector: ACVMField[],
|
|
@@ -60,76 +62,37 @@ export function buildLegacyOracleCallbacks(oracle: Oracle): ACIRCallback {
|
|
|
60
62
|
startStorageSlot: ACVMField[],
|
|
61
63
|
numberOfElements: ACVMField[],
|
|
62
64
|
): Promise<ACVMField[][]> =>
|
|
63
|
-
oracle.
|
|
65
|
+
oracle.aztec_utl_getFromPublicStorage(blockHash, contractAddress, startStorageSlot, numberOfElements),
|
|
64
66
|
utilityStoreCapsule: (
|
|
65
67
|
contractAddress: ACVMField[],
|
|
66
68
|
slot: ACVMField[],
|
|
67
69
|
capsule: ACVMField[],
|
|
68
|
-
): Promise<ACVMField[]> =>
|
|
70
|
+
): Promise<ACVMField[]> =>
|
|
71
|
+
oracle.aztec_utl_setCapsule(contractAddress, slot, capsule, [toACVMField(AztecAddress.ZERO)]),
|
|
69
72
|
utilityCopyCapsule: (
|
|
70
73
|
contractAddress: ACVMField[],
|
|
71
74
|
srcSlot: ACVMField[],
|
|
72
75
|
dstSlot: ACVMField[],
|
|
73
76
|
numEntries: ACVMField[],
|
|
74
|
-
): Promise<ACVMField[]> => oracle.aztec_utl_copyCapsule(contractAddress, srcSlot, dstSlot, numEntries),
|
|
75
|
-
utilityDeleteCapsule: (contractAddress: ACVMField[], slot: ACVMField[]): Promise<ACVMField[]> =>
|
|
76
|
-
oracle.aztec_utl_deleteCapsule(contractAddress, slot),
|
|
77
|
-
utilityGetSharedSecret: (
|
|
78
|
-
address: ACVMField[],
|
|
79
|
-
ephPKField0: ACVMField[],
|
|
80
|
-
ephPKField1: ACVMField[],
|
|
81
|
-
ephPKField2: ACVMField[],
|
|
82
|
-
): Promise<ACVMField[]> => oracle.aztec_utl_getSharedSecret(address, ephPKField0, ephPKField1, ephPKField2),
|
|
83
|
-
utilityFetchTaggedLogs: (pendingTaggedLogArrayBaseSlot: ACVMField[]): Promise<ACVMField[]> =>
|
|
84
|
-
oracle.aztec_utl_fetchTaggedLogs(pendingTaggedLogArrayBaseSlot),
|
|
85
|
-
utilityBulkRetrieveLogs: (
|
|
86
|
-
contractAddress: ACVMField[],
|
|
87
|
-
logRetrievalRequestsArrayBaseSlot: ACVMField[],
|
|
88
|
-
logRetrievalResponsesArrayBaseSlot: ACVMField[],
|
|
89
77
|
): Promise<ACVMField[]> =>
|
|
90
|
-
oracle.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
logRetrievalResponsesArrayBaseSlot,
|
|
94
|
-
),
|
|
78
|
+
oracle.aztec_utl_copyCapsule(contractAddress, srcSlot, dstSlot, numEntries, [toACVMField(AztecAddress.ZERO)]),
|
|
79
|
+
utilityDeleteCapsule: (contractAddress: ACVMField[], slot: ACVMField[]): Promise<ACVMField[]> =>
|
|
80
|
+
oracle.aztec_utl_deleteCapsule(contractAddress, slot, [toACVMField(AztecAddress.ZERO)]),
|
|
95
81
|
utilityGetL1ToL2MembershipWitness: (
|
|
96
82
|
contractAddress: ACVMField[],
|
|
97
83
|
messageHash: ACVMField[],
|
|
98
84
|
secret: ACVMField[],
|
|
99
85
|
): Promise<(ACVMField | ACVMField[])[]> =>
|
|
100
86
|
oracle.aztec_utl_getL1ToL2MembershipWitness(contractAddress, messageHash, secret),
|
|
101
|
-
utilityEmitOffchainEffect: (data: ACVMField[]): Promise<ACVMField[]> => oracle.aztec_utl_emitOffchainEffect(data),
|
|
102
|
-
// Adapter: old 3-param signature → new 5-param with injected constants.
|
|
103
|
-
// Values derived from: MAX_MESSAGE_CONTENT_LEN(11) - RESERVED_FIELDS (3 for notes, 1 for events).
|
|
104
|
-
utilityValidateAndStoreEnqueuedNotesAndEvents: (
|
|
105
|
-
contractAddress: ACVMField[],
|
|
106
|
-
noteValidationRequestsArrayBaseSlot: ACVMField[],
|
|
107
|
-
eventValidationRequestsArrayBaseSlot: ACVMField[],
|
|
108
|
-
): Promise<ACVMField[]> =>
|
|
109
|
-
oracle.aztec_utl_validateAndStoreEnqueuedNotesAndEvents(
|
|
110
|
-
contractAddress,
|
|
111
|
-
noteValidationRequestsArrayBaseSlot,
|
|
112
|
-
eventValidationRequestsArrayBaseSlot,
|
|
113
|
-
[new Fr(8).toString()],
|
|
114
|
-
[new Fr(10).toString()],
|
|
115
|
-
),
|
|
116
87
|
// Renames (same signature, different oracle name)
|
|
117
88
|
privateNotifySetMinRevertibleSideEffectCounter: (counter: ACVMField[]): Promise<ACVMField[]> =>
|
|
118
89
|
oracle.aztec_prv_notifyRevertiblePhaseStart(counter),
|
|
119
|
-
privateIsSideEffectCounterRevertible: (sideEffectCounter: ACVMField[]): Promise<ACVMField[]> =>
|
|
120
|
-
oracle.aztec_prv_inRevertiblePhase(sideEffectCounter),
|
|
121
90
|
// Signature changes: old 4-param oracles → new 1-param validatePublicCalldata
|
|
122
91
|
privateNotifyEnqueuedPublicFunctionCall: (
|
|
123
92
|
_contractAddress: ACVMField[],
|
|
124
93
|
calldataHash: ACVMField[],
|
|
125
94
|
_sideEffectCounter: ACVMField[],
|
|
126
95
|
_isStaticCall: ACVMField[],
|
|
127
|
-
): Promise<ACVMField[]> => oracle.
|
|
128
|
-
privateNotifySetPublicTeardownFunctionCall: (
|
|
129
|
-
_contractAddress: ACVMField[],
|
|
130
|
-
calldataHash: ACVMField[],
|
|
131
|
-
_sideEffectCounter: ACVMField[],
|
|
132
|
-
_isStaticCall: ACVMField[],
|
|
133
|
-
): Promise<ACVMField[]> => oracle.aztec_prv_validatePublicCalldata(calldataHash),
|
|
96
|
+
): Promise<ACVMField[]> => oracle.aztec_prv_assertValidPublicCalldata(calldataHash),
|
|
134
97
|
};
|
|
135
98
|
}
|