@aztec/archiver 3.0.0-canary.a9708bd → 3.0.0-devnet.2-patch.1

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.
Files changed (127) hide show
  1. package/README.md +27 -6
  2. package/dest/archiver/archiver.d.ts +87 -64
  3. package/dest/archiver/archiver.d.ts.map +1 -1
  4. package/dest/archiver/archiver.js +463 -278
  5. package/dest/archiver/archiver_store.d.ts +46 -28
  6. package/dest/archiver/archiver_store.d.ts.map +1 -1
  7. package/dest/archiver/archiver_store_test_suite.d.ts +1 -1
  8. package/dest/archiver/archiver_store_test_suite.d.ts.map +1 -1
  9. package/dest/archiver/archiver_store_test_suite.js +316 -143
  10. package/dest/archiver/config.d.ts +6 -23
  11. package/dest/archiver/config.d.ts.map +1 -1
  12. package/dest/archiver/config.js +19 -12
  13. package/dest/archiver/errors.d.ts +1 -1
  14. package/dest/archiver/errors.d.ts.map +1 -1
  15. package/dest/archiver/index.d.ts +1 -1
  16. package/dest/archiver/instrumentation.d.ts +5 -3
  17. package/dest/archiver/instrumentation.d.ts.map +1 -1
  18. package/dest/archiver/instrumentation.js +14 -0
  19. package/dest/archiver/kv_archiver_store/block_store.d.ts +45 -9
  20. package/dest/archiver/kv_archiver_store/block_store.d.ts.map +1 -1
  21. package/dest/archiver/kv_archiver_store/block_store.js +99 -12
  22. package/dest/archiver/kv_archiver_store/contract_class_store.d.ts +2 -2
  23. package/dest/archiver/kv_archiver_store/contract_class_store.d.ts.map +1 -1
  24. package/dest/archiver/kv_archiver_store/contract_class_store.js +1 -1
  25. package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts +2 -2
  26. package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts.map +1 -1
  27. package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts +30 -30
  28. package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts.map +1 -1
  29. package/dest/archiver/kv_archiver_store/kv_archiver_store.js +26 -15
  30. package/dest/archiver/kv_archiver_store/log_store.d.ts +3 -10
  31. package/dest/archiver/kv_archiver_store/log_store.d.ts.map +1 -1
  32. package/dest/archiver/kv_archiver_store/log_store.js +4 -26
  33. package/dest/archiver/kv_archiver_store/message_store.d.ts +6 -5
  34. package/dest/archiver/kv_archiver_store/message_store.d.ts.map +1 -1
  35. package/dest/archiver/kv_archiver_store/message_store.js +15 -14
  36. package/dest/archiver/l1/bin/retrieve-calldata.d.ts +3 -0
  37. package/dest/archiver/l1/bin/retrieve-calldata.d.ts.map +1 -0
  38. package/dest/archiver/l1/bin/retrieve-calldata.js +147 -0
  39. package/dest/archiver/l1/calldata_retriever.d.ts +98 -0
  40. package/dest/archiver/l1/calldata_retriever.d.ts.map +1 -0
  41. package/dest/archiver/l1/calldata_retriever.js +403 -0
  42. package/dest/archiver/l1/data_retrieval.d.ts +87 -0
  43. package/dest/archiver/l1/data_retrieval.d.ts.map +1 -0
  44. package/dest/archiver/{data_retrieval.js → l1/data_retrieval.js} +118 -154
  45. package/dest/archiver/l1/debug_tx.d.ts +19 -0
  46. package/dest/archiver/l1/debug_tx.d.ts.map +1 -0
  47. package/dest/archiver/l1/debug_tx.js +73 -0
  48. package/dest/archiver/l1/spire_proposer.d.ts +70 -0
  49. package/dest/archiver/l1/spire_proposer.d.ts.map +1 -0
  50. package/dest/archiver/l1/spire_proposer.js +157 -0
  51. package/dest/archiver/l1/trace_tx.d.ts +97 -0
  52. package/dest/archiver/l1/trace_tx.d.ts.map +1 -0
  53. package/dest/archiver/l1/trace_tx.js +91 -0
  54. package/dest/archiver/l1/types.d.ts +12 -0
  55. package/dest/archiver/l1/types.d.ts.map +1 -0
  56. package/dest/archiver/l1/types.js +3 -0
  57. package/dest/archiver/l1/validate_trace.d.ts +29 -0
  58. package/dest/archiver/l1/validate_trace.d.ts.map +1 -0
  59. package/dest/archiver/l1/validate_trace.js +150 -0
  60. package/dest/archiver/structs/data_retrieval.d.ts +1 -1
  61. package/dest/archiver/structs/inbox_message.d.ts +4 -4
  62. package/dest/archiver/structs/inbox_message.d.ts.map +1 -1
  63. package/dest/archiver/structs/inbox_message.js +6 -5
  64. package/dest/archiver/structs/published.d.ts +3 -2
  65. package/dest/archiver/structs/published.d.ts.map +1 -1
  66. package/dest/archiver/validation.d.ts +10 -4
  67. package/dest/archiver/validation.d.ts.map +1 -1
  68. package/dest/archiver/validation.js +66 -44
  69. package/dest/factory.d.ts +3 -11
  70. package/dest/factory.d.ts.map +1 -1
  71. package/dest/factory.js +5 -17
  72. package/dest/index.d.ts +2 -2
  73. package/dest/index.d.ts.map +1 -1
  74. package/dest/index.js +1 -1
  75. package/dest/rpc/index.d.ts +2 -2
  76. package/dest/test/index.d.ts +1 -1
  77. package/dest/test/mock_archiver.d.ts +16 -8
  78. package/dest/test/mock_archiver.d.ts.map +1 -1
  79. package/dest/test/mock_archiver.js +19 -14
  80. package/dest/test/mock_l1_to_l2_message_source.d.ts +7 -6
  81. package/dest/test/mock_l1_to_l2_message_source.d.ts.map +1 -1
  82. package/dest/test/mock_l1_to_l2_message_source.js +10 -9
  83. package/dest/test/mock_l2_block_source.d.ts +24 -20
  84. package/dest/test/mock_l2_block_source.d.ts.map +1 -1
  85. package/dest/test/mock_l2_block_source.js +79 -13
  86. package/dest/test/mock_structs.d.ts +3 -2
  87. package/dest/test/mock_structs.d.ts.map +1 -1
  88. package/dest/test/mock_structs.js +9 -8
  89. package/package.json +18 -17
  90. package/src/archiver/archiver.ts +610 -363
  91. package/src/archiver/archiver_store.ts +55 -28
  92. package/src/archiver/archiver_store_test_suite.ts +369 -143
  93. package/src/archiver/config.ts +26 -51
  94. package/src/archiver/instrumentation.ts +19 -2
  95. package/src/archiver/kv_archiver_store/block_store.ts +139 -21
  96. package/src/archiver/kv_archiver_store/contract_class_store.ts +1 -1
  97. package/src/archiver/kv_archiver_store/contract_instance_store.ts +1 -1
  98. package/src/archiver/kv_archiver_store/kv_archiver_store.ts +48 -33
  99. package/src/archiver/kv_archiver_store/log_store.ts +4 -30
  100. package/src/archiver/kv_archiver_store/message_store.ts +21 -18
  101. package/src/archiver/l1/README.md +98 -0
  102. package/src/archiver/l1/bin/retrieve-calldata.ts +182 -0
  103. package/src/archiver/l1/calldata_retriever.ts +531 -0
  104. package/src/archiver/{data_retrieval.ts → l1/data_retrieval.ts} +198 -242
  105. package/src/archiver/l1/debug_tx.ts +99 -0
  106. package/src/archiver/l1/spire_proposer.ts +160 -0
  107. package/src/archiver/l1/trace_tx.ts +128 -0
  108. package/src/archiver/l1/types.ts +13 -0
  109. package/src/archiver/l1/validate_trace.ts +211 -0
  110. package/src/archiver/structs/inbox_message.ts +8 -8
  111. package/src/archiver/structs/published.ts +2 -1
  112. package/src/archiver/validation.ts +86 -32
  113. package/src/factory.ts +6 -26
  114. package/src/index.ts +1 -1
  115. package/src/test/fixtures/debug_traceTransaction-multicall3.json +88 -0
  116. package/src/test/fixtures/debug_traceTransaction-multiplePropose.json +153 -0
  117. package/src/test/fixtures/debug_traceTransaction-proxied.json +122 -0
  118. package/src/test/fixtures/trace_transaction-multicall3.json +65 -0
  119. package/src/test/fixtures/trace_transaction-multiplePropose.json +319 -0
  120. package/src/test/fixtures/trace_transaction-proxied.json +128 -0
  121. package/src/test/fixtures/trace_transaction-randomRevert.json +216 -0
  122. package/src/test/mock_archiver.ts +22 -16
  123. package/src/test/mock_l1_to_l2_message_source.ts +10 -9
  124. package/src/test/mock_l2_block_source.ts +110 -27
  125. package/src/test/mock_structs.ts +10 -9
  126. package/dest/archiver/data_retrieval.d.ts +0 -78
  127. package/dest/archiver/data_retrieval.d.ts.map +0 -1
