@aztec/archiver 4.0.0-nightly.20250907 → 4.0.0-nightly.20260108

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 (133) hide show
  1. package/README.md +27 -6
  2. package/dest/archiver/archiver.d.ts +127 -84
  3. package/dest/archiver/archiver.d.ts.map +1 -1
  4. package/dest/archiver/archiver.js +1150 -382
  5. package/dest/archiver/archiver_store.d.ts +122 -45
  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 +2013 -343
  10. package/dest/archiver/config.d.ts +7 -20
  11. package/dest/archiver/config.d.ts.map +1 -1
  12. package/dest/archiver/config.js +21 -5
  13. package/dest/archiver/errors.d.ts +25 -1
  14. package/dest/archiver/errors.d.ts.map +1 -1
  15. package/dest/archiver/errors.js +37 -0
  16. package/dest/archiver/index.d.ts +2 -2
  17. package/dest/archiver/index.d.ts.map +1 -1
  18. package/dest/archiver/instrumentation.d.ts +5 -3
  19. package/dest/archiver/instrumentation.d.ts.map +1 -1
  20. package/dest/archiver/instrumentation.js +14 -0
  21. package/dest/archiver/kv_archiver_store/block_store.d.ts +83 -15
  22. package/dest/archiver/kv_archiver_store/block_store.d.ts.map +1 -1
  23. package/dest/archiver/kv_archiver_store/block_store.js +396 -73
  24. package/dest/archiver/kv_archiver_store/contract_class_store.d.ts +2 -2
  25. package/dest/archiver/kv_archiver_store/contract_class_store.d.ts.map +1 -1
  26. package/dest/archiver/kv_archiver_store/contract_class_store.js +1 -1
  27. package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts +2 -2
  28. package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts.map +1 -1
  29. package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts +51 -55
  30. package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts.map +1 -1
  31. package/dest/archiver/kv_archiver_store/kv_archiver_store.js +82 -46
  32. package/dest/archiver/kv_archiver_store/log_store.d.ts +12 -16
  33. package/dest/archiver/kv_archiver_store/log_store.d.ts.map +1 -1
  34. package/dest/archiver/kv_archiver_store/log_store.js +149 -84
  35. package/dest/archiver/kv_archiver_store/message_store.d.ts +6 -5
  36. package/dest/archiver/kv_archiver_store/message_store.d.ts.map +1 -1
  37. package/dest/archiver/kv_archiver_store/message_store.js +15 -14
  38. package/dest/archiver/l1/bin/retrieve-calldata.d.ts +3 -0
  39. package/dest/archiver/l1/bin/retrieve-calldata.d.ts.map +1 -0
  40. package/dest/archiver/l1/bin/retrieve-calldata.js +149 -0
  41. package/dest/archiver/l1/calldata_retriever.d.ts +112 -0
  42. package/dest/archiver/l1/calldata_retriever.d.ts.map +1 -0
  43. package/dest/archiver/l1/calldata_retriever.js +471 -0
  44. package/dest/archiver/l1/data_retrieval.d.ts +90 -0
  45. package/dest/archiver/l1/data_retrieval.d.ts.map +1 -0
  46. package/dest/archiver/l1/data_retrieval.js +331 -0
  47. package/dest/archiver/l1/debug_tx.d.ts +19 -0
  48. package/dest/archiver/l1/debug_tx.d.ts.map +1 -0
  49. package/dest/archiver/l1/debug_tx.js +73 -0
  50. package/dest/archiver/l1/spire_proposer.d.ts +70 -0
  51. package/dest/archiver/l1/spire_proposer.d.ts.map +1 -0
  52. package/dest/archiver/l1/spire_proposer.js +157 -0
  53. package/dest/archiver/l1/trace_tx.d.ts +97 -0
  54. package/dest/archiver/l1/trace_tx.d.ts.map +1 -0
  55. package/dest/archiver/l1/trace_tx.js +91 -0
  56. package/dest/archiver/l1/types.d.ts +12 -0
  57. package/dest/archiver/l1/types.d.ts.map +1 -0
  58. package/dest/archiver/l1/types.js +3 -0
  59. package/dest/archiver/l1/validate_trace.d.ts +29 -0
  60. package/dest/archiver/l1/validate_trace.d.ts.map +1 -0
  61. package/dest/archiver/l1/validate_trace.js +150 -0
  62. package/dest/archiver/structs/data_retrieval.d.ts +1 -1
  63. package/dest/archiver/structs/inbox_message.d.ts +4 -4
  64. package/dest/archiver/structs/inbox_message.d.ts.map +1 -1
  65. package/dest/archiver/structs/inbox_message.js +6 -5
  66. package/dest/archiver/structs/published.d.ts +2 -2
  67. package/dest/archiver/structs/published.d.ts.map +1 -1
  68. package/dest/archiver/validation.d.ts +10 -4
  69. package/dest/archiver/validation.d.ts.map +1 -1
  70. package/dest/archiver/validation.js +66 -44
  71. package/dest/factory.d.ts +4 -6
  72. package/dest/factory.d.ts.map +1 -1
  73. package/dest/factory.js +5 -4
  74. package/dest/index.d.ts +2 -2
  75. package/dest/index.d.ts.map +1 -1
  76. package/dest/index.js +1 -1
  77. package/dest/rpc/index.d.ts +2 -2
  78. package/dest/test/index.d.ts +1 -1
  79. package/dest/test/mock_archiver.d.ts +16 -8
  80. package/dest/test/mock_archiver.d.ts.map +1 -1
  81. package/dest/test/mock_archiver.js +19 -14
  82. package/dest/test/mock_l1_to_l2_message_source.d.ts +7 -6
  83. package/dest/test/mock_l1_to_l2_message_source.d.ts.map +1 -1
  84. package/dest/test/mock_l1_to_l2_message_source.js +10 -9
  85. package/dest/test/mock_l2_block_source.d.ts +31 -20
  86. package/dest/test/mock_l2_block_source.d.ts.map +1 -1
  87. package/dest/test/mock_l2_block_source.js +85 -18
  88. package/dest/test/mock_structs.d.ts +3 -2
  89. package/dest/test/mock_structs.d.ts.map +1 -1
  90. package/dest/test/mock_structs.js +9 -8
  91. package/package.json +18 -17
  92. package/src/archiver/archiver.ts +990 -481
  93. package/src/archiver/archiver_store.ts +141 -44
  94. package/src/archiver/archiver_store_test_suite.ts +2114 -331
  95. package/src/archiver/config.ts +30 -35
  96. package/src/archiver/errors.ts +64 -0
  97. package/src/archiver/index.ts +1 -1
  98. package/src/archiver/instrumentation.ts +19 -2
  99. package/src/archiver/kv_archiver_store/block_store.ts +541 -83
  100. package/src/archiver/kv_archiver_store/contract_class_store.ts +1 -1
  101. package/src/archiver/kv_archiver_store/contract_instance_store.ts +1 -1
  102. package/src/archiver/kv_archiver_store/kv_archiver_store.ts +107 -67
  103. package/src/archiver/kv_archiver_store/log_store.ts +209 -99
  104. package/src/archiver/kv_archiver_store/message_store.ts +21 -18
  105. package/src/archiver/l1/README.md +98 -0
  106. package/src/archiver/l1/bin/retrieve-calldata.ts +182 -0
  107. package/src/archiver/l1/calldata_retriever.ts +641 -0
  108. package/src/archiver/l1/data_retrieval.ts +512 -0
  109. package/src/archiver/l1/debug_tx.ts +99 -0
  110. package/src/archiver/l1/spire_proposer.ts +160 -0
  111. package/src/archiver/l1/trace_tx.ts +128 -0
  112. package/src/archiver/l1/types.ts +13 -0
  113. package/src/archiver/l1/validate_trace.ts +211 -0
  114. package/src/archiver/structs/inbox_message.ts +8 -8
  115. package/src/archiver/structs/published.ts +1 -1
  116. package/src/archiver/validation.ts +86 -32
  117. package/src/factory.ts +6 -7
  118. package/src/index.ts +1 -1
  119. package/src/test/fixtures/debug_traceTransaction-multicall3.json +88 -0
  120. package/src/test/fixtures/debug_traceTransaction-multiplePropose.json +153 -0
  121. package/src/test/fixtures/debug_traceTransaction-proxied.json +122 -0
  122. package/src/test/fixtures/trace_transaction-multicall3.json +65 -0
  123. package/src/test/fixtures/trace_transaction-multiplePropose.json +319 -0
  124. package/src/test/fixtures/trace_transaction-proxied.json +128 -0
  125. package/src/test/fixtures/trace_transaction-randomRevert.json +216 -0
  126. package/src/test/mock_archiver.ts +22 -16
  127. package/src/test/mock_l1_to_l2_message_source.ts +10 -9
  128. package/src/test/mock_l2_block_source.ts +114 -27
  129. package/src/test/mock_structs.ts +10 -9
  130. package/dest/archiver/data_retrieval.d.ts +0 -78
  131. package/dest/archiver/data_retrieval.d.ts.map +0 -1
  132. package/dest/archiver/data_retrieval.js +0 -354
  133. package/src/archiver/data_retrieval.ts +0 -535
