@aztec/archiver 0.0.0-test.1 → 0.0.1-commit.1142ef1
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 +204 -94
- package/dest/archiver/archiver.d.ts.map +1 -1
- package/dest/archiver/archiver.js +1616 -414
- package/dest/archiver/archiver_store.d.ts +178 -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 +2373 -397
- 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 +45 -41
- package/dest/archiver/kv_archiver_store/block_store.d.ts +98 -21
- package/dest/archiver/kv_archiver_store/block_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/block_store.js +495 -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 +81 -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 +145 -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 +151 -114
- 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 +30 -7
- package/dest/test/mock_l2_block_source.d.ts +56 -13
- package/dest/test/mock_l2_block_source.d.ts.map +1 -1
- package/dest/test/mock_l2_block_source.js +196 -25
- 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 +1596 -512
- package/src/archiver/archiver_store.ts +205 -88
- package/src/archiver/archiver_store_test_suite.ts +2386 -354
- 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 +65 -45
- package/src/archiver/kv_archiver_store/block_store.ts +668 -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 +197 -113
- package/src/archiver/kv_archiver_store/log_store.ts +204 -132
- 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 +26 -8
- package/src/test/mock_l2_block_source.ts +254 -31
- 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,283 +0,0 @@
|
|
|
1
|
-
import { Blob, BlobDeserializationError } from '@aztec/blob-lib';
|
|
2
|
-
import { asyncPool } from '@aztec/foundation/async-pool';
|
|
3
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
5
|
-
import { numToUInt32BE } from '@aztec/foundation/serialize';
|
|
6
|
-
import { ForwarderAbi, RollupAbi } from '@aztec/l1-artifacts';
|
|
7
|
-
import { Body, L2Block } from '@aztec/stdlib/block';
|
|
8
|
-
import { InboxLeaf } from '@aztec/stdlib/messaging';
|
|
9
|
-
import { Proof } from '@aztec/stdlib/proofs';
|
|
10
|
-
import { AppendOnlyTreeSnapshot } from '@aztec/stdlib/trees';
|
|
11
|
-
import { BlockHeader } from '@aztec/stdlib/tx';
|
|
12
|
-
import { decodeFunctionData, getAbiItem, hexToBytes } from 'viem';
|
|
13
|
-
import { NoBlobBodiesFoundError } from './errors.js';
|
|
14
|
-
/**
|
|
15
|
-
* Fetches new L2 blocks.
|
|
16
|
-
* @param publicClient - The viem public client to use for transaction retrieval.
|
|
17
|
-
* @param rollupAddress - The address of the rollup contract.
|
|
18
|
-
* @param searchStartBlock - The block number to use for starting the search.
|
|
19
|
-
* @param searchEndBlock - The highest block number that we should search up to.
|
|
20
|
-
* @param expectedNextL2BlockNum - The next L2 block number that we expect to find.
|
|
21
|
-
* @returns An array of block; as well as the next eth block to search from.
|
|
22
|
-
*/ export async function retrieveBlocksFromRollup(rollup, publicClient, blobSinkClient, searchStartBlock, searchEndBlock, logger = createLogger('archiver')) {
|
|
23
|
-
const retrievedBlocks = [];
|
|
24
|
-
do {
|
|
25
|
-
if (searchStartBlock > searchEndBlock) {
|
|
26
|
-
break;
|
|
27
|
-
}
|
|
28
|
-
const l2BlockProposedLogs = (await rollup.getEvents.L2BlockProposed({}, {
|
|
29
|
-
fromBlock: searchStartBlock,
|
|
30
|
-
toBlock: searchEndBlock
|
|
31
|
-
})).filter((log)=>log.blockNumber >= searchStartBlock && log.blockNumber <= searchEndBlock);
|
|
32
|
-
if (l2BlockProposedLogs.length === 0) {
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
35
|
-
const lastLog = l2BlockProposedLogs[l2BlockProposedLogs.length - 1];
|
|
36
|
-
logger.debug(`Got ${l2BlockProposedLogs.length} L2 block processed logs for L2 blocks ${l2BlockProposedLogs[0].args.blockNumber}-${lastLog.args.blockNumber} between L1 blocks ${searchStartBlock}-${searchEndBlock}`);
|
|
37
|
-
const newBlocks = await processL2BlockProposedLogs(rollup, publicClient, blobSinkClient, l2BlockProposedLogs, logger);
|
|
38
|
-
retrievedBlocks.push(...newBlocks);
|
|
39
|
-
searchStartBlock = lastLog.blockNumber + 1n;
|
|
40
|
-
}while (searchStartBlock <= searchEndBlock)
|
|
41
|
-
// The asyncpool from processL2BlockProposedLogs will not necessarily return the blocks in order, so we sort them before returning.
|
|
42
|
-
return retrievedBlocks.sort((a, b)=>Number(a.l1.blockNumber - b.l1.blockNumber));
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Processes newly received L2BlockProposed logs.
|
|
46
|
-
* @param rollup - The rollup contract
|
|
47
|
-
* @param publicClient - The viem public client to use for transaction retrieval.
|
|
48
|
-
* @param logs - L2BlockProposed logs.
|
|
49
|
-
* @returns - An array blocks.
|
|
50
|
-
*/ export async function processL2BlockProposedLogs(rollup, publicClient, blobSinkClient, logs, logger) {
|
|
51
|
-
const retrievedBlocks = [];
|
|
52
|
-
await asyncPool(10, logs, async (log)=>{
|
|
53
|
-
const l2BlockNumber = log.args.blockNumber;
|
|
54
|
-
const archive = log.args.archive;
|
|
55
|
-
const archiveFromChain = await rollup.read.archiveAt([
|
|
56
|
-
l2BlockNumber
|
|
57
|
-
]);
|
|
58
|
-
const blobHashes = log.args.versionedBlobHashes.map((blobHash)=>Buffer.from(blobHash.slice(2), 'hex'));
|
|
59
|
-
// The value from the event and contract will match only if the block is in the chain.
|
|
60
|
-
if (archive === archiveFromChain) {
|
|
61
|
-
const block = await getBlockFromRollupTx(publicClient, blobSinkClient, log.transactionHash, blobHashes, l2BlockNumber, rollup.address, logger);
|
|
62
|
-
const l1 = {
|
|
63
|
-
blockNumber: log.blockNumber,
|
|
64
|
-
blockHash: log.blockHash,
|
|
65
|
-
timestamp: await getL1BlockTime(publicClient, log.blockNumber)
|
|
66
|
-
};
|
|
67
|
-
retrievedBlocks.push({
|
|
68
|
-
data: block,
|
|
69
|
-
l1
|
|
70
|
-
});
|
|
71
|
-
} else {
|
|
72
|
-
logger.warn(`Ignoring L2 block ${l2BlockNumber} due to archive root mismatch`, {
|
|
73
|
-
actual: archive,
|
|
74
|
-
expected: archiveFromChain
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
return retrievedBlocks;
|
|
79
|
-
}
|
|
80
|
-
export async function getL1BlockTime(publicClient, blockNumber) {
|
|
81
|
-
const block = await publicClient.getBlock({
|
|
82
|
-
blockNumber,
|
|
83
|
-
includeTransactions: false
|
|
84
|
-
});
|
|
85
|
-
return block.timestamp;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Extracts the first 'propose' method calldata from a forwarder transaction's data.
|
|
89
|
-
* @param forwarderData - The forwarder transaction input data
|
|
90
|
-
* @param rollupAddress - The address of the rollup contract
|
|
91
|
-
* @returns The calldata for the first 'propose' method call to the rollup contract
|
|
92
|
-
*/ function extractRollupProposeCalldata(forwarderData, rollupAddress) {
|
|
93
|
-
// TODO(#11451): custom forwarders
|
|
94
|
-
const { functionName: forwarderFunctionName, args: forwarderArgs } = decodeFunctionData({
|
|
95
|
-
abi: ForwarderAbi,
|
|
96
|
-
data: forwarderData
|
|
97
|
-
});
|
|
98
|
-
if (forwarderFunctionName !== 'forward') {
|
|
99
|
-
throw new Error(`Unexpected forwarder method called ${forwarderFunctionName}`);
|
|
100
|
-
}
|
|
101
|
-
if (forwarderArgs.length !== 2) {
|
|
102
|
-
throw new Error(`Unexpected number of arguments for forwarder`);
|
|
103
|
-
}
|
|
104
|
-
const [to, data] = forwarderArgs;
|
|
105
|
-
// Find all rollup calls
|
|
106
|
-
const rollupAddressLower = rollupAddress.toLowerCase();
|
|
107
|
-
for(let i = 0; i < to.length; i++){
|
|
108
|
-
const addr = to[i];
|
|
109
|
-
if (addr.toLowerCase() !== rollupAddressLower) {
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
|
-
const callData = data[i];
|
|
113
|
-
try {
|
|
114
|
-
const { functionName: rollupFunctionName } = decodeFunctionData({
|
|
115
|
-
abi: RollupAbi,
|
|
116
|
-
data: callData
|
|
117
|
-
});
|
|
118
|
-
if (rollupFunctionName === 'propose') {
|
|
119
|
-
return callData;
|
|
120
|
-
}
|
|
121
|
-
} catch (err) {
|
|
122
|
-
continue;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
throw new Error(`Rollup address not found in forwarder args`);
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Gets block from the calldata of an L1 transaction.
|
|
129
|
-
* Assumes that the block was published from an EOA.
|
|
130
|
-
* TODO: Add retries and error management.
|
|
131
|
-
* @param publicClient - The viem public client to use for transaction retrieval.
|
|
132
|
-
* @param txHash - Hash of the tx that published it.
|
|
133
|
-
* @param l2BlockNum - L2 block number.
|
|
134
|
-
* @returns L2 block from the calldata, deserialized
|
|
135
|
-
*/ async function getBlockFromRollupTx(publicClient, blobSinkClient, txHash, blobHashes, l2BlockNum, rollupAddress, logger) {
|
|
136
|
-
const { input: forwarderData, blockHash } = await publicClient.getTransaction({
|
|
137
|
-
hash: txHash
|
|
138
|
-
});
|
|
139
|
-
const rollupData = extractRollupProposeCalldata(forwarderData, rollupAddress);
|
|
140
|
-
const { functionName: rollupFunctionName, args: rollupArgs } = decodeFunctionData({
|
|
141
|
-
abi: RollupAbi,
|
|
142
|
-
data: rollupData
|
|
143
|
-
});
|
|
144
|
-
if (rollupFunctionName !== 'propose') {
|
|
145
|
-
throw new Error(`Unexpected rollup method called ${rollupFunctionName}`);
|
|
146
|
-
}
|
|
147
|
-
const [decodedArgs] = rollupArgs;
|
|
148
|
-
const header = BlockHeader.fromBuffer(Buffer.from(hexToBytes(decodedArgs.header)));
|
|
149
|
-
const blobBodies = await blobSinkClient.getBlobSidecar(blockHash, blobHashes);
|
|
150
|
-
if (blobBodies.length === 0) {
|
|
151
|
-
throw new NoBlobBodiesFoundError(Number(l2BlockNum));
|
|
152
|
-
}
|
|
153
|
-
let blockFields;
|
|
154
|
-
try {
|
|
155
|
-
blockFields = Blob.toEncodedFields(blobBodies);
|
|
156
|
-
} catch (err) {
|
|
157
|
-
if (err instanceof BlobDeserializationError) {
|
|
158
|
-
logger.fatal(err.message);
|
|
159
|
-
} else {
|
|
160
|
-
logger.fatal('Unable to sync: failed to decode fetched blob, this blob was likely not created by us');
|
|
161
|
-
}
|
|
162
|
-
throw err;
|
|
163
|
-
}
|
|
164
|
-
// The blob source gives us blockFields, and we must construct the body from them:
|
|
165
|
-
const blockBody = Body.fromBlobFields(blockFields);
|
|
166
|
-
const blockNumberFromHeader = header.globalVariables.blockNumber.toBigInt();
|
|
167
|
-
if (blockNumberFromHeader !== l2BlockNum) {
|
|
168
|
-
throw new Error(`Block number mismatch: expected ${l2BlockNum} but got ${blockNumberFromHeader}`);
|
|
169
|
-
}
|
|
170
|
-
const archive = AppendOnlyTreeSnapshot.fromBuffer(Buffer.concat([
|
|
171
|
-
Buffer.from(hexToBytes(decodedArgs.archive)),
|
|
172
|
-
numToUInt32BE(Number(l2BlockNum + 1n))
|
|
173
|
-
]));
|
|
174
|
-
return new L2Block(archive, header, blockBody);
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Fetch L1 to L2 messages.
|
|
178
|
-
* @param publicClient - The viem public client to use for transaction retrieval.
|
|
179
|
-
* @param inboxAddress - The address of the inbox contract to fetch messages from.
|
|
180
|
-
* @param blockUntilSynced - If true, blocks until the archiver has fully synced.
|
|
181
|
-
* @param searchStartBlock - The block number to use for starting the search.
|
|
182
|
-
* @param searchEndBlock - The highest block number that we should search up to.
|
|
183
|
-
* @returns An array of InboxLeaf and next eth block to search from.
|
|
184
|
-
*/ export async function retrieveL1ToL2Messages(inbox, searchStartBlock, searchEndBlock) {
|
|
185
|
-
const retrievedL1ToL2Messages = [];
|
|
186
|
-
do {
|
|
187
|
-
if (searchStartBlock > searchEndBlock) {
|
|
188
|
-
break;
|
|
189
|
-
}
|
|
190
|
-
const messageSentLogs = (await inbox.getEvents.MessageSent({}, {
|
|
191
|
-
fromBlock: searchStartBlock,
|
|
192
|
-
toBlock: searchEndBlock
|
|
193
|
-
})).filter((log)=>log.blockNumber >= searchStartBlock && log.blockNumber <= searchEndBlock);
|
|
194
|
-
if (messageSentLogs.length === 0) {
|
|
195
|
-
break;
|
|
196
|
-
}
|
|
197
|
-
for (const log of messageSentLogs){
|
|
198
|
-
const { index, hash } = log.args;
|
|
199
|
-
retrievedL1ToL2Messages.push(new InboxLeaf(index, Fr.fromHexString(hash)));
|
|
200
|
-
}
|
|
201
|
-
// handles the case when there are no new messages:
|
|
202
|
-
searchStartBlock = (messageSentLogs.findLast((msgLog)=>!!msgLog)?.blockNumber || searchStartBlock) + 1n;
|
|
203
|
-
}while (searchStartBlock <= searchEndBlock)
|
|
204
|
-
return {
|
|
205
|
-
lastProcessedL1BlockNumber: searchStartBlock - 1n,
|
|
206
|
-
retrievedData: retrievedL1ToL2Messages
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
/** Retrieves L2ProofVerified events from the rollup contract. */ export async function retrieveL2ProofVerifiedEvents(publicClient, rollupAddress, searchStartBlock, searchEndBlock) {
|
|
210
|
-
const logs = await publicClient.getLogs({
|
|
211
|
-
address: rollupAddress.toString(),
|
|
212
|
-
fromBlock: searchStartBlock,
|
|
213
|
-
toBlock: searchEndBlock ? searchEndBlock : undefined,
|
|
214
|
-
strict: true,
|
|
215
|
-
event: getAbiItem({
|
|
216
|
-
abi: RollupAbi,
|
|
217
|
-
name: 'L2ProofVerified'
|
|
218
|
-
})
|
|
219
|
-
});
|
|
220
|
-
return logs.map((log)=>({
|
|
221
|
-
l1BlockNumber: log.blockNumber,
|
|
222
|
-
l2BlockNumber: log.args.blockNumber,
|
|
223
|
-
proverId: Fr.fromHexString(log.args.proverId),
|
|
224
|
-
txHash: log.transactionHash
|
|
225
|
-
}));
|
|
226
|
-
}
|
|
227
|
-
/** Retrieve submitted proofs from the rollup contract */ export async function retrieveL2ProofsFromRollup(publicClient, rollupAddress, searchStartBlock, searchEndBlock) {
|
|
228
|
-
const logs = await retrieveL2ProofVerifiedEvents(publicClient, rollupAddress, searchStartBlock, searchEndBlock);
|
|
229
|
-
const retrievedData = [];
|
|
230
|
-
const lastProcessedL1BlockNumber = logs.length > 0 ? logs.at(-1).l1BlockNumber : searchStartBlock - 1n;
|
|
231
|
-
for (const { txHash, proverId, l2BlockNumber } of logs){
|
|
232
|
-
const proofData = await getProofFromSubmitProofTx(publicClient, txHash, proverId);
|
|
233
|
-
retrievedData.push({
|
|
234
|
-
proof: proofData.proof,
|
|
235
|
-
proverId: proofData.proverId,
|
|
236
|
-
l2BlockNumber,
|
|
237
|
-
txHash
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
return {
|
|
241
|
-
retrievedData,
|
|
242
|
-
lastProcessedL1BlockNumber
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Gets block metadata (header and archive snapshot) from the calldata of an L1 transaction.
|
|
247
|
-
* Assumes that the block was published from an EOA.
|
|
248
|
-
* TODO: Add retries and error management.
|
|
249
|
-
* @param publicClient - The viem public client to use for transaction retrieval.
|
|
250
|
-
* @param txHash - Hash of the tx that published it.
|
|
251
|
-
* @param l2BlockNum - L2 block number.
|
|
252
|
-
* @returns L2 block metadata (header and archive) from the calldata, deserialized
|
|
253
|
-
*/ export async function getProofFromSubmitProofTx(publicClient, txHash, expectedProverId) {
|
|
254
|
-
const { input: data } = await publicClient.getTransaction({
|
|
255
|
-
hash: txHash
|
|
256
|
-
});
|
|
257
|
-
const { functionName, args } = decodeFunctionData({
|
|
258
|
-
abi: RollupAbi,
|
|
259
|
-
data
|
|
260
|
-
});
|
|
261
|
-
let proverId;
|
|
262
|
-
let archiveRoot;
|
|
263
|
-
let aggregationObject;
|
|
264
|
-
let proof;
|
|
265
|
-
if (functionName === 'submitEpochRootProof') {
|
|
266
|
-
const [decodedArgs] = args;
|
|
267
|
-
aggregationObject = Buffer.from(hexToBytes(decodedArgs.aggregationObject));
|
|
268
|
-
proverId = Fr.fromHexString(decodedArgs.args.proverId);
|
|
269
|
-
archiveRoot = Fr.fromHexString(decodedArgs.args.endArchive);
|
|
270
|
-
proof = Proof.fromBuffer(Buffer.from(hexToBytes(decodedArgs.proof)));
|
|
271
|
-
} else {
|
|
272
|
-
throw new Error(`Unexpected proof method called ${functionName}`);
|
|
273
|
-
}
|
|
274
|
-
if (!proverId.equals(expectedProverId)) {
|
|
275
|
-
throw new Error(`Prover ID mismatch: expected ${expectedProverId} but got ${proverId}`);
|
|
276
|
-
}
|
|
277
|
-
return {
|
|
278
|
-
proverId,
|
|
279
|
-
aggregationObject,
|
|
280
|
-
archiveRoot,
|
|
281
|
-
proof
|
|
282
|
-
};
|
|
283
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
3
|
-
import type { InBlock, L2Block } from '@aztec/stdlib/block';
|
|
4
|
-
export declare class NullifierStore {
|
|
5
|
-
#private;
|
|
6
|
-
private db;
|
|
7
|
-
constructor(db: AztecAsyncKVStore);
|
|
8
|
-
addNullifiers(blocks: L2Block[]): Promise<boolean>;
|
|
9
|
-
deleteNullifiers(blocks: L2Block[]): Promise<boolean>;
|
|
10
|
-
findNullifiersIndexesWithBlock(blockNumber: number, nullifiers: Fr[]): Promise<(InBlock<bigint> | undefined)[]>;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=nullifier_store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nullifier_store.d.ts","sourceRoot":"","sources":["../../../src/archiver/kv_archiver_store/nullifier_store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE5D,qBAAa,cAAc;;IAMb,OAAO,CAAC,EAAE;gBAAF,EAAE,EAAE,iBAAiB;IAMnC,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IA0BlD,gBAAgB,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAerD,8BAA8B,CAClC,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,EAAE,EAAE,GACf,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC;CAkC5C"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { MAX_NULLIFIERS_PER_TX } from '@aztec/constants';
|
|
2
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
-
export class NullifierStore {
|
|
4
|
-
db;
|
|
5
|
-
#nullifiersToBlockNumber;
|
|
6
|
-
#nullifiersToBlockHash;
|
|
7
|
-
#nullifiersToIndex;
|
|
8
|
-
#log;
|
|
9
|
-
constructor(db){
|
|
10
|
-
this.db = db;
|
|
11
|
-
this.#log = createLogger('archiver:log_store');
|
|
12
|
-
this.#nullifiersToBlockNumber = db.openMap('archiver_nullifiers_to_block_number');
|
|
13
|
-
this.#nullifiersToBlockHash = db.openMap('archiver_nullifiers_to_block_hash');
|
|
14
|
-
this.#nullifiersToIndex = db.openMap('archiver_nullifiers_to_index');
|
|
15
|
-
}
|
|
16
|
-
async addNullifiers(blocks) {
|
|
17
|
-
const blockHashes = await Promise.all(blocks.map((block)=>block.hash()));
|
|
18
|
-
await this.db.transactionAsync(async ()=>{
|
|
19
|
-
await Promise.all(blocks.map((block, i)=>{
|
|
20
|
-
const dataStartIndexForBlock = block.header.state.partial.nullifierTree.nextAvailableLeafIndex - block.body.txEffects.length * MAX_NULLIFIERS_PER_TX;
|
|
21
|
-
return Promise.all(block.body.txEffects.map((txEffects, txIndex)=>{
|
|
22
|
-
const dataStartIndexForTx = dataStartIndexForBlock + txIndex * MAX_NULLIFIERS_PER_TX;
|
|
23
|
-
return Promise.all(txEffects.nullifiers.map(async (nullifier, nullifierIndex)=>{
|
|
24
|
-
await this.#nullifiersToBlockNumber.set(nullifier.toString(), block.number);
|
|
25
|
-
await this.#nullifiersToBlockHash.set(nullifier.toString(), blockHashes[i].toString());
|
|
26
|
-
await this.#nullifiersToIndex.set(nullifier.toString(), dataStartIndexForTx + nullifierIndex);
|
|
27
|
-
}));
|
|
28
|
-
}));
|
|
29
|
-
}));
|
|
30
|
-
});
|
|
31
|
-
return true;
|
|
32
|
-
}
|
|
33
|
-
async deleteNullifiers(blocks) {
|
|
34
|
-
await this.db.transactionAsync(async ()=>{
|
|
35
|
-
for (const block of blocks){
|
|
36
|
-
for (const nullifier of block.body.txEffects.flatMap((tx)=>tx.nullifiers)){
|
|
37
|
-
await Promise.all([
|
|
38
|
-
this.#nullifiersToBlockNumber.delete(nullifier.toString()),
|
|
39
|
-
this.#nullifiersToBlockHash.delete(nullifier.toString()),
|
|
40
|
-
this.#nullifiersToIndex.delete(nullifier.toString())
|
|
41
|
-
]);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
async findNullifiersIndexesWithBlock(blockNumber, nullifiers) {
|
|
48
|
-
const asStrings = nullifiers.map((x)=>x.toString());
|
|
49
|
-
const maybeNullifiers = await Promise.all(asStrings.map(async (nullifier)=>{
|
|
50
|
-
const [data, l2BlockNumber, l2BlockHash] = await Promise.all([
|
|
51
|
-
this.#nullifiersToIndex.getAsync(nullifier),
|
|
52
|
-
this.#nullifiersToBlockNumber.getAsync(nullifier),
|
|
53
|
-
this.#nullifiersToBlockHash.getAsync(nullifier)
|
|
54
|
-
]);
|
|
55
|
-
return {
|
|
56
|
-
data,
|
|
57
|
-
l2BlockNumber,
|
|
58
|
-
l2BlockHash
|
|
59
|
-
};
|
|
60
|
-
}));
|
|
61
|
-
return maybeNullifiers.map(({ data, l2BlockNumber, l2BlockHash })=>{
|
|
62
|
-
if (data === undefined || l2BlockNumber === undefined || l2BlockHash === undefined || l2BlockNumber > blockNumber) {
|
|
63
|
-
return undefined;
|
|
64
|
-
} else {
|
|
65
|
-
return {
|
|
66
|
-
data: BigInt(data),
|
|
67
|
-
l2BlockNumber,
|
|
68
|
-
l2BlockHash
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import { InboxLeaf } from '@aztec/stdlib/messaging';
|
|
3
|
-
/**
|
|
4
|
-
* A simple in-memory implementation of an L1 to L2 message store.
|
|
5
|
-
*/
|
|
6
|
-
export declare class L1ToL2MessageStore {
|
|
7
|
-
#private;
|
|
8
|
-
/**
|
|
9
|
-
* A map pointing from a key in a "messageIndex" format to the corresponding L1 to L2 message hash.
|
|
10
|
-
*/
|
|
11
|
-
protected store: Map<string, Fr>;
|
|
12
|
-
constructor();
|
|
13
|
-
getTotalL1ToL2MessageCount(): bigint;
|
|
14
|
-
addMessage(message: InboxLeaf): void;
|
|
15
|
-
getMessages(blockNumber: bigint): Fr[];
|
|
16
|
-
/**
|
|
17
|
-
* Gets the L1 to L2 message index in the L1 to L2 message tree.
|
|
18
|
-
* @param l1ToL2Message - The L1 to L2 message.
|
|
19
|
-
* @returns The index of the L1 to L2 message in the L1 to L2 message tree (undefined if not found).
|
|
20
|
-
*/
|
|
21
|
-
getMessageIndex(l1ToL2Message: Fr): bigint | undefined;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=l1_to_l2_message_store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"l1_to_l2_message_store.d.ts","sourceRoot":"","sources":["../../../src/archiver/memory_archiver_store/l1_to_l2_message_store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD;;GAEG;AACH,qBAAa,kBAAkB;;IAC7B;;OAEG;IACH,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAa;;IAM7C,0BAA0B,IAAI,MAAM;IAIpC,UAAU,CAAC,OAAO,EAAE,SAAS;IAI7B,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,EAAE,EAAE;IAsBtC;;;;OAIG;IACH,eAAe,CAAC,aAAa,EAAE,EAAE,GAAG,MAAM,GAAG,SAAS;CAQvD"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { L1_TO_L2_MSG_SUBTREE_HEIGHT } from '@aztec/constants';
|
|
2
|
-
import { InboxLeaf } from '@aztec/stdlib/messaging';
|
|
3
|
-
/**
|
|
4
|
-
* A simple in-memory implementation of an L1 to L2 message store.
|
|
5
|
-
*/ export class L1ToL2MessageStore {
|
|
6
|
-
/**
|
|
7
|
-
* A map pointing from a key in a "messageIndex" format to the corresponding L1 to L2 message hash.
|
|
8
|
-
*/ store = new Map();
|
|
9
|
-
#l1ToL2MessagesSubtreeSize = 2 ** L1_TO_L2_MSG_SUBTREE_HEIGHT;
|
|
10
|
-
constructor(){}
|
|
11
|
-
getTotalL1ToL2MessageCount() {
|
|
12
|
-
return BigInt(this.store.size);
|
|
13
|
-
}
|
|
14
|
-
addMessage(message) {
|
|
15
|
-
this.store.set(`${message.index}`, message.leaf);
|
|
16
|
-
}
|
|
17
|
-
getMessages(blockNumber) {
|
|
18
|
-
const messages = [];
|
|
19
|
-
let undefinedMessageFound = false;
|
|
20
|
-
const startIndex = Number(InboxLeaf.smallestIndexFromL2Block(blockNumber));
|
|
21
|
-
for(let i = startIndex; i < startIndex + this.#l1ToL2MessagesSubtreeSize; i++){
|
|
22
|
-
// This is inefficient but probably fine for now.
|
|
23
|
-
const message = this.store.get(`${i}`);
|
|
24
|
-
if (message) {
|
|
25
|
-
if (undefinedMessageFound) {
|
|
26
|
-
throw new Error(`L1 to L2 message gap found in block ${blockNumber}`);
|
|
27
|
-
}
|
|
28
|
-
messages.push(message);
|
|
29
|
-
} else {
|
|
30
|
-
undefinedMessageFound = true;
|
|
31
|
-
// We continue iterating over messages here to verify that there are no more messages after the undefined one.
|
|
32
|
-
// --> If this was the case this would imply there is some issue with log fetching.
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return messages;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Gets the L1 to L2 message index in the L1 to L2 message tree.
|
|
39
|
-
* @param l1ToL2Message - The L1 to L2 message.
|
|
40
|
-
* @returns The index of the L1 to L2 message in the L1 to L2 message tree (undefined if not found).
|
|
41
|
-
*/ getMessageIndex(l1ToL2Message) {
|
|
42
|
-
for (const [key, message] of this.store.entries()){
|
|
43
|
-
if (message.equals(l1ToL2Message)) {
|
|
44
|
-
return BigInt(key);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return undefined;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
3
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
-
import { type InBlock, type L2Block } from '@aztec/stdlib/block';
|
|
5
|
-
import type { ContractClassPublic, ContractInstanceUpdateWithAddress, ContractInstanceWithAddress, ExecutablePrivateFunctionWithMembershipProof, UnconstrainedFunctionWithMembershipProof } from '@aztec/stdlib/contract';
|
|
6
|
-
import type { GetContractClassLogsResponse, GetPublicLogsResponse } from '@aztec/stdlib/interfaces/client';
|
|
7
|
-
import { type LogFilter, type PrivateLog, TxScopedL2Log } from '@aztec/stdlib/logs';
|
|
8
|
-
import type { InboxLeaf } from '@aztec/stdlib/messaging';
|
|
9
|
-
import { type BlockHeader, TxEffect, TxHash, TxReceipt } from '@aztec/stdlib/tx';
|
|
10
|
-
import type { ArchiverDataStore, ArchiverL1SynchPoint } from '../archiver_store.js';
|
|
11
|
-
import type { DataRetrieval } from '../structs/data_retrieval.js';
|
|
12
|
-
import type { L1Published } from '../structs/published.js';
|
|
13
|
-
/**
|
|
14
|
-
* Simple, in-memory implementation of an archiver data store.
|
|
15
|
-
*/
|
|
16
|
-
export declare class MemoryArchiverStore implements ArchiverDataStore {
|
|
17
|
-
#private;
|
|
18
|
-
/** The max number of logs that can be obtained in 1 "getPublicLogs" call. */
|
|
19
|
-
readonly maxLogs: number;
|
|
20
|
-
/**
|
|
21
|
-
* An array containing all the L2 blocks that have been fetched so far.
|
|
22
|
-
*/
|
|
23
|
-
private l2Blocks;
|
|
24
|
-
/**
|
|
25
|
-
* An array containing all the tx effects in the L2 blocks that have been fetched so far.
|
|
26
|
-
*/
|
|
27
|
-
private txEffects;
|
|
28
|
-
private taggedLogs;
|
|
29
|
-
private logTagsPerBlock;
|
|
30
|
-
private privateLogsPerBlock;
|
|
31
|
-
private publicLogsPerBlock;
|
|
32
|
-
private contractClassLogsPerBlock;
|
|
33
|
-
private blockScopedNullifiers;
|
|
34
|
-
/**
|
|
35
|
-
* Contains all L1 to L2 messages.
|
|
36
|
-
*/
|
|
37
|
-
private l1ToL2Messages;
|
|
38
|
-
private contractClasses;
|
|
39
|
-
private bytecodeCommitments;
|
|
40
|
-
private privateFunctions;
|
|
41
|
-
private unconstrainedFunctions;
|
|
42
|
-
private contractInstances;
|
|
43
|
-
private contractInstanceUpdates;
|
|
44
|
-
private lastL1BlockNewBlocks;
|
|
45
|
-
private lastL1BlockNewMessages;
|
|
46
|
-
private lastProvenL2BlockNumber;
|
|
47
|
-
private lastProvenL2EpochNumber;
|
|
48
|
-
private functionNames;
|
|
49
|
-
constructor(
|
|
50
|
-
/** The max number of logs that can be obtained in 1 "getPublicLogs" call. */
|
|
51
|
-
maxLogs: number);
|
|
52
|
-
getContractClass(id: Fr): Promise<ContractClassPublic | undefined>;
|
|
53
|
-
getContractClassIds(): Promise<Fr[]>;
|
|
54
|
-
getContractInstance(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;
|
|
55
|
-
getBytecodeCommitment(contractClassId: Fr): Promise<Fr | undefined>;
|
|
56
|
-
addFunctions(contractClassId: Fr, newPrivateFunctions: ExecutablePrivateFunctionWithMembershipProof[], newUnconstrainedFunctions: UnconstrainedFunctionWithMembershipProof[]): Promise<boolean>;
|
|
57
|
-
addContractClasses(data: ContractClassPublic[], bytecodeCommitments: Fr[], blockNumber: number): Promise<boolean>;
|
|
58
|
-
deleteContractClasses(data: ContractClassPublic[], blockNumber: number): Promise<boolean>;
|
|
59
|
-
addContractInstances(data: ContractInstanceWithAddress[], _blockNumber: number): Promise<boolean>;
|
|
60
|
-
deleteContractInstances(data: ContractInstanceWithAddress[], _blockNumber: number): Promise<boolean>;
|
|
61
|
-
addContractInstanceUpdates(data: ContractInstanceUpdateWithAddress[], blockNumber: number): Promise<boolean>;
|
|
62
|
-
deleteContractInstanceUpdates(data: ContractInstanceUpdateWithAddress[], blockNumber: number): Promise<boolean>;
|
|
63
|
-
/**
|
|
64
|
-
* Append new blocks to the store's list.
|
|
65
|
-
* @param blocks - The L2 blocks to be added to the store and the last processed L1 block.
|
|
66
|
-
* @returns True if the operation is successful.
|
|
67
|
-
*/
|
|
68
|
-
addBlocks(blocks: L1Published<L2Block>[]): Promise<boolean>;
|
|
69
|
-
/**
|
|
70
|
-
* Unwinds blocks from the database
|
|
71
|
-
* @param from - The tip of the chain, passed for verification purposes,
|
|
72
|
-
* ensuring that we don't end up deleting something we did not intend
|
|
73
|
-
* @param blocksToUnwind - The number of blocks we are to unwind
|
|
74
|
-
* @returns True if the operation is successful
|
|
75
|
-
*/
|
|
76
|
-
unwindBlocks(from: number, blocksToUnwind: number): Promise<boolean>;
|
|
77
|
-
/**
|
|
78
|
-
* Append new logs to the store's list.
|
|
79
|
-
* @param block - The block for which to add the logs.
|
|
80
|
-
* @returns True if the operation is successful.
|
|
81
|
-
*/
|
|
82
|
-
addLogs(blocks: L2Block[]): Promise<boolean>;
|
|
83
|
-
deleteLogs(blocks: L2Block[]): Promise<boolean>;
|
|
84
|
-
addNullifiers(blocks: L2Block[]): Promise<boolean>;
|
|
85
|
-
deleteNullifiers(blocks: L2Block[]): Promise<boolean>;
|
|
86
|
-
findNullifiersIndexesWithBlock(blockNumber: number, nullifiers: Fr[]): Promise<(InBlock<bigint> | undefined)[]>;
|
|
87
|
-
getTotalL1ToL2MessageCount(): Promise<bigint>;
|
|
88
|
-
/**
|
|
89
|
-
* Append L1 to L2 messages to the store.
|
|
90
|
-
* @param messages - The L1 to L2 messages to be added to the store and the last processed L1 block.
|
|
91
|
-
* @returns True if the operation is successful.
|
|
92
|
-
*/
|
|
93
|
-
addL1ToL2Messages(messages: DataRetrieval<InboxLeaf>): Promise<boolean>;
|
|
94
|
-
/**
|
|
95
|
-
* Gets the L1 to L2 message index in the L1 to L2 message tree.
|
|
96
|
-
* @param l1ToL2Message - The L1 to L2 message.
|
|
97
|
-
* @returns The index of the L1 to L2 message in the L1 to L2 message tree (undefined if not found).
|
|
98
|
-
*/
|
|
99
|
-
getL1ToL2MessageIndex(l1ToL2Message: Fr): Promise<bigint | undefined>;
|
|
100
|
-
/**
|
|
101
|
-
* Gets up to `limit` amount of L2 blocks starting from `from`.
|
|
102
|
-
* @param from - Number of the first block to return (inclusive).
|
|
103
|
-
* @param limit - The number of blocks to return.
|
|
104
|
-
* @returns The requested L2 blocks.
|
|
105
|
-
* @remarks When "from" is smaller than genesis block number, blocks from the beginning are returned.
|
|
106
|
-
*/
|
|
107
|
-
getBlocks(from: number, limit: number): Promise<L1Published<L2Block>[]>;
|
|
108
|
-
getBlockHeaders(from: number, limit: number): Promise<BlockHeader[]>;
|
|
109
|
-
/**
|
|
110
|
-
* Gets a tx effect.
|
|
111
|
-
* @param txHash - The txHash of the tx effect.
|
|
112
|
-
* @returns The requested tx effect.
|
|
113
|
-
*/
|
|
114
|
-
getTxEffect(txHash: TxHash): Promise<InBlock<TxEffect> | undefined>;
|
|
115
|
-
/**
|
|
116
|
-
* Gets a receipt of a settled tx.
|
|
117
|
-
* @param txHash - The hash of a tx we try to get the receipt for.
|
|
118
|
-
* @returns The requested tx receipt (or undefined if not found).
|
|
119
|
-
*/
|
|
120
|
-
getSettledTxReceipt(txHash: TxHash): Promise<TxReceipt | undefined>;
|
|
121
|
-
/**
|
|
122
|
-
* Gets L1 to L2 message (to be) included in a given block.
|
|
123
|
-
* @param blockNumber - L2 block number to get messages for.
|
|
124
|
-
* @returns The L1 to L2 messages/leaves of the messages subtree (throws if not found).
|
|
125
|
-
*/
|
|
126
|
-
getL1ToL2Messages(blockNumber: bigint): Promise<Fr[]>;
|
|
127
|
-
/**
|
|
128
|
-
* Retrieves all private logs from up to `limit` blocks, starting from the block number `from`.
|
|
129
|
-
* @param from - The block number from which to begin retrieving logs.
|
|
130
|
-
* @param limit - The maximum number of blocks to retrieve logs from.
|
|
131
|
-
* @returns An array of private logs from the specified range of blocks.
|
|
132
|
-
*/
|
|
133
|
-
getPrivateLogs(from: number, limit: number): Promise<PrivateLog[]>;
|
|
134
|
-
/**
|
|
135
|
-
* Gets all logs that match any of the received tags (i.e. logs with their first field equal to a tag).
|
|
136
|
-
* @param tags - The tags to filter the logs by.
|
|
137
|
-
* @returns For each received tag, an array of matching logs is returned. An empty array implies no logs match
|
|
138
|
-
* that tag.
|
|
139
|
-
*/
|
|
140
|
-
getLogsByTags(tags: Fr[]): Promise<TxScopedL2Log[][]>;
|
|
141
|
-
/**
|
|
142
|
-
* Gets public logs based on the provided filter.
|
|
143
|
-
* @param filter - The filter to apply to the logs.
|
|
144
|
-
* @returns The requested logs.
|
|
145
|
-
* @remarks Works by doing an intersection of all params in the filter.
|
|
146
|
-
*/
|
|
147
|
-
getPublicLogs(filter: LogFilter): Promise<GetPublicLogsResponse>;
|
|
148
|
-
/**
|
|
149
|
-
* Gets contract class logs based on the provided filter.
|
|
150
|
-
* NB: clone of the above fn, but for contract class logs
|
|
151
|
-
* @param filter - The filter to apply to the logs.
|
|
152
|
-
* @returns The requested logs.
|
|
153
|
-
* @remarks Works by doing an intersection of all params in the filter.
|
|
154
|
-
*/
|
|
155
|
-
getContractClassLogs(filter: LogFilter): Promise<GetContractClassLogsResponse>;
|
|
156
|
-
getLastBlockNumber(): number;
|
|
157
|
-
/**
|
|
158
|
-
* Gets the number of the latest L2 block processed.
|
|
159
|
-
* @returns The number of the latest L2 block processed.
|
|
160
|
-
*/
|
|
161
|
-
getSynchedL2BlockNumber(): Promise<number>;
|
|
162
|
-
getProvenL2BlockNumber(): Promise<number>;
|
|
163
|
-
setProvenL2BlockNumber(l2BlockNumber: number): Promise<void>;
|
|
164
|
-
setBlockSynchedL1BlockNumber(l1BlockNumber: bigint): Promise<void>;
|
|
165
|
-
setMessageSynchedL1BlockNumber(l1BlockNumber: bigint): Promise<void>;
|
|
166
|
-
getSynchPoint(): Promise<ArchiverL1SynchPoint>;
|
|
167
|
-
getContractFunctionName(_address: AztecAddress, selector: FunctionSelector): Promise<string | undefined>;
|
|
168
|
-
registerContractFunctionSignatures(_address: AztecAddress, signatures: string[]): Promise<void>;
|
|
169
|
-
estimateSize(): Promise<{
|
|
170
|
-
mappingSize: number;
|
|
171
|
-
actualSize: number;
|
|
172
|
-
numItems: number;
|
|
173
|
-
}>;
|
|
174
|
-
}
|
|
175
|
-
//# sourceMappingURL=memory_archiver_store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memory_archiver_store.d.ts","sourceRoot":"","sources":["../../../src/archiver/memory_archiver_store/memory_archiver_store.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,OAAO,EAA4B,MAAM,qBAAqB,CAAC;AAC3F,OAAO,KAAK,EACV,mBAAmB,EAEnB,iCAAiC,EACjC,2BAA2B,EAC3B,4CAA4C,EAC5C,wCAAwC,EACzC,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAC3G,OAAO,EAIL,KAAK,SAAS,EAEd,KAAK,UAAU,EAEf,aAAa,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,KAAK,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,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