@aztec/stdlib 3.0.0-nightly.20251202 → 3.0.0-nightly.20251204
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 +17 -9
- package/dest/avm/avm.d.ts.map +1 -1
- 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 +6 -5
- 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 +1 -1
- 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 +5 -4
- package/dest/block/l2_block_new.d.ts.map +1 -1
- package/dest/block/l2_block_new.js +1 -1
- package/dest/block/l2_block_source.d.ts +56 -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 +1 -1
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +2 -2
- 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 +14 -9
- package/dest/interfaces/aztec-node.d.ts +23 -23
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +24 -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/kernel/private_call_data.d.ts +5 -62
- package/dest/kernel/private_call_data.d.ts.map +1 -1
- package/dest/kernel/private_call_data.js +4 -105
- 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 +4 -3
- package/dest/note/note_dao.d.ts.map +1 -1
- package/dest/note/note_dao.js +3 -2
- 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/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 +6 -3
- 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/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 +8 -8
- package/src/block/block_parameter.ts +8 -0
- package/src/block/in_block.ts +5 -4
- package/src/block/index.ts +1 -1
- package/src/block/l2_block.ts +4 -4
- 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 +4 -3
- package/src/block/l2_block_source.ts +26 -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 +2 -2
- package/src/contract/interfaces/contract_data_source.ts +2 -1
- package/src/interfaces/archiver.ts +17 -9
- package/src/interfaces/aztec-node.ts +51 -44
- 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/kernel/private_call_data.ts +3 -130
- 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 +4 -3
- 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/global_variables.ts +8 -8
- package/src/tx/indexed_tx_effect.ts +2 -1
- package/src/tx/private_execution_result.ts +2 -2
- 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';
|
|
23
|
+
import { type BlockParameter, BlockParameterSchema } from '../block/block_parameter.js';
|
|
19
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,7 +92,7 @@ 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
98
|
): Promise<(DataInBlock<bigint> | undefined)[]>;
|
|
@@ -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.
|
|
@@ -326,7 +330,7 @@ export interface AztecNode
|
|
|
326
330
|
* @param limit - The maximum number of blocks to retrieve logs from.
|
|
327
331
|
* @returns An array of private logs from the specified range of blocks.
|
|
328
332
|
*/
|
|
329
|
-
getPrivateLogs(from:
|
|
333
|
+
getPrivateLogs(from: BlockNumber, limit: number): Promise<PrivateLog[]>;
|
|
330
334
|
|
|
331
335
|
/**
|
|
332
336
|
* Gets public logs based on the provided filter.
|
|
@@ -413,13 +417,13 @@ export interface AztecNode
|
|
|
413
417
|
* @param blockNumber - The block number at which to get the data or 'latest'.
|
|
414
418
|
* @returns Storage value at the given contract slot.
|
|
415
419
|
*/
|
|
416
|
-
getPublicStorageAt(blockNumber:
|
|
420
|
+
getPublicStorageAt(blockNumber: BlockParameter, contract: AztecAddress, slot: Fr): Promise<Fr>;
|
|
417
421
|
|
|
418
422
|
/**
|
|
419
423
|
* Returns the currently committed block header.
|
|
420
424
|
* @returns The current committed block header.
|
|
421
425
|
*/
|
|
422
|
-
getBlockHeader(blockNumber?:
|
|
426
|
+
getBlockHeader(blockNumber?: BlockParameter): Promise<BlockHeader | undefined>;
|
|
423
427
|
|
|
424
428
|
/**
|
|
425
429
|
* Get a block header specified by its hash.
|
|
@@ -497,74 +501,77 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
497
501
|
|
|
498
502
|
findLeavesIndexes: z
|
|
499
503
|
.function()
|
|
500
|
-
.args(
|
|
504
|
+
.args(BlockParameterSchema, z.nativeEnum(MerkleTreeId), z.array(schemas.Fr).max(MAX_RPC_LEN))
|
|
501
505
|
.returns(z.array(optional(inBlockSchemaFor(schemas.BigInt)))),
|
|
502
506
|
|
|
503
507
|
getNullifierSiblingPath: z
|
|
504
508
|
.function()
|
|
505
|
-
.args(
|
|
509
|
+
.args(BlockParameterSchema, schemas.BigInt)
|
|
506
510
|
.returns(SiblingPath.schemaFor(NULLIFIER_TREE_HEIGHT)),
|
|
507
511
|
|
|
508
512
|
getNoteHashSiblingPath: z
|
|
509
513
|
.function()
|
|
510
|
-
.args(
|
|
514
|
+
.args(BlockParameterSchema, schemas.BigInt)
|
|
511
515
|
.returns(SiblingPath.schemaFor(NOTE_HASH_TREE_HEIGHT)),
|
|
512
516
|
|
|
513
517
|
getArchiveSiblingPath: z
|
|
514
518
|
.function()
|
|
515
|
-
.args(
|
|
519
|
+
.args(BlockParameterSchema, schemas.BigInt)
|
|
516
520
|
.returns(SiblingPath.schemaFor(ARCHIVE_HEIGHT)),
|
|
517
521
|
|
|
518
522
|
getPublicDataSiblingPath: z
|
|
519
523
|
.function()
|
|
520
|
-
.args(
|
|
524
|
+
.args(BlockParameterSchema, schemas.BigInt)
|
|
521
525
|
.returns(SiblingPath.schemaFor(PUBLIC_DATA_TREE_HEIGHT)),
|
|
522
526
|
|
|
523
527
|
getNullifierMembershipWitness: z
|
|
524
528
|
.function()
|
|
525
|
-
.args(
|
|
529
|
+
.args(BlockParameterSchema, schemas.Fr)
|
|
526
530
|
.returns(NullifierMembershipWitness.schema.optional()),
|
|
527
531
|
|
|
528
532
|
getLowNullifierMembershipWitness: z
|
|
529
533
|
.function()
|
|
530
|
-
.args(
|
|
534
|
+
.args(BlockParameterSchema, schemas.Fr)
|
|
531
535
|
.returns(NullifierMembershipWitness.schema.optional()),
|
|
532
536
|
|
|
533
|
-
getPublicDataWitness: z
|
|
537
|
+
getPublicDataWitness: z
|
|
538
|
+
.function()
|
|
539
|
+
.args(BlockParameterSchema, schemas.Fr)
|
|
540
|
+
.returns(PublicDataWitness.schema.optional()),
|
|
534
541
|
|
|
535
542
|
getArchiveMembershipWitness: z
|
|
536
543
|
.function()
|
|
537
|
-
.args(
|
|
544
|
+
.args(BlockParameterSchema, schemas.Fr)
|
|
538
545
|
.returns(MembershipWitness.schemaFor(ARCHIVE_HEIGHT).optional()),
|
|
539
546
|
|
|
540
547
|
getNoteHashMembershipWitness: z
|
|
541
548
|
.function()
|
|
542
|
-
.args(
|
|
549
|
+
.args(BlockParameterSchema, schemas.Fr)
|
|
543
550
|
.returns(MembershipWitness.schemaFor(NOTE_HASH_TREE_HEIGHT).optional()),
|
|
544
551
|
|
|
545
552
|
getL1ToL2MessageMembershipWitness: z
|
|
546
553
|
.function()
|
|
547
|
-
.args(
|
|
554
|
+
.args(BlockParameterSchema, schemas.Fr)
|
|
548
555
|
.returns(z.tuple([schemas.BigInt, SiblingPath.schemaFor(L1_TO_L2_MSG_TREE_HEIGHT)]).optional()),
|
|
549
556
|
|
|
550
|
-
getL1ToL2MessageBlock: z.function().args(schemas.Fr).returns(
|
|
557
|
+
getL1ToL2MessageBlock: z.function().args(schemas.Fr).returns(BlockNumberSchema.optional()),
|
|
551
558
|
|
|
552
559
|
isL1ToL2MessageSynced: z.function().args(schemas.Fr).returns(z.boolean()),
|
|
553
560
|
|
|
554
561
|
getL2ToL1Messages: z
|
|
555
562
|
.function()
|
|
556
|
-
.args(
|
|
563
|
+
.args(BlockParameterSchema)
|
|
557
564
|
.returns(z.array(z.array(schemas.Fr)).optional()),
|
|
558
565
|
|
|
559
|
-
getBlock: z.function().args(
|
|
566
|
+
getBlock: z.function().args(BlockParameterSchema).returns(L2Block.schema.optional()),
|
|
560
567
|
|
|
561
568
|
getBlockByHash: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
|
|
562
569
|
|
|
563
570
|
getBlockByArchive: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
|
|
564
571
|
|
|
565
|
-
getBlockNumber: z.function().returns(
|
|
572
|
+
getBlockNumber: z.function().returns(BlockNumberSchema),
|
|
566
573
|
|
|
567
|
-
getProvenBlockNumber: z.function().returns(
|
|
574
|
+
getProvenBlockNumber: z.function().returns(BlockNumberSchema),
|
|
568
575
|
|
|
569
576
|
isReady: z.function().returns(z.boolean()),
|
|
570
577
|
|
|
@@ -572,12 +579,12 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
572
579
|
|
|
573
580
|
getBlocks: z
|
|
574
581
|
.function()
|
|
575
|
-
.args(
|
|
582
|
+
.args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
|
|
576
583
|
.returns(z.array(L2Block.schema)),
|
|
577
584
|
|
|
578
585
|
getPublishedBlocks: z
|
|
579
586
|
.function()
|
|
580
|
-
.args(
|
|
587
|
+
.args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
|
|
581
588
|
.returns(z.array(PublishedL2Block.schema)),
|
|
582
589
|
|
|
583
590
|
getCurrentBaseFees: z.function().returns(GasFees.schema),
|
|
@@ -601,7 +608,7 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
601
608
|
|
|
602
609
|
getPrivateLogs: z
|
|
603
610
|
.function()
|
|
604
|
-
.args(
|
|
611
|
+
.args(BlockNumberPositiveSchema, z.number().lte(MAX_RPC_LEN))
|
|
605
612
|
.returns(z.array(PrivateLog.schema)),
|
|
606
613
|
|
|
607
614
|
getPublicLogs: z.function().args(LogFilterSchema).returns(GetPublicLogsResponseSchema),
|
|
@@ -633,9 +640,9 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
633
640
|
|
|
634
641
|
getTxsByHash: z.function().args(z.array(TxHash.schema).max(MAX_RPC_TXS_LEN)).returns(z.array(Tx.schema)),
|
|
635
642
|
|
|
636
|
-
getPublicStorageAt: z.function().args(
|
|
643
|
+
getPublicStorageAt: z.function().args(BlockParameterSchema, schemas.AztecAddress, schemas.Fr).returns(schemas.Fr),
|
|
637
644
|
|
|
638
|
-
getBlockHeader: z.function().args(optional(
|
|
645
|
+
getBlockHeader: z.function().args(optional(BlockParameterSchema)).returns(BlockHeader.schema.optional()),
|
|
639
646
|
|
|
640
647
|
getBlockHeaderByHash: z.function().args(schemas.Fr).returns(BlockHeader.schema.optional()),
|
|
641
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
|
+
});
|
|
@@ -1,27 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FUNCTION_TREE_HEIGHT,
|
|
3
|
-
MAX_CONTRACT_CLASS_LOGS_PER_CALL,
|
|
4
|
-
MAX_ENQUEUED_CALLS_PER_CALL,
|
|
5
|
-
MAX_L2_TO_L1_MSGS_PER_CALL,
|
|
6
|
-
MAX_NOTE_HASHES_PER_CALL,
|
|
7
|
-
MAX_NOTE_HASH_READ_REQUESTS_PER_CALL,
|
|
8
|
-
MAX_NULLIFIERS_PER_CALL,
|
|
9
|
-
MAX_NULLIFIER_READ_REQUESTS_PER_CALL,
|
|
10
|
-
MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL,
|
|
11
|
-
MAX_PRIVATE_LOGS_PER_CALL,
|
|
12
|
-
PUBLIC_DATA_TREE_HEIGHT,
|
|
13
|
-
TOTAL_COUNTED_SIDE_EFFECTS_PER_CALL,
|
|
14
|
-
UPDATES_VALUE_SIZE,
|
|
15
|
-
} from '@aztec/constants';
|
|
1
|
+
import { FUNCTION_TREE_HEIGHT, PUBLIC_DATA_TREE_HEIGHT, UPDATES_VALUE_SIZE } from '@aztec/constants';
|
|
16
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
17
|
-
import { BufferReader,
|
|
3
|
+
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
18
4
|
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
19
5
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
20
6
|
|
|
21
7
|
import { DelayedPublicMutableValues } from '../delayed_public_mutable/delayed_public_mutable_values.js';
|
|
22
8
|
import { PublicKeys } from '../keys/public_keys.js';
|
|
23
9
|
import { PublicDataTreeLeafPreimage } from '../trees/index.js';
|
|
24
|
-
import type { UInt32 } from '../types/shared.js';
|
|
25
10
|
import { VerificationKeyAsFields } from '../vks/verification_key.js';
|
|
26
11
|
import { PrivateCircuitPublicInputs } from './private_circuit_public_inputs.js';
|
|
27
12
|
|
|
@@ -44,11 +29,6 @@ export class PrivateCallData {
|
|
|
44
29
|
* Hints for the validation of the vk
|
|
45
30
|
*/
|
|
46
31
|
public verificationKeyHints: PrivateVerificationKeyHints,
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Hints for validating the uniqueness of the side effects.
|
|
50
|
-
*/
|
|
51
|
-
public sideEffectUniquenessHints: SideEffectUniquenessHints,
|
|
52
32
|
) {}
|
|
53
33
|
|
|
54
34
|
/**
|
|
@@ -57,7 +37,7 @@ export class PrivateCallData {
|
|
|
57
37
|
* @returns The array.
|
|
58
38
|
*/
|
|
59
39
|
static getFields(fields: FieldsOf<PrivateCallData>) {
|
|
60
|
-
return [fields.publicInputs, fields.vk, fields.verificationKeyHints
|
|
40
|
+
return [fields.publicInputs, fields.vk, fields.verificationKeyHints] as const;
|
|
61
41
|
}
|
|
62
42
|
|
|
63
43
|
static from(fields: FieldsOf<PrivateCallData>): PrivateCallData {
|
|
@@ -83,7 +63,6 @@ export class PrivateCallData {
|
|
|
83
63
|
reader.readObject(PrivateCircuitPublicInputs),
|
|
84
64
|
reader.readObject(VerificationKeyAsFields),
|
|
85
65
|
reader.readObject(PrivateVerificationKeyHints),
|
|
86
|
-
reader.readObject(SideEffectUniquenessHints),
|
|
87
66
|
);
|
|
88
67
|
}
|
|
89
68
|
}
|
|
@@ -201,109 +180,3 @@ export class UpdatedClassIdHints {
|
|
|
201
180
|
);
|
|
202
181
|
}
|
|
203
182
|
}
|
|
204
|
-
|
|
205
|
-
export class SideEffectUniquenessHints {
|
|
206
|
-
constructor(
|
|
207
|
-
public sideEffectRanges: Tuple<SideEffectCounterRange, typeof TOTAL_COUNTED_SIDE_EFFECTS_PER_CALL>,
|
|
208
|
-
public noteHashReadRequestIndices: Tuple<UInt32, typeof MAX_NOTE_HASH_READ_REQUESTS_PER_CALL>,
|
|
209
|
-
public nullifierReadRequestIndices: Tuple<UInt32, typeof MAX_NULLIFIER_READ_REQUESTS_PER_CALL>,
|
|
210
|
-
public noteHashesIndices: Tuple<UInt32, typeof MAX_NOTE_HASHES_PER_CALL>,
|
|
211
|
-
public nullifiersIndices: Tuple<UInt32, typeof MAX_NULLIFIERS_PER_CALL>,
|
|
212
|
-
public privateCallRequestsIndices: Tuple<UInt32, typeof MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL>,
|
|
213
|
-
public publicCallRequestsIndices: Tuple<UInt32, typeof MAX_ENQUEUED_CALLS_PER_CALL>,
|
|
214
|
-
public l2ToL1MsgsIndices: Tuple<UInt32, typeof MAX_L2_TO_L1_MSGS_PER_CALL>,
|
|
215
|
-
public privateLogsIndices: Tuple<UInt32, typeof MAX_PRIVATE_LOGS_PER_CALL>,
|
|
216
|
-
public contractClassLogsHashesIndices: Tuple<UInt32, typeof MAX_CONTRACT_CLASS_LOGS_PER_CALL>,
|
|
217
|
-
) {}
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Serialize into a field array. Low-level utility.
|
|
221
|
-
* @param fields - Object with fields.
|
|
222
|
-
* @returns The array.
|
|
223
|
-
*/
|
|
224
|
-
static getFields(fields: FieldsOf<SideEffectUniquenessHints>) {
|
|
225
|
-
return [
|
|
226
|
-
fields.sideEffectRanges,
|
|
227
|
-
fields.noteHashReadRequestIndices,
|
|
228
|
-
fields.nullifierReadRequestIndices,
|
|
229
|
-
fields.noteHashesIndices,
|
|
230
|
-
fields.nullifiersIndices,
|
|
231
|
-
fields.privateCallRequestsIndices,
|
|
232
|
-
fields.publicCallRequestsIndices,
|
|
233
|
-
fields.l2ToL1MsgsIndices,
|
|
234
|
-
fields.privateLogsIndices,
|
|
235
|
-
fields.contractClassLogsHashesIndices,
|
|
236
|
-
] as const;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
static from(fields: FieldsOf<SideEffectUniquenessHints>): SideEffectUniquenessHints {
|
|
240
|
-
return new SideEffectUniquenessHints(...SideEffectUniquenessHints.getFields(fields));
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Serialize this as a buffer.
|
|
245
|
-
* @returns The buffer.
|
|
246
|
-
*/
|
|
247
|
-
toBuffer(): Buffer {
|
|
248
|
-
return serializeToBuffer(...SideEffectUniquenessHints.getFields(this));
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* Deserializes from a buffer or reader.
|
|
253
|
-
* @param buffer - Buffer or reader to read from.
|
|
254
|
-
* @returns The deserialized instance.
|
|
255
|
-
*/
|
|
256
|
-
static fromBuffer(buffer: Buffer | BufferReader): SideEffectUniquenessHints {
|
|
257
|
-
const reader = BufferReader.asReader(buffer);
|
|
258
|
-
return new SideEffectUniquenessHints(
|
|
259
|
-
reader.readArray(TOTAL_COUNTED_SIDE_EFFECTS_PER_CALL, SideEffectCounterRange),
|
|
260
|
-
reader.readNumbers(MAX_NOTE_HASH_READ_REQUESTS_PER_CALL),
|
|
261
|
-
reader.readNumbers(MAX_NULLIFIER_READ_REQUESTS_PER_CALL),
|
|
262
|
-
reader.readNumbers(MAX_NOTE_HASHES_PER_CALL),
|
|
263
|
-
reader.readNumbers(MAX_NULLIFIERS_PER_CALL),
|
|
264
|
-
reader.readNumbers(MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL),
|
|
265
|
-
reader.readNumbers(MAX_ENQUEUED_CALLS_PER_CALL),
|
|
266
|
-
reader.readNumbers(MAX_L2_TO_L1_MSGS_PER_CALL),
|
|
267
|
-
reader.readNumbers(MAX_PRIVATE_LOGS_PER_CALL),
|
|
268
|
-
reader.readNumbers(MAX_CONTRACT_CLASS_LOGS_PER_CALL),
|
|
269
|
-
);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
export class SideEffectCounterRange {
|
|
274
|
-
constructor(
|
|
275
|
-
public start: UInt32,
|
|
276
|
-
public end: UInt32,
|
|
277
|
-
public sideEffectGlobalIndex: UInt32,
|
|
278
|
-
) {}
|
|
279
|
-
|
|
280
|
-
static getFields(fields: FieldsOf<SideEffectCounterRange>) {
|
|
281
|
-
return [fields.start, fields.end, fields.sideEffectGlobalIndex] as const;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
static from(fields: FieldsOf<SideEffectCounterRange>): SideEffectCounterRange {
|
|
285
|
-
return new SideEffectCounterRange(...SideEffectCounterRange.getFields(fields));
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
static empty(): SideEffectCounterRange {
|
|
289
|
-
return new SideEffectCounterRange(0, 0, 0);
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Serialize this as a buffer.
|
|
294
|
-
* @returns The buffer.
|
|
295
|
-
*/
|
|
296
|
-
toBuffer(): Buffer {
|
|
297
|
-
return serializeToBuffer(...SideEffectCounterRange.getFields(this));
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* Deserializes from a buffer or reader.
|
|
302
|
-
* @param buffer - Buffer or reader to read from.
|
|
303
|
-
* @returns The deserialized instance.
|
|
304
|
-
*/
|
|
305
|
-
static fromBuffer(buffer: Buffer | BufferReader): SideEffectCounterRange {
|
|
306
|
-
const reader = BufferReader.asReader(buffer);
|
|
307
|
-
return new SideEffectCounterRange(reader.readNumber(), reader.readNumber(), reader.readNumber());
|
|
308
|
-
}
|
|
309
|
-
}
|