@@ -1,24 +1,31 @@
1
- import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
2
- import { Fr } from '@aztec/foundation/fields';
1
+ import { INITIAL_CHECKPOINT_NUMBER, INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
2
+ import { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
3
3
  import { toArray } from '@aztec/foundation/iterable';
4
4
  import { createLogger } from '@aztec/foundation/log';
5
5
  import { BufferReader } from '@aztec/foundation/serialize';
6
6
  import { bufferToHex } from '@aztec/foundation/string';
7
- import { Body, CommitteeAttestation, L2Block, L2BlockHash } from '@aztec/stdlib/block';
7
+ import { isDefined } from '@aztec/foundation/types';
8
+ import { Body, CheckpointedL2Block, CommitteeAttestation, L2BlockHash, L2BlockNew, deserializeValidateBlockResult, serializeValidateBlockResult } from '@aztec/stdlib/block';
9
+ import { L1PublishedData } from '@aztec/stdlib/checkpoint';
10
+ import { CheckpointHeader } from '@aztec/stdlib/rollup';
8
11
  import { AppendOnlyTreeSnapshot } from '@aztec/stdlib/trees';
9
12
  import { BlockHeader, TxHash, TxReceipt, deserializeIndexedTxEffect, serializeIndexedTxEffect } from '@aztec/stdlib/tx';
10
- import { BlockNumberNotSequentialError, InitialBlockNumberNotSequentialError } from '../errors.js';
13
+ import { BlockArchiveNotConsistentError, BlockIndexNotSequentialError, BlockNotFoundError, BlockNumberNotSequentialError, CheckpointNotFoundError, CheckpointNumberNotConsistentError, CheckpointNumberNotSequentialError, InitialBlockNumberNotSequentialError, InitialCheckpointNumberNotSequentialError } from '../errors.js';
11
14
  export { TxReceipt } from '@aztec/stdlib/tx';
12
15
  /**
13
16
  * LMDB implementation of the ArchiverDataStore interface.
14
17
  */ export class BlockStore {
15
18
  db;
16
19
  /** Map block number to block data */ #blocks;
20
+ /** Map checkpoint number to checkpoint data */ #checkpoints;
17
21
  /** Map block hash to list of tx hashes */ #blockTxs;
18
22
  /** Tx hash to serialized IndexedTxEffect */ #txEffects;
19
23
  /** Stores L1 block number in which the last processed L2 block was included */ #lastSynchedL1Block;
20
- /** Stores l2 block number of the last proven block */ #lastProvenL2Block;
24
+ /** Stores last proven checkpoint */ #lastProvenCheckpoint;
25
+ /** Stores the pending chain validation status */ #pendingChainValidationStatus;
21
26
  /** Index mapping a contract's address (as a string) to its location in a block */ #contractIndex;
27
+ /** Index mapping block hash to block number */ #blockHashIndex;
28
+ /** Index mapping block archive to block number */ #blockArchiveIndex;
22
29
  #log;
23
30
  constructor(db){
24
31
  this.db = db;
@@ -27,11 +34,15 @@ export { TxReceipt } from '@aztec/stdlib/tx';
27
34
  this.#blockTxs = db.openMap('archiver_block_txs');
28
35
  this.#txEffects = db.openMap('archiver_tx_effects');
29
36
  this.#contractIndex = db.openMap('archiver_contract_index');
37
+ this.#blockHashIndex = db.openMap('archiver_block_hash_index');
38
+ this.#blockArchiveIndex = db.openMap('archiver_block_archive_index');
30
39
  this.#lastSynchedL1Block = db.openSingleton('archiver_last_synched_l1_block');
31
- this.#lastProvenL2Block = db.openSingleton('archiver_last_proven_l2_block');
40
+ this.#lastProvenCheckpoint = db.openSingleton('archiver_last_proven_l2_checkpoint');
41
+ this.#pendingChainValidationStatus = db.openSingleton('archiver_pending_chain_validation_status');
42
+ this.#checkpoints = db.openMap('archiver_checkpoints');
32
43
  }
33
44
  /**
34
- * Append new blocks to the store's list.
45
+ * Append new blocks to the store's list. All blocks must be for the 'current' checkpoint
35
46
  * @param blocks - The L2 blocks to be added to the store.
36
47
  * @returns True if the operation is successful.
37
48
  */ async addBlocks(blocks, opts = {}) {
@@ -40,78 +51,313 @@ export { TxReceipt } from '@aztec/stdlib/tx';
40
51
  }
41
52
  return await this.db.transactionAsync(async ()=>{
42
53
  // Check that the block immediately before the first block to be added is present in the store.
43
- const firstBlockNumber = blocks[0].block.number;
44
- const [previousBlockNumber] = await toArray(this.#blocks.keysAsync({
45
- reverse: true,
46
- limit: 1,
47
- end: firstBlockNumber - 1
48
- }));
49
- const hasPreviousBlock = firstBlockNumber === INITIAL_L2_BLOCK_NUM || previousBlockNumber !== undefined && previousBlockNumber === firstBlockNumber - 1;
50
- if (!opts.force && !hasPreviousBlock) {
54
+ const firstBlockNumber = blocks[0].number;
55
+ const firstBlockCheckpointNumber = blocks[0].checkpointNumber;
56
+ const firstBlockIndex = blocks[0].indexWithinCheckpoint;
57
+ const firstBlockLastArchive = blocks[0].header.lastArchive.root;
58
+ // Extract the latest block and checkpoint numbers
59
+ const previousBlockNumber = await this.getLatestBlockNumber();
60
+ const previousCheckpointNumber = await this.getLatestCheckpointNumber();
61
+ // Check that the first block number is the expected one
62
+ if (!opts.force && previousBlockNumber !== firstBlockNumber - 1) {
51
63
  throw new InitialBlockNumberNotSequentialError(firstBlockNumber, previousBlockNumber);
52
64
  }
53
- // Iterate over blocks array and insert them, checking that the block numbers are sequential.
65
+ // The same check as above but for checkpoints
66
+ if (!opts.force && previousCheckpointNumber !== firstBlockCheckpointNumber - 1) {
67
+ throw new InitialCheckpointNumberNotSequentialError(firstBlockCheckpointNumber, previousCheckpointNumber);
68
+ }
69
+ // Extract the previous block if there is one and see if it is for the same checkpoint or not
70
+ const previousBlockResult = await this.getBlock(previousBlockNumber);
71
+ let expectedFirstblockIndex = 0;
72
+ let previousBlockIndex = undefined;
73
+ if (previousBlockResult !== undefined) {
74
+ if (previousBlockResult.checkpointNumber === firstBlockCheckpointNumber) {
75
+ // The previous block is for the same checkpoint, therefore our index should follow it
76
+ previousBlockIndex = previousBlockResult.indexWithinCheckpoint;
77
+ expectedFirstblockIndex = previousBlockIndex + 1;
78
+ }
79
+ if (!previousBlockResult.archive.root.equals(firstBlockLastArchive)) {
80
+ throw new BlockArchiveNotConsistentError(firstBlockNumber, previousBlockResult.number, firstBlockLastArchive, previousBlockResult.archive.root);
81
+ }
82
+ }
83
+ // Now check that the first block has the expected index value
84
+ if (!opts.force && expectedFirstblockIndex !== firstBlockIndex) {
85
+ throw new BlockIndexNotSequentialError(firstBlockIndex, previousBlockIndex);
86
+ }
87
+ // Iterate over blocks array and insert them, checking that the block numbers and indexes are sequential. Also check they are for the correct checkpoint.
54
88
  let previousBlock = undefined;
55
89
  for (const block of blocks){
56
- if (!opts.force && previousBlock && previousBlock.block.number + 1 !== block.block.number) {
57
- throw new BlockNumberNotSequentialError(block.block.number, previousBlock.block.number);
90
+ if (!opts.force && previousBlock) {
91
+ if (previousBlock.number + 1 !== block.number) {
92
+ throw new BlockNumberNotSequentialError(block.number, previousBlock.number);
93
+ }
94
+ if (previousBlock.indexWithinCheckpoint + 1 !== block.indexWithinCheckpoint) {
95
+ throw new BlockIndexNotSequentialError(block.indexWithinCheckpoint, previousBlock.indexWithinCheckpoint);
96
+ }
97
+ if (!previousBlock.archive.root.equals(block.header.lastArchive.root)) {
98
+ throw new BlockArchiveNotConsistentError(block.number, previousBlock.number, block.header.lastArchive.root, previousBlock.archive.root);
99
+ }
100
+ }
101
+ if (!opts.force && firstBlockCheckpointNumber !== block.checkpointNumber) {
102
+ throw new CheckpointNumberNotConsistentError(block.checkpointNumber, firstBlockCheckpointNumber);
58
103
  }
59
104
  previousBlock = block;
60
- const blockHash = L2BlockHash.fromField(await block.block.hash());
61
- await this.#blocks.set(block.block.number, {
62
- header: block.block.header.toBuffer(),
63
- blockHash: blockHash.toBuffer(),
64
- archive: block.block.archive.toBuffer(),
65
- l1: block.l1,
66
- attestations: block.attestations.map((attestation)=>attestation.toBuffer())
67
- });
68
- for(let i = 0; i < block.block.body.txEffects.length; i++){
69
- const txEffect = {
70
- data: block.block.body.txEffects[i],
71
- l2BlockNumber: block.block.number,
72
- l2BlockHash: blockHash,
73
- txIndexInBlock: i
74
- };
75
- await this.#txEffects.set(txEffect.data.txHash.toString(), serializeIndexedTxEffect(txEffect));
105
+ await this.addBlockToDatabase(block, block.checkpointNumber, block.indexWithinCheckpoint);
106
+ }
107
+ return true;
108
+ });
109
+ }
110
+ /**
111
+ * Append new cheskpoints to the store's list.
112
+ * @param checkpoints - The L2 checkpoints to be added to the store.
113
+ * @returns True if the operation is successful.
114
+ */ async addCheckpoints(checkpoints, opts = {}) {
115
+ if (checkpoints.length === 0) {
116
+ return true;
117
+ }
118
+ return await this.db.transactionAsync(async ()=>{
119
+ // Check that the checkpoint immediately before the first block to be added is present in the store.
120
+ const firstCheckpointNumber = checkpoints[0].checkpoint.number;
121
+ const previousCheckpointNumber = await this.getLatestCheckpointNumber();
122
+ if (previousCheckpointNumber !== firstCheckpointNumber - 1 && !opts.force) {
123
+ throw new InitialCheckpointNumberNotSequentialError(firstCheckpointNumber, previousCheckpointNumber);
124
+ }
125
+ // Extract the previous checkpoint if there is one
126
+ let previousCheckpointData = undefined;
127
+ if (previousCheckpointNumber !== INITIAL_CHECKPOINT_NUMBER - 1) {
128
+ // There should be a previous checkpoint
129
+ previousCheckpointData = await this.getCheckpointData(previousCheckpointNumber);
130
+ if (previousCheckpointData === undefined) {
131
+ throw new CheckpointNotFoundError(previousCheckpointNumber);
132
+ }
133
+ }
134
+ let previousBlockNumber = undefined;
135
+ let previousBlock = undefined;
136
+ // If we have a previous checkpoint then we need to get the previous block number
137
+ if (previousCheckpointData !== undefined) {
138
+ previousBlockNumber = BlockNumber(previousCheckpointData.startBlock + previousCheckpointData.numBlocks - 1);
139
+ previousBlock = await this.getBlock(previousBlockNumber);
140
+ if (previousBlock === undefined) {
141
+ // We should be able to get the required previous block
142
+ throw new BlockNotFoundError(previousBlockNumber);
76
143
  }
77
- await this.#blockTxs.set(blockHash.toString(), Buffer.concat(block.block.body.txEffects.map((tx)=>tx.txHash.toBuffer())));
78
144
  }
79
- await this.#lastSynchedL1Block.set(blocks[blocks.length - 1].l1.blockNumber);
145
+ // Iterate over checkpoints array and insert them, checking that the block numbers are sequential.
146
+ let previousCheckpoint = undefined;
147
+ for (const checkpoint of checkpoints){
148
+ if (!opts.force && previousCheckpoint && previousCheckpoint.checkpoint.number + 1 !== checkpoint.checkpoint.number) {
149
+ throw new CheckpointNumberNotSequentialError(checkpoint.checkpoint.number, previousCheckpoint.checkpoint.number);
150
+ }
151
+ previousCheckpoint = checkpoint;
152
+ // Store every block in the database. the block may already exist, but this has come from chain and is assumed to be correct.
153
+ for(let i = 0; i < checkpoint.checkpoint.blocks.length; i++){
154
+ const block = checkpoint.checkpoint.blocks[i];
155
+ if (previousBlock) {
156
+ // The blocks should have a sequential block number
157
+ if (previousBlock.number !== block.number - 1) {
158
+ throw new BlockNumberNotSequentialError(block.number, previousBlock.number);
159
+ }
160
+ // If the blocks are for the same checkpoint then they should have sequential indexes
161
+ if (previousBlock.checkpointNumber === block.checkpointNumber && previousBlock.indexWithinCheckpoint !== block.indexWithinCheckpoint - 1) {
162
+ throw new BlockIndexNotSequentialError(block.indexWithinCheckpoint, previousBlock.indexWithinCheckpoint);
163
+ }
164
+ if (!previousBlock.archive.root.equals(block.header.lastArchive.root)) {
165
+ throw new BlockArchiveNotConsistentError(block.number, previousBlock.number, block.header.lastArchive.root, previousBlock.archive.root);
166
+ }
167
+ } else {
168
+ // No previous block, must be block 1 at checkpoint index 0
169
+ if (block.indexWithinCheckpoint !== 0) {
170
+ throw new BlockIndexNotSequentialError(block.indexWithinCheckpoint, undefined);
171
+ }
172
+ if (block.number !== INITIAL_L2_BLOCK_NUM) {
173
+ throw new BlockNumberNotSequentialError(block.number, undefined);
174
+ }
175
+ }
176
+ previousBlock = block;
177
+ await this.addBlockToDatabase(block, checkpoint.checkpoint.number, i);
178
+ }
179
+ // Store the checkpoint in the database
180
+ await this.#checkpoints.set(checkpoint.checkpoint.number, {
181
+ header: checkpoint.checkpoint.header.toBuffer(),
182
+ archive: checkpoint.checkpoint.archive.toBuffer(),
183
+ l1: checkpoint.l1.toBuffer(),
184
+ attestations: checkpoint.attestations.map((attestation)=>attestation.toBuffer()),
185
+ checkpointNumber: checkpoint.checkpoint.number,
186
+ startBlock: checkpoint.checkpoint.blocks[0].number,
187
+ numBlocks: checkpoint.checkpoint.blocks.length
188
+ });
189
+ }
190
+ await this.#lastSynchedL1Block.set(checkpoints[checkpoints.length - 1].l1.blockNumber);
80
191
  return true;
81
192
  });
