@aztec/archiver 0.63.0 → 0.64.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 +12 -3
- package/dest/archiver/archiver.d.ts.map +1 -1
- package/dest/archiver/archiver.js +37 -10
- package/dest/archiver/archiver_store.d.ts +25 -2
- package/dest/archiver/archiver_store.d.ts.map +1 -1
- package/dest/archiver/archiver_store_test_suite.d.ts.map +1 -1
- package/dest/archiver/archiver_store_test_suite.js +79 -19
- package/dest/archiver/data_retrieval.d.ts.map +1 -1
- package/dest/archiver/data_retrieval.js +4 -4
- package/dest/archiver/epoch_helpers.d.ts +12 -7
- package/dest/archiver/epoch_helpers.d.ts.map +1 -1
- package/dest/archiver/epoch_helpers.js +14 -2
- package/dest/archiver/instrumentation.d.ts +6 -0
- package/dest/archiver/instrumentation.d.ts.map +1 -1
- package/dest/archiver/instrumentation.js +15 -2
- 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 +18 -8
- package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts +16 -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 +24 -3
- package/dest/archiver/kv_archiver_store/nullifier_store.d.ts +12 -0
- package/dest/archiver/kv_archiver_store/nullifier_store.d.ts.map +1 -0
- package/dest/archiver/kv_archiver_store/nullifier_store.js +71 -0
- package/dest/archiver/memory_archiver_store/memory_archiver_store.d.ts +11 -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 +51 -6
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +21 -3
- package/dest/test/mock_l2_block_source.d.ts +5 -1
- package/dest/test/mock_l2_block_source.d.ts.map +1 -1
- package/dest/test/mock_l2_block_source.js +9 -3
- package/package.json +12 -11
- package/src/archiver/archiver.ts +51 -11
- package/src/archiver/archiver_store.ts +24 -1
- package/src/archiver/archiver_store_test_suite.ts +92 -17
- package/src/archiver/data_retrieval.ts +13 -4
- package/src/archiver/epoch_helpers.ts +30 -6
- package/src/archiver/instrumentation.ts +22 -0
- package/src/archiver/kv_archiver_store/block_store.ts +22 -10
- package/src/archiver/kv_archiver_store/kv_archiver_store.ts +27 -3
- package/src/archiver/kv_archiver_store/nullifier_store.ts +78 -0
- package/src/archiver/memory_archiver_store/memory_archiver_store.ts +59 -5
- package/src/factory.ts +21 -3
- package/src/test/mock_l2_block_source.ts +8 -2
package/src/factory.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type ArchiverApi, type Service } from '@aztec/circuit-types';
|
|
2
|
-
import { type ContractClassPublic } from '@aztec/circuits.js';
|
|
2
|
+
import { type ContractClassPublic, getContractClassFromArtifact } from '@aztec/circuits.js';
|
|
3
3
|
import { createDebugLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { type Maybe } from '@aztec/foundation/types';
|
|
5
5
|
import { type DataStoreConfig } from '@aztec/kv-store/config';
|
|
6
6
|
import { createStore } from '@aztec/kv-store/utils';
|
|
7
|
+
import { TokenBridgeContractArtifact, TokenContractArtifact } from '@aztec/noir-contracts.js';
|
|
7
8
|
import { getCanonicalProtocolContract, protocolContractNames } from '@aztec/protocol-contracts';
|
|
8
9
|
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
9
10
|
import { NoopTelemetryClient } from '@aztec/telemetry-client/noop';
|
|
@@ -21,14 +22,15 @@ export async function createArchiver(
|
|
|
21
22
|
if (!config.archiverUrl) {
|
|
22
23
|
const store = await createStore('archiver', config, createDebugLogger('aztec:archiver:lmdb'));
|
|
23
24
|
const archiverStore = new KVArchiverDataStore(store, config.maxLogs);
|
|
24
|
-
await
|
|
25
|
+
await registerProtocolContracts(archiverStore);
|
|
26
|
+
await registerCommonContracts(archiverStore);
|
|
25
27
|
return Archiver.createAndSync(config, archiverStore, telemetry, opts.blockUntilSync);
|
|
26
28
|
} else {
|
|
27
29
|
return createArchiverClient(config.archiverUrl);
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
32
|
|
|
31
|
-
async function
|
|
33
|
+
async function registerProtocolContracts(store: KVArchiverDataStore) {
|
|
32
34
|
const blockNumber = 0;
|
|
33
35
|
for (const name of protocolContractNames) {
|
|
34
36
|
const contract = getCanonicalProtocolContract(name);
|
|
@@ -42,3 +44,19 @@ async function initWithProtocolContracts(store: KVArchiverDataStore) {
|
|
|
42
44
|
await store.addContractInstances([contract.instance], blockNumber);
|
|
43
45
|
}
|
|
44
46
|
}
|
|
47
|
+
|
|
48
|
+
// TODO(#10007): Remove this method. We are explicitly registering these contracts
|
|
49
|
+
// here to ensure they are available to all nodes and all prover nodes, since the PXE
|
|
50
|
+
// was tweaked to automatically push contract classes to the node it is registered,
|
|
51
|
+
// but other nodes in the network may require the contract classes to be registered as well.
|
|
52
|
+
// TODO(#10007): Remove the dependency on noir-contracts.js from this package once we remove this.
|
|
53
|
+
async function registerCommonContracts(store: KVArchiverDataStore) {
|
|
54
|
+
const blockNumber = 0;
|
|
55
|
+
const artifacts = [TokenBridgeContractArtifact, TokenContractArtifact];
|
|
56
|
+
const classes = artifacts.map(artifact => ({
|
|
57
|
+
...getContractClassFromArtifact(artifact),
|
|
58
|
+
privateFunctions: [],
|
|
59
|
+
unconstrainedFunctions: [],
|
|
60
|
+
}));
|
|
61
|
+
await store.addContractClasses(classes, blockNumber);
|
|
62
|
+
}
|
|
@@ -119,8 +119,14 @@ export class MockL2BlockSource implements L2BlockSource {
|
|
|
119
119
|
* @returns The requested tx effect.
|
|
120
120
|
*/
|
|
121
121
|
public getTxEffect(txHash: TxHash) {
|
|
122
|
-
const
|
|
123
|
-
|
|
122
|
+
const match = this.l2Blocks
|
|
123
|
+
.flatMap(b => b.body.txEffects.map(tx => [tx, b] as const))
|
|
124
|
+
.find(([tx]) => tx.txHash.equals(txHash));
|
|
125
|
+
if (!match) {
|
|
126
|
+
return Promise.resolve(undefined);
|
|
127
|
+
}
|
|
128
|
+
const [txEffect, block] = match;
|
|
129
|
+
return Promise.resolve({ data: txEffect, l2BlockNumber: block.number, l2BlockHash: block.hash().toString() });
|
|
124
130
|
}
|
|
125
131
|
|
|
126
132
|
/**
|