@aztec/archiver 0.0.0-test.1 → 0.0.1-commit.03f7ef2
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/README.md +27 -6
- package/dest/archiver/archiver.d.ts +201 -94
- package/dest/archiver/archiver.d.ts.map +1 -1
- package/dest/archiver/archiver.js +1141 -396
- package/dest/archiver/archiver_store.d.ts +171 -83
- package/dest/archiver/archiver_store.d.ts.map +1 -1
- package/dest/archiver/archiver_store_test_suite.d.ts +1 -1
- package/dest/archiver/archiver_store_test_suite.d.ts.map +1 -1
- package/dest/archiver/archiver_store_test_suite.js +2389 -393
- package/dest/archiver/config.d.ts +7 -22
- package/dest/archiver/config.d.ts.map +1 -1
- package/dest/archiver/config.js +30 -14
- package/dest/archiver/errors.d.ts +33 -1
- package/dest/archiver/errors.d.ts.map +1 -1
- package/dest/archiver/errors.js +49 -0
- package/dest/archiver/index.d.ts +3 -4
- package/dest/archiver/index.d.ts.map +1 -1
- package/dest/archiver/index.js +1 -2
- package/dest/archiver/instrumentation.d.ts +14 -6
- package/dest/archiver/instrumentation.d.ts.map +1 -1
- package/dest/archiver/instrumentation.js +69 -17
- package/dest/archiver/kv_archiver_store/block_store.d.ts +91 -21
- package/dest/archiver/kv_archiver_store/block_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/block_store.js +476 -86
- package/dest/archiver/kv_archiver_store/contract_class_store.d.ts +4 -4
- package/dest/archiver/kv_archiver_store/contract_class_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/contract_class_store.js +13 -19
- package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts +12 -9
- package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/contract_instance_store.js +30 -16
- package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts +80 -75
- package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/kv_archiver_store.js +142 -83
- package/dest/archiver/kv_archiver_store/log_store.d.ts +12 -16
- package/dest/archiver/kv_archiver_store/log_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/log_store.js +153 -113
- package/dest/archiver/kv_archiver_store/message_store.d.ts +25 -18
- package/dest/archiver/kv_archiver_store/message_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/message_store.js +152 -49
- package/dest/archiver/l1/bin/retrieve-calldata.d.ts +3 -0
- package/dest/archiver/l1/bin/retrieve-calldata.d.ts.map +1 -0
- package/dest/archiver/l1/bin/retrieve-calldata.js +149 -0
- package/dest/archiver/l1/calldata_retriever.d.ts +112 -0
- package/dest/archiver/l1/calldata_retriever.d.ts.map +1 -0
- package/dest/archiver/l1/calldata_retriever.js +471 -0
- package/dest/archiver/l1/data_retrieval.d.ts +90 -0
- package/dest/archiver/l1/data_retrieval.d.ts.map +1 -0
- package/dest/archiver/l1/data_retrieval.js +331 -0
- package/dest/archiver/l1/debug_tx.d.ts +19 -0
- package/dest/archiver/l1/debug_tx.d.ts.map +1 -0
- package/dest/archiver/l1/debug_tx.js +73 -0
- package/dest/archiver/l1/spire_proposer.d.ts +70 -0
- package/dest/archiver/l1/spire_proposer.d.ts.map +1 -0
- package/dest/archiver/l1/spire_proposer.js +157 -0
- package/dest/archiver/l1/trace_tx.d.ts +97 -0
- package/dest/archiver/l1/trace_tx.d.ts.map +1 -0
- package/dest/archiver/l1/trace_tx.js +91 -0
- package/dest/archiver/l1/types.d.ts +12 -0
- package/dest/archiver/l1/types.d.ts.map +1 -0
- package/dest/archiver/l1/types.js +3 -0
- package/dest/archiver/l1/validate_trace.d.ts +29 -0
- package/dest/archiver/l1/validate_trace.d.ts.map +1 -0
- package/dest/archiver/l1/validate_trace.js +150 -0
- package/dest/archiver/structs/data_retrieval.d.ts +1 -1
- package/dest/archiver/structs/inbox_message.d.ts +15 -0
- package/dest/archiver/structs/inbox_message.d.ts.map +1 -0
- package/dest/archiver/structs/inbox_message.js +39 -0
- package/dest/archiver/structs/published.d.ts +2 -11
- package/dest/archiver/structs/published.d.ts.map +1 -1
- package/dest/archiver/structs/published.js +1 -1
- package/dest/archiver/validation.d.ts +17 -0
- package/dest/archiver/validation.d.ts.map +1 -0
- package/dest/archiver/validation.js +98 -0
- package/dest/factory.d.ts +9 -14
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +22 -52
- package/dest/index.d.ts +2 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -1
- package/dest/rpc/index.d.ts +2 -3
- package/dest/rpc/index.d.ts.map +1 -1
- package/dest/rpc/index.js +1 -4
- package/dest/test/index.d.ts +1 -1
- package/dest/test/mock_archiver.d.ts +16 -8
- package/dest/test/mock_archiver.d.ts.map +1 -1
- package/dest/test/mock_archiver.js +19 -14
- package/dest/test/mock_l1_to_l2_message_source.d.ts +9 -6
- package/dest/test/mock_l1_to_l2_message_source.d.ts.map +1 -1
- package/dest/test/mock_l1_to_l2_message_source.js +21 -7
- package/dest/test/mock_l2_block_source.d.ts +52 -13
- package/dest/test/mock_l2_block_source.d.ts.map +1 -1
- package/dest/test/mock_l2_block_source.js +140 -15
- package/dest/test/mock_structs.d.ts +10 -0
- package/dest/test/mock_structs.d.ts.map +1 -0
- package/dest/test/mock_structs.js +38 -0
- package/package.json +29 -30
- package/src/archiver/archiver.ts +1477 -501
- package/src/archiver/archiver_store.ts +197 -88
- package/src/archiver/archiver_store_test_suite.ts +2403 -350
- package/src/archiver/config.ts +38 -46
- package/src/archiver/errors.ts +85 -0
- package/src/archiver/index.ts +2 -3
- package/src/archiver/instrumentation.ts +91 -22
- package/src/archiver/kv_archiver_store/block_store.ts +640 -101
- package/src/archiver/kv_archiver_store/contract_class_store.ts +14 -24
- package/src/archiver/kv_archiver_store/contract_instance_store.ts +36 -28
- package/src/archiver/kv_archiver_store/kv_archiver_store.ts +193 -113
- package/src/archiver/kv_archiver_store/log_store.ts +205 -127
- package/src/archiver/kv_archiver_store/message_store.ts +213 -54
- package/src/archiver/l1/README.md +98 -0
- package/src/archiver/l1/bin/retrieve-calldata.ts +182 -0
- package/src/archiver/l1/calldata_retriever.ts +641 -0
- package/src/archiver/l1/data_retrieval.ts +512 -0
- package/src/archiver/l1/debug_tx.ts +99 -0
- package/src/archiver/l1/spire_proposer.ts +160 -0
- package/src/archiver/l1/trace_tx.ts +128 -0
- package/src/archiver/l1/types.ts +13 -0
- package/src/archiver/l1/validate_trace.ts +211 -0
- package/src/archiver/structs/inbox_message.ts +41 -0
- package/src/archiver/structs/published.ts +1 -11
- package/src/archiver/validation.ts +124 -0
- package/src/factory.ts +28 -69
- package/src/index.ts +1 -1
- package/src/rpc/index.ts +1 -5
- package/src/test/fixtures/debug_traceTransaction-multicall3.json +88 -0
- package/src/test/fixtures/debug_traceTransaction-multiplePropose.json +153 -0
- package/src/test/fixtures/debug_traceTransaction-proxied.json +122 -0
- package/src/test/fixtures/trace_transaction-multicall3.json +65 -0
- package/src/test/fixtures/trace_transaction-multiplePropose.json +319 -0
- package/src/test/fixtures/trace_transaction-proxied.json +128 -0
- package/src/test/fixtures/trace_transaction-randomRevert.json +216 -0
- package/src/test/mock_archiver.ts +22 -16
- package/src/test/mock_l1_to_l2_message_source.ts +20 -8
- package/src/test/mock_l2_block_source.ts +186 -21
- package/src/test/mock_structs.ts +50 -0
- package/dest/archiver/data_retrieval.d.ts +0 -74
- package/dest/archiver/data_retrieval.d.ts.map +0 -1
- package/dest/archiver/data_retrieval.js +0 -283
- package/dest/archiver/kv_archiver_store/nullifier_store.d.ts +0 -12
- package/dest/archiver/kv_archiver_store/nullifier_store.d.ts.map +0 -1
- package/dest/archiver/kv_archiver_store/nullifier_store.js +0 -73
- package/dest/archiver/memory_archiver_store/l1_to_l2_message_store.d.ts +0 -23
- package/dest/archiver/memory_archiver_store/l1_to_l2_message_store.d.ts.map +0 -1
- package/dest/archiver/memory_archiver_store/l1_to_l2_message_store.js +0 -49
- package/dest/archiver/memory_archiver_store/memory_archiver_store.d.ts +0 -175
- package/dest/archiver/memory_archiver_store/memory_archiver_store.d.ts.map +0 -1
- package/dest/archiver/memory_archiver_store/memory_archiver_store.js +0 -636
- package/src/archiver/data_retrieval.ts +0 -422
- package/src/archiver/kv_archiver_store/nullifier_store.ts +0 -97
- package/src/archiver/memory_archiver_store/l1_to_l2_message_store.ts +0 -61
- package/src/archiver/memory_archiver_store/memory_archiver_store.ts +0 -801
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GENESIS_ARCHIVE_ROOT } from '@aztec/constants';
|
|
2
|
+
import { DefaultL1ContractsConfig } from '@aztec/ethereum/config';
|
|
3
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
4
|
+
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
5
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
6
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
7
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
|
-
import { L2Block, L2BlockHash } from '@aztec/stdlib/block';
|
|
5
|
-
import {
|
|
8
|
+
import { L2Block, L2BlockHash, PublishedL2Block } from '@aztec/stdlib/block';
|
|
9
|
+
import { L1PublishedData } from '@aztec/stdlib/checkpoint';
|
|
10
|
+
import { EmptyL1RollupConstants, getSlotRangeForEpoch } from '@aztec/stdlib/epoch-helpers';
|
|
6
11
|
import { TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
7
12
|
/**
|
|
8
13
|
* A mocked implementation of L2BlockSource to be used in tests.
|
|
9
14
|
*/ export class MockL2BlockSource {
|
|
10
15
|
l2Blocks = [];
|
|
11
16
|
provenBlockNumber = 0;
|
|
17
|
+
finalizedBlockNumber = 0;
|
|
12
18
|
log = createLogger('archiver:mock_l2_block_source');
|
|
13
19
|
async createBlocks(numBlocks) {
|
|
14
20
|
for(let i = 0; i < numBlocks; i++){
|
|
15
21
|
const blockNum = this.l2Blocks.length + 1;
|
|
16
|
-
const block = await L2Block.random(blockNum);
|
|
22
|
+
const block = await L2Block.random(BlockNumber(blockNum));
|
|
17
23
|
this.l2Blocks.push(block);
|
|
18
24
|
}
|
|
19
25
|
this.log.verbose(`Created ${numBlocks} blocks in the mock L2 block source`);
|
|
@@ -29,6 +35,12 @@ import { TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
|
29
35
|
setProvenBlockNumber(provenBlockNumber) {
|
|
30
36
|
this.provenBlockNumber = provenBlockNumber;
|
|
31
37
|
}
|
|
38
|
+
setFinalizedBlockNumber(finalizedBlockNumber) {
|
|
39
|
+
if (finalizedBlockNumber > this.provenBlockNumber) {
|
|
40
|
+
this.provenBlockNumber = finalizedBlockNumber;
|
|
41
|
+
}
|
|
42
|
+
this.finalizedBlockNumber = finalizedBlockNumber;
|
|
43
|
+
}
|
|
32
44
|
/**
|
|
33
45
|
* Method to fetch the rollup contract address at the base-layer.
|
|
34
46
|
* @returns The rollup address.
|
|
@@ -45,10 +57,14 @@ import { TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
|
45
57
|
* Gets the number of the latest L2 block processed by the block source implementation.
|
|
46
58
|
* @returns In this mock instance, returns the number of L2 blocks that we've mocked.
|
|
47
59
|
*/ getBlockNumber() {
|
|
48
|
-
return Promise.resolve(this.l2Blocks.length);
|
|
60
|
+
return Promise.resolve(BlockNumber(this.l2Blocks.length));
|
|
49
61
|
}
|
|
50
62
|
getProvenBlockNumber() {
|
|
51
|
-
return Promise.resolve(this.provenBlockNumber);
|
|
63
|
+
return Promise.resolve(BlockNumber(this.provenBlockNumber));
|
|
64
|
+
}
|
|
65
|
+
getCheckpointedBlock(_number) {
|
|
66
|
+
// In this mock, we don't track checkpointed blocks separately
|
|
67
|
+
return Promise.resolve(undefined);
|
|
52
68
|
}
|
|
53
69
|
/**
|
|
54
70
|
* Gets an l2 block.
|
|
@@ -58,6 +74,14 @@ import { TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
|
58
74
|
return Promise.resolve(this.l2Blocks[number - 1]);
|
|
59
75
|
}
|
|
60
76
|
/**
|
|
77
|
+
* Gets an L2 block (new format).
|
|
78
|
+
* @param number - The block number to return.
|
|
79
|
+
* @returns The requested L2 block.
|
|
80
|
+
*/ getL2BlockNew(number) {
|
|
81
|
+
const block = this.l2Blocks[number - 1];
|
|
82
|
+
return Promise.resolve(block?.toL2Block());
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
61
85
|
* Gets up to `limit` amount of L2 blocks starting from `from`.
|
|
62
86
|
* @param from - Number of the first block to return (inclusive).
|
|
63
87
|
* @param limit - The maximum number of blocks to return.
|
|
@@ -65,8 +89,65 @@ import { TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
|
65
89
|
*/ getBlocks(from, limit, proven) {
|
|
66
90
|
return Promise.resolve(this.l2Blocks.slice(from - 1, from - 1 + limit).filter((b)=>!proven || this.provenBlockNumber === undefined || b.number <= this.provenBlockNumber));
|
|
67
91
|
}
|
|
92
|
+
async getPublishedCheckpoints(from, limit) {
|
|
93
|
+
// TODO: Implement this properly. This only works when we have one block per checkpoint.
|
|
94
|
+
return (await this.getPublishedBlocks(from, limit)).map((block)=>block.toPublishedCheckpoint());
|
|
95
|
+
}
|
|
96
|
+
async getCheckpointByArchive(archive) {
|
|
97
|
+
// TODO: Implement this properly. This only works when we have one block per checkpoint.
|
|
98
|
+
return (await this.getPublishedBlockByArchive(archive))?.block.toCheckpoint();
|
|
99
|
+
}
|
|
100
|
+
async getPublishedBlocks(from, limit, proven) {
|
|
101
|
+
const blocks = await this.getBlocks(from, limit, proven);
|
|
102
|
+
return blocks.map((block)=>PublishedL2Block.fromFields({
|
|
103
|
+
block,
|
|
104
|
+
l1: new L1PublishedData(BigInt(block.number), BigInt(block.number), Buffer32.random().toString()),
|
|
105
|
+
attestations: []
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
async getPublishedBlockByHash(blockHash) {
|
|
109
|
+
for (const block of this.l2Blocks){
|
|
110
|
+
const hash = await block.hash();
|
|
111
|
+
if (hash.equals(blockHash)) {
|
|
112
|
+
return PublishedL2Block.fromFields({
|
|
113
|
+
block,
|
|
114
|
+
l1: new L1PublishedData(BigInt(block.number), BigInt(block.number), Buffer32.random().toString()),
|
|
115
|
+
attestations: []
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return undefined;
|
|
120
|
+
}
|
|
121
|
+
getPublishedBlockByArchive(archive) {
|
|
122
|
+
const block = this.l2Blocks.find((b)=>b.archive.root.equals(archive));
|
|
123
|
+
if (!block) {
|
|
124
|
+
return Promise.resolve(undefined);
|
|
125
|
+
}
|
|
126
|
+
return Promise.resolve(PublishedL2Block.fromFields({
|
|
127
|
+
block,
|
|
128
|
+
l1: new L1PublishedData(BigInt(block.number), BigInt(block.number), Buffer32.random().toString()),
|
|
129
|
+
attestations: []
|
|
130
|
+
}));
|
|
131
|
+
}
|
|
132
|
+
async getBlockHeaderByHash(blockHash) {
|
|
133
|
+
for (const block of this.l2Blocks){
|
|
134
|
+
const hash = await block.hash();
|
|
135
|
+
if (hash.equals(blockHash)) {
|
|
136
|
+
return block.getBlockHeader();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return undefined;
|
|
140
|
+
}
|
|
141
|
+
getBlockHeaderByArchive(archive) {
|
|
142
|
+
const block = this.l2Blocks.find((b)=>b.archive.root.equals(archive));
|
|
143
|
+
return Promise.resolve(block?.getBlockHeader());
|
|
144
|
+
}
|
|
68
145
|
getBlockHeader(number) {
|
|
69
|
-
return Promise.resolve(this.l2Blocks.at(typeof number === 'number' ? number - 1 : -1)?.
|
|
146
|
+
return Promise.resolve(this.l2Blocks.at(typeof number === 'number' ? number - 1 : -1)?.getBlockHeader());
|
|
147
|
+
}
|
|
148
|
+
getCheckpointsForEpoch(epochNumber) {
|
|
149
|
+
// TODO: Implement this properly. This only works when we have one block per checkpoint.
|
|
150
|
+
return this.getBlocksForEpoch(epochNumber).then((blocks)=>blocks.map((b)=>b.toCheckpoint()));
|
|
70
151
|
}
|
|
71
152
|
getBlocksForEpoch(epochNumber) {
|
|
72
153
|
const epochDuration = DefaultL1ContractsConfig.aztecEpochDuration;
|
|
@@ -74,15 +155,19 @@ import { TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
|
74
155
|
epochDuration
|
|
75
156
|
});
|
|
76
157
|
const blocks = this.l2Blocks.filter((b)=>{
|
|
77
|
-
const slot = b.header.globalVariables.slotNumber
|
|
158
|
+
const slot = b.header.globalVariables.slotNumber;
|
|
78
159
|
return slot >= start && slot <= end;
|
|
79
160
|
});
|
|
80
161
|
return Promise.resolve(blocks);
|
|
81
162
|
}
|
|
163
|
+
async getBlockHeadersForEpoch(epochNumber) {
|
|
164
|
+
const blocks = await this.getBlocksForEpoch(epochNumber);
|
|
165
|
+
return blocks.map((b)=>b.getBlockHeader());
|
|
166
|
+
}
|
|
82
167
|
/**
|
|
83
168
|
* Gets a tx effect.
|
|
84
|
-
* @param txHash - The hash of
|
|
85
|
-
* @returns The requested tx effect.
|
|
169
|
+
* @param txHash - The hash of the tx corresponding to the tx effect.
|
|
170
|
+
* @returns The requested tx effect with block info (or undefined if not found).
|
|
86
171
|
*/ async getTxEffect(txHash) {
|
|
87
172
|
const match = this.l2Blocks.flatMap((b)=>b.body.txEffects.map((tx)=>[
|
|
88
173
|
tx,
|
|
@@ -95,7 +180,8 @@ import { TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
|
95
180
|
return {
|
|
96
181
|
data: txEffect,
|
|
97
182
|
l2BlockNumber: block.number,
|
|
98
|
-
l2BlockHash: (await block.hash())
|
|
183
|
+
l2BlockHash: L2BlockHash.fromField(await block.hash()),
|
|
184
|
+
txIndexInBlock: block.body.txEffects.indexOf(txEffect)
|
|
99
185
|
};
|
|
100
186
|
}
|
|
101
187
|
/**
|
|
@@ -116,22 +202,22 @@ import { TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
|
116
202
|
const [latest, proven, finalized] = [
|
|
117
203
|
await this.getBlockNumber(),
|
|
118
204
|
await this.getProvenBlockNumber(),
|
|
119
|
-
|
|
205
|
+
this.finalizedBlockNumber
|
|
120
206
|
];
|
|
121
207
|
const latestBlock = this.l2Blocks[latest - 1];
|
|
122
208
|
const provenBlock = this.l2Blocks[proven - 1];
|
|
123
209
|
const finalizedBlock = this.l2Blocks[finalized - 1];
|
|
124
210
|
return {
|
|
125
211
|
latest: {
|
|
126
|
-
number: latest,
|
|
212
|
+
number: BlockNumber(latest),
|
|
127
213
|
hash: (await latestBlock?.hash())?.toString()
|
|
128
214
|
},
|
|
129
215
|
proven: {
|
|
130
|
-
number: proven,
|
|
216
|
+
number: BlockNumber(proven),
|
|
131
217
|
hash: (await provenBlock?.hash())?.toString()
|
|
132
218
|
},
|
|
133
219
|
finalized: {
|
|
134
|
-
number: finalized,
|
|
220
|
+
number: BlockNumber(finalized),
|
|
135
221
|
hash: (await finalizedBlock?.hash())?.toString()
|
|
136
222
|
}
|
|
137
223
|
};
|
|
@@ -146,18 +232,57 @@ import { TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
|
146
232
|
throw new Error('Method not implemented.');
|
|
147
233
|
}
|
|
148
234
|
getL1Constants() {
|
|
235
|
+
return Promise.resolve(EmptyL1RollupConstants);
|
|
236
|
+
}
|
|
237
|
+
getGenesisValues() {
|
|
238
|
+
return Promise.resolve({
|
|
239
|
+
genesisArchiveRoot: new Fr(GENESIS_ARCHIVE_ROOT)
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
getL1Timestamp() {
|
|
149
243
|
throw new Error('Method not implemented.');
|
|
150
244
|
}
|
|
151
245
|
/**
|
|
152
246
|
* Starts the block source. In this mock implementation, this is a noop.
|
|
153
247
|
* @returns A promise that signals the initialization of the l2 block source on completion.
|
|
154
248
|
*/ start() {
|
|
249
|
+
this.log.verbose('Starting mock L2 block source');
|
|
155
250
|
return Promise.resolve();
|
|
156
251
|
}
|
|
157
252
|
/**
|
|
158
253
|
* Stops the block source. In this mock implementation, this is a noop.
|
|
159
254
|
* @returns A promise that signals the l2 block source is now stopped.
|
|
160
255
|
*/ stop() {
|
|
256
|
+
this.log.verbose('Stopping mock L2 block source');
|
|
257
|
+
return Promise.resolve();
|
|
258
|
+
}
|
|
259
|
+
getContractClass(_id) {
|
|
260
|
+
return Promise.resolve(undefined);
|
|
261
|
+
}
|
|
262
|
+
getBytecodeCommitment(_id) {
|
|
263
|
+
return Promise.resolve(undefined);
|
|
264
|
+
}
|
|
265
|
+
getContract(_address, _timestamp) {
|
|
266
|
+
return Promise.resolve(undefined);
|
|
267
|
+
}
|
|
268
|
+
getContractClassIds() {
|
|
269
|
+
return Promise.resolve([]);
|
|
270
|
+
}
|
|
271
|
+
getDebugFunctionName(_address, _selector) {
|
|
272
|
+
return Promise.resolve(undefined);
|
|
273
|
+
}
|
|
274
|
+
registerContractFunctionSignatures(_signatures) {
|
|
161
275
|
return Promise.resolve();
|
|
162
276
|
}
|
|
277
|
+
syncImmediate() {
|
|
278
|
+
return Promise.resolve();
|
|
279
|
+
}
|
|
280
|
+
isPendingChainInvalid() {
|
|
281
|
+
return Promise.resolve(false);
|
|
282
|
+
}
|
|
283
|
+
getPendingChainValidationStatus() {
|
|
284
|
+
return Promise.resolve({
|
|
285
|
+
valid: true
|
|
286
|
+
});
|
|
287
|
+
}
|
|
163
288
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { Buffer16 } from '@aztec/foundation/buffer';
|
|
3
|
+
import { type InboxMessage } from '../archiver/structs/inbox_message.js';
|
|
4
|
+
export declare function makeInboxMessage(previousRollingHash?: Buffer16, overrides?: Partial<InboxMessage>): InboxMessage;
|
|
5
|
+
export declare function makeInboxMessages(count: number, opts?: {
|
|
6
|
+
initialHash?: Buffer16;
|
|
7
|
+
initialCheckpointNumber?: CheckpointNumber;
|
|
8
|
+
overrideFn?: (msg: InboxMessage, index: number) => InboxMessage;
|
|
9
|
+
}): InboxMessage[];
|
|
10
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9ja19zdHJ1Y3RzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGVzdC9tb2NrX3N0cnVjdHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDbkUsT0FBTyxFQUFFLFFBQVEsRUFBWSxNQUFNLDBCQUEwQixDQUFDO0FBSzlELE9BQU8sRUFBRSxLQUFLLFlBQVksRUFBcUIsTUFBTSxzQ0FBc0MsQ0FBQztBQUU1Rix3QkFBZ0IsZ0JBQWdCLENBQzlCLG1CQUFtQixXQUFnQixFQUNuQyxTQUFTLEdBQUUsT0FBTyxDQUFDLFlBQVksQ0FBTSxHQUNwQyxZQUFZLENBZ0JkO0FBRUQsd0JBQWdCLGlCQUFpQixDQUMvQixLQUFLLEVBQUUsTUFBTSxFQUNiLElBQUksR0FBRTtJQUNKLFdBQVcsQ0FBQyxFQUFFLFFBQVEsQ0FBQztJQUN2Qix1QkFBdUIsQ0FBQyxFQUFFLGdCQUFnQixDQUFDO0lBQzNDLFVBQVUsQ0FBQyxFQUFFLENBQUMsR0FBRyxFQUFFLFlBQVksRUFBRSxLQUFLLEVBQUUsTUFBTSxLQUFLLFlBQVksQ0FBQztDQUM1RCxHQUNMLFlBQVksRUFBRSxDQWFoQiJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock_structs.d.ts","sourceRoot":"","sources":["../../src/test/mock_structs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAY,MAAM,0BAA0B,CAAC;AAK9D,OAAO,EAAE,KAAK,YAAY,EAAqB,MAAM,sCAAsC,CAAC;AAE5F,wBAAgB,gBAAgB,CAC9B,mBAAmB,WAAgB,EACnC,SAAS,GAAE,OAAO,CAAC,YAAY,CAAM,GACpC,YAAY,CAgBd;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,IAAI,GAAE;IACJ,WAAW,CAAC,EAAE,QAAQ,CAAC;IACvB,uBAAuB,CAAC,EAAE,gBAAgB,CAAC;IAC3C,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,KAAK,YAAY,CAAC;CAC5D,GACL,YAAY,EAAE,CAahB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { Buffer16, Buffer32 } from '@aztec/foundation/buffer';
|
|
3
|
+
import { randomBigInt, randomInt } from '@aztec/foundation/crypto/random';
|
|
4
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
|
+
import { InboxLeaf } from '@aztec/stdlib/messaging';
|
|
6
|
+
import { updateRollingHash } from '../archiver/structs/inbox_message.js';
|
|
7
|
+
export function makeInboxMessage(previousRollingHash = Buffer16.ZERO, overrides = {}) {
|
|
8
|
+
const { checkpointNumber = CheckpointNumber(randomInt(100) + 1) } = overrides;
|
|
9
|
+
const { l1BlockNumber = randomBigInt(100n) + 1n } = overrides;
|
|
10
|
+
const { l1BlockHash = Buffer32.random() } = overrides;
|
|
11
|
+
const { leaf = Fr.random() } = overrides;
|
|
12
|
+
const { rollingHash = updateRollingHash(previousRollingHash, leaf) } = overrides;
|
|
13
|
+
const { index = InboxLeaf.smallestIndexForCheckpoint(checkpointNumber) } = overrides;
|
|
14
|
+
return {
|
|
15
|
+
index,
|
|
16
|
+
leaf,
|
|
17
|
+
checkpointNumber,
|
|
18
|
+
l1BlockNumber,
|
|
19
|
+
l1BlockHash,
|
|
20
|
+
rollingHash
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export function makeInboxMessages(count, opts = {}) {
|
|
24
|
+
const { initialHash = Buffer16.ZERO, overrideFn = (msg)=>msg, initialCheckpointNumber = 1 } = opts;
|
|
25
|
+
const messages = [];
|
|
26
|
+
let rollingHash = initialHash;
|
|
27
|
+
for(let i = 0; i < count; i++){
|
|
28
|
+
const leaf = Fr.random();
|
|
29
|
+
const checkpointNumber = CheckpointNumber(i + initialCheckpointNumber);
|
|
30
|
+
const message = overrideFn(makeInboxMessage(rollingHash, {
|
|
31
|
+
leaf,
|
|
32
|
+
checkpointNumber
|
|
33
|
+
}), i);
|
|
34
|
+
rollingHash = message.rollingHash;
|
|
35
|
+
messages.push(message);
|
|
36
|
+
}
|
|
37
|
+
return messages;
|
|
38
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/archiver",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1-commit.03f7ef2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -17,11 +17,9 @@
|
|
|
17
17
|
"tsconfig": "./tsconfig.json"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
|
-
"build": "yarn clean && tsc
|
|
21
|
-
"build:dev": "tsc
|
|
20
|
+
"build": "yarn clean && ../scripts/tsc.sh",
|
|
21
|
+
"build:dev": "../scripts/tsc.sh --watch",
|
|
22
22
|
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
23
|
-
"formatting": "run -T prettier --check ./src && run -T eslint ./src",
|
|
24
|
-
"formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src",
|
|
25
23
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}",
|
|
26
24
|
"test:integration": "concurrently -k -s first -c reset,dim -n test,anvil \"yarn test:integration:run\" \"anvil\"",
|
|
27
25
|
"test:integration:run": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --config jest.integration.config.json"
|
|
@@ -61,42 +59,43 @@
|
|
|
61
59
|
"testTimeout": 120000,
|
|
62
60
|
"setupFiles": [
|
|
63
61
|
"../../foundation/src/jest/setup.mjs"
|
|
62
|
+
],
|
|
63
|
+
"testEnvironment": "../../foundation/src/jest/env.mjs",
|
|
64
|
+
"setupFilesAfterEnv": [
|
|
65
|
+
"../../foundation/src/jest/setupAfterEnv.mjs"
|
|
64
66
|
]
|
|
65
67
|
},
|
|
66
68
|
"dependencies": {
|
|
67
|
-
"@aztec/blob-
|
|
68
|
-
"@aztec/blob-
|
|
69
|
-
"@aztec/constants": "0.0.
|
|
70
|
-
"@aztec/
|
|
71
|
-
"@aztec/
|
|
72
|
-
"@aztec/
|
|
73
|
-
"@aztec/
|
|
74
|
-
"@aztec/
|
|
75
|
-
"@aztec/noir-protocol-circuits-types": "0.0.
|
|
76
|
-
"@aztec/protocol-contracts": "0.0.
|
|
77
|
-
"@aztec/stdlib": "0.0.
|
|
78
|
-
"@aztec/telemetry-client": "0.0.
|
|
79
|
-
"debug": "^4.3.4",
|
|
69
|
+
"@aztec/blob-client": "0.0.1-commit.03f7ef2",
|
|
70
|
+
"@aztec/blob-lib": "0.0.1-commit.03f7ef2",
|
|
71
|
+
"@aztec/constants": "0.0.1-commit.03f7ef2",
|
|
72
|
+
"@aztec/epoch-cache": "0.0.1-commit.03f7ef2",
|
|
73
|
+
"@aztec/ethereum": "0.0.1-commit.03f7ef2",
|
|
74
|
+
"@aztec/foundation": "0.0.1-commit.03f7ef2",
|
|
75
|
+
"@aztec/kv-store": "0.0.1-commit.03f7ef2",
|
|
76
|
+
"@aztec/l1-artifacts": "0.0.1-commit.03f7ef2",
|
|
77
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.03f7ef2",
|
|
78
|
+
"@aztec/protocol-contracts": "0.0.1-commit.03f7ef2",
|
|
79
|
+
"@aztec/stdlib": "0.0.1-commit.03f7ef2",
|
|
80
|
+
"@aztec/telemetry-client": "0.0.1-commit.03f7ef2",
|
|
80
81
|
"lodash.groupby": "^4.6.0",
|
|
81
82
|
"lodash.omit": "^4.5.0",
|
|
82
|
-
"tsc-watch": "^6.0.0",
|
|
83
83
|
"tslib": "^2.5.0",
|
|
84
|
-
"viem": "2.
|
|
85
|
-
"
|
|
84
|
+
"viem": "npm:@aztec/viem@2.38.2",
|
|
85
|
+
"zod": "^3.23.8"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
|
-
"@jest/globals": "^
|
|
89
|
-
"@types/
|
|
90
|
-
"@types/jest": "^29.5.0",
|
|
88
|
+
"@jest/globals": "^30.0.0",
|
|
89
|
+
"@types/jest": "^30.0.0",
|
|
91
90
|
"@types/lodash.groupby": "^4.6.9",
|
|
92
91
|
"@types/lodash.omit": "^4.5.7",
|
|
93
|
-
"@types/node": "^
|
|
94
|
-
"@
|
|
92
|
+
"@types/node": "^22.15.17",
|
|
93
|
+
"@typescript/native-preview": "7.0.0-dev.20251126.1",
|
|
95
94
|
"concurrently": "^8.0.1",
|
|
96
|
-
"jest": "^
|
|
97
|
-
"jest-mock-extended": "^
|
|
95
|
+
"jest": "^30.0.0",
|
|
96
|
+
"jest-mock-extended": "^4.0.0",
|
|
98
97
|
"ts-node": "^10.9.1",
|
|
99
|
-
"typescript": "^5.
|
|
98
|
+
"typescript": "^5.3.3"
|
|
100
99
|
},
|
|
101
100
|
"files": [
|
|
102
101
|
"dest",
|
|
@@ -105,6 +104,6 @@
|
|
|
105
104
|
],
|
|
106
105
|
"types": "./dest/index.d.ts",
|
|
107
106
|
"engines": {
|
|
108
|
-
"node": ">=
|
|
107
|
+
"node": ">=20.10"
|
|
109
108
|
}
|
|
110
109
|
}
|