82
193
  }
194
+ async addBlockToDatabase(block, checkpointNumber, indexWithinCheckpoint) {
195
+ const blockHash = L2BlockHash.fromField(await block.hash());
196
+ await this.#blocks.set(block.number, {
197
+ header: block.header.toBuffer(),
198
+ blockHash: blockHash.toBuffer(),
199
+ archive: block.archive.toBuffer(),
200
+ checkpointNumber,
201
+ indexWithinCheckpoint
202
+ });
203
+ for(let i = 0; i < block.body.txEffects.length; i++){
204
+ const txEffect = {
205
+ data: block.body.txEffects[i],
206
+ l2BlockNumber: block.number,
207
+ l2BlockHash: blockHash,
208
+ txIndexInBlock: i
209
+ };
210
+ await this.#txEffects.set(txEffect.data.txHash.toString(), serializeIndexedTxEffect(txEffect));
211
+ }
212
+ await this.#blockTxs.set(blockHash.toString(), Buffer.concat(block.body.txEffects.map((tx)=>tx.txHash.toBuffer())));
213
+ // Update indices for block hash and archive
214
+ await this.#blockHashIndex.set(blockHash.toString(), block.number);
215
+ await this.#blockArchiveIndex.set(block.archive.root.toString(), block.number);
216
+ }
83
217
  /**
84
- * Unwinds blocks from the database
218
+ * Unwinds checkpoints from the database
85
219
  * @param from - The tip of the chain, passed for verification purposes,
86
220
  * ensuring that we don't end up deleting something we did not intend
87
- * @param blocksToUnwind - The number of blocks we are to unwind
221
+ * @param checkpointsToUnwind - The number of checkpoints we are to unwind
88
222
  * @returns True if the operation is successful
89
- */ async unwindBlocks(from, blocksToUnwind) {
223
+ */ async unwindCheckpoints(from, checkpointsToUnwind) {
90
224
  return await this.db.transactionAsync(async ()=>{
91
- const last = await this.getSynchedL2BlockNumber();
225
+ const last = await this.getLatestCheckpointNumber();
92
226
  if (from !== last) {
93
- throw new Error(`Can only unwind blocks from the tip (requested ${from} but current tip is ${last})`);
227
+ throw new Error(`Can only unwind checkpoints from the tip (requested ${from} but current tip is ${last})`);
94
228
  }
95
- const proven = await this.getProvenL2BlockNumber();
96
- if (from - blocksToUnwind < proven) {
97
- await this.setProvenL2BlockNumber(from - blocksToUnwind);
229
+ const proven = await this.getProvenCheckpointNumber();
230
+ if (from - checkpointsToUnwind < proven) {
231
+ await this.setProvenCheckpointNumber(CheckpointNumber(from - checkpointsToUnwind));
98
232
  }
99
- for(let i = 0; i < blocksToUnwind; i++){
100
- const blockNumber = from - i;
101
- const block = await this.getBlock(blockNumber);
102
- if (block === undefined) {
103
- this.#log.warn(`Cannot remove block ${blockNumber} from the store since we don't have it`);
233
+ for(let i = 0; i < checkpointsToUnwind; i++){
234
+ const checkpointNumber = from - i;
235
+ const checkpoint = await this.#checkpoints.getAsync(checkpointNumber);
236
+ if (checkpoint === undefined) {
237
+ this.#log.warn(`Cannot remove checkpoint ${checkpointNumber} from the store since we don't have it`);
104
238
  continue;
105
239
  }
106
- await this.#blocks.delete(block.block.number);
107
- await Promise.all(block.block.body.txEffects.map((tx)=>this.#txEffects.delete(tx.txHash.toString())));
108
- const blockHash = (await block.block.hash()).toString();
109
- await this.#blockTxs.delete(blockHash);
110
- this.#log.debug(`Unwound block ${blockNumber} ${blockHash}`);
240
+ await this.#checkpoints.delete(checkpointNumber);
241
+ const maxBlock = checkpoint.startBlock + checkpoint.numBlocks - 1;
242
+ for(let blockNumber = checkpoint.startBlock; blockNumber <= maxBlock; blockNumber++){
243
+ const block = await this.getBlock(BlockNumber(blockNumber));
244
+ if (block === undefined) {
245
+ this.#log.warn(`Cannot remove block ${blockNumber} from the store since we don't have it`);
246
+ continue;
247
+ }
248
+ await this.#blocks.delete(block.number);
249
+ await Promise.all(block.body.txEffects.map((tx)=>this.#txEffects.delete(tx.txHash.toString())));
250
+ const blockHash = (await block.hash()).toString();
251
+ await this.#blockTxs.delete(blockHash);
252
+ // Clean up indices
253
+ await this.#blockHashIndex.delete(blockHash);
254
+ await this.#blockArchiveIndex.delete(block.archive.root.toString());
255
+ this.#log.debug(`Unwound block ${blockNumber} ${blockHash} for checkpoint ${checkpointNumber}`);
256
+ }
111
257
  }
112
258
  return true;
113
259
  });
114
260
  }
261
+ async getCheckpointData(checkpointNumber) {
262
+ const checkpointStorage = await this.#checkpoints.getAsync(checkpointNumber);
263
+ if (!checkpointStorage) {
264
+ return undefined;
265
+ }
266
+ return this.checkpointDataFromCheckpointStorage(checkpointStorage);
267
+ }
268
+ async getRangeOfCheckpoints(from, limit) {
269
+ const checkpoints = [];
270
+ for(let checkpointNumber = from; checkpointNumber < from + limit; checkpointNumber++){
271
+ const checkpoint = await this.#checkpoints.getAsync(checkpointNumber);
272
+ if (!checkpoint) {
273
+ break;
274
+ }
275
+ checkpoints.push(this.checkpointDataFromCheckpointStorage(checkpoint));
276
+ }
277
+ return checkpoints;
278
+ }
279
+ checkpointDataFromCheckpointStorage(checkpointStorage) {
280
+ const data = {
281
+ header: CheckpointHeader.fromBuffer(checkpointStorage.header),
282
+ archive: AppendOnlyTreeSnapshot.fromBuffer(checkpointStorage.archive),
283
+ checkpointNumber: CheckpointNumber(checkpointStorage.checkpointNumber),
284
+ startBlock: checkpointStorage.startBlock,
285
+ numBlocks: checkpointStorage.numBlocks,
286
+ l1: L1PublishedData.fromBuffer(checkpointStorage.l1),
287
+ attestations: checkpointStorage.attestations
288
+ };
289
+ return data;
290
+ }
291
+ async getBlocksForCheckpoint(checkpointNumber) {
292
+ const checkpoint = await this.#checkpoints.getAsync(checkpointNumber);
293
+ if (!checkpoint) {
294
+ return undefined;
295
+ }
296
+ const blocksForCheckpoint = await toArray(this.#blocks.entriesAsync({
297
+ start: checkpoint.startBlock,
298
+ end: checkpoint.startBlock + checkpoint.numBlocks
299
+ }));
300
+ const converted = await Promise.all(blocksForCheckpoint.map((x)=>this.getBlockFromBlockStorage(x[0], x[1])));
301
+ return converted.filter(isDefined);
302
+ }
303
+ async getProvenBlockNumber() {
304
+ const provenCheckpointNumber = await this.getProvenCheckpointNumber();
305
+ if (provenCheckpointNumber === INITIAL_CHECKPOINT_NUMBER - 1) {
306
+ return BlockNumber(INITIAL_L2_BLOCK_NUM - 1);
307
+ }
308
+ const checkpointStorage = await this.#checkpoints.getAsync(provenCheckpointNumber);
309
+ if (!checkpointStorage) {
310
+ throw new CheckpointNotFoundError(provenCheckpointNumber);
311
+ } else {
312
+ return BlockNumber(checkpointStorage.startBlock + checkpointStorage.numBlocks - 1);
313
+ }
314
+ }
315
+ async getLatestBlockNumber() {
316
+ const [latestBlocknumber] = await toArray(this.#blocks.keysAsync({
317
+ reverse: true,
318
+ limit: 1
319
+ }));
320
+ return typeof latestBlocknumber === 'number' ? BlockNumber(latestBlocknumber) : BlockNumber(INITIAL_L2_BLOCK_NUM - 1);
321
+ }
322
+ async getLatestCheckpointNumber() {
323
+ const [latestCheckpointNumber] = await toArray(this.#checkpoints.keysAsync({
324
+ reverse: true,
325
+ limit: 1
326
+ }));
327
+ if (latestCheckpointNumber === undefined) {
328
+ return CheckpointNumber(INITIAL_CHECKPOINT_NUMBER - 1);
329
+ }
330
+ return CheckpointNumber(latestCheckpointNumber);
331
+ }
332
+ async getCheckpointedBlock(number) {
333
+ const blockStorage = await this.#blocks.getAsync(number);
334
+ if (!blockStorage) {
335
+ return undefined;
336
+ }
337
+ const checkpoint = await this.#checkpoints.getAsync(blockStorage.checkpointNumber);
338
+ if (!checkpoint) {
339
+ return undefined;
340
+ }
341
+ const block = await this.getBlockFromBlockStorage(number, blockStorage);
342
+ if (!block) {
343
+ return undefined;
344
+ }
345
+ return new CheckpointedL2Block(CheckpointNumber(checkpoint.checkpointNumber), block, L1PublishedData.fromBuffer(checkpoint.l1), checkpoint.attestations.map((buf)=>CommitteeAttestation.fromBuffer(buf)));
346
+ }
347
+ async getCheckpointedBlockByHash(blockHash) {
348
+ const blockNumber = await this.#blockHashIndex.getAsync(blockHash.toString());
349
+ if (blockNumber === undefined) {
350
+ return undefined;
351
+ }
352
+ return this.getCheckpointedBlock(BlockNumber(blockNumber));
353
+ }
354
+ async getCheckpointedBlockByArchive(archive) {
355
+ const blockNumber = await this.#blockArchiveIndex.getAsync(archive.toString());
356
+ if (blockNumber === undefined) {
357
+ return undefined;
358
+ }
359
+ return this.getCheckpointedBlock(BlockNumber(blockNumber));
360
+ }
115
361
  /**
116
362
  * Gets up to `limit` amount of L2 blocks starting from `from`.
117
363
  * @param start - Number of the first block to return (inclusive).
@@ -137,6 +383,58 @@ export { TxReceipt } from '@aztec/stdlib/tx';
137
383
  return this.getBlockFromBlockStorage(blockNumber, blockStorage);
138
384
  }
139
385
  /**
386
+ * Gets an L2 block by its hash.
387
+ * @param blockHash - The hash of the block to return.
388
+ * @returns The requested L2 block.
389
+ */ async getBlockByHash(blockHash) {
390
+ const blockNumber = await this.#blockHashIndex.getAsync(blockHash.toString());
391
+ if (blockNumber === undefined) {
392
+ return undefined;
393
+ }
394
+ return this.getBlock(BlockNumber(blockNumber));
395
+ }
396
+ /**
397
+ * Gets an L2 block by its archive root.
398
+ * @param archive - The archive root of the block to return.
399
+ * @returns The requested L2 block.
400
+ */ async getBlockByArchive(archive) {
401
+ const blockNumber = await this.#blockArchiveIndex.getAsync(archive.toString());
402
+ if (blockNumber === undefined) {
403
+ return undefined;
404
+ }
405
+ return this.getBlock(BlockNumber(blockNumber));
406
+ }
407
+ /**
408
+ * Gets a block header by its hash.
409
+ * @param blockHash - The hash of the block to return.
410
+ * @returns The requested block header.
411
+ */ async getBlockHeaderByHash(blockHash) {
412
+ const blockNumber = await this.#blockHashIndex.getAsync(blockHash.toString());
413
+ if (blockNumber === undefined) {
414
+ return undefined;
415
+ }
416
+ const blockStorage = await this.#blocks.getAsync(blockNumber);
417
+ if (!blockStorage || !blockStorage.header) {
418
+ return undefined;
419
+ }
420
+ return BlockHeader.fromBuffer(blockStorage.header);
421
+ }
422
+ /**
423
+ * Gets a block header by its archive root.
424
+ * @param archive - The archive root of the block to return.
425
+ * @returns The requested block header.
426
+ */ async getBlockHeaderByArchive(archive) {
427
+ const blockNumber = await this.#blockArchiveIndex.getAsync(archive.toString());
428
+ if (blockNumber === undefined) {
429
+ return undefined;
430
+ }
431
+ const blockStorage = await this.#blocks.getAsync(blockNumber);
432
+ if (!blockStorage || !blockStorage.header) {
433
+ return undefined;
434
+ }
435
+ return BlockHeader.fromBuffer(blockStorage.header);
436
+ }
437
+ /**
140
438
  * Gets the headers for a sequence of L2 blocks.
141
439
  * @param start - Number of the first block to return (inclusive).
142
440
  * @param limit - The number of blocks to return.
@@ -185,16 +483,11 @@ export { TxReceipt } from '@aztec/stdlib/tx';
185
483
  txEffects.push(deserializeIndexedTxEffect(txEffect).data);
186
484
  }
187
485
  const body = new Body(txEffects);
188
- const block = new L2Block(archive, header, body, Fr.fromBuffer(blockHash));
486
+ const block = new L2BlockNew(archive, header, body, CheckpointNumber(blockStorage.checkpointNumber), blockStorage.indexWithinCheckpoint);
189
487
  if (block.number !== blockNumber) {
190
488
  throw new Error(`Block number mismatch when retrieving block from archive (expected ${blockNumber} but got ${block.number} with hash ${blockHashString})`);
191
489
  }
192
- const attestations = blockStorage.attestations.map(CommitteeAttestation.fromBuffer);
193
- return {
194
- block,
195
- l1: blockStorage.l1,
196
- attestations
197
- };
490
+ return block;
198
491
  }
199
492
  /**
200
493
  * Gets a tx effect.
@@ -216,7 +509,7 @@ export { TxReceipt } from '@aztec/stdlib/tx';
216
509
  if (!txEffect) {
217
510
  return undefined;
218
511
  }
219
- return new TxReceipt(txHash, TxReceipt.statusFromRevertCode(txEffect.data.revertCode), '', txEffect.data.transactionFee.toBigInt(), txEffect.l2BlockHash, txEffect.l2BlockNumber);
512
+ return new TxReceipt(txHash, TxReceipt.statusFromRevertCode(txEffect.data.revertCode), '', txEffect.data.transactionFee.toBigInt(), txEffect.l2BlockHash, BlockNumber(txEffect.l2BlockNumber));
220
513
  }
221
514
  /**
222
515
  * Looks up which block included the requested tx effect.
@@ -241,14 +534,22 @@ export { TxReceipt } from '@aztec/stdlib/tx';
241
534
  return this.#contractIndex.getAsync(contractAddress.toString());
242
535
  }
243
536
  /**
244
- * Gets the number of the latest L2 block processed.
245
- * @returns The number of the latest L2 block processed.
246
- */ async getSynchedL2BlockNumber() {
537
+ * Gets the number of the latest L2 block checkpointed.
538
+ * @returns The number of the latest L2 block checkpointed.
539
+ */ async getCheckpointedL2BlockNumber() {
540
+ const latestCheckpointNumber = await this.getLatestCheckpointNumber();
541
+ const checkpoint = await this.getCheckpointData(latestCheckpointNumber);
542
+ if (!checkpoint) {
543
+ return BlockNumber(INITIAL_L2_BLOCK_NUM - 1);
544
+ }
545
+ return BlockNumber(checkpoint.startBlock + checkpoint.numBlocks - 1);
546
+ }
547
+ async getLatestL2BlockNumber() {
247
548
  const [lastBlockNumber] = await toArray(this.#blocks.keysAsync({
248
549
  reverse: true,
249
550
  limit: 1
250
551
  }));
251
- return typeof lastBlockNumber === 'number' ? lastBlockNumber : INITIAL_L2_BLOCK_NUM - 1;
552
+ return typeof lastBlockNumber === 'number' ? BlockNumber(lastBlockNumber) : BlockNumber(INITIAL_L2_BLOCK_NUM - 1);
252
553
  }
253
554
  /**
254
555
  * Gets the most recent L1 block processed.
@@ -259,15 +560,16 @@ export { TxReceipt } from '@aztec/stdlib/tx';
259
560
  setSynchedL1BlockNumber(l1BlockNumber) {
260
561
  return this.#lastSynchedL1Block.set(l1BlockNumber);
261
562
  }
262
- async getProvenL2BlockNumber() {
263
- const [latestBlockNumber, provenBlockNumber] = await Promise.all([
264
- this.getSynchedL2BlockNumber(),
265
- this.#lastProvenL2Block.getAsync()
563
+ async getProvenCheckpointNumber() {
564
+ const [latestCheckpointNumber, provenCheckpointNumber] = await Promise.all([
565
+ this.getLatestCheckpointNumber(),
566
+ this.#lastProvenCheckpoint.getAsync()
266
567
  ]);
267
- return (provenBlockNumber ?? 0) > latestBlockNumber ? latestBlockNumber : provenBlockNumber ?? 0;
568
+ return (provenCheckpointNumber ?? 0) > latestCheckpointNumber ? latestCheckpointNumber : CheckpointNumber(provenCheckpointNumber ?? 0);
268
569
  }
269
- setProvenL2BlockNumber(blockNumber) {
270
- return this.#lastProvenL2Block.set(blockNumber);
570
+ async setProvenCheckpointNumber(checkpointNumber) {
571
+ const result = await this.#lastProvenCheckpoint.set(checkpointNumber);
572
+ return result;
271
573
  }
272
574
  #computeBlockRange(start, limit) {
273
575
  if (limit < 1) {
@@ -281,4 +583,25 @@ export { TxReceipt } from '@aztec/stdlib/tx';
281
583
  limit
282
584
  };
283
585
  }
586
+ /**
587
+ * Gets the pending chain validation status.
588
+ * @returns The validation status or undefined if not set.
589
+ */ async getPendingChainValidationStatus() {
590
+ const buffer = await this.#pendingChainValidationStatus.getAsync();
591
+ if (!buffer) {
592
+ return undefined;
593
+ }
594
+ return deserializeValidateBlockResult(buffer);
595
+ }
596
+ /**
597
+ * Sets the pending chain validation status.
598
+ * @param status - The validation status to store.
599
+ */ async setPendingChainValidationStatus(status) {
600
+ if (status) {
601
+ const buffer = serializeValidateBlockResult(status);
602
+ await this.#pendingChainValidationStatus.set(buffer);
603
+ } else {
604
+ await this.#pendingChainValidationStatus.delete();
605
+ }
606
+ }
284
607
  }
