@aztec/archiver 0.0.0-test.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/README.md +16 -0
- package/dest/archiver/archiver.d.ts +197 -0
- package/dest/archiver/archiver.d.ts.map +1 -0
- package/dest/archiver/archiver.js +900 -0
- package/dest/archiver/archiver_store.d.ts +220 -0
- package/dest/archiver/archiver_store.d.ts.map +1 -0
- package/dest/archiver/archiver_store.js +4 -0
- package/dest/archiver/archiver_store_test_suite.d.ts +8 -0
- package/dest/archiver/archiver_store_test_suite.d.ts.map +1 -0
- package/dest/archiver/archiver_store_test_suite.js +794 -0
- package/dest/archiver/config.d.ts +37 -0
- package/dest/archiver/config.d.ts.map +1 -0
- package/dest/archiver/config.js +46 -0
- package/dest/archiver/data_retrieval.d.ts +74 -0
- package/dest/archiver/data_retrieval.d.ts.map +1 -0
- package/dest/archiver/data_retrieval.js +283 -0
- package/dest/archiver/errors.d.ts +4 -0
- package/dest/archiver/errors.d.ts.map +1 -0
- package/dest/archiver/errors.js +5 -0
- package/dest/archiver/index.d.ts +8 -0
- package/dest/archiver/index.d.ts.map +1 -0
- package/dest/archiver/index.js +5 -0
- package/dest/archiver/instrumentation.d.ts +29 -0
- package/dest/archiver/instrumentation.d.ts.map +1 -0
- package/dest/archiver/instrumentation.js +99 -0
- package/dest/archiver/kv_archiver_store/block_store.d.ts +87 -0
- package/dest/archiver/kv_archiver_store/block_store.d.ts.map +1 -0
- package/dest/archiver/kv_archiver_store/block_store.js +217 -0
- package/dest/archiver/kv_archiver_store/contract_class_store.d.ts +18 -0
- package/dest/archiver/kv_archiver_store/contract_class_store.d.ts.map +1 -0
- package/dest/archiver/kv_archiver_store/contract_class_store.js +126 -0
- package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts +21 -0
- package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts.map +1 -0
- package/dest/archiver/kv_archiver_store/contract_instance_store.js +63 -0
- package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts +153 -0
- package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts.map +1 -0
- package/dest/archiver/kv_archiver_store/kv_archiver_store.js +254 -0
- package/dest/archiver/kv_archiver_store/log_store.d.ts +49 -0
- package/dest/archiver/kv_archiver_store/log_store.d.ts.map +1 -0
- package/dest/archiver/kv_archiver_store/log_store.js +364 -0
- package/dest/archiver/kv_archiver_store/message_store.d.ts +33 -0
- package/dest/archiver/kv_archiver_store/message_store.d.ts.map +1 -0
- package/dest/archiver/kv_archiver_store/message_store.js +85 -0
- 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 +73 -0
- package/dest/archiver/memory_archiver_store/l1_to_l2_message_store.d.ts +23 -0
- package/dest/archiver/memory_archiver_store/l1_to_l2_message_store.d.ts.map +1 -0
- package/dest/archiver/memory_archiver_store/l1_to_l2_message_store.js +49 -0
- package/dest/archiver/memory_archiver_store/memory_archiver_store.d.ts +175 -0
- package/dest/archiver/memory_archiver_store/memory_archiver_store.d.ts.map +1 -0
- package/dest/archiver/memory_archiver_store/memory_archiver_store.js +636 -0
- package/dest/archiver/structs/data_retrieval.d.ts +27 -0
- package/dest/archiver/structs/data_retrieval.d.ts.map +1 -0
- package/dest/archiver/structs/data_retrieval.js +5 -0
- package/dest/archiver/structs/published.d.ts +11 -0
- package/dest/archiver/structs/published.d.ts.map +1 -0
- package/dest/archiver/structs/published.js +1 -0
- package/dest/factory.d.ts +24 -0
- package/dest/factory.d.ts.map +1 -0
- package/dest/factory.js +85 -0
- package/dest/index.d.ts +5 -0
- package/dest/index.d.ts.map +1 -0
- package/dest/index.js +4 -0
- package/dest/rpc/index.d.ts +10 -0
- package/dest/rpc/index.d.ts.map +1 -0
- package/dest/rpc/index.js +18 -0
- package/dest/test/index.d.ts +4 -0
- package/dest/test/index.d.ts.map +1 -0
- package/dest/test/index.js +3 -0
- package/dest/test/mock_archiver.d.ts +23 -0
- package/dest/test/mock_archiver.d.ts.map +1 -0
- package/dest/test/mock_archiver.js +40 -0
- package/dest/test/mock_l1_to_l2_message_source.d.ts +16 -0
- package/dest/test/mock_l1_to_l2_message_source.d.ts.map +1 -0
- package/dest/test/mock_l1_to_l2_message_source.js +25 -0
- package/dest/test/mock_l2_block_source.d.ts +79 -0
- package/dest/test/mock_l2_block_source.d.ts.map +1 -0
- package/dest/test/mock_l2_block_source.js +163 -0
- package/package.json +110 -0
- package/src/archiver/archiver.ts +1181 -0
- package/src/archiver/archiver_store.ts +263 -0
- package/src/archiver/archiver_store_test_suite.ts +810 -0
- package/src/archiver/config.ts +92 -0
- package/src/archiver/data_retrieval.ts +422 -0
- package/src/archiver/errors.ts +5 -0
- package/src/archiver/index.ts +7 -0
- package/src/archiver/instrumentation.ts +132 -0
- package/src/archiver/kv_archiver_store/block_store.ts +283 -0
- package/src/archiver/kv_archiver_store/contract_class_store.ts +186 -0
- package/src/archiver/kv_archiver_store/contract_instance_store.ts +107 -0
- package/src/archiver/kv_archiver_store/kv_archiver_store.ts +358 -0
- package/src/archiver/kv_archiver_store/log_store.ts +444 -0
- package/src/archiver/kv_archiver_store/message_store.ts +102 -0
- package/src/archiver/kv_archiver_store/nullifier_store.ts +97 -0
- package/src/archiver/memory_archiver_store/l1_to_l2_message_store.ts +61 -0
- package/src/archiver/memory_archiver_store/memory_archiver_store.ts +801 -0
- package/src/archiver/structs/data_retrieval.ts +27 -0
- package/src/archiver/structs/published.ts +11 -0
- package/src/factory.ts +107 -0
- package/src/index.ts +5 -0
- package/src/rpc/index.ts +20 -0
- package/src/test/index.ts +3 -0
- package/src/test/mock_archiver.ts +57 -0
- package/src/test/mock_l1_to_l2_message_source.ts +31 -0
- package/src/test/mock_l2_block_source.ts +204 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"published.d.ts","sourceRoot":"","sources":["../../../src/archiver/structs/published.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;IAC3B,IAAI,EAAE,CAAC,CAAC;IACR,EAAE,EAAE,eAAe,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/** Extends a type with L1 published info (block number, hash, and timestamp) */ export { };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { BlobSinkClientInterface } from '@aztec/blob-sink/client';
|
|
2
|
+
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
3
|
+
import type { L2BlockSourceEventEmitter } from '@aztec/stdlib/block';
|
|
4
|
+
import type { ArchiverApi, Service } from '@aztec/stdlib/interfaces/server';
|
|
5
|
+
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
6
|
+
import type { ArchiverConfig } from './archiver/config.js';
|
|
7
|
+
/**
|
|
8
|
+
* Creates a local archiver.
|
|
9
|
+
* @param config - The archiver configuration.
|
|
10
|
+
* @param blobSinkClient - The blob sink client.
|
|
11
|
+
* @param opts - The options.
|
|
12
|
+
* @param telemetry - The telemetry client.
|
|
13
|
+
* @returns The local archiver.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createArchiver(config: ArchiverConfig & DataStoreConfig, blobSinkClient: BlobSinkClientInterface, opts?: {
|
|
16
|
+
blockUntilSync: boolean;
|
|
17
|
+
}, telemetry?: TelemetryClient): Promise<ArchiverApi & Service & L2BlockSourceEventEmitter>;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a remote archiver client.
|
|
20
|
+
* @param config - The archiver configuration.
|
|
21
|
+
* @returns The remote archiver client.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createRemoteArchiver(config: ArchiverConfig): ArchiverApi;
|
|
24
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAEvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAQ9D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAMrE,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAE5E,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,yBAAyB,CAAC;AAGnF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAI3D;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,cAAc,GAAG,eAAe,EACxC,cAAc,EAAE,uBAAuB,EACvC,IAAI,GAAE;IAAE,cAAc,EAAE,OAAO,CAAA;CAA6B,EAC5D,SAAS,GAAE,eAAsC,GAChD,OAAO,CAAC,WAAW,GAAG,OAAO,GAAG,yBAAyB,CAAC,CAW5D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,GAAG,WAAW,CASxE"}
|
package/dest/factory.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
+
import { createStore } from '@aztec/kv-store/lmdb-v2';
|
|
3
|
+
import { TokenContractArtifact } from '@aztec/noir-contracts.js/Token';
|
|
4
|
+
import { TokenBridgeContractArtifact } from '@aztec/noir-contracts.js/TokenBridge';
|
|
5
|
+
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
6
|
+
import { protocolContractNames, protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
7
|
+
import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
|
|
8
|
+
import { FunctionType, decodeFunctionSignature } from '@aztec/stdlib/abi';
|
|
9
|
+
import { computePublicBytecodeCommitment, getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
10
|
+
import { getComponentsVersionsFromConfig } from '@aztec/stdlib/versioning';
|
|
11
|
+
import { getTelemetryClient } from '@aztec/telemetry-client';
|
|
12
|
+
import { Archiver } from './archiver/archiver.js';
|
|
13
|
+
import { KVArchiverDataStore } from './archiver/index.js';
|
|
14
|
+
import { createArchiverClient } from './rpc/index.js';
|
|
15
|
+
/**
|
|
16
|
+
* Creates a local archiver.
|
|
17
|
+
* @param config - The archiver configuration.
|
|
18
|
+
* @param blobSinkClient - The blob sink client.
|
|
19
|
+
* @param opts - The options.
|
|
20
|
+
* @param telemetry - The telemetry client.
|
|
21
|
+
* @returns The local archiver.
|
|
22
|
+
*/ export async function createArchiver(config, blobSinkClient, opts = {
|
|
23
|
+
blockUntilSync: true
|
|
24
|
+
}, telemetry = getTelemetryClient()) {
|
|
25
|
+
const store = await createStore('archiver', KVArchiverDataStore.SCHEMA_VERSION, config, createLogger('archiver:lmdb'));
|
|
26
|
+
const archiverStore = new KVArchiverDataStore(store, config.maxLogs);
|
|
27
|
+
await registerProtocolContracts(archiverStore);
|
|
28
|
+
await registerCommonContracts(archiverStore);
|
|
29
|
+
return Archiver.createAndSync(config, archiverStore, {
|
|
30
|
+
telemetry,
|
|
31
|
+
blobSinkClient
|
|
32
|
+
}, opts.blockUntilSync);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Creates a remote archiver client.
|
|
36
|
+
* @param config - The archiver configuration.
|
|
37
|
+
* @returns The remote archiver client.
|
|
38
|
+
*/ export function createRemoteArchiver(config) {
|
|
39
|
+
if (!config.archiverUrl) {
|
|
40
|
+
throw new Error('Archiver URL is required');
|
|
41
|
+
}
|
|
42
|
+
return createArchiverClient(config.archiverUrl, getComponentsVersionsFromConfig(config, protocolContractTreeRoot, getVKTreeRoot()));
|
|
43
|
+
}
|
|
44
|
+
async function registerProtocolContracts(store) {
|
|
45
|
+
const blockNumber = 0;
|
|
46
|
+
for (const name of protocolContractNames){
|
|
47
|
+
const provider = new BundledProtocolContractsProvider();
|
|
48
|
+
const contract = await provider.getProtocolContractArtifact(name);
|
|
49
|
+
const contractClassPublic = {
|
|
50
|
+
...contract.contractClass,
|
|
51
|
+
privateFunctions: [],
|
|
52
|
+
unconstrainedFunctions: []
|
|
53
|
+
};
|
|
54
|
+
const publicFunctionSignatures = contract.artifact.functions.filter((fn)=>fn.functionType === FunctionType.PUBLIC).map((fn)=>decodeFunctionSignature(fn.name, fn.parameters));
|
|
55
|
+
await store.registerContractFunctionSignatures(contract.address, publicFunctionSignatures);
|
|
56
|
+
const bytecodeCommitment = await computePublicBytecodeCommitment(contractClassPublic.packedBytecode);
|
|
57
|
+
await store.addContractClasses([
|
|
58
|
+
contractClassPublic
|
|
59
|
+
], [
|
|
60
|
+
bytecodeCommitment
|
|
61
|
+
], blockNumber);
|
|
62
|
+
await store.addContractInstances([
|
|
63
|
+
contract.instance
|
|
64
|
+
], blockNumber);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// TODO(#10007): Remove this method. We are explicitly registering these contracts
|
|
68
|
+
// here to ensure they are available to all nodes and all prover nodes, since the PXE
|
|
69
|
+
// was tweaked to automatically push contract classes to the node it is registered,
|
|
70
|
+
// but other nodes in the network may require the contract classes to be registered as well.
|
|
71
|
+
// TODO(#10007): Remove the dependency on noir-contracts.js from this package once we remove this.
|
|
72
|
+
async function registerCommonContracts(store) {
|
|
73
|
+
const blockNumber = 0;
|
|
74
|
+
const artifacts = [
|
|
75
|
+
TokenBridgeContractArtifact,
|
|
76
|
+
TokenContractArtifact
|
|
77
|
+
];
|
|
78
|
+
const classes = await Promise.all(artifacts.map(async (artifact)=>({
|
|
79
|
+
...await getContractClassFromArtifact(artifact),
|
|
80
|
+
privateFunctions: [],
|
|
81
|
+
unconstrainedFunctions: []
|
|
82
|
+
})));
|
|
83
|
+
const bytecodeCommitments = await Promise.all(classes.map((x)=>computePublicBytecodeCommitment(x.packedBytecode)));
|
|
84
|
+
await store.addContractClasses(classes, bytecodeCommitments, blockNumber);
|
|
85
|
+
}
|
package/dest/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAE/B,OAAO,EAAE,wBAAwB,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC"}
|
package/dest/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ArchiverApi } from '@aztec/stdlib/interfaces/server';
|
|
2
|
+
import { type ComponentsVersions } from '@aztec/stdlib/versioning';
|
|
3
|
+
export declare function createArchiverClient(url: string, versions: Partial<ComponentsVersions>, fetch?: (host: string, rpcMethod: string, body: any, useApiEndpoints: boolean, extraHeaders?: Record<string, string> | undefined, noRetry?: boolean | undefined) => Promise<{
|
|
4
|
+
response: any;
|
|
5
|
+
headers: {
|
|
6
|
+
get: (header: string) => string | null | undefined;
|
|
7
|
+
};
|
|
8
|
+
}>): ArchiverApi;
|
|
9
|
+
export declare function createArchiverRpcServer(handler: ArchiverApi): import("@aztec/foundation/json-rpc/server").SafeJsonRpcServer;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rpc/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,iCAAiC,CAAC;AACtF,OAAO,EAAE,KAAK,kBAAkB,EAAgC,MAAM,0BAA0B,CAAC;AAGjG,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,OAAO,CAAC,kBAAkB,CAAC,EACrC,KAAK;;;;;EAAmC,GACvC,WAAW,CAMb;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,WAAW,iEAE3D"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createSafeJsonRpcClient } from '@aztec/foundation/json-rpc/client';
|
|
2
|
+
import { ArchiverApiSchema } from '@aztec/stdlib/interfaces/server';
|
|
3
|
+
import { getVersioningResponseHandler } from '@aztec/stdlib/versioning';
|
|
4
|
+
import { createTracedJsonRpcServer, makeTracedFetch } from '@aztec/telemetry-client';
|
|
5
|
+
export function createArchiverClient(url, versions, fetch = makeTracedFetch([
|
|
6
|
+
1,
|
|
7
|
+
2,
|
|
8
|
+
3
|
|
9
|
+
], true)) {
|
|
10
|
+
return createSafeJsonRpcClient(url, ArchiverApiSchema, {
|
|
11
|
+
namespaceMethods: 'archiver',
|
|
12
|
+
fetch,
|
|
13
|
+
onResponse: getVersioningResponseHandler(versions)
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
export function createArchiverRpcServer(handler) {
|
|
17
|
+
return createTracedJsonRpcServer(handler, ArchiverApiSchema);
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import type { L2Block, L2BlockSource } from '@aztec/stdlib/block';
|
|
3
|
+
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
4
|
+
import { MockL2BlockSource } from './mock_l2_block_source.js';
|
|
5
|
+
/**
|
|
6
|
+
* A mocked implementation of the archiver that implements L2BlockSource and L1ToL2MessageSource.
|
|
7
|
+
*/
|
|
8
|
+
export declare class MockArchiver extends MockL2BlockSource implements L2BlockSource, L1ToL2MessageSource {
|
|
9
|
+
private messageSource;
|
|
10
|
+
setL1ToL2Messages(blockNumber: number, msgs: Fr[]): void;
|
|
11
|
+
getL1ToL2Messages(blockNumber: bigint): Promise<Fr[]>;
|
|
12
|
+
getL1ToL2MessageIndex(_l1ToL2Message: Fr): Promise<bigint | undefined>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A mocked implementation of the archiver with a set of precomputed blocks and messages.
|
|
16
|
+
*/
|
|
17
|
+
export declare class MockPrefilledArchiver extends MockArchiver {
|
|
18
|
+
private precomputed;
|
|
19
|
+
constructor(precomputed: L2Block[], messages: Fr[][]);
|
|
20
|
+
setPrefilledBlocks(blocks: L2Block[], messages: Fr[][]): void;
|
|
21
|
+
createBlocks(numBlocks: number): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=mock_archiver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock_archiver.d.ts","sourceRoot":"","sources":["../../src/test/mock_archiver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAGnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D;;GAEG;AACH,qBAAa,YAAa,SAAQ,iBAAkB,YAAW,aAAa,EAAE,mBAAmB;IAC/F,OAAO,CAAC,aAAa,CAAkC;IAEhD,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE;IAIxD,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,EAAE,CAAC;IAIrD,qBAAqB,CAAC,cAAc,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;CAGvE;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,YAAY;IACrD,OAAO,CAAC,WAAW,CAAY;gBAEnB,WAAW,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE;IAM7C,kBAAkB,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE;IAO7C,YAAY,CAAC,SAAS,EAAE,MAAM;CAW/C"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { MockL1ToL2MessageSource } from './mock_l1_to_l2_message_source.js';
|
|
2
|
+
import { MockL2BlockSource } from './mock_l2_block_source.js';
|
|
3
|
+
/**
|
|
4
|
+
* A mocked implementation of the archiver that implements L2BlockSource and L1ToL2MessageSource.
|
|
5
|
+
*/ export class MockArchiver extends MockL2BlockSource {
|
|
6
|
+
messageSource = new MockL1ToL2MessageSource(0);
|
|
7
|
+
setL1ToL2Messages(blockNumber, msgs) {
|
|
8
|
+
this.messageSource.setL1ToL2Messages(blockNumber, msgs);
|
|
9
|
+
}
|
|
10
|
+
getL1ToL2Messages(blockNumber) {
|
|
11
|
+
return this.messageSource.getL1ToL2Messages(blockNumber);
|
|
12
|
+
}
|
|
13
|
+
getL1ToL2MessageIndex(_l1ToL2Message) {
|
|
14
|
+
return this.messageSource.getL1ToL2MessageIndex(_l1ToL2Message);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A mocked implementation of the archiver with a set of precomputed blocks and messages.
|
|
19
|
+
*/ export class MockPrefilledArchiver extends MockArchiver {
|
|
20
|
+
precomputed;
|
|
21
|
+
constructor(precomputed, messages){
|
|
22
|
+
super();
|
|
23
|
+
this.precomputed = precomputed.slice();
|
|
24
|
+
messages.forEach((msgs, i)=>this.setL1ToL2Messages(i + 1, msgs));
|
|
25
|
+
}
|
|
26
|
+
setPrefilledBlocks(blocks, messages) {
|
|
27
|
+
for (const block of blocks){
|
|
28
|
+
this.precomputed[block.number - 1] = block;
|
|
29
|
+
}
|
|
30
|
+
messages.forEach((msgs, i)=>this.setL1ToL2Messages(blocks[i].number, msgs));
|
|
31
|
+
}
|
|
32
|
+
createBlocks(numBlocks) {
|
|
33
|
+
if (this.l2Blocks.length + numBlocks > this.precomputed.length) {
|
|
34
|
+
throw new Error(`Not enough precomputed blocks to create ${numBlocks} more blocks (already at ${this.l2Blocks.length})`);
|
|
35
|
+
}
|
|
36
|
+
const fromBlock = this.l2Blocks.length;
|
|
37
|
+
this.addBlocks(this.precomputed.slice(fromBlock, fromBlock + numBlocks));
|
|
38
|
+
return Promise.resolve();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
3
|
+
/**
|
|
4
|
+
* A mocked implementation of L1ToL2MessageSource to be used in tests.
|
|
5
|
+
*/
|
|
6
|
+
export declare class MockL1ToL2MessageSource implements L1ToL2MessageSource {
|
|
7
|
+
private blockNumber;
|
|
8
|
+
private messagesPerBlock;
|
|
9
|
+
constructor(blockNumber: number);
|
|
10
|
+
setL1ToL2Messages(blockNumber: number, msgs: Fr[]): void;
|
|
11
|
+
setBlockNumber(blockNumber: number): void;
|
|
12
|
+
getL1ToL2Messages(blockNumber: bigint): Promise<Fr[]>;
|
|
13
|
+
getL1ToL2MessageIndex(_l1ToL2Message: Fr): Promise<bigint | undefined>;
|
|
14
|
+
getBlockNumber(): Promise<number>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=mock_l1_to_l2_message_source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock_l1_to_l2_message_source.d.ts","sourceRoot":"","sources":["../../src/test/mock_l1_to_l2_message_source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEnE;;GAEG;AACH,qBAAa,uBAAwB,YAAW,mBAAmB;IAGrD,OAAO,CAAC,WAAW;IAF/B,OAAO,CAAC,gBAAgB,CAA2B;gBAE/B,WAAW,EAAE,MAAM;IAEhC,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE;IAIjD,cAAc,CAAC,WAAW,EAAE,MAAM;IAIzC,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,EAAE,CAAC;IAIrD,qBAAqB,CAAC,cAAc,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAItE,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;CAGlC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A mocked implementation of L1ToL2MessageSource to be used in tests.
|
|
3
|
+
*/ export class MockL1ToL2MessageSource {
|
|
4
|
+
blockNumber;
|
|
5
|
+
messagesPerBlock;
|
|
6
|
+
constructor(blockNumber){
|
|
7
|
+
this.blockNumber = blockNumber;
|
|
8
|
+
this.messagesPerBlock = new Map();
|
|
9
|
+
}
|
|
10
|
+
setL1ToL2Messages(blockNumber, msgs) {
|
|
11
|
+
this.messagesPerBlock.set(blockNumber, msgs);
|
|
12
|
+
}
|
|
13
|
+
setBlockNumber(blockNumber) {
|
|
14
|
+
this.blockNumber = blockNumber;
|
|
15
|
+
}
|
|
16
|
+
getL1ToL2Messages(blockNumber) {
|
|
17
|
+
return Promise.resolve(this.messagesPerBlock.get(Number(blockNumber)) ?? []);
|
|
18
|
+
}
|
|
19
|
+
getL1ToL2MessageIndex(_l1ToL2Message) {
|
|
20
|
+
throw new Error('Method not implemented.');
|
|
21
|
+
}
|
|
22
|
+
getBlockNumber() {
|
|
23
|
+
return Promise.resolve(this.blockNumber);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
+
import { L2Block, type L2BlockSource, type L2Tips } from '@aztec/stdlib/block';
|
|
3
|
+
import { type L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
4
|
+
import { type BlockHeader, TxHash, TxReceipt } from '@aztec/stdlib/tx';
|
|
5
|
+
/**
|
|
6
|
+
* A mocked implementation of L2BlockSource to be used in tests.
|
|
7
|
+
*/
|
|
8
|
+
export declare class MockL2BlockSource implements L2BlockSource {
|
|
9
|
+
protected l2Blocks: L2Block[];
|
|
10
|
+
private provenBlockNumber;
|
|
11
|
+
private log;
|
|
12
|
+
createBlocks(numBlocks: number): Promise<void>;
|
|
13
|
+
addBlocks(blocks: L2Block[]): void;
|
|
14
|
+
removeBlocks(numBlocks: number): void;
|
|
15
|
+
setProvenBlockNumber(provenBlockNumber: number): void;
|
|
16
|
+
/**
|
|
17
|
+
* Method to fetch the rollup contract address at the base-layer.
|
|
18
|
+
* @returns The rollup address.
|
|
19
|
+
*/
|
|
20
|
+
getRollupAddress(): Promise<EthAddress>;
|
|
21
|
+
/**
|
|
22
|
+
* Method to fetch the registry contract address at the base-layer.
|
|
23
|
+
* @returns The registry address.
|
|
24
|
+
*/
|
|
25
|
+
getRegistryAddress(): Promise<EthAddress>;
|
|
26
|
+
/**
|
|
27
|
+
* Gets the number of the latest L2 block processed by the block source implementation.
|
|
28
|
+
* @returns In this mock instance, returns the number of L2 blocks that we've mocked.
|
|
29
|
+
*/
|
|
30
|
+
getBlockNumber(): Promise<number>;
|
|
31
|
+
getProvenBlockNumber(): Promise<number>;
|
|
32
|
+
/**
|
|
33
|
+
* Gets an l2 block.
|
|
34
|
+
* @param number - The block number to return (inclusive).
|
|
35
|
+
* @returns The requested L2 block.
|
|
36
|
+
*/
|
|
37
|
+
getBlock(number: number): Promise<L2Block>;
|
|
38
|
+
/**
|
|
39
|
+
* Gets up to `limit` amount of L2 blocks starting from `from`.
|
|
40
|
+
* @param from - Number of the first block to return (inclusive).
|
|
41
|
+
* @param limit - The maximum number of blocks to return.
|
|
42
|
+
* @returns The requested mocked L2 blocks.
|
|
43
|
+
*/
|
|
44
|
+
getBlocks(from: number, limit: number, proven?: boolean): Promise<L2Block[]>;
|
|
45
|
+
getBlockHeader(number: number | 'latest'): Promise<BlockHeader | undefined>;
|
|
46
|
+
getBlocksForEpoch(epochNumber: bigint): Promise<L2Block[]>;
|
|
47
|
+
/**
|
|
48
|
+
* Gets a tx effect.
|
|
49
|
+
* @param txHash - The hash of a transaction which resulted in the returned tx effect.
|
|
50
|
+
* @returns The requested tx effect.
|
|
51
|
+
*/
|
|
52
|
+
getTxEffect(txHash: TxHash): Promise<{
|
|
53
|
+
data: import("@aztec/stdlib/tx").TxEffect;
|
|
54
|
+
l2BlockNumber: number;
|
|
55
|
+
l2BlockHash: `0x${string}`;
|
|
56
|
+
} | undefined>;
|
|
57
|
+
/**
|
|
58
|
+
* Gets a receipt of a settled tx.
|
|
59
|
+
* @param txHash - The hash of a tx we try to get the receipt for.
|
|
60
|
+
* @returns The requested tx receipt (or undefined if not found).
|
|
61
|
+
*/
|
|
62
|
+
getSettledTxReceipt(txHash: TxHash): Promise<TxReceipt | undefined>;
|
|
63
|
+
getL2Tips(): Promise<L2Tips>;
|
|
64
|
+
getL2EpochNumber(): Promise<bigint>;
|
|
65
|
+
getL2SlotNumber(): Promise<bigint>;
|
|
66
|
+
isEpochComplete(_epochNumber: bigint): Promise<boolean>;
|
|
67
|
+
getL1Constants(): Promise<L1RollupConstants>;
|
|
68
|
+
/**
|
|
69
|
+
* Starts the block source. In this mock implementation, this is a noop.
|
|
70
|
+
* @returns A promise that signals the initialization of the l2 block source on completion.
|
|
71
|
+
*/
|
|
72
|
+
start(): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* Stops the block source. In this mock implementation, this is a noop.
|
|
75
|
+
* @returns A promise that signals the l2 block source is now stopped.
|
|
76
|
+
*/
|
|
77
|
+
stop(): Promise<void>;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=mock_l2_block_source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock_l2_block_source.d.ts","sourceRoot":"","sources":["../../src/test/mock_l2_block_source.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAe,KAAK,aAAa,EAAE,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC5F,OAAO,EAAE,KAAK,iBAAiB,EAAwB,MAAM,6BAA6B,CAAC;AAC3F,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,EAAE,SAAS,EAAY,MAAM,kBAAkB,CAAC;AAEjF;;GAEG;AACH,qBAAa,iBAAkB,YAAW,aAAa;IACrD,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAM;IAEnC,OAAO,CAAC,iBAAiB,CAAa;IAEtC,OAAO,CAAC,GAAG,CAAiD;IAE/C,YAAY,CAAC,SAAS,EAAE,MAAM;IAUpC,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE;IAK3B,YAAY,CAAC,SAAS,EAAE,MAAM;IAK9B,oBAAoB,CAAC,iBAAiB,EAAE,MAAM;IAIrD;;;OAGG;IACH,gBAAgB,IAAI,OAAO,CAAC,UAAU,CAAC;IAIvC;;;OAGG;IACH,kBAAkB,IAAI,OAAO,CAAC,UAAU,CAAC;IAIzC;;;OAGG;IACI,cAAc;IAId,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC;IAI9C;;;;OAIG;IACI,QAAQ,CAAC,MAAM,EAAE,MAAM;IAI9B;;;;;OAKG;IACI,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO;IAQ9D,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;IAI3E,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAU1D;;;;OAIG;IACU,WAAW,CAAC,MAAM,EAAE,MAAM;;;;;IAWvC;;;;OAIG;IACU,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAkB1E,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IA2BlC,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC;IAInC,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;IAIlC,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIvD,cAAc,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAI5C;;;OAGG;IACI,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI7B;;;OAGG;IACI,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { DefaultL1ContractsConfig } from '@aztec/ethereum';
|
|
2
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
4
|
+
import { L2Block, L2BlockHash } from '@aztec/stdlib/block';
|
|
5
|
+
import { getSlotRangeForEpoch } from '@aztec/stdlib/epoch-helpers';
|
|
6
|
+
import { TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
7
|
+
/**
|
|
8
|
+
* A mocked implementation of L2BlockSource to be used in tests.
|
|
9
|
+
*/ export class MockL2BlockSource {
|
|
10
|
+
l2Blocks = [];
|
|
11
|
+
provenBlockNumber = 0;
|
|
12
|
+
log = createLogger('archiver:mock_l2_block_source');
|
|
13
|
+
async createBlocks(numBlocks) {
|
|
14
|
+
for(let i = 0; i < numBlocks; i++){
|
|
15
|
+
const blockNum = this.l2Blocks.length + 1;
|
|
16
|
+
const block = await L2Block.random(blockNum);
|
|
17
|
+
this.l2Blocks.push(block);
|
|
18
|
+
}
|
|
19
|
+
this.log.verbose(`Created ${numBlocks} blocks in the mock L2 block source`);
|
|
20
|
+
}
|
|
21
|
+
addBlocks(blocks) {
|
|
22
|
+
this.l2Blocks.push(...blocks);
|
|
23
|
+
this.log.verbose(`Added ${blocks.length} blocks to the mock L2 block source`);
|
|
24
|
+
}
|
|
25
|
+
removeBlocks(numBlocks) {
|
|
26
|
+
this.l2Blocks = this.l2Blocks.slice(0, -numBlocks);
|
|
27
|
+
this.log.verbose(`Removed ${numBlocks} blocks from the mock L2 block source`);
|
|
28
|
+
}
|
|
29
|
+
setProvenBlockNumber(provenBlockNumber) {
|
|
30
|
+
this.provenBlockNumber = provenBlockNumber;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Method to fetch the rollup contract address at the base-layer.
|
|
34
|
+
* @returns The rollup address.
|
|
35
|
+
*/ getRollupAddress() {
|
|
36
|
+
return Promise.resolve(EthAddress.random());
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Method to fetch the registry contract address at the base-layer.
|
|
40
|
+
* @returns The registry address.
|
|
41
|
+
*/ getRegistryAddress() {
|
|
42
|
+
return Promise.resolve(EthAddress.random());
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Gets the number of the latest L2 block processed by the block source implementation.
|
|
46
|
+
* @returns In this mock instance, returns the number of L2 blocks that we've mocked.
|
|
47
|
+
*/ getBlockNumber() {
|
|
48
|
+
return Promise.resolve(this.l2Blocks.length);
|
|
49
|
+
}
|
|
50
|
+
getProvenBlockNumber() {
|
|
51
|
+
return Promise.resolve(this.provenBlockNumber);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Gets an l2 block.
|
|
55
|
+
* @param number - The block number to return (inclusive).
|
|
56
|
+
* @returns The requested L2 block.
|
|
57
|
+
*/ getBlock(number) {
|
|
58
|
+
return Promise.resolve(this.l2Blocks[number - 1]);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Gets up to `limit` amount of L2 blocks starting from `from`.
|
|
62
|
+
* @param from - Number of the first block to return (inclusive).
|
|
63
|
+
* @param limit - The maximum number of blocks to return.
|
|
64
|
+
* @returns The requested mocked L2 blocks.
|
|
65
|
+
*/ getBlocks(from, limit, proven) {
|
|
66
|
+
return Promise.resolve(this.l2Blocks.slice(from - 1, from - 1 + limit).filter((b)=>!proven || this.provenBlockNumber === undefined || b.number <= this.provenBlockNumber));
|
|
67
|
+
}
|
|
68
|
+
getBlockHeader(number) {
|
|
69
|
+
return Promise.resolve(this.l2Blocks.at(typeof number === 'number' ? number - 1 : -1)?.header);
|
|
70
|
+
}
|
|
71
|
+
getBlocksForEpoch(epochNumber) {
|
|
72
|
+
const epochDuration = DefaultL1ContractsConfig.aztecEpochDuration;
|
|
73
|
+
const [start, end] = getSlotRangeForEpoch(epochNumber, {
|
|
74
|
+
epochDuration
|
|
75
|
+
});
|
|
76
|
+
const blocks = this.l2Blocks.filter((b)=>{
|
|
77
|
+
const slot = b.header.globalVariables.slotNumber.toBigInt();
|
|
78
|
+
return slot >= start && slot <= end;
|
|
79
|
+
});
|
|
80
|
+
return Promise.resolve(blocks);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Gets a tx effect.
|
|
84
|
+
* @param txHash - The hash of a transaction which resulted in the returned tx effect.
|
|
85
|
+
* @returns The requested tx effect.
|
|
86
|
+
*/ async getTxEffect(txHash) {
|
|
87
|
+
const match = this.l2Blocks.flatMap((b)=>b.body.txEffects.map((tx)=>[
|
|
88
|
+
tx,
|
|
89
|
+
b
|
|
90
|
+
])).find(([tx])=>tx.txHash.equals(txHash));
|
|
91
|
+
if (!match) {
|
|
92
|
+
return Promise.resolve(undefined);
|
|
93
|
+
}
|
|
94
|
+
const [txEffect, block] = match;
|
|
95
|
+
return {
|
|
96
|
+
data: txEffect,
|
|
97
|
+
l2BlockNumber: block.number,
|
|
98
|
+
l2BlockHash: (await block.hash()).toString()
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Gets a receipt of a settled tx.
|
|
103
|
+
* @param txHash - The hash of a tx we try to get the receipt for.
|
|
104
|
+
* @returns The requested tx receipt (or undefined if not found).
|
|
105
|
+
*/ async getSettledTxReceipt(txHash) {
|
|
106
|
+
for (const block of this.l2Blocks){
|
|
107
|
+
for (const txEffect of block.body.txEffects){
|
|
108
|
+
if (txEffect.txHash.equals(txHash)) {
|
|
109
|
+
return new TxReceipt(txHash, TxStatus.SUCCESS, '', txEffect.transactionFee.toBigInt(), L2BlockHash.fromField(await block.hash()), block.number);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
async getL2Tips() {
|
|
116
|
+
const [latest, proven, finalized] = [
|
|
117
|
+
await this.getBlockNumber(),
|
|
118
|
+
await this.getProvenBlockNumber(),
|
|
119
|
+
await this.getProvenBlockNumber()
|
|
120
|
+
];
|
|
121
|
+
const latestBlock = this.l2Blocks[latest - 1];
|
|
122
|
+
const provenBlock = this.l2Blocks[proven - 1];
|
|
123
|
+
const finalizedBlock = this.l2Blocks[finalized - 1];
|
|
124
|
+
return {
|
|
125
|
+
latest: {
|
|
126
|
+
number: latest,
|
|
127
|
+
hash: (await latestBlock?.hash())?.toString()
|
|
128
|
+
},
|
|
129
|
+
proven: {
|
|
130
|
+
number: proven,
|
|
131
|
+
hash: (await provenBlock?.hash())?.toString()
|
|
132
|
+
},
|
|
133
|
+
finalized: {
|
|
134
|
+
number: finalized,
|
|
135
|
+
hash: (await finalizedBlock?.hash())?.toString()
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
getL2EpochNumber() {
|
|
140
|
+
throw new Error('Method not implemented.');
|
|
141
|
+
}
|
|
142
|
+
getL2SlotNumber() {
|
|
143
|
+
throw new Error('Method not implemented.');
|
|
144
|
+
}
|
|
145
|
+
isEpochComplete(_epochNumber) {
|
|
146
|
+
throw new Error('Method not implemented.');
|
|
147
|
+
}
|
|
148
|
+
getL1Constants() {
|
|
149
|
+
throw new Error('Method not implemented.');
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Starts the block source. In this mock implementation, this is a noop.
|
|
153
|
+
* @returns A promise that signals the initialization of the l2 block source on completion.
|
|
154
|
+
*/ start() {
|
|
155
|
+
return Promise.resolve();
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Stops the block source. In this mock implementation, this is a noop.
|
|
159
|
+
* @returns A promise that signals the l2 block source is now stopped.
|
|
160
|
+
*/ stop() {
|
|
161
|
+
return Promise.resolve();
|
|
162
|
+
}
|
|
163
|
+
}
|