@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
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import { L2Block, type L2BlockSource } from '@aztec/stdlib/block';
|
|
4
|
+
import { Checkpoint, L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
5
|
+
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
6
|
+
|
|
7
|
+
// TODO(spl/new-rpc-api): delete once `L2BlockStream` is refactored to consume the new
|
|
8
|
+
// `BlockResponse` / `CheckpointResponse` shapes. For now the stream requires concrete `L2Block`
|
|
9
|
+
// and `PublishedCheckpoint` instances, so we rehydrate them from RPC responses.
|
|
10
|
+
/**
|
|
11
|
+
* Lifts an {@link AztecNode} RPC client into the shape {@link L2BlockStream} expects. `getBlocks`
|
|
12
|
+
* requests transaction bodies so that real `L2Block` instances can be constructed;
|
|
13
|
+
* `getCheckpoints` requests blocks + L1 info + attestations so that `PublishedCheckpoint`
|
|
14
|
+
* instances are fully populated.
|
|
15
|
+
*/
|
|
16
|
+
export function blockStreamSourceFromAztecNode(
|
|
17
|
+
node: AztecNode,
|
|
18
|
+
): Pick<L2BlockSource, 'getBlocks' | 'getBlockHeader' | 'getL2Tips' | 'getCheckpoints' | 'getCheckpointedBlocks'> {
|
|
19
|
+
return {
|
|
20
|
+
getL2Tips: () => node.getL2Tips(),
|
|
21
|
+
getBlockHeader: number => node.getBlockHeader(number),
|
|
22
|
+
getCheckpointedBlocks: (from: BlockNumber, limit: number) => node.getCheckpointedBlocks(from, limit),
|
|
23
|
+
|
|
24
|
+
async getBlocks(from: BlockNumber, limit: number): Promise<L2Block[]> {
|
|
25
|
+
const responses = await node.getBlocks(from, limit, { includeTransactions: true });
|
|
26
|
+
return responses.map(r => new L2Block(r.archive, r.header, r.body!, r.checkpointNumber, r.indexWithinCheckpoint));
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
async getCheckpoints(from: CheckpointNumber, limit: number): Promise<PublishedCheckpoint[]> {
|
|
30
|
+
const responses = await node.getCheckpoints(from, limit, {
|
|
31
|
+
includeBlocks: true,
|
|
32
|
+
includeTransactions: true,
|
|
33
|
+
includeL1PublishInfo: true,
|
|
34
|
+
includeAttestations: true,
|
|
35
|
+
});
|
|
36
|
+
return responses.map(r => {
|
|
37
|
+
const checkpoint = new Checkpoint(
|
|
38
|
+
r.archive,
|
|
39
|
+
r.header,
|
|
40
|
+
r.blocks!.map(b => new L2Block(b.archive, b.header, b.body!, b.checkpointNumber, b.indexWithinCheckpoint)),
|
|
41
|
+
r.number,
|
|
42
|
+
r.feeAssetPriceModifier,
|
|
43
|
+
);
|
|
44
|
+
const l1 =
|
|
45
|
+
r.l1?.published === true
|
|
46
|
+
? new L1PublishedData(r.l1.blockNumber, r.l1.timestamp, r.l1.blockHash)
|
|
47
|
+
: new L1PublishedData(0n, 0n, Fr.ZERO.toString());
|
|
48
|
+
return new PublishedCheckpoint(checkpoint, l1, r.attestations ?? []);
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
3
|
+
import { SerialQueue } from '@aztec/foundation/queue';
|
|
3
4
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
4
5
|
import type { L2TipsKVStore } from '@aztec/kv-store/stores';
|
|
5
6
|
import { BlockHash, L2BlockStream, type L2BlockStreamEvent, type L2BlockStreamEventHandler } from '@aztec/stdlib/block';
|
|
@@ -11,6 +12,7 @@ import type { ContractSyncService } from '../contract_sync/contract_sync_service
|
|
|
11
12
|
import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
|
|
12
13
|
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
13
14
|
import type { PrivateEventStore } from '../storage/private_event_store/private_event_store.js';
|
|
15
|
+
import { blockStreamSourceFromAztecNode } from './block_stream_source.js';
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* The BlockSynchronizer class orchestrates synchronization between PXE and Aztec node, maintaining an up-to-date
|
|
@@ -20,6 +22,7 @@ import type { PrivateEventStore } from '../storage/private_event_store/private_e
|
|
|
20
22
|
export class BlockSynchronizer implements L2BlockStreamEventHandler {
|
|
21
23
|
private log: Logger;
|
|
22
24
|
private isSyncing: Promise<void> | undefined;
|
|
25
|
+
private readonly eventQueue = new SerialQueue();
|
|
23
26
|
protected readonly blockStream: L2BlockStream;
|
|
24
27
|
|
|
25
28
|
constructor(
|
|
@@ -35,11 +38,12 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
|
|
|
35
38
|
) {
|
|
36
39
|
this.log = createLogger('pxe:block_synchronizer', bindings);
|
|
37
40
|
this.blockStream = this.createBlockStream(config);
|
|
41
|
+
this.eventQueue.start();
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
protected createBlockStream(config: Partial<BlockSynchronizerConfig>): L2BlockStream {
|
|
41
45
|
return new L2BlockStream(
|
|
42
|
-
this.node,
|
|
46
|
+
blockStreamSourceFromAztecNode(this.node),
|
|
43
47
|
this.l2TipsStore,
|
|
44
48
|
this,
|
|
45
49
|
createLogger('pxe:block_stream', this.log.getBindings()),
|
|
@@ -52,8 +56,12 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
|
|
|
52
56
|
);
|
|
53
57
|
}
|
|
54
58
|
|
|
55
|
-
/** Handle events emitted by the block stream. */
|
|
56
|
-
public
|
|
59
|
+
/** Handle events emitted by the block stream. Serialized to prevent concurrent mutations to anchor state. */
|
|
60
|
+
public handleBlockStreamEvent(event: L2BlockStreamEvent): Promise<void> {
|
|
61
|
+
return this.eventQueue.put(() => this.doHandleBlockStreamEvent(event));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
private async doHandleBlockStreamEvent(event: L2BlockStreamEvent): Promise<void> {
|
|
57
65
|
await this.l2TipsStore.handleBlockStreamEvent(event);
|
|
58
66
|
|
|
59
67
|
switch (event.type) {
|
|
@@ -74,18 +82,22 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
|
|
|
74
82
|
}
|
|
75
83
|
case 'chain-proven': {
|
|
76
84
|
if (this.config.syncChainTip === 'proven') {
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
79
|
-
await this.updateAnchorBlockHeader(
|
|
85
|
+
const block = await this.node.getBlock(BlockNumber(event.block.number));
|
|
86
|
+
if (block) {
|
|
87
|
+
await this.updateAnchorBlockHeader(block.header);
|
|
88
|
+
} else {
|
|
89
|
+
this.log.warn(`Block header not found for proven block ${event.block.number}, skipping anchor update`);
|
|
80
90
|
}
|
|
81
91
|
}
|
|
82
92
|
break;
|
|
83
93
|
}
|
|
84
94
|
case 'chain-finalized': {
|
|
85
95
|
if (this.config.syncChainTip === 'finalized') {
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
88
|
-
await this.updateAnchorBlockHeader(
|
|
96
|
+
const block = await this.node.getBlock(BlockNumber(event.block.number));
|
|
97
|
+
if (block) {
|
|
98
|
+
await this.updateAnchorBlockHeader(block.header);
|
|
99
|
+
} else {
|
|
100
|
+
this.log.warn(`Block header not found for finalized block ${event.block.number}, skipping anchor update`);
|
|
89
101
|
}
|
|
90
102
|
}
|
|
91
103
|
break;
|
|
@@ -106,7 +118,8 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
|
|
|
106
118
|
// Note that the following is not necessarily the anchor block that will be used in the transaction - if
|
|
107
119
|
// the chain has already moved past the reorg, we'll also see blocks-added events that will push the anchor
|
|
108
120
|
// forward.
|
|
109
|
-
const
|
|
121
|
+
const newAnchorBlock = await this.node.getBlock(BlockHash.fromString(event.block.hash));
|
|
122
|
+
const newAnchorBlockHeader = newAnchorBlock?.header;
|
|
110
123
|
|
|
111
124
|
if (!newAnchorBlockHeader) {
|
|
112
125
|
throw new Error(
|
|
@@ -152,6 +165,8 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
|
|
|
152
165
|
}
|
|
153
166
|
|
|
154
167
|
this.log.debug(`Syncing PXE with the node`);
|
|
168
|
+
// Capture the promise locally so we always await the exact promise we created, even if this.isSyncing is modified
|
|
169
|
+
// between assignment and await (e.g. due to future refactors introducing a yield point).
|
|
155
170
|
const isSyncing = this.doSync();
|
|
156
171
|
this.isSyncing = isSyncing;
|
|
157
172
|
try {
|
|
@@ -161,6 +176,13 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
|
|
|
161
176
|
}
|
|
162
177
|
}
|
|
163
178
|
|
|
179
|
+
/** Stops the block synchronizer, waiting for any in-progress sync and queued events to complete. */
|
|
180
|
+
public async stop() {
|
|
181
|
+
await this.isSyncing;
|
|
182
|
+
await this.blockStream.stop();
|
|
183
|
+
await this.eventQueue.end();
|
|
184
|
+
}
|
|
185
|
+
|
|
164
186
|
private async doSync() {
|
|
165
187
|
let currentHeader;
|
|
166
188
|
|
|
@@ -171,7 +193,7 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
|
|
|
171
193
|
}
|
|
172
194
|
if (!currentHeader) {
|
|
173
195
|
// REFACTOR: We should know the header of the genesis block without having to request it from the node.
|
|
174
|
-
await this.anchorBlockStore.setHeader((await this.node.
|
|
196
|
+
await this.anchorBlockStore.setHeader((await this.node.getBlock(BlockNumber.ZERO))!.header);
|
|
175
197
|
}
|
|
176
198
|
await this.blockStream.sync();
|
|
177
199
|
}
|
package/src/config/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
type ConfigMappingsType,
|
|
3
3
|
booleanConfigHelper,
|
|
4
|
+
enumConfigHelper,
|
|
4
5
|
getConfigFromMappings,
|
|
5
6
|
numberConfigHelper,
|
|
6
7
|
parseBooleanEnv,
|
|
@@ -58,14 +59,7 @@ export const pxeConfigMappings: ConfigMappingsType<PXEConfig> = {
|
|
|
58
59
|
syncChainTip: {
|
|
59
60
|
env: 'PXE_SYNC_CHAIN_TIP',
|
|
60
61
|
description: 'Which chain tip to sync to (proposed, checkpointed, proven, finalized)',
|
|
61
|
-
|
|
62
|
-
parseEnv: (val: string) => {
|
|
63
|
-
const allowedValues = ['proposed', 'checkpointed', 'proven', 'finalized'];
|
|
64
|
-
if (allowedValues.includes(val)) {
|
|
65
|
-
return val;
|
|
66
|
-
}
|
|
67
|
-
throw new Error(`Invalid value for PXE_SYNC_CHAIN_TIP: ${val}. Allowed values are: ${allowedValues.join(', ')}`);
|
|
68
|
-
},
|
|
62
|
+
...enumConfigHelper(['proposed', 'checkpointed', 'proven', 'finalized'], 'proposed'),
|
|
69
63
|
},
|
|
70
64
|
};
|
|
71
65
|
|
|
@@ -42,7 +42,7 @@ import type { FunctionCall } from '@aztec/stdlib/abi';
|
|
|
42
42
|
import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
43
43
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
44
44
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
45
|
-
import type { BlockParameter } from '@aztec/stdlib/block';
|
|
45
|
+
import type { BlockParameter, L2TipsProvider } from '@aztec/stdlib/block';
|
|
46
46
|
import { Gas } from '@aztec/stdlib/gas';
|
|
47
47
|
import {
|
|
48
48
|
computeNoteHashNonce,
|
|
@@ -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
|
};
|
|
@@ -134,6 +134,7 @@ export type ContractFunctionSimulatorArgs = {
|
|
|
134
134
|
keyStore: KeyStore;
|
|
135
135
|
addressStore: AddressStore;
|
|
136
136
|
aztecNode: AztecNode;
|
|
137
|
+
l2TipsStore: L2TipsProvider;
|
|
137
138
|
senderTaggingStore: SenderTaggingStore;
|
|
138
139
|
recipientTaggingStore: RecipientTaggingStore;
|
|
139
140
|
senderAddressBookStore: SenderAddressBookStore;
|
|
@@ -154,6 +155,7 @@ export class ContractFunctionSimulator {
|
|
|
154
155
|
private readonly keyStore: KeyStore;
|
|
155
156
|
private readonly addressStore: AddressStore;
|
|
156
157
|
private readonly aztecNode: AztecNode;
|
|
158
|
+
private readonly l2TipsStore: L2TipsProvider;
|
|
157
159
|
private readonly senderTaggingStore: SenderTaggingStore;
|
|
158
160
|
private readonly recipientTaggingStore: RecipientTaggingStore;
|
|
159
161
|
private readonly senderAddressBookStore: SenderAddressBookStore;
|
|
@@ -169,6 +171,7 @@ export class ContractFunctionSimulator {
|
|
|
169
171
|
this.keyStore = args.keyStore;
|
|
170
172
|
this.addressStore = args.addressStore;
|
|
171
173
|
this.aztecNode = args.aztecNode;
|
|
174
|
+
this.l2TipsStore = args.l2TipsStore;
|
|
172
175
|
this.senderTaggingStore = args.senderTaggingStore;
|
|
173
176
|
this.recipientTaggingStore = args.recipientTaggingStore;
|
|
174
177
|
this.senderAddressBookStore = args.senderAddressBookStore;
|
|
@@ -205,7 +208,7 @@ export class ContractFunctionSimulator {
|
|
|
205
208
|
}
|
|
206
209
|
|
|
207
210
|
if (request.origin !== contractAddress) {
|
|
208
|
-
|
|
211
|
+
throw new Error(
|
|
209
212
|
`Request origin does not match contract address in simulation. Request origin: ${request.origin}, contract address: ${contractAddress}`,
|
|
210
213
|
);
|
|
211
214
|
}
|
|
@@ -245,7 +248,7 @@ export class ContractFunctionSimulator {
|
|
|
245
248
|
senderTaggingStore: this.senderTaggingStore,
|
|
246
249
|
recipientTaggingStore: this.recipientTaggingStore,
|
|
247
250
|
senderAddressBookStore: this.senderAddressBookStore,
|
|
248
|
-
|
|
251
|
+
capsuleService: new CapsuleService(this.capsuleStore, scopes),
|
|
249
252
|
privateEventStore: this.privateEventStore,
|
|
250
253
|
messageContextService: this.messageContextService,
|
|
251
254
|
contractSyncService: this.contractSyncService,
|
|
@@ -255,6 +258,7 @@ export class ContractFunctionSimulator {
|
|
|
255
258
|
scopes,
|
|
256
259
|
senderForTags,
|
|
257
260
|
simulator: this.simulator,
|
|
261
|
+
l2TipsStore: this.l2TipsStore,
|
|
258
262
|
});
|
|
259
263
|
|
|
260
264
|
const setupTime = simulatorSetupTimer.ms();
|
|
@@ -284,7 +288,7 @@ export class ContractFunctionSimulator {
|
|
|
284
288
|
);
|
|
285
289
|
const publicFunctionsCalldata = await Promise.all(
|
|
286
290
|
publicCallRequests.map(async r => {
|
|
287
|
-
const calldata = await privateExecutionOracle.
|
|
291
|
+
const calldata = await privateExecutionOracle.getHashPreimage(r.calldataHash);
|
|
288
292
|
return new HashedValues(calldata, r.calldataHash);
|
|
289
293
|
}),
|
|
290
294
|
);
|
|
@@ -305,7 +309,6 @@ export class ContractFunctionSimulator {
|
|
|
305
309
|
}
|
|
306
310
|
}
|
|
307
311
|
|
|
308
|
-
// docs:start:execute_utility_function
|
|
309
312
|
/**
|
|
310
313
|
* Runs a utility function.
|
|
311
314
|
* @param call - The function call to execute.
|
|
@@ -319,7 +322,7 @@ export class ContractFunctionSimulator {
|
|
|
319
322
|
call: FunctionCall,
|
|
320
323
|
authwits: AuthWitness[],
|
|
321
324
|
anchorBlockHeader: BlockHeader,
|
|
322
|
-
scopes:
|
|
325
|
+
scopes: AztecAddress[],
|
|
323
326
|
jobId: string,
|
|
324
327
|
): Promise<{ result: Fr[]; offchainEffects: OffchainEffect[] }> {
|
|
325
328
|
const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
|
|
@@ -340,10 +343,11 @@ export class ContractFunctionSimulator {
|
|
|
340
343
|
aztecNode: this.aztecNode,
|
|
341
344
|
recipientTaggingStore: this.recipientTaggingStore,
|
|
342
345
|
senderAddressBookStore: this.senderAddressBookStore,
|
|
343
|
-
|
|
346
|
+
capsuleService: new CapsuleService(this.capsuleStore, scopes),
|
|
344
347
|
privateEventStore: this.privateEventStore,
|
|
345
348
|
messageContextService: this.messageContextService,
|
|
346
349
|
contractSyncService: this.contractSyncService,
|
|
350
|
+
l2TipsStore: this.l2TipsStore,
|
|
347
351
|
jobId,
|
|
348
352
|
scopes,
|
|
349
353
|
});
|
|
@@ -379,7 +383,6 @@ export class ContractFunctionSimulator {
|
|
|
379
383
|
throw createSimulationError(err instanceof Error ? err : new Error('Unknown error during private execution'));
|
|
380
384
|
}
|
|
381
385
|
}
|
|
382
|
-
// docs:end:execute_utility_function
|
|
383
386
|
|
|
384
387
|
/**
|
|
385
388
|
* Returns the execution statistics collected during the simulator run.
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
|
|
3
|
+
/** In-memory store for ephemeral arrays scoped to a single contract call frame. */
|
|
4
|
+
export class EphemeralArrayService {
|
|
5
|
+
/**
|
|
6
|
+
* Maps a slot to the elements of the array stored at that slot. Each element is a serialized representation of
|
|
7
|
+
* the original type.
|
|
8
|
+
*/
|
|
9
|
+
#arrays: Map<string, Fr[][]> = new Map();
|
|
10
|
+
|
|
11
|
+
/** Returns all elements in the array, or an empty array if uninitialized. */
|
|
12
|
+
readArrayAt(slot: Fr): Fr[][] {
|
|
13
|
+
return this.#arrays.get(slot.toString()) ?? [];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
#setArray(slot: Fr, array: Fr[][]): void {
|
|
17
|
+
this.#arrays.set(slot.toString(), array);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Returns the number of elements in the array at the given slot. */
|
|
21
|
+
len(slot: Fr): number {
|
|
22
|
+
return this.readArrayAt(slot).length;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Appends an element to the array and returns the new length. */
|
|
26
|
+
push(slot: Fr, elements: Fr[]): number {
|
|
27
|
+
const array = this.readArrayAt(slot);
|
|
28
|
+
array.push(elements);
|
|
29
|
+
this.#setArray(slot, array);
|
|
30
|
+
return array.length;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Removes and returns the last element. Throws if empty. */
|
|
34
|
+
pop(slot: Fr): Fr[] {
|
|
35
|
+
const array = this.readArrayAt(slot);
|
|
36
|
+
if (array.length === 0) {
|
|
37
|
+
throw new Error(`Ephemeral array at slot ${slot} is empty`);
|
|
38
|
+
}
|
|
39
|
+
const element = array.pop()!;
|
|
40
|
+
this.#setArray(slot, array);
|
|
41
|
+
return element;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Returns the element at the given index. Throws if out of bounds. */
|
|
45
|
+
get(slot: Fr, index: number): Fr[] {
|
|
46
|
+
const array = this.readArrayAt(slot);
|
|
47
|
+
if (index < 0 || index >= array.length) {
|
|
48
|
+
throw new Error(
|
|
49
|
+
`Ephemeral array index ${index} out of bounds for array of length ${array.length} at slot ${slot}`,
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
return array[index];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Overwrites the element at the given index. Throws if out of bounds. */
|
|
56
|
+
set(slot: Fr, index: number, value: Fr[]): void {
|
|
57
|
+
const array = this.readArrayAt(slot);
|
|
58
|
+
if (index < 0 || index >= array.length) {
|
|
59
|
+
throw new Error(
|
|
60
|
+
`Ephemeral array index ${index} out of bounds for array of length ${array.length} at slot ${slot}`,
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
array[index] = value;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Removes the element at the given index, shifting subsequent elements backward. Throws if out of bounds. */
|
|
67
|
+
remove(slot: Fr, index: number): void {
|
|
68
|
+
const array = this.readArrayAt(slot);
|
|
69
|
+
if (index < 0 || index >= array.length) {
|
|
70
|
+
throw new Error(
|
|
71
|
+
`Ephemeral array index ${index} out of bounds for array of length ${array.length} at slot ${slot}`,
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
array.splice(index, 1);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Removes all elements from the array. */
|
|
78
|
+
clear(slot: Fr): void {
|
|
79
|
+
this.#arrays.delete(slot.toString());
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** Allocates a fresh, unused slot for a new ephemeral array. */
|
|
83
|
+
allocateSlot(): Fr {
|
|
84
|
+
let slot: Fr;
|
|
85
|
+
do {
|
|
86
|
+
slot = Fr.random();
|
|
87
|
+
} while (this.#arrays.has(slot.toString()));
|
|
88
|
+
return slot;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** Creates a new ephemeral array pre-populated with the given elements and returns its slot. */
|
|
92
|
+
newArray(elements: Fr[][]): Fr {
|
|
93
|
+
const slot = this.allocateSlot();
|
|
94
|
+
this.#setArray(slot, elements);
|
|
95
|
+
return slot;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** Copies `count` elements from the source array to the destination array (overwrites destination). */
|
|
99
|
+
copy(srcSlot: Fr, dstSlot: Fr, count: number): void {
|
|
100
|
+
const srcArray = this.readArrayAt(srcSlot);
|
|
101
|
+
if (count > srcArray.length) {
|
|
102
|
+
throw new Error(
|
|
103
|
+
`Cannot copy ${count} elements from ephemeral array of length ${srcArray.length} at slot ${srcSlot}`,
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
// Deep copy the elements to avoid aliasing
|
|
107
|
+
const copied = srcArray.slice(0, count).map(el => [...el]);
|
|
108
|
+
this.#setArray(dstSlot, copied);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -6,7 +6,7 @@ import { TxHash } from '@aztec/stdlib/tx';
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Intermediate struct used to perform batch event validation by PXE. The `utilityValidateAndStoreEnqueuedNotesAndEvents` oracle
|
|
9
|
-
* expects for values of this type to be stored in a `
|
|
9
|
+
* expects for values of this type to be stored in a `EphemeralArray`.
|
|
10
10
|
*/
|
|
11
11
|
export class EventValidationRequest {
|
|
12
12
|
constructor(
|
|
@@ -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
|
}
|
|
@@ -5,7 +5,7 @@ import { Tag } from '@aztec/stdlib/logs';
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Intermediate struct used to perform batch log retrieval by PXE. The `utilityBulkRetrieveLogs` oracle expects values of this
|
|
8
|
-
* type to be stored in a `
|
|
8
|
+
* type to be stored in a `EphemeralArray`.
|
|
9
9
|
*/
|
|
10
10
|
export class LogRetrievalRequest {
|
|
11
11
|
constructor(
|
|
@@ -7,7 +7,7 @@ const MAX_LOG_CONTENT_LEN = PRIVATE_LOG_CIPHERTEXT_LEN;
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Intermediate struct used to perform batch log retrieval by PXE. The `utilityBulkRetrieveLogs` oracle stores values of this
|
|
10
|
-
* type in a `
|
|
10
|
+
* type in a `EphemeralArray`.
|
|
11
11
|
*/
|
|
12
12
|
export class LogRetrievalResponse {
|
|
13
13
|
constructor(
|
|
@@ -5,7 +5,7 @@ import { TxHash } from '@aztec/stdlib/tx';
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Intermediate struct used to perform batch note validation by PXE. The `utilityValidateAndStoreEnqueuedNotesAndEvents` oracle
|
|
8
|
-
* expects for values of this type to be stored in a `
|
|
8
|
+
* expects for values of this type to be stored in a `EphemeralArray`.
|
|
9
9
|
*/
|
|
10
10
|
export class NoteValidationRequest {
|
|
11
11
|
constructor(
|
|
@@ -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
|
}
|
|
@@ -54,7 +54,7 @@ export interface IMiscOracle {
|
|
|
54
54
|
isMisc: true;
|
|
55
55
|
|
|
56
56
|
getRandomField(): Fr;
|
|
57
|
-
assertCompatibleOracleVersion(
|
|
57
|
+
assertCompatibleOracleVersion(major: number, minor: number): void;
|
|
58
58
|
log(level: number, message: string, fields: Fr[]): Promise<void>;
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -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,44 +107,72 @@ 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
|
+
getPendingTaggedLogsV2(scope: AztecAddress): Promise<Fr>;
|
|
123
124
|
validateAndStoreEnqueuedNotesAndEvents(
|
|
124
125
|
contractAddress: AztecAddress,
|
|
125
126
|
noteValidationRequestsArrayBaseSlot: Fr,
|
|
126
127
|
eventValidationRequestsArrayBaseSlot: Fr,
|
|
127
128
|
maxNotePackedLen: number,
|
|
128
129
|
maxEventSerializedLen: number,
|
|
130
|
+
scope: AztecAddress,
|
|
129
131
|
): Promise<void>;
|
|
130
|
-
|
|
132
|
+
getLogsByTag(
|
|
131
133
|
contractAddress: AztecAddress,
|
|
132
134
|
logRetrievalRequestsArrayBaseSlot: Fr,
|
|
133
135
|
logRetrievalResponsesArrayBaseSlot: Fr,
|
|
136
|
+
scope: AztecAddress,
|
|
134
137
|
): Promise<void>;
|
|
135
|
-
|
|
138
|
+
validateAndStoreEnqueuedNotesAndEventsV2(
|
|
139
|
+
noteValidationRequestsArrayBaseSlot: Fr,
|
|
140
|
+
eventValidationRequestsArrayBaseSlot: Fr,
|
|
141
|
+
maxNotePackedLen: number,
|
|
142
|
+
maxEventSerializedLen: number,
|
|
143
|
+
scope: AztecAddress,
|
|
144
|
+
): Promise<void>;
|
|
145
|
+
getLogsByTagV2(requestArrayBaseSlot: Fr): Promise<Fr>;
|
|
146
|
+
getMessageContextsByTxHashV2(requestArrayBaseSlot: Fr): Promise<Fr>;
|
|
147
|
+
getMessageContextsByTxHash(
|
|
136
148
|
contractAddress: AztecAddress,
|
|
137
149
|
messageContextRequestsArrayBaseSlot: Fr,
|
|
138
150
|
messageContextResponsesArrayBaseSlot: Fr,
|
|
151
|
+
scope: AztecAddress,
|
|
152
|
+
): Promise<void>;
|
|
153
|
+
setCapsule(contractAddress: AztecAddress, key: Fr, capsule: Fr[], scope: AztecAddress): void;
|
|
154
|
+
getCapsule(contractAddress: AztecAddress, key: Fr, scope: AztecAddress): Promise<Fr[] | null>;
|
|
155
|
+
deleteCapsule(contractAddress: AztecAddress, key: Fr, scope: AztecAddress): void;
|
|
156
|
+
copyCapsule(
|
|
157
|
+
contractAddress: AztecAddress,
|
|
158
|
+
srcKey: Fr,
|
|
159
|
+
dstKey: Fr,
|
|
160
|
+
numEntries: number,
|
|
161
|
+
scope: AztecAddress,
|
|
139
162
|
): Promise<void>;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
copyCapsule(contractAddress: AztecAddress, srcKey: Fr, dstKey: Fr, numEntries: number): Promise<void>;
|
|
144
|
-
aes128Decrypt(ciphertext: Buffer, iv: Buffer, symKey: Buffer): Promise<Buffer>;
|
|
145
|
-
getSharedSecret(address: AztecAddress, ephPk: Point): Promise<Point>;
|
|
146
|
-
invalidateContractSyncCache(contractAddress: AztecAddress, scopes: AztecAddress[]): void;
|
|
163
|
+
decryptAes128(ciphertext: Buffer, iv: Buffer, symKey: Buffer): Promise<Buffer>;
|
|
164
|
+
getSharedSecret(address: AztecAddress, ephPk: Point, contractAddress: AztecAddress): Promise<Fr>;
|
|
165
|
+
setContractSyncCacheInvalid(contractAddress: AztecAddress, scopes: AztecAddress[]): void;
|
|
147
166
|
emitOffchainEffect(data: Fr[]): Promise<void>;
|
|
167
|
+
|
|
168
|
+
// Ephemeral array methods
|
|
169
|
+
pushEphemeral(slot: Fr, elements: Fr[]): number;
|
|
170
|
+
popEphemeral(slot: Fr): Fr[];
|
|
171
|
+
getEphemeral(slot: Fr, index: number): Fr[];
|
|
172
|
+
setEphemeral(slot: Fr, index: number, elements: Fr[]): void;
|
|
173
|
+
getEphemeralLen(slot: Fr): number;
|
|
174
|
+
removeEphemeral(slot: Fr, index: number): void;
|
|
175
|
+
clearEphemeral(slot: Fr): void;
|
|
148
176
|
}
|
|
149
177
|
|
|
150
178
|
/**
|
|
@@ -154,8 +182,8 @@ export interface IUtilityExecutionOracle {
|
|
|
154
182
|
export interface IPrivateExecutionOracle {
|
|
155
183
|
isPrivate: true;
|
|
156
184
|
|
|
157
|
-
|
|
158
|
-
|
|
185
|
+
setHashPreimage(values: Fr[], hash: Fr): void;
|
|
186
|
+
getHashPreimage(hash: Fr): Promise<Fr[]>;
|
|
159
187
|
notifyCreatedNote(
|
|
160
188
|
owner: AztecAddress,
|
|
161
189
|
storageSlot: Fr,
|
|
@@ -176,9 +204,9 @@ export interface IPrivateExecutionOracle {
|
|
|
176
204
|
sideEffectCounter: number,
|
|
177
205
|
isStaticCall: boolean,
|
|
178
206
|
): Promise<{ endSideEffectCounter: Fr; returnsHash: Fr }>;
|
|
179
|
-
|
|
207
|
+
assertValidPublicCalldata(calldataHash: Fr): Promise<void>;
|
|
180
208
|
notifyRevertiblePhaseStart(minRevertibleSideEffectCounter: number): Promise<void>;
|
|
181
|
-
|
|
209
|
+
isExecutionInRevertiblePhase(sideEffectCounter: number): Promise<boolean>;
|
|
182
210
|
getSenderForTags(): Promise<AztecAddress | undefined>;
|
|
183
211
|
setSenderForTags(senderForTags: AztecAddress): Promise<void>;
|
|
184
212
|
getNextAppTagAsSender(sender: AztecAddress, recipient: AztecAddress): Promise<Tag>;
|