@@ -1,9 +1,10 @@
1
- import type { L1BlockId } from '@aztec/ethereum';
2
- import type { Fr } from '@aztec/foundation/fields';
1
+ import type { L1BlockId } from '@aztec/ethereum/l1-types';
2
+ import type { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
3
+ import type { Fr } from '@aztec/foundation/curves/bn254';
3
4
  import type { CustomRange } from '@aztec/kv-store';
4
5
  import type { FunctionSelector } from '@aztec/stdlib/abi';
5
6
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
6
- import type { L2Block } from '@aztec/stdlib/block';
7
+ import type { L2Block, ValidateBlockResult } from '@aztec/stdlib/block';
7
8
  import type {
8
9
  ContractClassPublic,
9
10
  ContractInstanceUpdateWithAddress,
@@ -12,7 +13,7 @@ import type {
12
13
  UtilityFunctionWithMembershipProof,
13
14
  } from '@aztec/stdlib/contract';
14
15
  import type { GetContractClassLogsResponse, GetPublicLogsResponse } from '@aztec/stdlib/interfaces/client';
15
- import type { LogFilter, PrivateLog, TxScopedL2Log } from '@aztec/stdlib/logs';
16
+ import type { LogFilter, TxScopedL2Log } from '@aztec/stdlib/logs';
16
17
  import { BlockHeader, type IndexedTxEffect, type TxHash, type TxReceipt } from '@aztec/stdlib/tx';
17
18
  import type { UInt64 } from '@aztec/stdlib/types';
18
19
 
@@ -53,13 +54,25 @@ export interface ArchiverDataStore {
53
54
  * @param blocksToUnwind - The number of blocks we are to unwind
54
55
  * @returns True if the operation is successful
55
56
  */
56
- unwindBlocks(from: number, blocksToUnwind: number): Promise<boolean>;
57
+ unwindBlocks(from: BlockNumber, blocksToUnwind: number): Promise<boolean>;
57
58
 
58
59
  /**
59
60
  * Returns the block for the given number, or undefined if not exists.
60
61
  * @param number - The block number to return.
61
62
  */
62
- getPublishedBlock(number: number): Promise<PublishedL2Block | undefined>;
63
+ getPublishedBlock(number: BlockNumber): Promise<PublishedL2Block | undefined>;
64
+
65
+ /**
66
+ * Returns the block for the given hash, or undefined if not exists.
67
+ * @param blockHash - The block hash to return.
68
+ */
69
+ getPublishedBlockByHash(blockHash: Fr): Promise<PublishedL2Block | undefined>;
70
+
71
+ /**
72
+ * Returns the block for the given archive root, or undefined if not exists.
73
+ * @param archive - The archive root to return.
74
+ */
75
+ getPublishedBlockByArchive(archive: Fr): Promise<PublishedL2Block | undefined>;
63
76
 
64
77
  /**
65
78
  * Gets up to `limit` amount of published L2 blocks starting from `from`.
@@ -67,7 +80,7 @@ export interface ArchiverDataStore {
67
80
  * @param limit - The number of blocks to return.
68
81
  * @returns The requested L2 blocks.
69
82
  */
70
- getPublishedBlocks(from: number, limit: number): Promise<PublishedL2Block[]>;
83
+ getPublishedBlocks(from: BlockNumber, limit: number): Promise<PublishedL2Block[]>;
71
84
 
72
85
  /**
73
86
  * Gets up to `limit` amount of L2 block headers starting from `from`.
@@ -75,7 +88,19 @@ export interface ArchiverDataStore {
75
88
  * @param limit - The number of blocks to return.
76
89
  * @returns The requested L2 block headers.
77
90
  */
78
- getBlockHeaders(from: number, limit: number): Promise<BlockHeader[]>;
91
+ getBlockHeaders(from: BlockNumber, limit: number): Promise<BlockHeader[]>;
92
+
93
+ /**
94
+ * Returns the block header for the given hash, or undefined if not exists.
95
+ * @param blockHash - The block hash to return.
96
+ */
97
+ getBlockHeaderByHash(blockHash: Fr): Promise<BlockHeader | undefined>;
98
+
99
+ /**
100
+ * Returns the block header for the given archive root, or undefined if not exists.
101
+ * @param archive - The archive root to return.
102
+ */
103
+ getBlockHeaderByArchive(archive: Fr): Promise<BlockHeader | undefined>;
79
104
 
80
105
  /**
81
106
  * Gets a tx effect.
@@ -107,11 +132,11 @@ export interface ArchiverDataStore {
107
132
  addL1ToL2Messages(messages: InboxMessage[]): Promise<void>;
108
133
 
109
134
  /**
110
- * Gets L1 to L2 message (to be) included in a given block.
111
- * @param blockNumber - L2 block number to get messages for.
135
+ * Gets L1 to L2 message (to be) included in a given checkpoint.
136
+ * @param checkpointNumber - Checkpoint number to get messages for.
112
137
  * @returns The L1 to L2 messages/leaves of the messages subtree (throws if not found).
113
138
  */
114
- getL1ToL2Messages(blockNumber: number): Promise<Fr[]>;
139
+ getL1ToL2Messages(checkpointNumber: CheckpointNumber): Promise<Fr[]>;
115
140
 
116
141
  /**
117
142
  * Gets the L1 to L2 message index in the L1 to L2 message tree.
@@ -126,14 +151,6 @@ export interface ArchiverDataStore {
126
151
  */
127
152
  getTotalL1ToL2MessageCount(): Promise<bigint>;
128
153
 
129
- /**
130
- * Retrieves all private logs from up to `limit` blocks, starting from the block number `from`.
131
- * @param from - The block number from which to begin retrieving logs.
132
- * @param limit - The maximum number of blocks to retrieve logs from.
133
- * @returns An array of private logs from the specified range of blocks.
134
- */
135
- getPrivateLogs(from: number, limit: number): Promise<PrivateLog[]>;
136
-
137
154
  /**
138
155
  * Gets all logs that match any of the received tags (i.e. logs with their first field equal to a tag).
139
156
  * @param tags - The tags to filter the logs by.
@@ -161,19 +178,19 @@ export interface ArchiverDataStore {
161
178
  * Gets the number of the latest L2 block processed.
162
179
  * @returns The number of the latest L2 block processed.
163
180
  */
164
- getSynchedL2BlockNumber(): Promise<number>;
181
+ getSynchedL2BlockNumber(): Promise<BlockNumber>;
165
182
 
166
183
  /**
167
184
  * Gets the number of the latest proven L2 block processed.
168
185
  * @returns The number of the latest proven L2 block processed.
169
186
  */
170
- getProvenL2BlockNumber(): Promise<number>;
187
+ getProvenL2BlockNumber(): Promise<BlockNumber>;
171
188
 
172
189
  /**
173
190
  * Stores the number of the latest proven L2 block processed.
174
191
  * @param l2BlockNumber - The number of the latest proven L2 block processed.
175
192
  */
176
- setProvenL2BlockNumber(l2BlockNumber: number): Promise<void>;
193
+ setProvenL2BlockNumber(l2BlockNumber: BlockNumber): Promise<void>;
177
194
 
178
195
  /**
179
196
  * Stores the l1 block number that blocks have been synched until
@@ -197,9 +214,13 @@ export interface ArchiverDataStore {
197
214
  * @param blockNumber - Number of the L2 block the contracts were registered in.
198
215
  * @returns True if the operation is successful.
199
216
  */
200
- addContractClasses(data: ContractClassPublic[], bytecodeCommitments: Fr[], blockNumber: number): Promise<boolean>;
217
+ addContractClasses(
218
+ data: ContractClassPublic[],
219
+ bytecodeCommitments: Fr[],
220
+ blockNumber: BlockNumber,
221
+ ): Promise<boolean>;
201
222
 
202
- deleteContractClasses(data: ContractClassPublic[], blockNumber: number): Promise<boolean>;
223
+ deleteContractClasses(data: ContractClassPublic[], blockNumber: BlockNumber): Promise<boolean>;
203
224
 
204
225
  getBytecodeCommitment(contractClassId: Fr): Promise<Fr | undefined>;
205
226
 
@@ -215,8 +236,8 @@ export interface ArchiverDataStore {
215
236
  * @param blockNumber - Number of the L2 block the instances were deployed in.
216
237
  * @returns True if the operation is successful.
217
238
  */
218
- addContractInstances(data: ContractInstanceWithAddress[], blockNumber: number): Promise<boolean>;
219
- deleteContractInstances(data: ContractInstanceWithAddress[], blockNumber: number): Promise<boolean>;
239
+ addContractInstances(data: ContractInstanceWithAddress[], blockNumber: BlockNumber): Promise<boolean>;
240
+ deleteContractInstances(data: ContractInstanceWithAddress[], blockNumber: BlockNumber): Promise<boolean>;
220
241
 
221
242
  /**
222
243
  * Add new contract instance updates
@@ -261,8 +282,8 @@ export interface ArchiverDataStore {
261
282
  /** Closes the underlying data store. */
262
283
  close(): Promise<void>;
263
284
 
264
- /** Deletes all L1 to L2 messages up until (excluding) the target L2 block number. */
265
- rollbackL1ToL2MessagesToL2Block(targetBlockNumber: number): Promise<void>;
285
+ /** Deletes all L1 to L2 messages up until (excluding) the target checkpoint number. */
286
+ rollbackL1ToL2MessagesToCheckpoint(targetCheckpointNumber: CheckpointNumber): Promise<void>;
266
287
 
267
288
  /** Returns an async iterator to all L1 to L2 messages on the range. */
268
289
  iterateL1ToL2Messages(range?: CustomRange<bigint>): AsyncIterableIterator<InboxMessage>;
@@ -272,4 +293,10 @@ export interface ArchiverDataStore {
272
293
 
273
294
  /** Returns the last L1 to L2 message stored. */
274
295
  getLastL1ToL2Message(): Promise<InboxMessage | undefined>;
296
+
297
+ /** Returns the last synced validation status of the pending chain. */
298
+ getPendingChainValidationStatus(): Promise<ValidateBlockResult | undefined>;
299
+
300
+ /** Sets the last synced validation status of the pending chain. */
301
+ setPendingChainValidationStatus(status: ValidateBlockResult | undefined): Promise<void>;
275
302
  }