@aztec/pxe 0.0.1-commit.5de5ca79e → 0.0.1-commit.6201a7b05
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/bin/check_oracle_version.js +4 -4
- package/dest/block_synchronizer/block_stream_source.d.ts +10 -0
- package/dest/block_synchronizer/block_stream_source.d.ts.map +1 -0
- package/dest/block_synchronizer/block_stream_source.js +37 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts +6 -2
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +30 -10
- package/dest/config/index.d.ts +1 -1
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +7 -14
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +6 -4
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +10 -7
- package/dest/contract_function_simulator/ephemeral_array_service.d.ts +28 -0
- package/dest/contract_function_simulator/ephemeral_array_service.d.ts.map +1 -0
- package/dest/contract_function_simulator/ephemeral_array_service.js +78 -0
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +3 -4
- 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 +3 -6
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +3 -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 -6
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +31 -20
- 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 +28 -23
- package/dest/contract_function_simulator/oracle/oracle.d.ts +50 -20
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +157 -41
- package/dest/contract_function_simulator/oracle/private_execution.js +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +16 -15
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +36 -21
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +58 -42
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +205 -96
- 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 +20 -3
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.js +3 -0
- 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 +37 -35
- 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 +2 -3
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +1 -2
- 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 +26 -5
- package/dest/events/private_event_filter_validator.d.ts +3 -2
- package/dest/events/private_event_filter_validator.d.ts.map +1 -1
- package/dest/events/private_event_filter_validator.js +15 -0
- package/dest/logs/log_service.d.ts +7 -8
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +27 -37
- 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 +4 -3
- package/dest/oracle_version.d.ts.map +1 -1
- package/dest/oracle_version.js +20 -10
- 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 +4 -7
- package/dest/private_kernel/private_kernel_oracle.d.ts +5 -5
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +12 -15
- package/dest/pxe.d.ts +19 -8
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +55 -24
- package/dest/storage/anchor_block_store/anchor_block_store.js +1 -1
- 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 +36 -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/contract_store/contract_store.d.ts +1 -1
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
- package/dest/storage/contract_store/contract_store.js +4 -2
- 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/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 +3 -0
- package/dest/storage/private_event_store/stored_private_event.js +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +2 -2
- 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 +2 -16
- package/package.json +16 -16
- package/src/bin/check_oracle_version.ts +4 -4
- package/src/block_synchronizer/block_stream_source.ts +52 -0
- package/src/block_synchronizer/block_synchronizer.ts +33 -11
- package/src/config/index.ts +2 -8
- package/src/contract_function_simulator/contract_function_simulator.ts +13 -10
- package/src/contract_function_simulator/ephemeral_array_service.ts +110 -0
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -4
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -1
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -4
- package/src/contract_function_simulator/oracle/interfaces.ts +46 -18
- package/src/contract_function_simulator/oracle/legacy_oracle_mappings.ts +20 -51
- package/src/contract_function_simulator/oracle/oracle.ts +222 -36
- package/src/contract_function_simulator/oracle/private_execution.ts +1 -1
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +49 -23
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +345 -123
- package/src/contract_function_simulator/pick_notes.ts +22 -3
- package/src/contract_function_simulator/proxied_contract_data_source.ts +8 -1
- package/src/contract_logging.ts +18 -5
- package/src/contract_sync/contract_sync_service.ts +64 -69
- 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 +1 -2
- package/src/entrypoints/server/utils.ts +2 -3
- package/src/events/event_service.ts +30 -5
- package/src/events/private_event_filter_validator.ts +21 -1
- package/src/logs/log_service.ts +57 -78
- 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 +20 -10
- package/src/private_kernel/private_kernel_execution_prover.ts +4 -9
- package/src/private_kernel/private_kernel_oracle.ts +14 -14
- package/src/pxe.ts +96 -33
- package/src/storage/anchor_block_store/anchor_block_store.ts +1 -1
- package/src/storage/capsule_store/capsule_service.ts +90 -0
- package/src/storage/capsule_store/capsule_store.ts +44 -26
- package/src/storage/capsule_store/index.ts +1 -0
- package/src/storage/contract_store/contract_store.ts +8 -6
- package/src/storage/metadata.ts +1 -1
- package/src/storage/note_store/note_store.ts +2 -5
- package/src/storage/private_event_store/private_event_store.ts +4 -0
- package/src/storage/private_event_store/stored_private_event.ts +1 -1
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +5 -15
- 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
|
@@ -106,7 +106,7 @@ export class NoteStore implements StagedStore {
|
|
|
106
106
|
* returned once if this is the case)
|
|
107
107
|
*/
|
|
108
108
|
getNotes(filter: NotesFilter, jobId: string): Promise<NoteDao[]> {
|
|
109
|
-
if (filter.scopes
|
|
109
|
+
if (filter.scopes.length === 0) {
|
|
110
110
|
return Promise.resolve([]);
|
|
111
111
|
}
|
|
112
112
|
|
|
@@ -180,10 +180,7 @@ export class NoteStore implements StagedStore {
|
|
|
180
180
|
continue;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
if (
|
|
184
|
-
filter.scopes !== 'ALL_SCOPES' &&
|
|
185
|
-
note.scopes.intersection(new Set(filter.scopes.map(s => s.toString()))).size === 0
|
|
186
|
-
) {
|
|
183
|
+
if (note.scopes.intersection(new Set(filter.scopes.map(s => s.toString()))).size === 0) {
|
|
187
184
|
continue;
|
|
188
185
|
}
|
|
189
186
|
|
|
@@ -234,6 +234,10 @@ export class PrivateEventStore implements StagedStore {
|
|
|
234
234
|
* IMPORTANT: This method must be called within a transaction to ensure atomicity.
|
|
235
235
|
*/
|
|
236
236
|
public async rollback(blockNumber: number, synchedBlockNumber: number): Promise<void> {
|
|
237
|
+
if (this.#eventsForJob.size > 0) {
|
|
238
|
+
throw new Error('PXE private event store rollback is not allowed while jobs are running');
|
|
239
|
+
}
|
|
240
|
+
|
|
237
241
|
// First pass: collect all event IDs for all blocks, starting reads during iteration to keep tx alive.
|
|
238
242
|
const eventsByBlock: Map<number, { eventId: string; eventReadPromise: Promise<Buffer | undefined> }[]> = new Map();
|
|
239
243
|
|
|
@@ -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 = BlockHash.fromBuffer(reader);
|
|
53
53
|
const txHash = TxHash.fromBuffer(reader);
|
|
54
54
|
const txIndexInBlock = reader.readNumber();
|
|
55
55
|
const eventIndexInTx = reader.readNumber();
|
|
@@ -21,6 +21,8 @@ export async function loadPrivateLogsForSenderRecipientPair(
|
|
|
21
21
|
taggingStore: RecipientTaggingStore,
|
|
22
22
|
anchorBlockNumber: BlockNumber,
|
|
23
23
|
anchorBlockHash: BlockHash,
|
|
24
|
+
currentTimestamp: bigint,
|
|
25
|
+
finalizedBlockNumber: BlockNumber,
|
|
24
26
|
jobId: string,
|
|
25
27
|
): Promise<TxScopedL2Log[]> {
|
|
26
28
|
// # Explanation of how the algorithm works
|
|
@@ -61,20 +63,6 @@ export async function loadPrivateLogsForSenderRecipientPair(
|
|
|
61
63
|
// the highest finalized index. If that index was already used, they will throw an error. For this reason we
|
|
62
64
|
// don't have to look further than `highestFinalizedIndex + WINDOW_LEN`.
|
|
63
65
|
|
|
64
|
-
let finalizedBlockNumber: number, currentTimestamp: bigint;
|
|
65
|
-
{
|
|
66
|
-
const [l2Tips, latestBlockHeader] = await Promise.all([aztecNode.getL2Tips(), aztecNode.getBlockHeader('latest')]);
|
|
67
|
-
|
|
68
|
-
if (!latestBlockHeader) {
|
|
69
|
-
throw new Error('Node failed to return latest block header when syncing logs');
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
[finalizedBlockNumber, currentTimestamp] = [
|
|
73
|
-
l2Tips.finalized.block.number,
|
|
74
|
-
latestBlockHeader.globalVariables.timestamp,
|
|
75
|
-
];
|
|
76
|
-
}
|
|
77
|
-
|
|
78
66
|
let start: number, end: number;
|
|
79
67
|
{
|
|
80
68
|
const currentHighestAgedIndex = await taggingStore.getHighestAgedIndex(secret, jobId);
|
|
@@ -125,7 +113,9 @@ export async function loadPrivateLogsForSenderRecipientPair(
|
|
|
125
113
|
|
|
126
114
|
if (highestAgedIndex !== undefined && highestAgedIndex > highestFinalizedIndex) {
|
|
127
115
|
// This is just a sanity check as this should never happen.
|
|
128
|
-
throw new Error(
|
|
116
|
+
throw new Error(
|
|
117
|
+
`Highest aged index (${highestAgedIndex}) must not exceed highest finalized index (${highestFinalizedIndex})`,
|
|
118
|
+
);
|
|
129
119
|
}
|
|
130
120
|
|
|
131
121
|
await taggingStore.updateHighestFinalizedIndex(secret, highestFinalizedIndex, jobId);
|
package/dest/access_scopes.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
|
-
/**
|
|
3
|
-
* Controls which accounts' private state and keys are accessible during execution.
|
|
4
|
-
* - `'ALL_SCOPES'`: All registered accounts' private state and keys are accessible.
|
|
5
|
-
* - `AztecAddress[]` with entries: Only the specified accounts' private state and keys are accessible.
|
|
6
|
-
* - `[]` (empty array): Deny-all. No private state is visible and no keys are accessible.
|
|
7
|
-
*/
|
|
8
|
-
export type AccessScopes = 'ALL_SCOPES' | AztecAddress[];
|
|
9
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWNjZXNzX3Njb3Blcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2FjY2Vzc19zY29wZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFFaEU7Ozs7O0dBS0c7QUFDSCxNQUFNLE1BQU0sWUFBWSxHQUFHLFlBQVksR0FBRyxZQUFZLEVBQUUsQ0FBQyJ9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"access_scopes.d.ts","sourceRoot":"","sources":["../src/access_scopes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,YAAY,EAAE,CAAC"}
|
package/dest/access_scopes.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Controls which accounts' private state and keys are accessible during execution.
|
|
3
|
-
* - `'ALL_SCOPES'`: All registered accounts' private state and keys are accessible.
|
|
4
|
-
* - `AztecAddress[]` with entries: Only the specified accounts' private state and keys are accessible.
|
|
5
|
-
* - `[]` (empty array): Deny-all. No private state is visible and no keys are accessible.
|
|
6
|
-
*/ export { };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
import type { TxHash } from '@aztec/stdlib/tx';
|
|
3
|
-
/**
|
|
4
|
-
* Intermediate struct used to return resolved message contexts from PXE. The
|
|
5
|
-
* `utilityResolveMessageContexts` oracle stores values of this type in a CapsuleArray.
|
|
6
|
-
*/
|
|
7
|
-
export declare class MessageTxContext {
|
|
8
|
-
txHash: TxHash;
|
|
9
|
-
uniqueNoteHashesInTx: Fr[];
|
|
10
|
-
firstNullifierInTx: Fr;
|
|
11
|
-
constructor(txHash: TxHash, uniqueNoteHashesInTx: Fr[], firstNullifierInTx: Fr);
|
|
12
|
-
toFields(): Fr[];
|
|
13
|
-
static toEmptyFields(): Fr[];
|
|
14
|
-
static toSerializedOption(response: MessageTxContext | null): Fr[];
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVzc2FnZV90eF9jb250ZXh0LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY29udHJhY3RfZnVuY3Rpb25fc2ltdWxhdG9yL25vaXItc3RydWN0cy9tZXNzYWdlX3R4X2NvbnRleHQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3BELE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBRS9DOzs7R0FHRztBQUNILHFCQUFhLGdCQUFnQjtJQUVsQixNQUFNLEVBQUUsTUFBTTtJQUNkLG9CQUFvQixFQUFFLEVBQUUsRUFBRTtJQUMxQixrQkFBa0IsRUFBRSxFQUFFO0lBSC9CLFlBQ1MsTUFBTSxFQUFFLE1BQU0sRUFDZCxvQkFBb0IsRUFBRSxFQUFFLEVBQUUsRUFDMUIsa0JBQWtCLEVBQUUsRUFBRSxFQUMzQjtJQUVKLFFBQVEsSUFBSSxFQUFFLEVBQUUsQ0FNZjtJQUVELE1BQU0sQ0FBQyxhQUFhLElBQUksRUFBRSxFQUFFLENBSTNCO0lBRUQsTUFBTSxDQUFDLGtCQUFrQixDQUFDLFFBQVEsRUFBRSxnQkFBZ0IsR0FBRyxJQUFJLEdBQUcsRUFBRSxFQUFFLENBTWpFO0NBQ0YifQ==
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"message_tx_context.d.ts","sourceRoot":"","sources":["../../../src/contract_function_simulator/noir-structs/message_tx_context.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;;GAGG;AACH,qBAAa,gBAAgB;IAElB,MAAM,EAAE,MAAM;IACd,oBAAoB,EAAE,EAAE,EAAE;IAC1B,kBAAkB,EAAE,EAAE;IAH/B,YACS,MAAM,EAAE,MAAM,EACd,oBAAoB,EAAE,EAAE,EAAE,EAC1B,kBAAkB,EAAE,EAAE,EAC3B;IAEJ,QAAQ,IAAI,EAAE,EAAE,CAMf;IAED,MAAM,CAAC,aAAa,IAAI,EAAE,EAAE,CAI3B;IAED,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI,GAAG,EAAE,EAAE,CAMjE;CACF"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { MAX_NOTE_HASHES_PER_TX } from '@aztec/constants';
|
|
2
|
-
import { range } from '@aztec/foundation/array';
|
|
3
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
-
/**
|
|
5
|
-
* Intermediate struct used to return resolved message contexts from PXE. The
|
|
6
|
-
* `utilityResolveMessageContexts` oracle stores values of this type in a CapsuleArray.
|
|
7
|
-
*/ export class MessageTxContext {
|
|
8
|
-
txHash;
|
|
9
|
-
uniqueNoteHashesInTx;
|
|
10
|
-
firstNullifierInTx;
|
|
11
|
-
constructor(txHash, uniqueNoteHashesInTx, firstNullifierInTx){
|
|
12
|
-
this.txHash = txHash;
|
|
13
|
-
this.uniqueNoteHashesInTx = uniqueNoteHashesInTx;
|
|
14
|
-
this.firstNullifierInTx = firstNullifierInTx;
|
|
15
|
-
}
|
|
16
|
-
toFields() {
|
|
17
|
-
return [
|
|
18
|
-
this.txHash.hash,
|
|
19
|
-
...serializeBoundedVec(this.uniqueNoteHashesInTx, MAX_NOTE_HASHES_PER_TX),
|
|
20
|
-
this.firstNullifierInTx
|
|
21
|
-
];
|
|
22
|
-
}
|
|
23
|
-
static toEmptyFields() {
|
|
24
|
-
const serializationLen = 1 /* txHash */ + MAX_NOTE_HASHES_PER_TX + 1 /* uniqueNoteHashesInTx BVec */ + 1; /* firstNullifierInTx */
|
|
25
|
-
return range(serializationLen).map((_)=>Fr.zero());
|
|
26
|
-
}
|
|
27
|
-
static toSerializedOption(response) {
|
|
28
|
-
if (response) {
|
|
29
|
-
return [
|
|
30
|
-
new Fr(1),
|
|
31
|
-
...response.toFields()
|
|
32
|
-
];
|
|
33
|
-
} else {
|
|
34
|
-
return [
|
|
35
|
-
new Fr(0),
|
|
36
|
-
...MessageTxContext.toEmptyFields()
|
|
37
|
-
];
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Helper function to serialize a bounded vector according to Noir's BoundedVec format
|
|
43
|
-
* @param values - The values to serialize
|
|
44
|
-
* @param maxLength - The maximum length of the bounded vector
|
|
45
|
-
* @returns The serialized bounded vector as Fr[]
|
|
46
|
-
*/ function serializeBoundedVec(values, maxLength) {
|
|
47
|
-
if (values.length > maxLength) {
|
|
48
|
-
throw new Error(`Attempted to serialize ${values} values into a BoundedVec with max length ${maxLength}`);
|
|
49
|
-
}
|
|
50
|
-
const lengthDiff = maxLength - values.length;
|
|
51
|
-
const zeroPaddingArray = Array(lengthDiff).fill(Fr.ZERO);
|
|
52
|
-
const storage = values.concat(zeroPaddingArray);
|
|
53
|
-
return [
|
|
54
|
-
...storage,
|
|
55
|
-
new Fr(values.length)
|
|
56
|
-
];
|
|
57
|
-
}
|
package/src/access_scopes.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Controls which accounts' private state and keys are accessible during execution.
|
|
5
|
-
* - `'ALL_SCOPES'`: All registered accounts' private state and keys are accessible.
|
|
6
|
-
* - `AztecAddress[]` with entries: Only the specified accounts' private state and keys are accessible.
|
|
7
|
-
* - `[]` (empty array): Deny-all. No private state is visible and no keys are accessible.
|
|
8
|
-
*/
|
|
9
|
-
export type AccessScopes = 'ALL_SCOPES' | AztecAddress[];
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { MAX_NOTE_HASHES_PER_TX } from '@aztec/constants';
|
|
2
|
-
import { range } from '@aztec/foundation/array';
|
|
3
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
-
import type { TxHash } from '@aztec/stdlib/tx';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Intermediate struct used to return resolved message contexts from PXE. The
|
|
8
|
-
* `utilityResolveMessageContexts` oracle stores values of this type in a CapsuleArray.
|
|
9
|
-
*/
|
|
10
|
-
export class MessageTxContext {
|
|
11
|
-
constructor(
|
|
12
|
-
public txHash: TxHash,
|
|
13
|
-
public uniqueNoteHashesInTx: Fr[],
|
|
14
|
-
public firstNullifierInTx: Fr,
|
|
15
|
-
) {}
|
|
16
|
-
|
|
17
|
-
toFields(): Fr[] {
|
|
18
|
-
return [
|
|
19
|
-
this.txHash.hash,
|
|
20
|
-
...serializeBoundedVec(this.uniqueNoteHashesInTx, MAX_NOTE_HASHES_PER_TX),
|
|
21
|
-
this.firstNullifierInTx,
|
|
22
|
-
];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
static toEmptyFields(): Fr[] {
|
|
26
|
-
const serializationLen =
|
|
27
|
-
1 /* txHash */ + MAX_NOTE_HASHES_PER_TX + 1 /* uniqueNoteHashesInTx BVec */ + 1; /* firstNullifierInTx */
|
|
28
|
-
return range(serializationLen).map(_ => Fr.zero());
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
static toSerializedOption(response: MessageTxContext | null): Fr[] {
|
|
32
|
-
if (response) {
|
|
33
|
-
return [new Fr(1), ...response.toFields()];
|
|
34
|
-
} else {
|
|
35
|
-
return [new Fr(0), ...MessageTxContext.toEmptyFields()];
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Helper function to serialize a bounded vector according to Noir's BoundedVec format
|
|
42
|
-
* @param values - The values to serialize
|
|
43
|
-
* @param maxLength - The maximum length of the bounded vector
|
|
44
|
-
* @returns The serialized bounded vector as Fr[]
|
|
45
|
-
*/
|
|
46
|
-
function serializeBoundedVec(values: Fr[], maxLength: number): Fr[] {
|
|
47
|
-
if (values.length > maxLength) {
|
|
48
|
-
throw new Error(`Attempted to serialize ${values} values into a BoundedVec with max length ${maxLength}`);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const lengthDiff = maxLength - values.length;
|
|
52
|
-
const zeroPaddingArray = Array(lengthDiff).fill(Fr.ZERO);
|
|
53
|
-
const storage = values.concat(zeroPaddingArray);
|
|
54
|
-
return [...storage, new Fr(values.length)];
|
|
55
|
-
}
|