@aztec/archiver 0.66.0 → 0.67.1-devnet
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 +7 -10
- package/dest/archiver/archiver.d.ts.map +1 -1
- package/dest/archiver/archiver.js +566 -559
- package/dest/archiver/archiver_store.d.ts +2 -2
- package/dest/archiver/archiver_store.d.ts.map +1 -1
- package/dest/archiver/config.d.ts +2 -0
- package/dest/archiver/config.d.ts.map +1 -1
- package/dest/archiver/config.js +6 -1
- package/dest/archiver/data_retrieval.d.ts +3 -3
- package/dest/archiver/data_retrieval.d.ts.map +1 -1
- package/dest/archiver/data_retrieval.js +38 -17
- package/dest/archiver/instrumentation.d.ts +5 -2
- package/dest/archiver/instrumentation.d.ts.map +1 -1
- package/dest/archiver/instrumentation.js +17 -18
- package/dest/archiver/kv_archiver_store/block_store.d.ts +2 -2
- package/dest/archiver/kv_archiver_store/block_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/block_store.js +6 -6
- package/dest/archiver/kv_archiver_store/contract_class_store.js +2 -2
- package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts +2 -2
- package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/kv_archiver_store.js +3 -3
- package/dest/archiver/kv_archiver_store/log_store.js +3 -3
- package/dest/archiver/kv_archiver_store/message_store.js +3 -3
- package/dest/archiver/kv_archiver_store/nullifier_store.js +3 -3
- package/dest/archiver/memory_archiver_store/memory_archiver_store.d.ts +2 -2
- package/dest/archiver/memory_archiver_store/memory_archiver_store.d.ts.map +1 -1
- package/dest/archiver/memory_archiver_store/memory_archiver_store.js +4 -4
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +8 -6
- package/dest/index.d.ts +1 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +2 -2
- package/dest/test/mock_l2_block_source.d.ts +2 -2
- package/dest/test/mock_l2_block_source.d.ts.map +1 -1
- package/dest/test/mock_l2_block_source.js +3 -3
- package/package.json +17 -12
- package/src/archiver/archiver.ts +19 -24
- package/src/archiver/archiver_store.ts +2 -2
- package/src/archiver/config.ts +8 -0
- package/src/archiver/data_retrieval.ts +58 -25
- package/src/archiver/instrumentation.ts +25 -21
- package/src/archiver/kv_archiver_store/block_store.ts +6 -6
- package/src/archiver/kv_archiver_store/contract_class_store.ts +1 -1
- package/src/archiver/kv_archiver_store/kv_archiver_store.ts +4 -4
- package/src/archiver/kv_archiver_store/log_store.ts +2 -2
- package/src/archiver/kv_archiver_store/message_store.ts +2 -2
- package/src/archiver/kv_archiver_store/nullifier_store.ts +2 -2
- package/src/archiver/memory_archiver_store/memory_archiver_store.ts +5 -5
- package/src/factory.ts +7 -5
- package/src/index.ts +1 -4
- package/src/test/mock_l2_block_source.ts +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InboxLeaf } from '@aztec/circuit-types';
|
|
2
2
|
import { Fr, L1_TO_L2_MSG_SUBTREE_HEIGHT } from '@aztec/circuits.js';
|
|
3
|
-
import {
|
|
3
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { type AztecKVStore, type AztecMap, type AztecSingleton } from '@aztec/kv-store';
|
|
5
5
|
|
|
6
6
|
import { type DataRetrieval } from '../structs/data_retrieval.js';
|
|
@@ -14,7 +14,7 @@ export class MessageStore {
|
|
|
14
14
|
#lastSynchedL1Block: AztecSingleton<bigint>;
|
|
15
15
|
#totalMessageCount: AztecSingleton<bigint>;
|
|
16
16
|
|
|
17
|
-
#log =
|
|
17
|
+
#log = createLogger('archiver:message_store');
|
|
18
18
|
|
|
19
19
|
#l1ToL2MessagesSubtreeSize = 2 ** L1_TO_L2_MSG_SUBTREE_HEIGHT;
|
|
20
20
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { type InBlock, type L2Block } from '@aztec/circuit-types';
|
|
2
2
|
import { type Fr, MAX_NULLIFIERS_PER_TX } from '@aztec/circuits.js';
|
|
3
|
-
import {
|
|
3
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { type AztecKVStore, type AztecMap } from '@aztec/kv-store';
|
|
5
5
|
|
|
6
6
|
export class NullifierStore {
|
|
7
7
|
#nullifiersToBlockNumber: AztecMap<string, number>;
|
|
8
8
|
#nullifiersToBlockHash: AztecMap<string, string>;
|
|
9
9
|
#nullifiersToIndex: AztecMap<string, number>;
|
|
10
|
-
#log =
|
|
10
|
+
#log = createLogger('archiver:log_store');
|
|
11
11
|
|
|
12
12
|
constructor(private db: AztecKVStore) {
|
|
13
13
|
this.#nullifiersToBlockNumber = db.openMap('archiver_nullifiers_to_block_number');
|
|
@@ -16,12 +16,12 @@ import {
|
|
|
16
16
|
wrapInBlock,
|
|
17
17
|
} from '@aztec/circuit-types';
|
|
18
18
|
import {
|
|
19
|
+
type BlockHeader,
|
|
19
20
|
type ContractClassPublic,
|
|
20
21
|
type ContractClassPublicWithBlockNumber,
|
|
21
22
|
type ContractInstanceWithAddress,
|
|
22
23
|
type ExecutablePrivateFunctionWithMembershipProof,
|
|
23
24
|
Fr,
|
|
24
|
-
type Header,
|
|
25
25
|
INITIAL_L2_BLOCK_NUM,
|
|
26
26
|
MAX_NOTE_HASHES_PER_TX,
|
|
27
27
|
MAX_NULLIFIERS_PER_TX,
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
} from '@aztec/circuits.js';
|
|
31
31
|
import { type ContractArtifact, FunctionSelector } from '@aztec/foundation/abi';
|
|
32
32
|
import { type AztecAddress } from '@aztec/foundation/aztec-address';
|
|
33
|
-
import {
|
|
33
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
34
34
|
|
|
35
35
|
import { type ArchiverDataStore, type ArchiverL1SynchPoint } from '../archiver_store.js';
|
|
36
36
|
import { type DataRetrieval } from '../structs/data_retrieval.js';
|
|
@@ -86,7 +86,7 @@ export class MemoryArchiverStore implements ArchiverDataStore {
|
|
|
86
86
|
private lastProvenL2BlockNumber: number = 0;
|
|
87
87
|
private lastProvenL2EpochNumber: number = 0;
|
|
88
88
|
|
|
89
|
-
#log =
|
|
89
|
+
#log = createLogger('archiver:data-store');
|
|
90
90
|
|
|
91
91
|
constructor(
|
|
92
92
|
/** The max number of logs that can be obtained in 1 "getUnencryptedLogs" call. */
|
|
@@ -105,7 +105,7 @@ export class MemoryArchiverStore implements ArchiverDataStore {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
public getContractClassIds(): Promise<Fr[]> {
|
|
108
|
-
return Promise.resolve(Array.from(this.contractClasses.keys()).map(key => Fr.
|
|
108
|
+
return Promise.resolve(Array.from(this.contractClasses.keys()).map(key => Fr.fromHexString(key)));
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
public getContractInstance(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined> {
|
|
@@ -427,7 +427,7 @@ export class MemoryArchiverStore implements ArchiverDataStore {
|
|
|
427
427
|
return Promise.resolve(this.l2Blocks.slice(fromIndex, toIndex));
|
|
428
428
|
}
|
|
429
429
|
|
|
430
|
-
public async getBlockHeaders(from: number, limit: number): Promise<
|
|
430
|
+
public async getBlockHeaders(from: number, limit: number): Promise<BlockHeader[]> {
|
|
431
431
|
const blocks = await this.getBlocks(from, limit);
|
|
432
432
|
return blocks.map(block => block.data.header);
|
|
433
433
|
}
|
package/src/factory.ts
CHANGED
|
@@ -4,12 +4,14 @@ import {
|
|
|
4
4
|
computePublicBytecodeCommitment,
|
|
5
5
|
getContractClassFromArtifact,
|
|
6
6
|
} from '@aztec/circuits.js';
|
|
7
|
-
import {
|
|
7
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
8
8
|
import { type Maybe } from '@aztec/foundation/types';
|
|
9
9
|
import { type DataStoreConfig } from '@aztec/kv-store/config';
|
|
10
|
-
import { createStore } from '@aztec/kv-store/
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
10
|
+
import { createStore } from '@aztec/kv-store/lmdb';
|
|
11
|
+
import { TokenContractArtifact } from '@aztec/noir-contracts.js/Token';
|
|
12
|
+
import { TokenBridgeContractArtifact } from '@aztec/noir-contracts.js/TokenBridge';
|
|
13
|
+
import { protocolContractNames } from '@aztec/protocol-contracts';
|
|
14
|
+
import { getCanonicalProtocolContract } from '@aztec/protocol-contracts/bundle';
|
|
13
15
|
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
14
16
|
import { NoopTelemetryClient } from '@aztec/telemetry-client/noop';
|
|
15
17
|
|
|
@@ -24,7 +26,7 @@ export async function createArchiver(
|
|
|
24
26
|
opts: { blockUntilSync: boolean } = { blockUntilSync: true },
|
|
25
27
|
): Promise<ArchiverApi & Maybe<Service>> {
|
|
26
28
|
if (!config.archiverUrl) {
|
|
27
|
-
const store = await createStore('archiver', config,
|
|
29
|
+
const store = await createStore('archiver', config, createLogger('archiver:lmdb'));
|
|
28
30
|
const archiverStore = new KVArchiverDataStore(store, config.maxLogs);
|
|
29
31
|
await registerProtocolContracts(archiverStore);
|
|
30
32
|
await registerCommonContracts(archiverStore);
|
package/src/index.ts
CHANGED
|
@@ -2,7 +2,4 @@ export * from './archiver/index.js';
|
|
|
2
2
|
export * from './factory.js';
|
|
3
3
|
export * from './rpc/index.js';
|
|
4
4
|
|
|
5
|
-
export {
|
|
6
|
-
retrieveBlocksFromRollup as retrieveBlockFromRollup,
|
|
7
|
-
retrieveL2ProofVerifiedEvents,
|
|
8
|
-
} from './archiver/data_retrieval.js';
|
|
5
|
+
export { retrieveBlocksFromRollup, retrieveL2ProofVerifiedEvents } from './archiver/data_retrieval.js';
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
TxStatus,
|
|
9
9
|
} from '@aztec/circuit-types';
|
|
10
10
|
import { getSlotRangeForEpoch } from '@aztec/circuit-types';
|
|
11
|
-
import {
|
|
11
|
+
import { type BlockHeader, EthAddress } from '@aztec/circuits.js';
|
|
12
12
|
import { DefaultL1ContractsConfig } from '@aztec/ethereum';
|
|
13
|
-
import {
|
|
13
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* A mocked implementation of L2BlockSource to be used in tests.
|
|
@@ -21,7 +21,7 @@ export class MockL2BlockSource implements L2BlockSource {
|
|
|
21
21
|
private provenEpochNumber: number = 0;
|
|
22
22
|
private provenBlockNumber: number = 0;
|
|
23
23
|
|
|
24
|
-
private log =
|
|
24
|
+
private log = createLogger('archiver:mock_l2_block_source');
|
|
25
25
|
|
|
26
26
|
public createBlocks(numBlocks: number) {
|
|
27
27
|
for (let i = 0; i < numBlocks; i++) {
|
|
@@ -106,7 +106,7 @@ export class MockL2BlockSource implements L2BlockSource {
|
|
|
106
106
|
);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
getBlockHeader(number: number | 'latest'): Promise<
|
|
109
|
+
getBlockHeader(number: number | 'latest'): Promise<BlockHeader | undefined> {
|
|
110
110
|
return Promise.resolve(this.l2Blocks.at(typeof number === 'number' ? number - 1 : -1)?.header);
|
|
111
111
|
}
|
|
112
112
|
|