@aztec/sequencer-client 0.0.0-test.1 → 0.0.1-commit.03f7ef2
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/client/index.d.ts +1 -1
- package/dest/client/sequencer-client.d.ts +30 -29
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +82 -60
- package/dest/config.d.ts +15 -16
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +113 -70
- package/dest/global_variable_builder/global_builder.d.ts +25 -14
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +60 -42
- package/dest/global_variable_builder/index.d.ts +1 -1
- package/dest/index.d.ts +2 -3
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -2
- package/dest/publisher/config.d.ts +15 -12
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +32 -19
- package/dest/publisher/index.d.ts +3 -1
- package/dest/publisher/index.d.ts.map +1 -1
- package/dest/publisher/index.js +3 -0
- package/dest/publisher/sequencer-publisher-factory.d.ts +44 -0
- package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -0
- package/dest/publisher/sequencer-publisher-factory.js +51 -0
- package/dest/publisher/sequencer-publisher-metrics.d.ts +5 -4
- package/dest/publisher/sequencer-publisher-metrics.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-metrics.js +37 -2
- package/dest/publisher/sequencer-publisher.d.ts +132 -86
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +755 -248
- package/dest/sequencer/block_builder.d.ts +26 -0
- package/dest/sequencer/block_builder.d.ts.map +1 -0
- package/dest/sequencer/block_builder.js +129 -0
- package/dest/sequencer/checkpoint_builder.d.ts +63 -0
- package/dest/sequencer/checkpoint_builder.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_builder.js +131 -0
- package/dest/sequencer/checkpoint_proposal_job.d.ts +74 -0
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_proposal_job.js +640 -0
- package/dest/sequencer/checkpoint_voter.d.ts +34 -0
- package/dest/sequencer/checkpoint_voter.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_voter.js +85 -0
- package/dest/sequencer/config.d.ts +7 -1
- package/dest/sequencer/config.d.ts.map +1 -1
- package/dest/sequencer/errors.d.ts +11 -0
- package/dest/sequencer/errors.d.ts.map +1 -0
- package/dest/sequencer/errors.js +15 -0
- package/dest/sequencer/events.d.ts +46 -0
- package/dest/sequencer/events.d.ts.map +1 -0
- package/dest/sequencer/events.js +1 -0
- package/dest/sequencer/index.d.ts +6 -2
- package/dest/sequencer/index.d.ts.map +1 -1
- package/dest/sequencer/index.js +5 -1
- package/dest/sequencer/metrics.d.ts +48 -12
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +274 -48
- package/dest/sequencer/sequencer.d.ts +132 -135
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +519 -521
- package/dest/sequencer/timetable.d.ts +76 -24
- package/dest/sequencer/timetable.d.ts.map +1 -1
- package/dest/sequencer/timetable.js +177 -61
- package/dest/sequencer/types.d.ts +3 -0
- package/dest/sequencer/types.d.ts.map +1 -0
- package/dest/sequencer/types.js +1 -0
- package/dest/sequencer/utils.d.ts +20 -38
- package/dest/sequencer/utils.d.ts.map +1 -1
- package/dest/sequencer/utils.js +12 -47
- package/dest/test/index.d.ts +10 -1
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/index.js +0 -4
- package/dest/test/mock_checkpoint_builder.d.ts +83 -0
- package/dest/test/mock_checkpoint_builder.d.ts.map +1 -0
- package/dest/test/mock_checkpoint_builder.js +179 -0
- package/dest/test/utils.d.ts +49 -0
- package/dest/test/utils.d.ts.map +1 -0
- package/dest/test/utils.js +94 -0
- package/dest/tx_validator/nullifier_cache.d.ts +1 -3
- package/dest/tx_validator/nullifier_cache.d.ts.map +1 -1
- package/dest/tx_validator/tx_validator_factory.d.ts +11 -11
- package/dest/tx_validator/tx_validator_factory.d.ts.map +1 -1
- package/dest/tx_validator/tx_validator_factory.js +28 -25
- package/package.json +45 -45
- package/src/client/sequencer-client.ts +105 -105
- package/src/config.ts +126 -81
- package/src/global_variable_builder/global_builder.ts +82 -53
- package/src/index.ts +8 -2
- package/src/publisher/config.ts +45 -32
- package/src/publisher/index.ts +4 -0
- package/src/publisher/sequencer-publisher-factory.ts +92 -0
- package/src/publisher/sequencer-publisher-metrics.ts +26 -4
- package/src/publisher/sequencer-publisher.ts +955 -293
- package/src/sequencer/README.md +531 -0
- package/src/sequencer/block_builder.ts +217 -0
- package/src/sequencer/checkpoint_builder.ts +217 -0
- package/src/sequencer/checkpoint_proposal_job.ts +703 -0
- package/src/sequencer/checkpoint_voter.ts +105 -0
- package/src/sequencer/config.ts +8 -0
- package/src/sequencer/errors.ts +21 -0
- package/src/sequencer/events.ts +27 -0
- package/src/sequencer/index.ts +5 -1
- package/src/sequencer/metrics.ts +355 -50
- package/src/sequencer/sequencer.ts +631 -594
- package/src/sequencer/timetable.ts +221 -62
- package/src/sequencer/types.ts +6 -0
- package/src/sequencer/utils.ts +28 -60
- package/src/test/index.ts +13 -4
- package/src/test/mock_checkpoint_builder.ts +247 -0
- package/src/test/utils.ts +137 -0
- package/src/tx_validator/tx_validator_factory.ts +46 -33
- package/dest/sequencer/allowed.d.ts +0 -3
- package/dest/sequencer/allowed.d.ts.map +0 -1
- package/dest/sequencer/allowed.js +0 -27
- package/dest/slasher/factory.d.ts +0 -7
- package/dest/slasher/factory.d.ts.map +0 -1
- package/dest/slasher/factory.js +0 -8
- package/dest/slasher/index.d.ts +0 -3
- package/dest/slasher/index.d.ts.map +0 -1
- package/dest/slasher/index.js +0 -2
- package/dest/slasher/slasher_client.d.ts +0 -75
- package/dest/slasher/slasher_client.d.ts.map +0 -1
- package/dest/slasher/slasher_client.js +0 -132
- package/dest/tx_validator/archive_cache.d.ts +0 -14
- package/dest/tx_validator/archive_cache.d.ts.map +0 -1
- package/dest/tx_validator/archive_cache.js +0 -22
- package/dest/tx_validator/gas_validator.d.ts +0 -14
- package/dest/tx_validator/gas_validator.d.ts.map +0 -1
- package/dest/tx_validator/gas_validator.js +0 -78
- package/dest/tx_validator/phases_validator.d.ts +0 -12
- package/dest/tx_validator/phases_validator.d.ts.map +0 -1
- package/dest/tx_validator/phases_validator.js +0 -80
- package/dest/tx_validator/test_utils.d.ts +0 -23
- package/dest/tx_validator/test_utils.d.ts.map +0 -1
- package/dest/tx_validator/test_utils.js +0 -26
- package/src/sequencer/allowed.ts +0 -36
- package/src/slasher/factory.ts +0 -15
- package/src/slasher/index.ts +0 -2
- package/src/slasher/slasher_client.ts +0 -193
- package/src/tx_validator/archive_cache.ts +0 -28
- package/src/tx_validator/gas_validator.ts +0 -101
- package/src/tx_validator/phases_validator.ts +0 -98
- package/src/tx_validator/test_utils.ts +0 -48
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/sequencer-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1-commit.03f7ef2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -18,63 +18,59 @@
|
|
|
18
18
|
"../package.common.json"
|
|
19
19
|
],
|
|
20
20
|
"scripts": {
|
|
21
|
-
"build": "yarn clean && tsc
|
|
22
|
-
"build:dev": "tsc
|
|
21
|
+
"build": "yarn clean && ../scripts/tsc.sh",
|
|
22
|
+
"build:dev": "../scripts/tsc.sh --watch",
|
|
23
23
|
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
24
|
-
"formatting": "run -T prettier --check ./src && run -T eslint ./src",
|
|
25
|
-
"formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src",
|
|
26
24
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}",
|
|
27
25
|
"test:integration": "concurrently -k -s first -c reset,dim -n test,anvil \"yarn test:integration:run\" \"anvil\"",
|
|
28
26
|
"test:integration:run": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --config jest.integration.config.json"
|
|
29
27
|
},
|
|
30
28
|
"dependencies": {
|
|
31
|
-
"@aztec/aztec.js": "0.0.
|
|
32
|
-
"@aztec/bb-prover": "0.0.
|
|
33
|
-
"@aztec/blob-
|
|
34
|
-
"@aztec/blob-
|
|
35
|
-
"@aztec/constants": "0.0.
|
|
36
|
-
"@aztec/epoch-cache": "0.0.
|
|
37
|
-
"@aztec/ethereum": "0.0.
|
|
38
|
-
"@aztec/foundation": "0.0.
|
|
39
|
-
"@aztec/l1-artifacts": "0.0.
|
|
40
|
-
"@aztec/merkle-tree": "0.0.
|
|
41
|
-
"@aztec/
|
|
42
|
-
"@aztec/noir-
|
|
43
|
-
"@aztec/
|
|
44
|
-
"@aztec/protocol-
|
|
45
|
-
"@aztec/
|
|
46
|
-
"@aztec/
|
|
47
|
-
"@aztec/
|
|
48
|
-
"@aztec/
|
|
49
|
-
"@aztec/
|
|
50
|
-
"@aztec/
|
|
29
|
+
"@aztec/aztec.js": "0.0.1-commit.03f7ef2",
|
|
30
|
+
"@aztec/bb-prover": "0.0.1-commit.03f7ef2",
|
|
31
|
+
"@aztec/blob-client": "0.0.1-commit.03f7ef2",
|
|
32
|
+
"@aztec/blob-lib": "0.0.1-commit.03f7ef2",
|
|
33
|
+
"@aztec/constants": "0.0.1-commit.03f7ef2",
|
|
34
|
+
"@aztec/epoch-cache": "0.0.1-commit.03f7ef2",
|
|
35
|
+
"@aztec/ethereum": "0.0.1-commit.03f7ef2",
|
|
36
|
+
"@aztec/foundation": "0.0.1-commit.03f7ef2",
|
|
37
|
+
"@aztec/l1-artifacts": "0.0.1-commit.03f7ef2",
|
|
38
|
+
"@aztec/merkle-tree": "0.0.1-commit.03f7ef2",
|
|
39
|
+
"@aztec/node-keystore": "0.0.1-commit.03f7ef2",
|
|
40
|
+
"@aztec/noir-acvm_js": "0.0.1-commit.03f7ef2",
|
|
41
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.03f7ef2",
|
|
42
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.03f7ef2",
|
|
43
|
+
"@aztec/noir-types": "0.0.1-commit.03f7ef2",
|
|
44
|
+
"@aztec/p2p": "0.0.1-commit.03f7ef2",
|
|
45
|
+
"@aztec/protocol-contracts": "0.0.1-commit.03f7ef2",
|
|
46
|
+
"@aztec/prover-client": "0.0.1-commit.03f7ef2",
|
|
47
|
+
"@aztec/simulator": "0.0.1-commit.03f7ef2",
|
|
48
|
+
"@aztec/slasher": "0.0.1-commit.03f7ef2",
|
|
49
|
+
"@aztec/stdlib": "0.0.1-commit.03f7ef2",
|
|
50
|
+
"@aztec/telemetry-client": "0.0.1-commit.03f7ef2",
|
|
51
|
+
"@aztec/validator-client": "0.0.1-commit.03f7ef2",
|
|
52
|
+
"@aztec/world-state": "0.0.1-commit.03f7ef2",
|
|
51
53
|
"lodash.chunk": "^4.2.0",
|
|
52
|
-
"lodash.pick": "^4.4.0",
|
|
53
54
|
"tslib": "^2.4.0",
|
|
54
|
-
"viem": "2.
|
|
55
|
-
"@aztec/noir-acvm_js": "0.0.0-test.1",
|
|
56
|
-
"@aztec/noir-types": "0.0.0-test.1"
|
|
55
|
+
"viem": "npm:@aztec/viem@2.38.2"
|
|
57
56
|
},
|
|
58
57
|
"devDependencies": {
|
|
59
|
-
"@aztec/archiver": "0.0.
|
|
60
|
-
"@aztec/kv-store": "0.0.
|
|
61
|
-
"@jest/globals": "^
|
|
62
|
-
"@types/jest": "^
|
|
63
|
-
"@types/levelup": "^5.1.2",
|
|
58
|
+
"@aztec/archiver": "0.0.1-commit.03f7ef2",
|
|
59
|
+
"@aztec/kv-store": "0.0.1-commit.03f7ef2",
|
|
60
|
+
"@jest/globals": "^30.0.0",
|
|
61
|
+
"@types/jest": "^30.0.0",
|
|
64
62
|
"@types/lodash.chunk": "^4.2.7",
|
|
65
63
|
"@types/lodash.pick": "^4.4.7",
|
|
66
|
-
"@types/
|
|
67
|
-
"@
|
|
64
|
+
"@types/node": "^22.15.17",
|
|
65
|
+
"@typescript/native-preview": "7.0.0-dev.20251126.1",
|
|
68
66
|
"concurrently": "^7.6.0",
|
|
69
|
-
"eslint": "^
|
|
70
|
-
"express": "^4.21.
|
|
71
|
-
"jest": "^
|
|
72
|
-
"jest-mock-extended": "^
|
|
73
|
-
"
|
|
74
|
-
"memdown": "^6.1.1",
|
|
75
|
-
"prettier": "^2.8.7",
|
|
67
|
+
"eslint": "^9.26.0",
|
|
68
|
+
"express": "^4.21.2",
|
|
69
|
+
"jest": "^30.0.0",
|
|
70
|
+
"jest-mock-extended": "^4.0.0",
|
|
71
|
+
"prettier": "^3.5.3",
|
|
76
72
|
"ts-node": "^10.9.1",
|
|
77
|
-
"typescript": "^5.
|
|
73
|
+
"typescript": "^5.3.3"
|
|
78
74
|
},
|
|
79
75
|
"files": [
|
|
80
76
|
"dest",
|
|
@@ -83,7 +79,7 @@
|
|
|
83
79
|
],
|
|
84
80
|
"types": "./dest/index.d.ts",
|
|
85
81
|
"engines": {
|
|
86
|
-
"node": ">=
|
|
82
|
+
"node": ">=20.10"
|
|
87
83
|
},
|
|
88
84
|
"jest": {
|
|
89
85
|
"extensionsToTreatAsEsm": [
|
|
@@ -116,6 +112,10 @@
|
|
|
116
112
|
"testTimeout": 120000,
|
|
117
113
|
"setupFiles": [
|
|
118
114
|
"../../foundation/src/jest/setup.mjs"
|
|
115
|
+
],
|
|
116
|
+
"testEnvironment": "../../foundation/src/jest/env.mjs",
|
|
117
|
+
"setupFilesAfterEnv": [
|
|
118
|
+
"../../foundation/src/jest/setupAfterEnv.mjs"
|
|
119
119
|
]
|
|
120
120
|
}
|
|
121
121
|
}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BlobClientInterface } from '@aztec/blob-client/client';
|
|
2
2
|
import { EpochCache } from '@aztec/epoch-cache';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
RollupContract,
|
|
7
|
-
SlashingProposerContract,
|
|
8
|
-
createEthereumChain,
|
|
9
|
-
createL1Clients,
|
|
10
|
-
isAnvilTestChain,
|
|
11
|
-
} from '@aztec/ethereum';
|
|
3
|
+
import { isAnvilTestChain } from '@aztec/ethereum/chain';
|
|
4
|
+
import { getPublicClient } from '@aztec/ethereum/client';
|
|
5
|
+
import { GovernanceProposerContract, RollupContract } from '@aztec/ethereum/contracts';
|
|
12
6
|
import { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
|
|
7
|
+
import { PublisherManager } from '@aztec/ethereum/publisher-manager';
|
|
13
8
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
14
9
|
import { createLogger } from '@aztec/foundation/log';
|
|
15
10
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
11
|
+
import type { KeystoreManager } from '@aztec/node-keystore';
|
|
16
12
|
import type { P2P } from '@aztec/p2p';
|
|
17
|
-
import {
|
|
18
|
-
import { PublicProcessorFactory } from '@aztec/simulator/server';
|
|
19
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
13
|
+
import type { SlasherClientInterface } from '@aztec/slasher';
|
|
20
14
|
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
21
|
-
import type {
|
|
22
|
-
import
|
|
15
|
+
import type { ValidatorClientFullConfig, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
16
|
+
import { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
|
|
23
17
|
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
24
|
-
import type
|
|
25
|
-
import type
|
|
18
|
+
import { L1Metrics, type TelemetryClient } from '@aztec/telemetry-client';
|
|
19
|
+
import { NodeKeystoreAdapter, type ValidatorClient } from '@aztec/validator-client';
|
|
26
20
|
|
|
27
21
|
import type { SequencerClientConfig } from '../config.js';
|
|
28
22
|
import { GlobalVariableBuilder } from '../global_variable_builder/index.js';
|
|
29
|
-
import {
|
|
23
|
+
import { SequencerPublisherFactory } from '../publisher/sequencer-publisher-factory.js';
|
|
24
|
+
import { FullNodeCheckpointsBuilder } from '../sequencer/checkpoint_builder.js';
|
|
30
25
|
import { Sequencer, type SequencerConfig } from '../sequencer/index.js';
|
|
31
|
-
import type { SlasherClient } from '../slasher/index.js';
|
|
32
26
|
|
|
33
27
|
/**
|
|
34
28
|
* Encapsulates the full sequencer and publisher.
|
|
35
29
|
*/
|
|
36
30
|
export class SequencerClient {
|
|
37
|
-
constructor(
|
|
31
|
+
constructor(
|
|
32
|
+
protected publisherManager: PublisherManager<L1TxUtilsWithBlobs>,
|
|
33
|
+
protected sequencer: Sequencer,
|
|
34
|
+
protected checkpointsBuilder: FullNodeCheckpointsBuilder,
|
|
35
|
+
protected validatorClient?: ValidatorClient,
|
|
36
|
+
private l1Metrics?: L1Metrics,
|
|
37
|
+
) {}
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
|
-
* Initializes
|
|
40
|
+
* Initializes a new instance.
|
|
41
41
|
* @param config - Configuration for the sequencer, publisher, and L1 tx sender.
|
|
42
42
|
* @param p2pClient - P2P client that provides the txs to be sequenced.
|
|
43
43
|
* @param validatorClient - Validator client performs attestation duties when rotating proposers.
|
|
@@ -46,25 +46,25 @@ export class SequencerClient {
|
|
|
46
46
|
* @param l2BlockSource - Provides information about the previously published blocks.
|
|
47
47
|
* @param l1ToL2MessageSource - Provides access to L1 to L2 messages.
|
|
48
48
|
* @param prover - An instance of a block prover
|
|
49
|
-
* @param simulationProvider - An instance of a simulation provider
|
|
50
49
|
* @returns A new running instance.
|
|
51
50
|
*/
|
|
52
51
|
public static async new(
|
|
53
52
|
config: SequencerClientConfig,
|
|
54
53
|
deps: {
|
|
55
|
-
validatorClient: ValidatorClient
|
|
54
|
+
validatorClient: ValidatorClient;
|
|
56
55
|
p2pClient: P2P;
|
|
57
56
|
worldStateSynchronizer: WorldStateSynchronizer;
|
|
58
|
-
slasherClient:
|
|
59
|
-
|
|
57
|
+
slasherClient: SlasherClientInterface | undefined;
|
|
58
|
+
checkpointsBuilder: FullNodeCheckpointsBuilder;
|
|
60
59
|
l2BlockSource: L2BlockSource;
|
|
61
60
|
l1ToL2MessageSource: L1ToL2MessageSource;
|
|
62
61
|
telemetry: TelemetryClient;
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
publisherFactory?: SequencerPublisherFactory;
|
|
63
|
+
blobClient?: BlobClientInterface;
|
|
65
64
|
dateProvider: DateProvider;
|
|
66
65
|
epochCache?: EpochCache;
|
|
67
|
-
l1TxUtils
|
|
66
|
+
l1TxUtils: L1TxUtilsWithBlobs[];
|
|
67
|
+
nodeKeyStore: KeystoreManager;
|
|
68
68
|
},
|
|
69
69
|
) {
|
|
70
70
|
const {
|
|
@@ -72,42 +72,33 @@ export class SequencerClient {
|
|
|
72
72
|
p2pClient,
|
|
73
73
|
worldStateSynchronizer,
|
|
74
74
|
slasherClient,
|
|
75
|
-
|
|
75
|
+
checkpointsBuilder,
|
|
76
76
|
l2BlockSource,
|
|
77
77
|
l1ToL2MessageSource,
|
|
78
78
|
telemetry: telemetryClient,
|
|
79
79
|
} = deps;
|
|
80
|
-
const { l1RpcUrls: rpcUrls, l1ChainId: chainId
|
|
81
|
-
const
|
|
82
|
-
const
|
|
83
|
-
const
|
|
84
|
-
const
|
|
80
|
+
const { l1RpcUrls: rpcUrls, l1ChainId: chainId } = config;
|
|
81
|
+
const log = createLogger('sequencer');
|
|
82
|
+
const publicClient = getPublicClient(config);
|
|
83
|
+
const l1TxUtils = deps.l1TxUtils;
|
|
84
|
+
const l1Metrics = new L1Metrics(
|
|
85
|
+
telemetryClient.getMeter('L1PublisherMetrics'),
|
|
86
|
+
publicClient,
|
|
87
|
+
l1TxUtils.map(x => x.getSenderAddress()),
|
|
88
|
+
);
|
|
89
|
+
const publisherManager = new PublisherManager(l1TxUtils, config);
|
|
85
90
|
const rollupContract = new RollupContract(publicClient, config.l1Contracts.rollupAddress.toString());
|
|
86
|
-
const [l1GenesisTime, slotDuration] = await Promise.all([
|
|
91
|
+
const [l1GenesisTime, slotDuration, rollupVersion, rollupManaLimit] = await Promise.all([
|
|
87
92
|
rollupContract.getL1GenesisTime(),
|
|
88
93
|
rollupContract.getSlotDuration(),
|
|
94
|
+
rollupContract.getVersion(),
|
|
95
|
+
rollupContract.getManaLimit().then(Number),
|
|
89
96
|
] as const);
|
|
90
|
-
const forwarderContract =
|
|
91
|
-
config.customForwarderContractAddress && config.customForwarderContractAddress !== EthAddress.ZERO
|
|
92
|
-
? new ForwarderContract(
|
|
93
|
-
publicClient,
|
|
94
|
-
config.customForwarderContractAddress.toString(),
|
|
95
|
-
config.l1Contracts.rollupAddress.toString(),
|
|
96
|
-
)
|
|
97
|
-
: await ForwarderContract.create(
|
|
98
|
-
walletClient.account.address,
|
|
99
|
-
walletClient,
|
|
100
|
-
publicClient,
|
|
101
|
-
log,
|
|
102
|
-
config.l1Contracts.rollupAddress.toString(),
|
|
103
|
-
);
|
|
104
97
|
|
|
105
98
|
const governanceProposerContract = new GovernanceProposerContract(
|
|
106
99
|
publicClient,
|
|
107
100
|
config.l1Contracts.governanceProposerAddress.toString(),
|
|
108
101
|
);
|
|
109
|
-
const slashingProposerAddress = await rollupContract.getSlashingProposerAddress();
|
|
110
|
-
const slashingProposerContract = new SlashingProposerContract(publicClient, slashingProposerAddress.toString());
|
|
111
102
|
const epochCache =
|
|
112
103
|
deps.epochCache ??
|
|
113
104
|
(await EpochCache.create(
|
|
@@ -116,74 +107,92 @@ export class SequencerClient {
|
|
|
116
107
|
l1RpcUrls: rpcUrls,
|
|
117
108
|
l1ChainId: chainId,
|
|
118
109
|
viemPollingIntervalMS: config.viemPollingIntervalMS,
|
|
119
|
-
aztecSlotDuration: config.aztecSlotDuration,
|
|
120
110
|
ethereumSlotDuration: config.ethereumSlotDuration,
|
|
121
|
-
aztecEpochDuration: config.aztecEpochDuration,
|
|
122
111
|
},
|
|
123
112
|
{ dateProvider: deps.dateProvider },
|
|
124
113
|
));
|
|
125
114
|
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
115
|
+
const slashFactoryContract = new SlashFactoryContract(
|
|
116
|
+
publicClient,
|
|
117
|
+
config.l1Contracts.slashFactoryAddress?.toString() ?? EthAddress.ZERO.toString(),
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
const publisherFactory =
|
|
121
|
+
deps.publisherFactory ??
|
|
122
|
+
new SequencerPublisherFactory(config, {
|
|
130
123
|
telemetry: telemetryClient,
|
|
131
|
-
|
|
132
|
-
rollupContract,
|
|
124
|
+
blobClient: deps.blobClient,
|
|
133
125
|
epochCache,
|
|
134
|
-
forwarderContract,
|
|
135
126
|
governanceProposerContract,
|
|
136
|
-
|
|
127
|
+
slashFactoryContract,
|
|
128
|
+
rollupContract,
|
|
129
|
+
dateProvider: deps.dateProvider,
|
|
130
|
+
publisherManager,
|
|
131
|
+
nodeKeyStore: NodeKeystoreAdapter.fromKeyStoreManager(deps.nodeKeyStore),
|
|
132
|
+
logger: log,
|
|
137
133
|
});
|
|
138
|
-
const globalsBuilder = new GlobalVariableBuilder(config);
|
|
139
|
-
|
|
140
|
-
const publicProcessorFactory = new PublicProcessorFactory(contractDataSource, deps.dateProvider, telemetryClient);
|
|
141
134
|
|
|
142
135
|
const ethereumSlotDuration = config.ethereumSlotDuration;
|
|
136
|
+
const l1Constants = { l1GenesisTime, slotDuration: Number(slotDuration), ethereumSlotDuration };
|
|
137
|
+
|
|
138
|
+
const globalsBuilder = new GlobalVariableBuilder({ ...config, ...l1Constants, rollupVersion });
|
|
143
139
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
140
|
+
let sequencerManaLimit = config.maxL2BlockGas ?? rollupManaLimit;
|
|
141
|
+
if (sequencerManaLimit > rollupManaLimit) {
|
|
142
|
+
log.warn(
|
|
143
|
+
`Provided maxL2BlockGas ${sequencerManaLimit} is greater than the max allowed by L1. Setting limit to ${rollupManaLimit}.`,
|
|
144
|
+
);
|
|
145
|
+
sequencerManaLimit = rollupManaLimit;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// When running in anvil, assume we can post a tx up until one second before the end of an L1 slot.
|
|
149
|
+
// Otherwise, we need the full L1 slot duration for publishing to ensure inclusion.
|
|
147
150
|
// In theory, the L1 slot has an initial 4s phase where the block is propagated, so we could
|
|
148
|
-
//
|
|
151
|
+
// reduce the publishing time allowance. However, we prefer being conservative.
|
|
149
152
|
// See https://www.blocknative.com/blog/anatomy-of-a-slot#7 for more info.
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
const l1Constants = {
|
|
154
|
-
l1GenesisTime,
|
|
155
|
-
slotDuration: Number(slotDuration),
|
|
156
|
-
ethereumSlotDuration,
|
|
157
|
-
};
|
|
153
|
+
const l1PublishingTimeBasedOnChain = isAnvilTestChain(config.l1ChainId) ? 1 : ethereumSlotDuration;
|
|
154
|
+
const l1PublishingTime = config.l1PublishingTime ?? l1PublishingTimeBasedOnChain;
|
|
158
155
|
|
|
159
156
|
const sequencer = new Sequencer(
|
|
160
|
-
|
|
157
|
+
publisherFactory,
|
|
161
158
|
validatorClient,
|
|
162
159
|
globalsBuilder,
|
|
163
160
|
p2pClient,
|
|
164
161
|
worldStateSynchronizer,
|
|
165
162
|
slasherClient,
|
|
166
|
-
new LightweightBlockBuilderFactory(telemetryClient),
|
|
167
163
|
l2BlockSource,
|
|
168
164
|
l1ToL2MessageSource,
|
|
169
|
-
|
|
170
|
-
contractDataSource,
|
|
165
|
+
checkpointsBuilder,
|
|
171
166
|
l1Constants,
|
|
172
167
|
deps.dateProvider,
|
|
173
|
-
|
|
168
|
+
epochCache,
|
|
169
|
+
rollupContract,
|
|
170
|
+
{ ...config, l1PublishingTime, maxL2BlockGas: sequencerManaLimit },
|
|
174
171
|
telemetryClient,
|
|
172
|
+
log,
|
|
175
173
|
);
|
|
176
|
-
|
|
177
|
-
await sequencer.
|
|
178
|
-
|
|
174
|
+
|
|
175
|
+
await sequencer.init();
|
|
176
|
+
|
|
177
|
+
return new SequencerClient(publisherManager, sequencer, checkpointsBuilder, validatorClient, l1Metrics);
|
|
179
178
|
}
|
|
180
179
|
|
|
181
180
|
/**
|
|
182
|
-
* Updates sequencer config.
|
|
181
|
+
* Updates sequencer and validator client config.
|
|
183
182
|
* @param config - New parameters.
|
|
184
183
|
*/
|
|
185
|
-
public
|
|
186
|
-
|
|
184
|
+
public updateConfig(config: SequencerConfig & Partial<ValidatorClientFullConfig>) {
|
|
185
|
+
this.sequencer.updateConfig(config);
|
|
186
|
+
this.checkpointsBuilder.updateConfig(config);
|
|
187
|
+
this.validatorClient?.updateConfig(config);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** Starts the sequencer. */
|
|
191
|
+
public async start() {
|
|
192
|
+
await this.validatorClient?.start();
|
|
193
|
+
this.sequencer.start();
|
|
194
|
+
this.l1Metrics?.start();
|
|
195
|
+
await this.publisherManager.loadState();
|
|
187
196
|
}
|
|
188
197
|
|
|
189
198
|
/**
|
|
@@ -191,29 +200,20 @@ export class SequencerClient {
|
|
|
191
200
|
*/
|
|
192
201
|
public async stop() {
|
|
193
202
|
await this.sequencer.stop();
|
|
203
|
+
await this.validatorClient?.stop();
|
|
204
|
+
this.publisherManager.interrupt();
|
|
205
|
+
this.l1Metrics?.stop();
|
|
194
206
|
}
|
|
195
207
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
this.sequencer.flush();
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Restarts the sequencer after being stopped.
|
|
203
|
-
*/
|
|
204
|
-
public restart() {
|
|
205
|
-
this.sequencer.restart();
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
get coinbase(): EthAddress {
|
|
209
|
-
return this.sequencer.coinbase;
|
|
208
|
+
public getSequencer(): Sequencer {
|
|
209
|
+
return this.sequencer;
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
get
|
|
213
|
-
return this.sequencer.
|
|
212
|
+
get validatorAddresses(): EthAddress[] | undefined {
|
|
213
|
+
return this.sequencer.getValidatorAddresses();
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
get
|
|
217
|
-
return this.sequencer.
|
|
216
|
+
get maxL2BlockGas(): number | undefined {
|
|
217
|
+
return this.sequencer.maxL2BlockGas;
|
|
218
218
|
}
|
|
219
219
|
}
|