@@ -1,4 +1,4 @@
1
- import { Fr } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import type { AztecAsyncKVStore } from '@aztec/kv-store';
3
3
  import type { ContractClassPublic, ExecutablePrivateFunctionWithMembershipProof, UtilityFunctionWithMembershipProof } from '@aztec/stdlib/contract';
4
4
  /**
@@ -15,4 +15,4 @@ export declare class ContractClassStore {
15
15
  getContractClassIds(): Promise<Fr[]>;
16
16
  addFunctions(contractClassId: Fr, newPrivateFunctions: ExecutablePrivateFunctionWithMembershipProof[], newUtilityFunctions: UtilityFunctionWithMembershipProof[]): Promise<boolean>;
17
17
  }
18
- //# sourceMappingURL=contract_class_store.d.ts.map
18
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJhY3RfY2xhc3Nfc3RvcmUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9hcmNoaXZlci9rdl9hcmNoaXZlcl9zdG9yZS9jb250cmFjdF9jbGFzc19zdG9yZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFHcEQ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iver_store/contract_class_store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AAExE,OAAO,KAAK,EACV,mBAAmB,EAEnB,4CAA4C,EAC5C,kCAAkC,EACnC,MAAM,wBAAwB,CAAC;AAGhC;;GAEG;AACH,qBAAa,kBAAkB;;IAIjB,OAAO,CAAC,EAAE;gBAAF,EAAE,EAAE,iBAAiB;IAKnC,gBAAgB,CACpB,aAAa,EAAE,mBAAmB,EAClC,kBAAkB,EAAE,EAAE,EACtB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC;IAQV,qBAAqB,CAAC,aAAa,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ7F,gBAAgB,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC;IAKlE,qBAAqB,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,GAAG,SAAS,CAAC;IAKtD,mBAAmB,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC;IAIpC,YAAY,CAChB,eAAe,EAAE,EAAE,EACnB,mBAAmB,EAAE,4CAA4C,EAAE,EACnE,mBAAmB,EAAE,kCAAkC,EAAE,GACxD,OAAO,CAAC,OAAO,CAAC;CA0BpB"}
1
+ {"version":3,"file":"contract_class_store.d.ts","sourceRoot":"","sources":["../../../src/archiver/kv_archiver_store/contract_class_store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAGpD,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AAExE,OAAO,KAAK,EACV,mBAAmB,EAEnB,4CAA4C,EAC5C,kCAAkC,EACnC,MAAM,wBAAwB,CAAC;AAGhC;;GAEG;AACH,qBAAa,kBAAkB;;IAIjB,OAAO,CAAC,EAAE;IAAtB,YAAoB,EAAE,EAAE,iBAAiB,EAGxC;IAEK,gBAAgB,CACpB,aAAa,EAAE,mBAAmB,EAClC,kBAAkB,EAAE,EAAE,EACtB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CAMf;IAEK,qBAAqB,CAAC,aAAa,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMlG;IAEK,gBAAgB,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAGvE;IAEK,qBAAqB,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,GAAG,SAAS,CAAC,CAG3D;IAEK,mBAAmB,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC,CAEzC;IAEK,YAAY,CAChB,eAAe,EAAE,EAAE,EACnB,mBAAmB,EAAE,4CAA4C,EAAE,EACnE,mBAAmB,EAAE,kCAAkC,EAAE,GACxD,OAAO,CAAC,OAAO,CAAC,CAyBlB;CACF"}
@@ -1,4 +1,4 @@
1
- import { Fr } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import { toArray } from '@aztec/foundation/iterable';
3
3
  import { BufferReader, numToUInt8, serializeToBuffer } from '@aztec/foundation/serialize';
4
4
  import { FunctionSelector } from '@aztec/stdlib/abi';
@@ -1,4 +1,4 @@
1
- import type { Fr } from '@aztec/foundation/fields';
1
+ import type { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import type { AztecAsyncKVStore } from '@aztec/kv-store';
3
3
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
4
  import { type ContractInstanceUpdateWithAddress, type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
@@ -21,4 +21,4 @@ export declare class ContractInstanceStore {
21
21
  getContractInstanceDeploymentBlockNumber(address: AztecAddress): Promise<number | undefined>;
22
22
  }
23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F"}
1
+ {"version":3,"file":"contract_instance_store.d.ts","sourceRoot":"","sources":["../../../src/archiver/kv_archiver_store/contract_instance_store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EACL,KAAK,iCAAiC,EACtC,KAAK,2BAA2B,EAGjC,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,KAAK,yBAAyB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE7E;;GAEG;AACH,qBAAa,qBAAqB;;IAKpB,OAAO,CAAC,EAAE;IAAtB,YAAoB,EAAE,EAAE,iBAAiB,EAIxC;IAED,mBAAmB,CAAC,gBAAgB,EAAE,2BAA2B,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQrG;IAED,sBAAsB,CAAC,gBAAgB,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAKnF;IAED,YAAY,CAAC,eAAe,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,yBAAyB,CAM3G;IAED,yBAAyB,CACvB,sBAAsB,EAAE,iCAAiC,EACzD,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAKf;IAED,4BAA4B,CAC1B,sBAAsB,EAAE,iCAAiC,EACzD,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAEf;IAEK,iCAAiC,CAAC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,M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