@aztec/pxe 0.0.1-commit.2ed92850 → 0.0.1-commit.54489865
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 +3 -3
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +5 -5
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +4 -4
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +8 -8
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +7 -7
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +8 -8
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +2 -2
- package/dest/debug/pxe_debug_utils.d.ts +16 -6
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +17 -8
- 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 +10 -5
- 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 +11 -6
- package/dest/entrypoints/pxe_creation_options.d.ts +3 -2
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.d.ts +1 -1
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +19 -8
- package/dest/job_coordinator/job_coordinator.d.ts +3 -2
- package/dest/job_coordinator/job_coordinator.d.ts.map +1 -1
- package/dest/job_coordinator/job_coordinator.js +3 -2
- 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 +2 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +3 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +2 -2
- package/dest/private_kernel/private_kernel_oracle.d.ts +3 -3
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/pxe.d.ts +1 -1
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +7 -5
- 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 +29 -31
- package/dest/storage/private_event_store/private_event_store.d.ts +1 -1
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
- package/dest/storage/private_event_store/private_event_store.js +45 -47
- package/dest/storage/private_event_store/stored_private_event.d.ts +4 -4
- package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -1
- package/dest/storage/private_event_store/stored_private_event.js +2 -2
- package/dest/tagging/get_all_logs_by_tags.d.ts +4 -4
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +3 -3
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +3 -3
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +3 -3
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +3 -3
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
- package/package.json +16 -16
- package/src/block_synchronizer/block_synchronizer.ts +17 -19
- package/src/contract_function_simulator/contract_function_simulator.ts +6 -2
- package/src/contract_function_simulator/oracle/interfaces.ts +7 -7
- package/src/contract_function_simulator/oracle/oracle.ts +7 -7
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +9 -7
- package/src/debug/pxe_debug_utils.ts +23 -9
- package/src/entrypoints/client/bundle/utils.ts +4 -13
- package/src/entrypoints/client/lazy/utils.ts +5 -13
- package/src/entrypoints/pxe_creation_options.ts +2 -1
- package/src/entrypoints/server/utils.ts +15 -19
- package/src/job_coordinator/job_coordinator.ts +4 -3
- package/src/logs/log_service.ts +6 -3
- package/src/private_kernel/private_kernel_execution_prover.ts +6 -3
- package/src/private_kernel/private_kernel_oracle.ts +2 -2
- package/src/pxe.ts +15 -6
- package/src/storage/note_store/note_store.ts +28 -33
- package/src/storage/private_event_store/private_event_store.ts +57 -59
- package/src/storage/private_event_store/stored_private_event.ts +3 -3
- package/src/tagging/get_all_logs_by_tags.ts +3 -3
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +2 -2
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +2 -2
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +2 -2
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +3 -3
|
@@ -131,78 +131,76 @@ export class PrivateEventStore implements StagedStore {
|
|
|
131
131
|
* @returns - The event log contents, augmented with metadata about the transaction and block in which the event was
|
|
132
132
|
* included.
|
|
133
133
|
*/
|
|
134
|
-
public getPrivateEvents(
|
|
134
|
+
public async getPrivateEvents(
|
|
135
135
|
eventSelector: EventSelector,
|
|
136
136
|
filter: PrivateEventStoreFilter,
|
|
137
137
|
): Promise<PackedPrivateEvent[]> {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}> = [];
|
|
145
|
-
|
|
146
|
-
const key = this.#keyFor(filter.contractAddress, eventSelector);
|
|
147
|
-
const targetScopes = new Set(filter.scopes.map(s => s.toString()));
|
|
148
|
-
|
|
149
|
-
const eventIds: string[] = await toArray(this.#eventsByContractAndEventSelector.getValuesAsync(key));
|
|
150
|
-
|
|
151
|
-
for (const eventId of eventIds) {
|
|
152
|
-
const eventBuffer = await this.#events.getAsync(eventId);
|
|
153
|
-
|
|
154
|
-
// Defensive, if it happens, there's a problem with how we're handling #eventsByContractAndEventSelector
|
|
155
|
-
if (!eventBuffer) {
|
|
156
|
-
this.logger.verbose(
|
|
157
|
-
`EventId ${eventId} does not exist in main index but it is referenced from contract event selector index`,
|
|
158
|
-
);
|
|
159
|
-
continue;
|
|
160
|
-
}
|
|
138
|
+
const events: Array<{
|
|
139
|
+
l2BlockNumber: number;
|
|
140
|
+
txIndexInBlock: number;
|
|
141
|
+
eventIndexInTx: number;
|
|
142
|
+
event: PackedPrivateEvent;
|
|
143
|
+
}> = [];
|
|
161
144
|
|
|
162
|
-
|
|
145
|
+
const key = this.#keyFor(filter.contractAddress, eventSelector);
|
|
146
|
+
const targetScopes = new Set(filter.scopes.map(s => s.toString()));
|
|
163
147
|
|
|
164
|
-
|
|
165
|
-
if (storedPrivateEvent.l2BlockNumber < filter.fromBlock || storedPrivateEvent.l2BlockNumber >= filter.toBlock) {
|
|
166
|
-
continue;
|
|
167
|
-
}
|
|
148
|
+
const eventIds: string[] = await toArray(this.#eventsByContractAndEventSelector.getValuesAsync(key));
|
|
168
149
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
continue;
|
|
172
|
-
}
|
|
150
|
+
for (const eventId of eventIds) {
|
|
151
|
+
const eventBuffer = await this.#events.getAsync(eventId);
|
|
173
152
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
153
|
+
// Defensive, if it happens, there's a problem with how we're handling #eventsByContractAndEventSelector
|
|
154
|
+
if (!eventBuffer) {
|
|
155
|
+
this.logger.verbose(
|
|
156
|
+
`EventId ${eventId} does not exist in main index but it is referenced from contract event selector index`,
|
|
157
|
+
);
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
178
160
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
packedEvent: storedPrivateEvent.msgContent,
|
|
185
|
-
l2BlockNumber: BlockNumber(storedPrivateEvent.l2BlockNumber),
|
|
186
|
-
txHash: storedPrivateEvent.txHash,
|
|
187
|
-
l2BlockHash: storedPrivateEvent.l2BlockHash,
|
|
188
|
-
eventSelector,
|
|
189
|
-
},
|
|
190
|
-
});
|
|
161
|
+
const storedPrivateEvent = StoredPrivateEvent.fromBuffer(eventBuffer);
|
|
162
|
+
|
|
163
|
+
// Filter by block range
|
|
164
|
+
if (storedPrivateEvent.l2BlockNumber < filter.fromBlock || storedPrivateEvent.l2BlockNumber >= filter.toBlock) {
|
|
165
|
+
continue;
|
|
191
166
|
}
|
|
192
167
|
|
|
193
|
-
//
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
168
|
+
// Filter by scopes
|
|
169
|
+
if (storedPrivateEvent.scopes.intersection(targetScopes).size === 0) {
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Filter by txHash
|
|
174
|
+
if (filter.txHash && !storedPrivateEvent.txHash.equals(filter.txHash)) {
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
events.push({
|
|
179
|
+
l2BlockNumber: storedPrivateEvent.l2BlockNumber,
|
|
180
|
+
txIndexInBlock: storedPrivateEvent.txIndexInBlock,
|
|
181
|
+
eventIndexInTx: storedPrivateEvent.eventIndexInTx,
|
|
182
|
+
event: {
|
|
183
|
+
packedEvent: storedPrivateEvent.msgContent,
|
|
184
|
+
l2BlockNumber: BlockNumber(storedPrivateEvent.l2BlockNumber),
|
|
185
|
+
txHash: storedPrivateEvent.txHash,
|
|
186
|
+
l2BlockHash: storedPrivateEvent.l2BlockHash,
|
|
187
|
+
eventSelector,
|
|
188
|
+
},
|
|
202
189
|
});
|
|
190
|
+
}
|
|
203
191
|
|
|
204
|
-
|
|
192
|
+
// Sort by block number, then by tx index within block, then by event index within tx
|
|
193
|
+
events.sort((a, b) => {
|
|
194
|
+
if (a.l2BlockNumber !== b.l2BlockNumber) {
|
|
195
|
+
return a.l2BlockNumber - b.l2BlockNumber;
|
|
196
|
+
}
|
|
197
|
+
if (a.txIndexInBlock !== b.txIndexInBlock) {
|
|
198
|
+
return a.txIndexInBlock - b.txIndexInBlock;
|
|
199
|
+
}
|
|
200
|
+
return a.eventIndexInTx - b.eventIndexInTx;
|
|
205
201
|
});
|
|
202
|
+
|
|
203
|
+
return events.map(ev => ev.event);
|
|
206
204
|
}
|
|
207
205
|
|
|
208
206
|
/**
|
|
@@ -2,7 +2,7 @@ import { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
2
2
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
3
3
|
import { EventSelector } from '@aztec/stdlib/abi';
|
|
4
4
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
-
import {
|
|
5
|
+
import { BlockHash } from '@aztec/stdlib/block';
|
|
6
6
|
import { TxHash } from '@aztec/stdlib/tx';
|
|
7
7
|
|
|
8
8
|
/** Serializable private event entry with scope tracking. */
|
|
@@ -11,7 +11,7 @@ export class StoredPrivateEvent {
|
|
|
11
11
|
readonly randomness: Fr,
|
|
12
12
|
readonly msgContent: Fr[],
|
|
13
13
|
readonly l2BlockNumber: number,
|
|
14
|
-
readonly l2BlockHash:
|
|
14
|
+
readonly l2BlockHash: BlockHash,
|
|
15
15
|
readonly txHash: TxHash,
|
|
16
16
|
readonly txIndexInBlock: number,
|
|
17
17
|
readonly eventIndexInTx: number,
|
|
@@ -49,7 +49,7 @@ export class StoredPrivateEvent {
|
|
|
49
49
|
const msgContentLength = reader.readNumber();
|
|
50
50
|
const msgContent = reader.readArray(msgContentLength, Fr);
|
|
51
51
|
const l2BlockNumber = reader.readNumber();
|
|
52
|
-
const l2BlockHash =
|
|
52
|
+
const l2BlockHash = new BlockHash(Fr.fromBuffer(reader));
|
|
53
53
|
const txHash = TxHash.fromBuffer(reader);
|
|
54
54
|
const txIndexInBlock = reader.readNumber();
|
|
55
55
|
const eventIndexInTx = reader.readNumber();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
|
-
import type {
|
|
2
|
+
import type { BlockHash } from '@aztec/stdlib/block';
|
|
3
3
|
import { MAX_LOGS_PER_TAG } from '@aztec/stdlib/interfaces/api-limit';
|
|
4
4
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
5
5
|
import type { SiloedTag, Tag, TxScopedL2Log } from '@aztec/stdlib/logs';
|
|
@@ -42,7 +42,7 @@ async function getAllPages<T>(numTags: number, fetchPage: (page: number) => Prom
|
|
|
42
42
|
export function getAllPrivateLogsByTags(
|
|
43
43
|
aztecNode: AztecNode,
|
|
44
44
|
tags: SiloedTag[],
|
|
45
|
-
anchorBlockHash:
|
|
45
|
+
anchorBlockHash: BlockHash,
|
|
46
46
|
): Promise<TxScopedL2Log[][]> {
|
|
47
47
|
return getAllPages(tags.length, page => aztecNode.getPrivateLogsByTags(tags, page, anchorBlockHash));
|
|
48
48
|
}
|
|
@@ -60,7 +60,7 @@ export function getAllPublicLogsByTagsFromContract(
|
|
|
60
60
|
aztecNode: AztecNode,
|
|
61
61
|
contractAddress: AztecAddress,
|
|
62
62
|
tags: Tag[],
|
|
63
|
-
anchorBlockHash:
|
|
63
|
+
anchorBlockHash: BlockHash,
|
|
64
64
|
): Promise<TxScopedL2Log[][]> {
|
|
65
65
|
return getAllPages(tags.length, page =>
|
|
66
66
|
aztecNode.getPublicLogsByTagsFromContract(contractAddress, tags, page, anchorBlockHash),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
-
import type {
|
|
3
|
+
import type { BlockHash } from '@aztec/stdlib/block';
|
|
4
4
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
5
5
|
import type { DirectionalAppTaggingSecret, TxScopedL2Log } from '@aztec/stdlib/logs';
|
|
6
6
|
|
|
@@ -22,7 +22,7 @@ export async function loadPrivateLogsForSenderRecipientPair(
|
|
|
22
22
|
aztecNode: AztecNode,
|
|
23
23
|
taggingStore: RecipientTaggingStore,
|
|
24
24
|
anchorBlockNumber: BlockNumber,
|
|
25
|
-
anchorBlockHash:
|
|
25
|
+
anchorBlockHash: BlockHash,
|
|
26
26
|
jobId: string,
|
|
27
27
|
): Promise<TxScopedL2Log[]> {
|
|
28
28
|
// # Explanation of how the algorithm works
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
-
import type {
|
|
3
|
+
import type { BlockHash } from '@aztec/stdlib/block';
|
|
4
4
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
5
5
|
import type { DirectionalAppTaggingSecret, PreTag, TxScopedL2Log } from '@aztec/stdlib/logs';
|
|
6
6
|
import { SiloedTag, Tag } from '@aztec/stdlib/logs';
|
|
@@ -19,7 +19,7 @@ export async function loadLogsForRange(
|
|
|
19
19
|
start: number,
|
|
20
20
|
end: number,
|
|
21
21
|
anchorBlockNumber: BlockNumber,
|
|
22
|
-
anchorBlockHash:
|
|
22
|
+
anchorBlockHash: BlockHash,
|
|
23
23
|
): Promise<Array<{ log: TxScopedL2Log; taggingIndex: number }>> {
|
|
24
24
|
// Derive tags for the window
|
|
25
25
|
const preTags: PreTag[] = Array(end - start)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
|
-
import type {
|
|
2
|
+
import type { BlockHash } from '@aztec/stdlib/block';
|
|
3
3
|
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
4
4
|
import type { DirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
|
|
5
5
|
|
|
@@ -27,7 +27,7 @@ export async function syncSenderTaggingIndexes(
|
|
|
27
27
|
app: AztecAddress,
|
|
28
28
|
aztecNode: AztecNode,
|
|
29
29
|
taggingStore: SenderTaggingStore,
|
|
30
|
-
anchorBlockHash:
|
|
30
|
+
anchorBlockHash: BlockHash,
|
|
31
31
|
jobId: string,
|
|
32
32
|
): Promise<void> {
|
|
33
33
|
// # Explanation of how syncing works
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
|
-
import type {
|
|
2
|
+
import type { BlockHash } from '@aztec/stdlib/block';
|
|
3
3
|
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
4
4
|
import type { DirectionalAppTaggingSecret, PreTag } from '@aztec/stdlib/logs';
|
|
5
5
|
import { SiloedTag, Tag } from '@aztec/stdlib/logs';
|
|
@@ -29,7 +29,7 @@ export async function loadAndStoreNewTaggingIndexes(
|
|
|
29
29
|
end: number,
|
|
30
30
|
aztecNode: AztecNode,
|
|
31
31
|
taggingStore: SenderTaggingStore,
|
|
32
|
-
anchorBlockHash:
|
|
32
|
+
anchorBlockHash: BlockHash,
|
|
33
33
|
jobId: string,
|
|
34
34
|
) {
|
|
35
35
|
// We compute the tags for the current window of indexes
|
|
@@ -55,7 +55,7 @@ export async function loadAndStoreNewTaggingIndexes(
|
|
|
55
55
|
async function getTxsContainingTags(
|
|
56
56
|
tags: SiloedTag[],
|
|
57
57
|
aztecNode: AztecNode,
|
|
58
|
-
anchorBlockHash:
|
|
58
|
+
anchorBlockHash: BlockHash,
|
|
59
59
|
): Promise<TxHash[][]> {
|
|
60
60
|
// We use the utility function below to retrieve all logs for the tags across all pages, so we don't need to handle
|
|
61
61
|
// pagination here.
|