@aztec/stdlib 0.0.1-commit.9b94fc1 → 0.0.1-commit.d3ec352c
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/avm/avm.d.ts +187 -24
- package/dest/avm/avm.d.ts.map +1 -1
- package/dest/avm/avm.js +174 -20
- package/dest/avm/avm_circuit_public_inputs.d.ts +5 -3
- package/dest/avm/avm_circuit_public_inputs.d.ts.map +1 -1
- package/dest/avm/avm_proving_request.d.ts +9 -5
- package/dest/avm/avm_proving_request.d.ts.map +1 -1
- package/dest/block/block_parameter.d.ts +5 -0
- package/dest/block/block_parameter.d.ts.map +1 -0
- package/dest/block/block_parameter.js +6 -0
- package/dest/block/in_block.d.ts +12 -9
- package/dest/block/in_block.d.ts.map +1 -1
- package/dest/block/in_block.js +3 -3
- package/dest/block/index.d.ts +1 -1
- package/dest/block/index.js +1 -1
- package/dest/block/l2_block.d.ts +5 -5
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +3 -2
- package/dest/block/l2_block_code_to_purge.js +3 -3
- package/dest/block/l2_block_header.d.ts +3 -3
- package/dest/block/l2_block_header.d.ts.map +1 -1
- package/dest/block/l2_block_info.d.ts +15 -10
- package/dest/block/l2_block_info.d.ts.map +1 -1
- package/dest/block/l2_block_info.js +7 -6
- package/dest/block/l2_block_new.d.ts +6 -4
- package/dest/block/l2_block_new.d.ts.map +1 -1
- package/dest/block/l2_block_new.js +4 -1
- package/dest/block/l2_block_source.d.ts +63 -97
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +5 -11
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.js +4 -3
- package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts +3 -2
- package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_tips_memory_store.js +4 -2
- package/dest/block/test/l2_tips_store_test_suite.d.ts +1 -1
- package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
- package/dest/block/test/l2_tips_store_test_suite.js +6 -4
- package/dest/checkpoint/checkpoint.d.ts +14 -11
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +5 -5
- package/dest/checkpoint/published_checkpoint.d.ts +5 -3
- package/dest/checkpoint/published_checkpoint.d.ts.map +1 -1
- package/dest/contract/interfaces/contract_data_source.d.ts +3 -2
- package/dest/contract/interfaces/contract_data_source.d.ts.map +1 -1
- package/dest/interfaces/archiver.d.ts +1 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +15 -9
- package/dest/interfaces/aztec-node.d.ts +29 -24
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +25 -23
- package/dest/interfaces/block-builder.d.ts +3 -2
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/epoch-prover.d.ts +4 -4
- package/dest/interfaces/epoch-prover.d.ts.map +1 -1
- package/dest/interfaces/get_logs_response.d.ts +5 -3
- package/dest/interfaces/get_logs_response.d.ts.map +1 -1
- package/dest/interfaces/l2_logs_source.d.ts +4 -3
- package/dest/interfaces/l2_logs_source.d.ts.map +1 -1
- package/dest/interfaces/merkle_tree_operations.d.ts +3 -2
- package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
- package/dest/interfaces/proving-job.d.ts +9 -5
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/tx_provider.d.ts +3 -3
- package/dest/interfaces/tx_provider.d.ts.map +1 -1
- package/dest/interfaces/world_state.d.ts +9 -26
- package/dest/interfaces/world_state.d.ts.map +1 -1
- package/dest/interfaces/world_state.js +4 -3
- package/dest/logs/extended_public_log.d.ts +5 -3
- package/dest/logs/extended_public_log.d.ts.map +1 -1
- package/dest/logs/log_id.d.ts +8 -5
- package/dest/logs/log_id.d.ts.map +1 -1
- package/dest/logs/log_id.js +5 -4
- package/dest/logs/tx_scoped_l2_log.d.ts +10 -7
- package/dest/logs/tx_scoped_l2_log.d.ts.map +1 -1
- package/dest/logs/tx_scoped_l2_log.js +4 -3
- package/dest/messaging/l1_to_l2_message_source.d.ts +10 -3
- package/dest/messaging/l1_to_l2_message_source.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.d.ts +4 -3
- package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
- package/dest/note/note_dao.d.ts +9 -5
- package/dest/note/note_dao.d.ts.map +1 -1
- package/dest/note/note_dao.js +12 -7
- package/dest/note/notes_filter.d.ts +3 -1
- package/dest/note/notes_filter.d.ts.map +1 -1
- package/dest/note/notes_filter.js +1 -0
- package/dest/rollup/checkpoint_header.d.ts +2 -2
- package/dest/rollup/checkpoint_header.d.ts.map +1 -1
- package/dest/rollup/checkpoint_header.js +1 -1
- package/dest/tests/factories.js +5 -5
- package/dest/tests/mocks.d.ts +1 -1
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +2 -1
- package/dest/tx/block_header.d.ts +4 -4
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/content_commitment.d.ts +3 -2
- package/dest/tx/content_commitment.d.ts.map +1 -1
- package/dest/tx/content_commitment.js +10 -2
- package/dest/tx/global_variables.d.ts +13 -11
- package/dest/tx/global_variables.d.ts.map +1 -1
- package/dest/tx/global_variables.js +6 -6
- package/dest/tx/indexed_tx_effect.d.ts +8 -5
- package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
- package/dest/tx/indexed_tx_effect.js +2 -1
- package/dest/tx/private_execution_result.d.ts +3 -3
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/processed_tx.d.ts +2 -2
- package/dest/tx/processed_tx.d.ts.map +1 -1
- package/dest/tx/processed_tx.js +4 -1
- package/dest/tx/tx.d.ts +2 -2
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +1 -0
- package/dest/tx/tx_receipt.d.ts +4 -3
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +2 -1
- package/package.json +9 -9
- package/src/avm/avm.ts +238 -23
- package/src/block/block_parameter.ts +8 -0
- package/src/block/in_block.ts +13 -9
- package/src/block/index.ts +1 -1
- package/src/block/l2_block.ts +10 -5
- package/src/block/l2_block_code_to_purge.ts +3 -3
- package/src/block/l2_block_info.ts +10 -9
- package/src/block/l2_block_new.ts +8 -3
- package/src/block/l2_block_source.ts +40 -22
- package/src/block/l2_block_stream/l2_block_stream.ts +10 -5
- package/src/block/l2_block_stream/l2_tips_memory_store.ts +5 -2
- package/src/block/test/l2_tips_store_test_suite.ts +8 -3
- package/src/checkpoint/checkpoint.ts +7 -7
- package/src/contract/interfaces/contract_data_source.ts +2 -1
- package/src/interfaces/archiver.ts +18 -9
- package/src/interfaces/aztec-node.ts +61 -46
- package/src/interfaces/block-builder.ts +2 -1
- package/src/interfaces/epoch-prover.ts +3 -3
- package/src/interfaces/l2_logs_source.ts +3 -2
- package/src/interfaces/merkle_tree_operations.ts +2 -1
- package/src/interfaces/tx_provider.ts +2 -2
- package/src/interfaces/world_state.ts +12 -11
- package/src/logs/log_id.ts +6 -5
- package/src/logs/tx_scoped_l2_log.ts +5 -4
- package/src/messaging/l1_to_l2_message_source.ts +10 -2
- package/src/messaging/l2_to_l1_membership.ts +3 -2
- package/src/note/note_dao.ts +15 -5
- package/src/note/notes_filter.ts +3 -0
- package/src/rollup/checkpoint_header.ts +4 -2
- package/src/tests/factories.ts +4 -4
- package/src/tests/mocks.ts +2 -1
- package/src/tx/block_header.ts +2 -2
- package/src/tx/content_commitment.ts +11 -2
- package/src/tx/global_variables.ts +8 -8
- package/src/tx/indexed_tx_effect.ts +4 -3
- package/src/tx/private_execution_result.ts +2 -2
- package/src/tx/processed_tx.ts +8 -2
- package/src/tx/tx.ts +2 -1
- package/src/tx/tx_receipt.ts +3 -2
- package/dest/block/l2_block_number.d.ts +0 -5
- package/dest/block/l2_block_number.d.ts.map +0 -1
- package/dest/block/l2_block_number.js +0 -6
- package/src/block/l2_block_number.ts +0 -8
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ARCHIVE_HEIGHT,
|
|
3
|
-
INITIAL_L2_BLOCK_NUM,
|
|
4
3
|
L1_TO_L2_MSG_TREE_HEIGHT,
|
|
5
4
|
NOTE_HASH_TREE_HEIGHT,
|
|
6
5
|
NULLIFIER_TREE_HEIGHT,
|
|
7
6
|
PUBLIC_DATA_TREE_HEIGHT,
|
|
8
7
|
} from '@aztec/constants';
|
|
9
8
|
import { type L1ContractAddresses, L1ContractAddressesSchema } from '@aztec/ethereum/l1-contract-addresses';
|
|
10
|
-
import
|
|
9
|
+
import {
|
|
10
|
+
BlockNumber,
|
|
11
|
+
BlockNumberPositiveSchema,
|
|
12
|
+
BlockNumberSchema,
|
|
13
|
+
type SlotNumber,
|
|
14
|
+
} from '@aztec/foundation/branded-types';
|
|
11
15
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
12
16
|
import type { Fr } from '@aztec/foundation/fields';
|
|
13
17
|
import { createSafeJsonRpcClient, makeFetch } from '@aztec/foundation/json-rpc/client';
|
|
@@ -16,9 +20,9 @@ import { MembershipWitness, SiblingPath } from '@aztec/foundation/trees';
|
|
|
16
20
|
import { z } from 'zod';
|
|
17
21
|
|
|
18
22
|
import type { AztecAddress } from '../aztec-address/index.js';
|
|
19
|
-
import { type
|
|
23
|
+
import { type BlockParameter, BlockParameterSchema } from '../block/block_parameter.js';
|
|
24
|
+
import { type DataInBlock, inBlockSchemaFor } from '../block/in_block.js';
|
|
20
25
|
import { L2Block } from '../block/l2_block.js';
|
|
21
|
-
import { type L2BlockNumber, L2BlockNumberSchema } from '../block/l2_block_number.js';
|
|
22
26
|
import { type L2BlockSource, type L2Tips, L2TipsSchema } from '../block/l2_block_source.js';
|
|
23
27
|
import { PublishedL2Block } from '../block/published_l2_block.js';
|
|
24
28
|
import {
|
|
@@ -88,10 +92,10 @@ export interface AztecNode
|
|
|
88
92
|
* @returns The indices of leaves and the block metadata of a block in which the leaves were inserted.
|
|
89
93
|
*/
|
|
90
94
|
findLeavesIndexes(
|
|
91
|
-
blockNumber:
|
|
95
|
+
blockNumber: BlockParameter,
|
|
92
96
|
treeId: MerkleTreeId,
|
|
93
97
|
leafValues: Fr[],
|
|
94
|
-
): Promise<(
|
|
98
|
+
): Promise<(DataInBlock<bigint> | undefined)[]>;
|
|
95
99
|
|
|
96
100
|
/**
|
|
97
101
|
* Returns a sibling path for the given index in the nullifier tree.
|
|
@@ -100,7 +104,7 @@ export interface AztecNode
|
|
|
100
104
|
* @returns The sibling path for the leaf index.
|
|
101
105
|
*/
|
|
102
106
|
getNullifierSiblingPath(
|
|
103
|
-
blockNumber:
|
|
107
|
+
blockNumber: BlockParameter,
|
|
104
108
|
leafIndex: bigint,
|
|
105
109
|
): Promise<SiblingPath<typeof NULLIFIER_TREE_HEIGHT>>;
|
|
106
110
|
|
|
@@ -111,7 +115,7 @@ export interface AztecNode
|
|
|
111
115
|
* @returns The sibling path for the leaf index.
|
|
112
116
|
*/
|
|
113
117
|
getNoteHashSiblingPath(
|
|
114
|
-
blockNumber:
|
|
118
|
+
blockNumber: BlockParameter,
|
|
115
119
|
leafIndex: bigint,
|
|
116
120
|
): Promise<SiblingPath<typeof NOTE_HASH_TREE_HEIGHT>>;
|
|
117
121
|
|
|
@@ -121,7 +125,7 @@ export interface AztecNode
|
|
|
121
125
|
* @param leafIndex - Index of the leaf in the tree.
|
|
122
126
|
* @returns The sibling path.
|
|
123
127
|
*/
|
|
124
|
-
getArchiveSiblingPath(blockNumber:
|
|
128
|
+
getArchiveSiblingPath(blockNumber: BlockParameter, leafIndex: bigint): Promise<SiblingPath<typeof ARCHIVE_HEIGHT>>;
|
|
125
129
|
|
|
126
130
|
/**
|
|
127
131
|
* Returns a sibling path for a leaf in the committed public data tree.
|
|
@@ -130,7 +134,7 @@ export interface AztecNode
|
|
|
130
134
|
* @returns The sibling path.
|
|
131
135
|
*/
|
|
132
136
|
getPublicDataSiblingPath(
|
|
133
|
-
blockNumber:
|
|
137
|
+
blockNumber: BlockParameter,
|
|
134
138
|
leafIndex: bigint,
|
|
135
139
|
): Promise<SiblingPath<typeof PUBLIC_DATA_TREE_HEIGHT>>;
|
|
136
140
|
|
|
@@ -141,7 +145,7 @@ export interface AztecNode
|
|
|
141
145
|
* @returns The nullifier membership witness (if found).
|
|
142
146
|
*/
|
|
143
147
|
getNullifierMembershipWitness(
|
|
144
|
-
blockNumber:
|
|
148
|
+
blockNumber: BlockParameter,
|
|
145
149
|
nullifier: Fr,
|
|
146
150
|
): Promise<NullifierMembershipWitness | undefined>;
|
|
147
151
|
|
|
@@ -155,7 +159,7 @@ export interface AztecNode
|
|
|
155
159
|
* we are trying to prove non-inclusion for.
|
|
156
160
|
*/
|
|
157
161
|
getLowNullifierMembershipWitness(
|
|
158
|
-
blockNumber:
|
|
162
|
+
blockNumber: BlockParameter,
|
|
159
163
|
nullifier: Fr,
|
|
160
164
|
): Promise<NullifierMembershipWitness | undefined>;
|
|
161
165
|
|
|
@@ -168,7 +172,7 @@ export interface AztecNode
|
|
|
168
172
|
* "in range" slot, means that the slot doesn't exist and the value is 0. If the low leaf preimage corresponds to the exact slot, the current value
|
|
169
173
|
* is contained in the leaf preimage.
|
|
170
174
|
*/
|
|
171
|
-
getPublicDataWitness(blockNumber:
|
|
175
|
+
getPublicDataWitness(blockNumber: BlockParameter, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
|
|
172
176
|
|
|
173
177
|
/**
|
|
174
178
|
* Returns a membership witness for a given archive leaf at a given block.
|
|
@@ -176,7 +180,7 @@ export interface AztecNode
|
|
|
176
180
|
* @param archive - The archive leaf we try to find the witness for.
|
|
177
181
|
*/
|
|
178
182
|
getArchiveMembershipWitness(
|
|
179
|
-
blockNumber:
|
|
183
|
+
blockNumber: BlockParameter,
|
|
180
184
|
archive: Fr,
|
|
181
185
|
): Promise<MembershipWitness<typeof ARCHIVE_HEIGHT> | undefined>;
|
|
182
186
|
|
|
@@ -186,7 +190,7 @@ export interface AztecNode
|
|
|
186
190
|
* @param noteHash - The note hash we try to find the witness for.
|
|
187
191
|
*/
|
|
188
192
|
getNoteHashMembershipWitness(
|
|
189
|
-
blockNumber:
|
|
193
|
+
blockNumber: BlockParameter,
|
|
190
194
|
noteHash: Fr,
|
|
191
195
|
): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT> | undefined>;
|
|
192
196
|
|
|
@@ -197,12 +201,12 @@ export interface AztecNode
|
|
|
197
201
|
* @returns A tuple of the index and the sibling path of the L1ToL2Message (undefined if not found).
|
|
198
202
|
*/
|
|
199
203
|
getL1ToL2MessageMembershipWitness(
|
|
200
|
-
blockNumber:
|
|
204
|
+
blockNumber: BlockParameter,
|
|
201
205
|
l1ToL2Message: Fr,
|
|
202
206
|
): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>] | undefined>;
|
|
203
207
|
|
|
204
208
|
/** Returns the L2 block number in which this L1 to L2 message becomes available, or undefined if not found. */
|
|
205
|
-
getL1ToL2MessageBlock(l1ToL2Message: Fr): Promise<
|
|
209
|
+
getL1ToL2MessageBlock(l1ToL2Message: Fr): Promise<BlockNumber | undefined>;
|
|
206
210
|
|
|
207
211
|
/**
|
|
208
212
|
* Returns whether an L1 to L2 message is synced by archiver.
|
|
@@ -217,14 +221,14 @@ export interface AztecNode
|
|
|
217
221
|
* @param blockNumber - The block number at which to get the data.
|
|
218
222
|
* @returns The L2 to L1 messages (undefined if the block number is not found).
|
|
219
223
|
*/
|
|
220
|
-
getL2ToL1Messages(blockNumber:
|
|
224
|
+
getL2ToL1Messages(blockNumber: BlockParameter): Promise<Fr[][] | undefined>;
|
|
221
225
|
|
|
222
226
|
/**
|
|
223
227
|
* Get a block specified by its number.
|
|
224
228
|
* @param number - The block number being requested.
|
|
225
229
|
* @returns The requested block.
|
|
226
230
|
*/
|
|
227
|
-
getBlock(number:
|
|
231
|
+
getBlock(number: BlockParameter): Promise<L2Block | undefined>;
|
|
228
232
|
|
|
229
233
|
/**
|
|
230
234
|
* Get a block specified by its hash.
|
|
@@ -244,13 +248,13 @@ export interface AztecNode
|
|
|
244
248
|
* Method to fetch the latest block number synchronized by the node.
|
|
245
249
|
* @returns The block number.
|
|
246
250
|
*/
|
|
247
|
-
getBlockNumber(): Promise<
|
|
251
|
+
getBlockNumber(): Promise<BlockNumber>;
|
|
248
252
|
|
|
249
253
|
/**
|
|
250
254
|
* Fetches the latest proven block number.
|
|
251
255
|
* @returns The block number.
|
|
252
256
|
*/
|
|
253
|
-
getProvenBlockNumber(): Promise<
|
|
257
|
+
getProvenBlockNumber(): Promise<BlockNumber>;
|
|
254
258
|
|
|
255
259
|
/**
|
|
256
260
|
* Method to determine if the node is ready to accept transactions.
|
|
@@ -271,7 +275,7 @@ export interface AztecNode
|
|
|
271
275
|
* @param limit - The maximum number of blocks to return.
|
|
272
276
|
* @returns The blocks requested.
|
|
273
277
|
*/
|
|
274
|
-
getBlocks(from:
|
|
278
|
+
getBlocks(from: BlockNumber, limit: number): Promise<L2Block[]>;
|
|
275
279
|
|
|
276
280
|
/**
|
|
277
281
|
* Method to fetch the current base fees.
|
|
@@ -279,6 +283,12 @@ export interface AztecNode
|
|
|
279
283
|
*/
|
|
280
284
|
getCurrentBaseFees(): Promise<GasFees>;
|
|
281
285
|
|
|
286
|
+
/**
|
|
287
|
+
* Method to fetch the current max priority fee of txs in the mempool.
|
|
288
|
+
* @returns The current max priority fees.
|
|
289
|
+
*/
|
|
290
|
+
getMaxPriorityFees(): Promise<GasFees>;
|
|
291
|
+
|
|
282
292
|
/**
|
|
283
293
|
* Method to fetch the version of the package.
|
|
284
294
|
* @returns The node package version
|
|
@@ -320,7 +330,7 @@ export interface AztecNode
|
|
|
320
330
|
* @param limit - The maximum number of blocks to retrieve logs from.
|
|
321
331
|
* @returns An array of private logs from the specified range of blocks.
|
|
322
332
|
*/
|
|
323
|
-
getPrivateLogs(from:
|
|
333
|
+
getPrivateLogs(from: BlockNumber, limit: number): Promise<PrivateLog[]>;
|
|
324
334
|
|
|
325
335
|
/**
|
|
326
336
|
* Gets public logs based on the provided filter.
|
|
@@ -407,13 +417,13 @@ export interface AztecNode
|
|
|
407
417
|
* @param blockNumber - The block number at which to get the data or 'latest'.
|
|
408
418
|
* @returns Storage value at the given contract slot.
|
|
409
419
|
*/
|
|
410
|
-
getPublicStorageAt(blockNumber:
|
|
420
|
+
getPublicStorageAt(blockNumber: BlockParameter, contract: AztecAddress, slot: Fr): Promise<Fr>;
|
|
411
421
|
|
|
412
422
|
/**
|
|
413
423
|
* Returns the currently committed block header.
|
|
414
424
|
* @returns The current committed block header.
|
|
415
425
|
*/
|
|
416
|
-
getBlockHeader(blockNumber?:
|
|
426
|
+
getBlockHeader(blockNumber?: BlockParameter): Promise<BlockHeader | undefined>;
|
|
417
427
|
|
|
418
428
|
/**
|
|
419
429
|
* Get a block header specified by its hash.
|
|
@@ -491,74 +501,77 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
491
501
|
|
|
492
502
|
findLeavesIndexes: z
|
|
493
503
|
.function()
|
|
494
|
-
.args(
|
|
504
|
+
.args(BlockParameterSchema, z.nativeEnum(MerkleTreeId), z.array(schemas.Fr).max(MAX_RPC_LEN))
|
|
495
505
|
.returns(z.array(optional(inBlockSchemaFor(schemas.BigInt)))),
|
|
496
506
|
|
|
497
507
|
getNullifierSiblingPath: z
|
|
498
508
|
.function()
|
|
499
|
-
.args(
|
|
509
|
+
.args(BlockParameterSchema, schemas.BigInt)
|
|
500
510
|
.returns(SiblingPath.schemaFor(NULLIFIER_TREE_HEIGHT)),
|
|
501
511
|
|
|
502
512
|
getNoteHashSiblingPath: z
|
|
503
513
|
.function()
|
|
504
|
-
.args(
|
|
514
|
+
.args(BlockParameterSchema, schemas.BigInt)
|
|
505
515
|
.returns(SiblingPath.schemaFor(NOTE_HASH_TREE_HEIGHT)),
|
|
506
516
|
|
|
507
517
|
getArchiveSiblingPath: z
|
|
508
518
|
.function()
|
|
509
|
-
.args(
|
|
519
|
+
.args(BlockParameterSchema, schemas.BigInt)
|
|
510
520
|
.returns(SiblingPath.schemaFor(ARCHIVE_HEIGHT)),
|
|
511
521
|
|
|
512
522
|
getPublicDataSiblingPath: z
|
|
513
523
|
.function()
|
|
514
|
-
.args(
|
|
524
|
+
.args(BlockParameterSchema, schemas.BigInt)
|
|
515
525
|
.returns(SiblingPath.schemaFor(PUBLIC_DATA_TREE_HEIGHT)),
|
|
516
526
|
|
|
517
527
|
getNullifierMembershipWitness: z
|
|
518
528
|
.function()
|
|
519
|
-
.args(
|
|
529
|
+
.args(BlockParameterSchema, schemas.Fr)
|
|
520
530
|
.returns(NullifierMembershipWitness.schema.optional()),
|
|
521
531
|
|
|
522
532
|
getLowNullifierMembershipWitness: z
|
|
523
533
|
.function()
|
|
524
|
-
.args(
|
|
534
|
+
.args(BlockParameterSchema, schemas.Fr)
|
|
525
535
|
.returns(NullifierMembershipWitness.schema.optional()),
|
|
526
536
|
|
|
527
|
-
getPublicDataWitness: z
|
|
537
|
+
getPublicDataWitness: z
|
|
538
|
+
.function()
|
|
539
|
+
.args(BlockParameterSchema, schemas.Fr)
|
|
540
|
+
.returns(PublicDataWitness.schema.optional()),
|
|
528
541
|
|
|
529
542
|
getArchiveMembershipWitness: z
|
|
530
543
|
.function()
|
|
531
|
-
.args(
|
|
544
|
+
.args(BlockParameterSchema, schemas.Fr)
|
|
532
545
|
.returns(MembershipWitness.schemaFor(ARCHIVE_HEIGHT).optional()),
|
|
533
546
|
|
|
534
547
|
getNoteHashMembershipWitness: z
|
|
535
548
|
.function()
|
|
536
|
-
.args(
|
|
549
|
+
.args(BlockParameterSchema, schemas.Fr)
|
|
537
550
|
.returns(MembershipWitness.schemaFor(NOTE_HASH_TREE_HEIGHT).optional()),
|
|
538
551
|
|
|
539
552
|
getL1ToL2MessageMembershipWitness: z
|
|
540
553
|
.function()
|
|
541
|
-
.args(
|
|
554
|
+
.args(BlockParameterSchema, schemas.Fr)
|
|
542
555
|
.returns(z.tuple([schemas.BigInt, SiblingPath.schemaFor(L1_TO_L2_MSG_TREE_HEIGHT)]).optional()),
|
|
543
556
|
|
|
544
|
-
getL1ToL2MessageBlock: z.function().args(schemas.Fr).returns(
|
|
557
|
+
getL1ToL2MessageBlock: z.function().args(schemas.Fr).returns(BlockNumberSchema.optional()),
|
|
545
558
|
|
|
546
559
|
isL1ToL2MessageSynced: z.function().args(schemas.Fr).returns(z.boolean()),
|
|
547
560
|
|
|
548
561
|
getL2ToL1Messages: z
|
|
549
562
|
.function()
|
|
550
|
-
.args(
|
|
563
|
+
.args(BlockParameterSchema)
|
|
551
564
|
.returns(z.array(z.array(schemas.Fr)).optional()),
|
|
552
565
|
|
|
553
|
-
getBlock: z.function().args(
|
|
566
|
+
getBlock: z.function().args(BlockParameterSchema).returns(L2Block.schema.optional()),
|
|
554
567
|
|
|
555
568
|
getBlockByHash: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
|
|
556
569
|
|
|
557
570
|
getBlockByArchive: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
|
|
558
571
|
|
|
559
|
-
getBlockNumber: z.function().returns(
|
|
572
|
+
getBlockNumber: z.function().returns(BlockNumberSchema),
|
|
560
573
|
|
|
561
|
-
getProvenBlockNumber: z.function().returns(
|
|
574
|
+
getProvenBlockNumber: z.function().returns(BlockNumberSchema),
|
|
562
575
|
|
|
563
576
|
isReady: z.function().returns(z.boolean()),
|
|
564
577
|
|
|
@@ -566,16 +579,18 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
566
579
|
|
|
567
580
|
getBlocks: z
|
|
568
581
|
.function()
|
|
569
|
-
.args(
|
|
582
|
+
.args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
|
|
570
583
|
.returns(z.array(L2Block.schema)),
|
|
571
584
|
|
|
572
585
|
getPublishedBlocks: z
|
|
573
586
|
.function()
|
|
574
|
-
.args(
|
|
587
|
+
.args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
|
|
575
588
|
.returns(z.array(PublishedL2Block.schema)),
|
|
576
589
|
|
|
577
590
|
getCurrentBaseFees: z.function().returns(GasFees.schema),
|
|
578
591
|
|
|
592
|
+
getMaxPriorityFees: z.function().returns(GasFees.schema),
|
|
593
|
+
|
|
579
594
|
getNodeVersion: z.function().returns(z.string()),
|
|
580
595
|
|
|
581
596
|
getVersion: z.function().returns(z.number()),
|
|
@@ -593,7 +608,7 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
593
608
|
|
|
594
609
|
getPrivateLogs: z
|
|
595
610
|
.function()
|
|
596
|
-
.args(
|
|
611
|
+
.args(BlockNumberPositiveSchema, z.number().lte(MAX_RPC_LEN))
|
|
597
612
|
.returns(z.array(PrivateLog.schema)),
|
|
598
613
|
|
|
599
614
|
getPublicLogs: z.function().args(LogFilterSchema).returns(GetPublicLogsResponseSchema),
|
|
@@ -625,9 +640,9 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
625
640
|
|
|
626
641
|
getTxsByHash: z.function().args(z.array(TxHash.schema).max(MAX_RPC_TXS_LEN)).returns(z.array(Tx.schema)),
|
|
627
642
|
|
|
628
|
-
getPublicStorageAt: z.function().args(
|
|
643
|
+
getPublicStorageAt: z.function().args(BlockParameterSchema, schemas.AztecAddress, schemas.Fr).returns(schemas.Fr),
|
|
629
644
|
|
|
630
|
-
getBlockHeader: z.function().args(optional(
|
|
645
|
+
getBlockHeader: z.function().args(optional(BlockParameterSchema)).returns(BlockHeader.schema.optional()),
|
|
631
646
|
|
|
632
647
|
getBlockHeaderByHash: z.function().args(schemas.Fr).returns(BlockHeader.schema.optional()),
|
|
633
648
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import type { Fr } from '@aztec/foundation/fields';
|
|
2
3
|
import type { Timer } from '@aztec/foundation/timer';
|
|
3
4
|
|
|
@@ -74,5 +75,5 @@ export interface IFullNodeBlockBuilder {
|
|
|
74
75
|
fork?: MerkleTreeWriteOperations,
|
|
75
76
|
): Promise<BuildBlockResult>;
|
|
76
77
|
|
|
77
|
-
getFork(blockNumber:
|
|
78
|
+
getFork(blockNumber: BlockNumber): Promise<MerkleTreeWriteOperations>;
|
|
78
79
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BatchedBlob, FinalBlobBatchingChallenges } from '@aztec/blob-lib/types';
|
|
2
|
-
import type { EpochNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import type { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
3
3
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
4
|
import type { Fr } from '@aztec/foundation/fields';
|
|
5
5
|
|
|
@@ -47,7 +47,7 @@ export interface EpochProver extends Omit<IBlockFactory, 'setBlockCompleted' | '
|
|
|
47
47
|
* @param timestamp - The timestamp of the block.
|
|
48
48
|
* @param totalNumTxs - The total number of txs in the block.
|
|
49
49
|
*/
|
|
50
|
-
startNewBlock(blockNumber:
|
|
50
|
+
startNewBlock(blockNumber: BlockNumber, timestamp: UInt64, totalNumTxs: number): Promise<void>;
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* Kickstarts chonk verifier circuits for the specified txs. These will be used during epoch proving.
|
|
@@ -56,7 +56,7 @@ export interface EpochProver extends Omit<IBlockFactory, 'setBlockCompleted' | '
|
|
|
56
56
|
startChonkVerifierCircuits(txs: Tx[]): Promise<void>;
|
|
57
57
|
|
|
58
58
|
/** Returns the block. */
|
|
59
|
-
setBlockCompleted(blockNumber:
|
|
59
|
+
setBlockCompleted(blockNumber: BlockNumber, expectedBlockHeader?: BlockHeader): Promise<BlockHeader>;
|
|
60
60
|
|
|
61
61
|
/** Pads the epoch with empty block roots if needed and blocks until proven. Throws if proving has failed. */
|
|
62
62
|
finalizeEpoch(): Promise<{ publicInputs: RootRollupPublicInputs; proof: Proof; batchedBlobInputs: BatchedBlob }>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import type { Fr } from '@aztec/foundation/fields';
|
|
2
3
|
|
|
3
4
|
import type { LogFilter } from '../logs/log_filter.js';
|
|
@@ -15,7 +16,7 @@ export interface L2LogsSource {
|
|
|
15
16
|
* @param limit - The maximum number of blocks to retrieve logs from.
|
|
16
17
|
* @returns An array of private logs from the specified range of blocks.
|
|
17
18
|
*/
|
|
18
|
-
getPrivateLogs(from:
|
|
19
|
+
getPrivateLogs(from: BlockNumber, limit: number): Promise<PrivateLog[]>;
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Gets all logs that match any of the received tags (i.e. logs with their first field equal to a tag).
|
|
@@ -44,5 +45,5 @@ export interface L2LogsSource {
|
|
|
44
45
|
* Gets the number of the latest L2 block processed by the implementation.
|
|
45
46
|
* @returns The number of the latest L2 block processed by the implementation.
|
|
46
47
|
*/
|
|
47
|
-
getBlockNumber(): Promise<
|
|
48
|
+
getBlockNumber(): Promise<BlockNumber>;
|
|
48
49
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import type { Fr } from '@aztec/foundation/fields';
|
|
2
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
4
|
import { type IndexedTreeLeafPreimage, SiblingPath } from '@aztec/foundation/trees';
|
|
@@ -220,7 +221,7 @@ export interface MerkleTreeReadOperations {
|
|
|
220
221
|
getBlockNumbersForLeafIndices<ID extends MerkleTreeId>(
|
|
221
222
|
treeId: ID,
|
|
222
223
|
leafIndices: bigint[],
|
|
223
|
-
): Promise<(
|
|
224
|
+
): Promise<(BlockNumber | undefined)[]>;
|
|
224
225
|
}
|
|
225
226
|
|
|
226
227
|
export interface MerkleTreeCheckpointOperations {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { L2BlockNew } from '@aztec/stdlib/block';
|
|
2
2
|
import type { BlockProposal } from '@aztec/stdlib/p2p';
|
|
3
3
|
import { type Tx, TxHash } from '@aztec/stdlib/tx';
|
|
4
4
|
|
|
@@ -13,5 +13,5 @@ export interface ITxProvider {
|
|
|
13
13
|
opts: { pinnedPeer: PeerId | undefined; deadline: Date },
|
|
14
14
|
): Promise<{ txs: Tx[]; missingTxs: TxHash[] }>;
|
|
15
15
|
|
|
16
|
-
getTxsForBlock(block:
|
|
16
|
+
getTxsForBlock(block: L2BlockNew, opts: { deadline: Date }): Promise<{ txs: Tx[]; missingTxs: TxHash[] }>;
|
|
17
17
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BlockNumber, BlockNumberSchema } from '@aztec/foundation/branded-types';
|
|
1
2
|
import type { PromiseWithResolvers } from '@aztec/foundation/promise';
|
|
2
3
|
|
|
3
4
|
import { z } from 'zod';
|
|
@@ -18,10 +19,10 @@ export enum WorldStateRunningState {
|
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export interface WorldStateSyncStatus {
|
|
21
|
-
latestBlockNumber:
|
|
22
|
+
latestBlockNumber: BlockNumber;
|
|
22
23
|
latestBlockHash: string;
|
|
23
|
-
finalizedBlockNumber:
|
|
24
|
-
oldestHistoricBlockNumber:
|
|
24
|
+
finalizedBlockNumber: BlockNumber;
|
|
25
|
+
oldestHistoricBlockNumber: BlockNumber;
|
|
25
26
|
treesAreSynched: boolean;
|
|
26
27
|
}
|
|
27
28
|
|
|
@@ -42,10 +43,10 @@ export interface WorldStateSynchronizerStatus {
|
|
|
42
43
|
/** Provides writeable forks of the world state at a given block number. */
|
|
43
44
|
export interface ForkMerkleTreeOperations {
|
|
44
45
|
/** Forks the world state at the given block number, defaulting to the latest one. */
|
|
45
|
-
fork(block?:
|
|
46
|
+
fork(block?: BlockNumber): Promise<MerkleTreeWriteOperations>;
|
|
46
47
|
|
|
47
48
|
/** Gets a handle that allows reading the state as it was at the given block number. */
|
|
48
|
-
getSnapshot(blockNumber:
|
|
49
|
+
getSnapshot(blockNumber: BlockNumber): MerkleTreeReadOperations;
|
|
49
50
|
|
|
50
51
|
/** Backups the db to the target path. */
|
|
51
52
|
backupTo(dstPath: string, compact?: boolean): Promise<Record<Exclude<SnapshotDataKeys, 'archiver'>, string>>;
|
|
@@ -74,7 +75,7 @@ export interface WorldStateSynchronizer extends ForkMerkleTreeOperations {
|
|
|
74
75
|
* @param skipThrowIfTargetNotReached - Whether to skip throwing if the target block number is not reached.
|
|
75
76
|
* @returns A promise that resolves with the block number the world state was synced to
|
|
76
77
|
*/
|
|
77
|
-
syncImmediate(minBlockNumber?:
|
|
78
|
+
syncImmediate(minBlockNumber?: BlockNumber, skipThrowIfTargetNotReached?: boolean): Promise<BlockNumber>;
|
|
78
79
|
|
|
79
80
|
/** Returns an instance of MerkleTreeAdminOperations that will not include uncommitted data. */
|
|
80
81
|
getCommitted(): MerkleTreeReadOperations;
|
|
@@ -83,10 +84,10 @@ export interface WorldStateSynchronizer extends ForkMerkleTreeOperations {
|
|
|
83
84
|
clear(): Promise<void>;
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
export const WorldStateSyncStatusSchema = z.object({
|
|
87
|
-
finalizedBlockNumber:
|
|
88
|
-
latestBlockNumber:
|
|
87
|
+
export const WorldStateSyncStatusSchema: z.ZodType<WorldStateSyncStatus, z.ZodTypeDef, any> = z.object({
|
|
88
|
+
finalizedBlockNumber: BlockNumberSchema,
|
|
89
|
+
latestBlockNumber: BlockNumberSchema,
|
|
89
90
|
latestBlockHash: z.string(),
|
|
90
|
-
oldestHistoricBlockNumber:
|
|
91
|
+
oldestHistoricBlockNumber: BlockNumberSchema,
|
|
91
92
|
treesAreSynched: z.boolean(),
|
|
92
|
-
})
|
|
93
|
+
});
|
package/src/logs/log_id.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
|
|
2
2
|
import { toBufferBE } from '@aztec/foundation/bigint-buffer';
|
|
3
|
+
import { BlockNumber, BlockNumberSchema } from '@aztec/foundation/branded-types';
|
|
3
4
|
import { BufferReader } from '@aztec/foundation/serialize';
|
|
4
5
|
|
|
5
6
|
import { z } from 'zod';
|
|
@@ -16,7 +17,7 @@ export class LogId {
|
|
|
16
17
|
*/
|
|
17
18
|
constructor(
|
|
18
19
|
/** The block number the log was emitted in. */
|
|
19
|
-
public readonly blockNumber:
|
|
20
|
+
public readonly blockNumber: BlockNumber,
|
|
20
21
|
/** The index of a tx in a block the log was emitted in. */
|
|
21
22
|
public readonly txIndex: number,
|
|
22
23
|
/** The index of a log the tx was emitted in. */
|
|
@@ -35,7 +36,7 @@ export class LogId {
|
|
|
35
36
|
|
|
36
37
|
static random() {
|
|
37
38
|
return new LogId(
|
|
38
|
-
Math.floor(Math.random() * 1000) + 1,
|
|
39
|
+
BlockNumber(Math.floor(Math.random() * 1000) + 1),
|
|
39
40
|
Math.floor(Math.random() * 1000),
|
|
40
41
|
Math.floor(Math.random() * 100),
|
|
41
42
|
);
|
|
@@ -44,7 +45,7 @@ export class LogId {
|
|
|
44
45
|
static get schema() {
|
|
45
46
|
return z
|
|
46
47
|
.object({
|
|
47
|
-
blockNumber:
|
|
48
|
+
blockNumber: BlockNumberSchema,
|
|
48
49
|
txIndex: schemas.Integer,
|
|
49
50
|
logIndex: schemas.Integer,
|
|
50
51
|
})
|
|
@@ -71,7 +72,7 @@ export class LogId {
|
|
|
71
72
|
static fromBuffer(buffer: Buffer | BufferReader): LogId {
|
|
72
73
|
const reader = BufferReader.asReader(buffer);
|
|
73
74
|
|
|
74
|
-
const blockNumber = reader.readNumber();
|
|
75
|
+
const blockNumber = BlockNumber(reader.readNumber());
|
|
75
76
|
const txIndex = reader.readNumber();
|
|
76
77
|
const logIndex = reader.readNumber();
|
|
77
78
|
|
|
@@ -93,7 +94,7 @@ export class LogId {
|
|
|
93
94
|
*/
|
|
94
95
|
static fromString(data: string): LogId {
|
|
95
96
|
const [rawBlockNumber, rawTxIndex, rawLogIndex] = data.split('-');
|
|
96
|
-
const blockNumber = Number(rawBlockNumber);
|
|
97
|
+
const blockNumber = BlockNumber(Number(rawBlockNumber));
|
|
97
98
|
const txIndex = Number(rawTxIndex);
|
|
98
99
|
const logIndex = Number(rawLogIndex);
|
|
99
100
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BlockNumber, BlockNumberSchema } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { BufferReader, boolToBuffer, numToUInt32BE } from '@aztec/foundation/serialize';
|
|
2
3
|
|
|
3
4
|
import { z } from 'zod';
|
|
@@ -26,7 +27,7 @@ export class TxScopedL2Log {
|
|
|
26
27
|
/*
|
|
27
28
|
* The block this log is included in
|
|
28
29
|
*/
|
|
29
|
-
public blockNumber:
|
|
30
|
+
public blockNumber: BlockNumber,
|
|
30
31
|
/*
|
|
31
32
|
* The log data as either a PrivateLog or PublicLog
|
|
32
33
|
*/
|
|
@@ -43,7 +44,7 @@ export class TxScopedL2Log {
|
|
|
43
44
|
txHash: TxHash.schema,
|
|
44
45
|
dataStartIndexForTx: z.number(),
|
|
45
46
|
logIndexInTx: z.number(),
|
|
46
|
-
blockNumber:
|
|
47
|
+
blockNumber: BlockNumberSchema,
|
|
47
48
|
log: z.union([PrivateLog.schema, PublicLog.schema]),
|
|
48
49
|
})
|
|
49
50
|
.transform(
|
|
@@ -69,7 +70,7 @@ export class TxScopedL2Log {
|
|
|
69
70
|
const txHash = reader.readObject(TxHash);
|
|
70
71
|
const dataStartIndexForTx = reader.readNumber();
|
|
71
72
|
const logIndexInTx = reader.readNumber();
|
|
72
|
-
const blockNumber = reader.readNumber();
|
|
73
|
+
const blockNumber = BlockNumber(reader.readNumber());
|
|
73
74
|
const isFromPublic = reader.readBoolean();
|
|
74
75
|
const log = isFromPublic ? PublicLog.fromBuffer(reader) : PrivateLog.fromBuffer(reader);
|
|
75
76
|
|
|
@@ -78,7 +79,7 @@ export class TxScopedL2Log {
|
|
|
78
79
|
|
|
79
80
|
static async random(isFromPublic = Math.random() < 0.5) {
|
|
80
81
|
const log = isFromPublic ? await PublicLog.random() : PrivateLog.random();
|
|
81
|
-
return new TxScopedL2Log(TxHash.random(), 1, 1, 1, log);
|
|
82
|
+
return new TxScopedL2Log(TxHash.random(), 1, 1, BlockNumber(1), log);
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
equals(other: TxScopedL2Log) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import type { Fr } from '@aztec/foundation/fields';
|
|
2
3
|
|
|
3
4
|
import type { L2Tips } from '../block/l2_block_source.js';
|
|
@@ -6,12 +7,19 @@ import type { L2Tips } from '../block/l2_block_source.js';
|
|
|
6
7
|
* Interface of classes allowing for the retrieval of L1 to L2 messages.
|
|
7
8
|
*/
|
|
8
9
|
export interface L1ToL2MessageSource {
|
|
10
|
+
/**
|
|
11
|
+
* Gets new L1 to L2 message (to be) included in a given checkpoint.
|
|
12
|
+
* @param checkpointNumber - Checkpoint number to get messages for.
|
|
13
|
+
* @returns The L1 to L2 messages/leaves of the messages subtree (throws if not found).
|
|
14
|
+
*/
|
|
15
|
+
getL1ToL2MessagesForCheckpoint(checkpointNumber: CheckpointNumber): Promise<Fr[]>;
|
|
16
|
+
|
|
9
17
|
/**
|
|
10
18
|
* Gets new L1 to L2 message (to be) included in a given block.
|
|
11
19
|
* @param blockNumber - L2 block number to get messages for.
|
|
12
20
|
* @returns The L1 to L2 messages/leaves of the messages subtree (throws if not found).
|
|
13
21
|
*/
|
|
14
|
-
getL1ToL2Messages(blockNumber:
|
|
22
|
+
getL1ToL2Messages(blockNumber: BlockNumber): Promise<Fr[]>;
|
|
15
23
|
|
|
16
24
|
/**
|
|
17
25
|
* Gets the L1 to L2 message index in the L1 to L2 message tree.
|
|
@@ -24,7 +32,7 @@ export interface L1ToL2MessageSource {
|
|
|
24
32
|
* Gets the number of the latest L2 block processed by the implementation.
|
|
25
33
|
* @returns The number of the latest L2 block processed by the implementation.
|
|
26
34
|
*/
|
|
27
|
-
getBlockNumber(): Promise<
|
|
35
|
+
getBlockNumber(): Promise<BlockNumber>;
|
|
28
36
|
|
|
29
37
|
/**
|
|
30
38
|
* Returns the tips of the L2 chain.
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
3
|
import { SiblingPath, UnbalancedMerkleTreeCalculator, computeUnbalancedShaRoot } from '@aztec/foundation/trees';
|
|
3
4
|
|
|
4
5
|
export interface MessageRetrieval {
|
|
5
|
-
getL2ToL1Messages(l2BlockNumber:
|
|
6
|
+
getL2ToL1Messages(l2BlockNumber: BlockNumber): Promise<Fr[][] | undefined>;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
export type L2ToL1MembershipWitness = {
|
|
@@ -13,7 +14,7 @@ export type L2ToL1MembershipWitness = {
|
|
|
13
14
|
|
|
14
15
|
export async function computeL2ToL1MembershipWitness(
|
|
15
16
|
messageRetriever: MessageRetrieval,
|
|
16
|
-
l2BlockNumber:
|
|
17
|
+
l2BlockNumber: BlockNumber,
|
|
17
18
|
message: Fr,
|
|
18
19
|
): Promise<L2ToL1MembershipWitness | undefined> {
|
|
19
20
|
const messagesForAllTxs = await messageRetriever.getL2ToL1Messages(l2BlockNumber);
|