@aztec/archiver 0.32.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/archiver/archiver.d.ts +9 -9
- package/dest/archiver/archiver.d.ts.map +1 -1
- package/dest/archiver/archiver.js +1 -1
- package/dest/archiver/archiver_store.d.ts +5 -5
- 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 +9 -9
- package/dest/archiver/config.d.ts +1 -1
- package/dest/archiver/config.d.ts.map +1 -1
- package/dest/archiver/config.js +2 -2
- package/dest/archiver/data_retrieval.d.ts +4 -4
- package/dest/archiver/data_retrieval.d.ts.map +1 -1
- package/dest/archiver/eth_log_handlers.d.ts +2 -2
- package/dest/archiver/eth_log_handlers.d.ts.map +1 -1
- package/dest/archiver/eth_log_handlers.js +1 -1
- package/dest/archiver/kv_archiver_store/block_body_store.d.ts +1 -1
- package/dest/archiver/kv_archiver_store/block_body_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/block_store.d.ts +5 -5
- package/dest/archiver/kv_archiver_store/block_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/block_store.js +4 -4
- package/dest/archiver/kv_archiver_store/contract_class_store.d.ts +3 -3
- package/dest/archiver/kv_archiver_store/contract_class_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts +4 -4
- package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/contract_instance_store.js +1 -1
- package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts +7 -7
- package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/log_store.d.ts +3 -3
- package/dest/archiver/kv_archiver_store/log_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/message_store.d.ts +3 -3
- package/dest/archiver/kv_archiver_store/message_store.d.ts.map +1 -1
- package/dest/archiver/memory_archiver_store/l1_to_l2_message_store.d.ts +2 -2
- package/dest/archiver/memory_archiver_store/l1_to_l2_message_store.d.ts.map +1 -1
- package/dest/archiver/memory_archiver_store/memory_archiver_store.d.ts +6 -6
- package/dest/archiver/memory_archiver_store/memory_archiver_store.d.ts.map +1 -1
- package/dest/archiver/memory_archiver_store/memory_archiver_store.js +16 -15
- package/dest/rpc/archiver_client.d.ts +1 -1
- package/dest/rpc/archiver_client.d.ts.map +1 -1
- package/dest/rpc/archiver_server.d.ts +1 -1
- package/dest/rpc/archiver_server.d.ts.map +1 -1
- package/package.json +19 -13
- package/src/archiver/archiver.ts +26 -26
- package/src/archiver/archiver_store.ts +20 -20
- package/src/archiver/archiver_store_test_suite.ts +14 -10
- package/src/archiver/config.ts +2 -2
- package/src/archiver/data_retrieval.ts +4 -4
- package/src/archiver/eth_log_handlers.ts +2 -2
- package/src/archiver/kv_archiver_store/block_body_store.ts +1 -1
- package/src/archiver/kv_archiver_store/block_store.ts +8 -8
- package/src/archiver/kv_archiver_store/contract_class_store.ts +5 -5
- package/src/archiver/kv_archiver_store/contract_instance_store.ts +4 -4
- package/src/archiver/kv_archiver_store/kv_archiver_store.ts +22 -22
- package/src/archiver/kv_archiver_store/log_store.ts +7 -7
- package/src/archiver/kv_archiver_store/message_store.ts +3 -3
- package/src/archiver/memory_archiver_store/l1_to_l2_message_store.ts +2 -2
- package/src/archiver/memory_archiver_store/memory_archiver_store.ts +32 -36
- package/src/rpc/archiver_client.ts +1 -1
- package/src/rpc/archiver_server.ts +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Body, InboxLeaf } from '@aztec/circuit-types';
|
|
2
2
|
import { AppendOnlyTreeSnapshot, Header } from '@aztec/circuits.js';
|
|
3
|
-
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
+
import { type EthAddress } from '@aztec/foundation/eth-address';
|
|
4
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
5
5
|
import { numToUInt32BE } from '@aztec/foundation/serialize';
|
|
6
6
|
import { AvailabilityOracleAbi, InboxAbi, RollupAbi } from '@aztec/l1-artifacts';
|
|
7
7
|
|
|
8
|
-
import { Hex, Log, PublicClient, decodeFunctionData, getAbiItem, getAddress, hexToBytes } from 'viem';
|
|
8
|
+
import { type Hex, type Log, type PublicClient, decodeFunctionData, getAbiItem, getAddress, hexToBytes } from 'viem';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Processes newly received MessageSent (L1 to L2) logs.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { L2Block, TxEffect, TxHash, TxReceipt, TxStatus } from '@aztec/circuit-types';
|
|
2
|
-
import { AppendOnlyTreeSnapshot, AztecAddress, Header, INITIAL_L2_BLOCK_NUM } from '@aztec/circuits.js';
|
|
1
|
+
import { L2Block, type TxEffect, type TxHash, TxReceipt, TxStatus } from '@aztec/circuit-types';
|
|
2
|
+
import { AppendOnlyTreeSnapshot, type AztecAddress, Header, INITIAL_L2_BLOCK_NUM } from '@aztec/circuits.js';
|
|
3
3
|
import { createDebugLogger } from '@aztec/foundation/log';
|
|
4
|
-
import { AztecKVStore, AztecMap, AztecSingleton, Range } from '@aztec/kv-store';
|
|
4
|
+
import { type AztecKVStore, type AztecMap, type AztecSingleton, type Range } from '@aztec/kv-store';
|
|
5
5
|
|
|
6
|
-
import { DataRetrieval } from '../data_retrieval.js';
|
|
7
|
-
import { BlockBodyStore } from './block_body_store.js';
|
|
6
|
+
import { type DataRetrieval } from '../data_retrieval.js';
|
|
7
|
+
import { type BlockBodyStore } from './block_body_store.js';
|
|
8
8
|
|
|
9
9
|
type BlockIndexValue = [blockNumber: number, index: number];
|
|
10
10
|
|
|
@@ -54,7 +54,7 @@ export class BlockStore {
|
|
|
54
54
|
archive: block.archive.toBuffer(),
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
-
block.
|
|
57
|
+
block.body.txEffects.forEach((tx, i) => {
|
|
58
58
|
void this.#txIndex.set(tx.txHash.toString(), [block.number, i]);
|
|
59
59
|
});
|
|
60
60
|
}
|
|
@@ -119,7 +119,7 @@ export class BlockStore {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
const block = this.getBlock(blockNumber);
|
|
122
|
-
return block?.
|
|
122
|
+
return block?.body.txEffects[txIndex];
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
/**
|
|
@@ -134,7 +134,7 @@ export class BlockStore {
|
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
const block = this.getBlock(blockNumber)!;
|
|
137
|
-
const tx = block.
|
|
137
|
+
const tx = block.body.txEffects[txIndex];
|
|
138
138
|
|
|
139
139
|
return new TxReceipt(
|
|
140
140
|
txHash,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Fr, FunctionSelector, Vector } from '@aztec/circuits.js';
|
|
2
2
|
import { BufferReader, numToUInt8, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
3
|
-
import { AztecKVStore, AztecMap } from '@aztec/kv-store';
|
|
3
|
+
import { type AztecKVStore, type AztecMap } from '@aztec/kv-store';
|
|
4
4
|
import {
|
|
5
|
-
ContractClassPublic,
|
|
6
|
-
ExecutablePrivateFunctionWithMembershipProof,
|
|
7
|
-
UnconstrainedFunctionWithMembershipProof,
|
|
5
|
+
type ContractClassPublic,
|
|
6
|
+
type ExecutablePrivateFunctionWithMembershipProof,
|
|
7
|
+
type UnconstrainedFunctionWithMembershipProof,
|
|
8
8
|
} from '@aztec/types/contracts';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -17,7 +17,7 @@ export class ContractClassStore {
|
|
|
17
17
|
this.#contractClasses = db.openMap('archiver_contract_classes');
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
addContractClass(contractClass: ContractClassPublic): Promise<
|
|
20
|
+
addContractClass(contractClass: ContractClassPublic): Promise<void> {
|
|
21
21
|
return this.#contractClasses.set(contractClass.id.toString(), serializeContractClassPublic(contractClass));
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AztecAddress } from '@aztec/circuits.js';
|
|
2
|
-
import { AztecKVStore, AztecMap } from '@aztec/kv-store';
|
|
3
|
-
import { ContractInstanceWithAddress, SerializableContractInstance } from '@aztec/types/contracts';
|
|
1
|
+
import { type AztecAddress } from '@aztec/circuits.js';
|
|
2
|
+
import { type AztecKVStore, type AztecMap } from '@aztec/kv-store';
|
|
3
|
+
import { type ContractInstanceWithAddress, SerializableContractInstance } from '@aztec/types/contracts';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* LMDB implementation of the ArchiverDataStore interface.
|
|
@@ -12,7 +12,7 @@ export class ContractInstanceStore {
|
|
|
12
12
|
this.#contractInstances = db.openMap('archiver_contract_instances');
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
addContractInstance(contractInstance: ContractInstanceWithAddress): Promise<
|
|
15
|
+
addContractInstance(contractInstance: ContractInstanceWithAddress): Promise<void> {
|
|
16
16
|
return this.#contractInstances.set(
|
|
17
17
|
contractInstance.address.toString(),
|
|
18
18
|
new SerializableContractInstance(contractInstance).toBuffer(),
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Body,
|
|
3
|
-
EncryptedL2BlockL2Logs,
|
|
4
|
-
FromLogType,
|
|
5
|
-
GetUnencryptedLogsResponse,
|
|
6
|
-
InboxLeaf,
|
|
7
|
-
L2Block,
|
|
8
|
-
L2BlockL2Logs,
|
|
9
|
-
LogFilter,
|
|
10
|
-
LogType,
|
|
11
|
-
TxEffect,
|
|
12
|
-
TxHash,
|
|
13
|
-
TxReceipt,
|
|
14
|
-
UnencryptedL2BlockL2Logs,
|
|
2
|
+
type Body,
|
|
3
|
+
type EncryptedL2BlockL2Logs,
|
|
4
|
+
type FromLogType,
|
|
5
|
+
type GetUnencryptedLogsResponse,
|
|
6
|
+
type InboxLeaf,
|
|
7
|
+
type L2Block,
|
|
8
|
+
type L2BlockL2Logs,
|
|
9
|
+
type LogFilter,
|
|
10
|
+
type LogType,
|
|
11
|
+
type TxEffect,
|
|
12
|
+
type TxHash,
|
|
13
|
+
type TxReceipt,
|
|
14
|
+
type UnencryptedL2BlockL2Logs,
|
|
15
15
|
} from '@aztec/circuit-types';
|
|
16
|
-
import { Fr } from '@aztec/circuits.js';
|
|
17
|
-
import { AztecAddress } from '@aztec/foundation/aztec-address';
|
|
16
|
+
import { type Fr } from '@aztec/circuits.js';
|
|
17
|
+
import { type AztecAddress } from '@aztec/foundation/aztec-address';
|
|
18
18
|
import { createDebugLogger } from '@aztec/foundation/log';
|
|
19
|
-
import { AztecKVStore } from '@aztec/kv-store';
|
|
19
|
+
import { type AztecKVStore } from '@aztec/kv-store';
|
|
20
20
|
import {
|
|
21
|
-
ContractClassPublic,
|
|
22
|
-
ContractInstanceWithAddress,
|
|
23
|
-
ExecutablePrivateFunctionWithMembershipProof,
|
|
24
|
-
UnconstrainedFunctionWithMembershipProof,
|
|
21
|
+
type ContractClassPublic,
|
|
22
|
+
type ContractInstanceWithAddress,
|
|
23
|
+
type ExecutablePrivateFunctionWithMembershipProof,
|
|
24
|
+
type UnconstrainedFunctionWithMembershipProof,
|
|
25
25
|
} from '@aztec/types/contracts';
|
|
26
26
|
|
|
27
|
-
import { ArchiverDataStore, ArchiverL1SynchPoint } from '../archiver_store.js';
|
|
28
|
-
import { DataRetrieval } from '../data_retrieval.js';
|
|
27
|
+
import { type ArchiverDataStore, type ArchiverL1SynchPoint } from '../archiver_store.js';
|
|
28
|
+
import { type DataRetrieval } from '../data_retrieval.js';
|
|
29
29
|
import { BlockBodyStore } from './block_body_store.js';
|
|
30
30
|
import { BlockStore } from './block_store.js';
|
|
31
31
|
import { ContractClassStore } from './contract_class_store.js';
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EncryptedL2BlockL2Logs,
|
|
3
3
|
ExtendedUnencryptedL2Log,
|
|
4
|
-
FromLogType,
|
|
5
|
-
GetUnencryptedLogsResponse,
|
|
6
|
-
L2BlockL2Logs,
|
|
7
|
-
LogFilter,
|
|
4
|
+
type FromLogType,
|
|
5
|
+
type GetUnencryptedLogsResponse,
|
|
6
|
+
type L2BlockL2Logs,
|
|
7
|
+
type LogFilter,
|
|
8
8
|
LogId,
|
|
9
9
|
LogType,
|
|
10
10
|
UnencryptedL2BlockL2Logs,
|
|
11
|
-
UnencryptedL2Log,
|
|
11
|
+
type UnencryptedL2Log,
|
|
12
12
|
} from '@aztec/circuit-types';
|
|
13
13
|
import { INITIAL_L2_BLOCK_NUM } from '@aztec/circuits.js/constants';
|
|
14
14
|
import { createDebugLogger } from '@aztec/foundation/log';
|
|
15
|
-
import { AztecKVStore, AztecMap } from '@aztec/kv-store';
|
|
15
|
+
import { type AztecKVStore, type AztecMap } from '@aztec/kv-store';
|
|
16
16
|
|
|
17
|
-
import { BlockStore } from './block_store.js';
|
|
17
|
+
import { type BlockStore } from './block_store.js';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* A store for logs
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InboxLeaf } from '@aztec/circuit-types';
|
|
1
|
+
import { type InboxLeaf } from '@aztec/circuit-types';
|
|
2
2
|
import {
|
|
3
3
|
Fr,
|
|
4
4
|
INITIAL_L2_BLOCK_NUM,
|
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP,
|
|
7
7
|
} from '@aztec/circuits.js';
|
|
8
8
|
import { createDebugLogger } from '@aztec/foundation/log';
|
|
9
|
-
import { AztecKVStore, AztecMap, AztecSingleton } from '@aztec/kv-store';
|
|
9
|
+
import { type AztecKVStore, type AztecMap, type AztecSingleton } from '@aztec/kv-store';
|
|
10
10
|
|
|
11
|
-
import { DataRetrieval } from '../data_retrieval.js';
|
|
11
|
+
import { type DataRetrieval } from '../data_retrieval.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* LMDB implementation of the ArchiverDataStore interface.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { InboxLeaf } from '@aztec/circuit-types';
|
|
1
|
+
import { type InboxLeaf } from '@aztec/circuit-types';
|
|
2
2
|
import {
|
|
3
3
|
INITIAL_L2_BLOCK_NUM,
|
|
4
4
|
L1_TO_L2_MSG_SUBTREE_HEIGHT,
|
|
5
5
|
NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP,
|
|
6
6
|
} from '@aztec/circuits.js/constants';
|
|
7
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
7
|
+
import { type Fr } from '@aztec/foundation/fields';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* A simple in-memory implementation of an L1 to L2 message store.
|
|
@@ -1,33 +1,32 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Body,
|
|
3
|
-
EncryptedL2BlockL2Logs,
|
|
2
|
+
type Body,
|
|
3
|
+
type EncryptedL2BlockL2Logs,
|
|
4
4
|
ExtendedUnencryptedL2Log,
|
|
5
|
-
FromLogType,
|
|
6
|
-
GetUnencryptedLogsResponse,
|
|
7
|
-
InboxLeaf,
|
|
8
|
-
L2Block,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
LogFilter,
|
|
5
|
+
type FromLogType,
|
|
6
|
+
type GetUnencryptedLogsResponse,
|
|
7
|
+
type InboxLeaf,
|
|
8
|
+
type L2Block,
|
|
9
|
+
type L2BlockL2Logs,
|
|
10
|
+
type LogFilter,
|
|
12
11
|
LogId,
|
|
13
12
|
LogType,
|
|
14
|
-
TxEffect,
|
|
15
|
-
TxHash,
|
|
13
|
+
type TxEffect,
|
|
14
|
+
type TxHash,
|
|
16
15
|
TxReceipt,
|
|
17
16
|
TxStatus,
|
|
18
|
-
UnencryptedL2BlockL2Logs,
|
|
17
|
+
type UnencryptedL2BlockL2Logs,
|
|
19
18
|
} from '@aztec/circuit-types';
|
|
20
19
|
import { Fr, INITIAL_L2_BLOCK_NUM } from '@aztec/circuits.js';
|
|
21
|
-
import { AztecAddress } from '@aztec/foundation/aztec-address';
|
|
20
|
+
import { type AztecAddress } from '@aztec/foundation/aztec-address';
|
|
22
21
|
import {
|
|
23
|
-
ContractClassPublic,
|
|
24
|
-
ContractInstanceWithAddress,
|
|
25
|
-
ExecutablePrivateFunctionWithMembershipProof,
|
|
26
|
-
UnconstrainedFunctionWithMembershipProof,
|
|
22
|
+
type ContractClassPublic,
|
|
23
|
+
type ContractInstanceWithAddress,
|
|
24
|
+
type ExecutablePrivateFunctionWithMembershipProof,
|
|
25
|
+
type UnconstrainedFunctionWithMembershipProof,
|
|
27
26
|
} from '@aztec/types/contracts';
|
|
28
27
|
|
|
29
|
-
import { ArchiverDataStore, ArchiverL1SynchPoint } from '../archiver_store.js';
|
|
30
|
-
import { DataRetrieval } from '../data_retrieval.js';
|
|
28
|
+
import { type ArchiverDataStore, type ArchiverL1SynchPoint } from '../archiver_store.js';
|
|
29
|
+
import { type DataRetrieval } from '../data_retrieval.js';
|
|
31
30
|
import { L1ToL2MessageStore } from './l1_to_l2_message_store.js';
|
|
32
31
|
|
|
33
32
|
/**
|
|
@@ -37,7 +36,7 @@ export class MemoryArchiverStore implements ArchiverDataStore {
|
|
|
37
36
|
/**
|
|
38
37
|
* An array containing all the L2 blocks that have been fetched so far.
|
|
39
38
|
*/
|
|
40
|
-
private
|
|
39
|
+
private l2Blocks: L2Block[] = [];
|
|
41
40
|
|
|
42
41
|
/**
|
|
43
42
|
* A mapping of body hash to body
|
|
@@ -144,8 +143,8 @@ export class MemoryArchiverStore implements ArchiverDataStore {
|
|
|
144
143
|
*/
|
|
145
144
|
public addBlocks(blocks: DataRetrieval<L2Block>): Promise<boolean> {
|
|
146
145
|
this.lastL1BlockNewBlocks = blocks.lastProcessedL1BlockNumber;
|
|
147
|
-
this.
|
|
148
|
-
this.txEffects.push(...blocks.retrievedData.flatMap(b => b.
|
|
146
|
+
this.l2Blocks.push(...blocks.retrievedData);
|
|
147
|
+
this.txEffects.push(...blocks.retrievedData.flatMap(b => b.body.txEffects));
|
|
149
148
|
return Promise.resolve(true);
|
|
150
149
|
}
|
|
151
150
|
|
|
@@ -242,12 +241,12 @@ export class MemoryArchiverStore implements ArchiverDataStore {
|
|
|
242
241
|
}
|
|
243
242
|
|
|
244
243
|
const fromIndex = Math.max(from - INITIAL_L2_BLOCK_NUM, 0);
|
|
245
|
-
if (fromIndex >= this.
|
|
244
|
+
if (fromIndex >= this.l2Blocks.length) {
|
|
246
245
|
return Promise.resolve([]);
|
|
247
246
|
}
|
|
248
247
|
|
|
249
248
|
const toIndex = fromIndex + limit;
|
|
250
|
-
return Promise.resolve(this.
|
|
249
|
+
return Promise.resolve(this.l2Blocks.slice(fromIndex, toIndex));
|
|
251
250
|
}
|
|
252
251
|
|
|
253
252
|
/**
|
|
@@ -266,12 +265,11 @@ export class MemoryArchiverStore implements ArchiverDataStore {
|
|
|
266
265
|
* @returns The requested tx receipt (or undefined if not found).
|
|
267
266
|
*/
|
|
268
267
|
public getSettledTxReceipt(txHash: TxHash): Promise<TxReceipt | undefined> {
|
|
269
|
-
for (const
|
|
270
|
-
|
|
268
|
+
for (const block of this.l2Blocks) {
|
|
269
|
+
const txHashes = block.body.txEffects.map(txEffect => txEffect.txHash);
|
|
270
|
+
for (const currentTxHash of txHashes) {
|
|
271
271
|
if (currentTxHash.equals(txHash)) {
|
|
272
|
-
return Promise.resolve(
|
|
273
|
-
new TxReceipt(txHash, TxStatus.MINED, '', blockContext.block.hash().toBuffer(), blockContext.block.number),
|
|
274
|
-
);
|
|
272
|
+
return Promise.resolve(new TxReceipt(txHash, TxStatus.MINED, '', block.hash().toBuffer(), block.number));
|
|
275
273
|
}
|
|
276
274
|
}
|
|
277
275
|
}
|
|
@@ -364,20 +362,18 @@ export class MemoryArchiverStore implements ArchiverDataStore {
|
|
|
364
362
|
const logs: ExtendedUnencryptedL2Log[] = [];
|
|
365
363
|
|
|
366
364
|
for (; fromBlockIndex < toBlockIndex; fromBlockIndex++) {
|
|
367
|
-
const
|
|
365
|
+
const block = this.l2Blocks[fromBlockIndex];
|
|
368
366
|
const blockLogs = this.unencryptedLogsPerBlock[fromBlockIndex];
|
|
369
367
|
for (; txIndexInBlock < blockLogs.txLogs.length; txIndexInBlock++) {
|
|
370
368
|
const txLogs = blockLogs.txLogs[txIndexInBlock].unrollLogs();
|
|
371
369
|
for (; logIndexInTx < txLogs.length; logIndexInTx++) {
|
|
372
370
|
const log = txLogs[logIndexInTx];
|
|
373
371
|
if (
|
|
374
|
-
(!txHash ||
|
|
372
|
+
(!txHash || block.body.txEffects[txIndexInBlock].txHash.equals(txHash)) &&
|
|
375
373
|
(!contractAddress || log.contractAddress.equals(contractAddress)) &&
|
|
376
374
|
(!selector || log.selector.equals(selector))
|
|
377
375
|
) {
|
|
378
|
-
logs.push(
|
|
379
|
-
new ExtendedUnencryptedL2Log(new LogId(blockContext.block.number, txIndexInBlock, logIndexInTx), log),
|
|
380
|
-
);
|
|
376
|
+
logs.push(new ExtendedUnencryptedL2Log(new LogId(block.number, txIndexInBlock, logIndexInTx), log));
|
|
381
377
|
if (logs.length === this.maxLogs) {
|
|
382
378
|
return Promise.resolve({
|
|
383
379
|
logs,
|
|
@@ -402,10 +398,10 @@ export class MemoryArchiverStore implements ArchiverDataStore {
|
|
|
402
398
|
* @returns The number of the latest L2 block processed.
|
|
403
399
|
*/
|
|
404
400
|
public getSynchedL2BlockNumber(): Promise<number> {
|
|
405
|
-
if (this.
|
|
401
|
+
if (this.l2Blocks.length === 0) {
|
|
406
402
|
return Promise.resolve(INITIAL_L2_BLOCK_NUM - 1);
|
|
407
403
|
}
|
|
408
|
-
return Promise.resolve(this.
|
|
404
|
+
return Promise.resolve(this.l2Blocks[this.l2Blocks.length - 1].number);
|
|
409
405
|
}
|
|
410
406
|
|
|
411
407
|
public getSynchPoint(): Promise<ArchiverL1SynchPoint> {
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import { EthAddress, Fr } from '@aztec/circuits.js';
|
|
10
10
|
import { createJsonRpcClient, makeFetch } from '@aztec/foundation/json-rpc/client';
|
|
11
11
|
|
|
12
|
-
import { ArchiveSource } from '../archiver/archiver.js';
|
|
12
|
+
import { type ArchiveSource } from '../archiver/archiver.js';
|
|
13
13
|
|
|
14
14
|
export const createArchiverClient = (url: string, fetch = makeFetch([1, 2, 3], true)): ArchiveSource =>
|
|
15
15
|
createJsonRpcClient<ArchiveSource>(
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { EthAddress, Fr } from '@aztec/circuits.js';
|
|
11
11
|
import { JsonRpcServer } from '@aztec/foundation/json-rpc/server';
|
|
12
12
|
|
|
13
|
-
import { Archiver } from '../archiver/archiver.js';
|
|
13
|
+
import { type Archiver } from '../archiver/archiver.js';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Wrap an Archiver instance with a JSON RPC HTTP server.
|