@aztec/sequencer-client 0.0.0-test.0 → 0.0.1-commit.001888fc
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 +50 -33
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +164 -57
- package/dest/config.d.ts +35 -17
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +150 -81
- package/dest/global_variable_builder/global_builder.d.ts +24 -15
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +63 -44
- package/dest/global_variable_builder/index.d.ts +1 -1
- package/dest/index.d.ts +2 -4
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -3
- package/dest/publisher/config.d.ts +48 -27
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +109 -32
- package/dest/publisher/index.d.ts +4 -1
- package/dest/publisher/index.d.ts.map +1 -1
- package/dest/publisher/index.js +3 -0
- package/dest/publisher/l1_tx_failed_store/factory.d.ts +11 -0
- package/dest/publisher/l1_tx_failed_store/factory.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/factory.js +22 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts +59 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.js +1 -0
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts +15 -0
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.js +34 -0
- package/dest/publisher/l1_tx_failed_store/index.d.ts +4 -0
- package/dest/publisher/l1_tx_failed_store/index.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/index.js +2 -0
- package/dest/publisher/sequencer-publisher-factory.d.ts +52 -0
- package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -0
- package/dest/publisher/sequencer-publisher-factory.js +76 -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 +34 -62
- package/dest/publisher/sequencer-publisher.d.ts +158 -93
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +1452 -255
- package/dest/sequencer/checkpoint_proposal_job.d.ts +100 -0
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_proposal_job.js +1240 -0
- package/dest/sequencer/checkpoint_voter.d.ts +35 -0
- package/dest/sequencer/checkpoint_voter.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_voter.js +109 -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 +4 -2
- package/dest/sequencer/index.d.ts.map +1 -1
- package/dest/sequencer/index.js +3 -1
- package/dest/sequencer/metrics.d.ts +60 -12
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +283 -67
- package/dest/sequencer/sequencer.d.ts +157 -135
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +966 -523
- package/dest/sequencer/timetable.d.ts +75 -25
- package/dest/sequencer/timetable.d.ts.map +1 -1
- package/dest/sequencer/timetable.js +174 -62
- 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 +9 -3
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/index.js +0 -4
- package/dest/test/mock_checkpoint_builder.d.ts +99 -0
- package/dest/test/mock_checkpoint_builder.d.ts.map +1 -0
- package/dest/test/mock_checkpoint_builder.js +231 -0
- package/dest/test/utils.d.ts +53 -0
- package/dest/test/utils.d.ts.map +1 -0
- package/dest/test/utils.js +104 -0
- package/package.json +46 -45
- package/src/client/sequencer-client.ts +220 -104
- package/src/config.ts +172 -96
- package/src/global_variable_builder/global_builder.ts +85 -55
- package/src/index.ts +1 -3
- package/src/publisher/config.ts +150 -59
- package/src/publisher/index.ts +7 -0
- package/src/publisher/l1_tx_failed_store/factory.ts +32 -0
- package/src/publisher/l1_tx_failed_store/failed_tx_store.ts +55 -0
- package/src/publisher/l1_tx_failed_store/file_store_failed_tx_store.ts +46 -0
- package/src/publisher/l1_tx_failed_store/index.ts +3 -0
- package/src/publisher/sequencer-publisher-factory.ts +124 -0
- package/src/publisher/sequencer-publisher-metrics.ts +33 -63
- package/src/publisher/sequencer-publisher.ts +1266 -311
- package/src/sequencer/README.md +531 -0
- package/src/sequencer/checkpoint_proposal_job.ts +967 -0
- package/src/sequencer/checkpoint_voter.ts +130 -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 +3 -1
- package/src/sequencer/metrics.ts +362 -73
- package/src/sequencer/sequencer.ts +712 -586
- package/src/sequencer/timetable.ts +224 -64
- package/src/sequencer/types.ts +6 -0
- package/src/sequencer/utils.ts +28 -60
- package/src/test/index.ts +11 -5
- package/src/test/mock_checkpoint_builder.ts +323 -0
- package/src/test/utils.ts +167 -0
- 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/nullifier_cache.d.ts +0 -16
- package/dest/tx_validator/nullifier_cache.d.ts.map +0 -1
- package/dest/tx_validator/nullifier_cache.js +0 -24
- 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/dest/tx_validator/tx_validator_factory.d.ts +0 -18
- package/dest/tx_validator/tx_validator_factory.d.ts.map +0 -1
- package/dest/tx_validator/tx_validator_factory.js +0 -50
- 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/nullifier_cache.ts +0 -30
- package/src/tx_validator/phases_validator.ts +0 -98
- package/src/tx_validator/test_utils.ts +0 -48
- package/src/tx_validator/tx_validator_factory.ts +0 -120
package/dest/client/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './sequencer-client.js';
|
|
2
|
-
//# sourceMappingURL=
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jbGllbnQvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyx1QkFBdUIsQ0FBQyJ9
|
|
@@ -1,28 +1,34 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BlobClientInterface } from '@aztec/blob-client/client';
|
|
2
2
|
import { EpochCache } from '@aztec/epoch-cache';
|
|
3
|
-
import {
|
|
3
|
+
import { type Delayer, L1TxUtils } from '@aztec/ethereum/l1-tx-utils';
|
|
4
|
+
import { PublisherManager } from '@aztec/ethereum/publisher-manager';
|
|
4
5
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
6
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
5
7
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
8
|
+
import type { KeystoreManager } from '@aztec/node-keystore';
|
|
6
9
|
import type { P2P } from '@aztec/p2p';
|
|
7
|
-
import type {
|
|
8
|
-
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
9
|
-
import type {
|
|
10
|
-
import type { WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
10
|
+
import type { SlasherClientInterface } from '@aztec/slasher';
|
|
11
|
+
import type { L2BlockSink, L2BlockSource } from '@aztec/stdlib/block';
|
|
12
|
+
import type { ValidatorClientFullConfig, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
11
13
|
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
12
|
-
import type
|
|
13
|
-
import type
|
|
14
|
-
import type
|
|
15
|
-
import {
|
|
14
|
+
import { L1Metrics, type TelemetryClient } from '@aztec/telemetry-client';
|
|
15
|
+
import { FullNodeCheckpointsBuilder, NodeKeystoreAdapter, type ValidatorClient } from '@aztec/validator-client';
|
|
16
|
+
import { type SequencerClientConfig } from '../config.js';
|
|
17
|
+
import { SequencerPublisherFactory } from '../publisher/sequencer-publisher-factory.js';
|
|
16
18
|
import { Sequencer, type SequencerConfig } from '../sequencer/index.js';
|
|
17
|
-
import type { SlasherClient } from '../slasher/index.js';
|
|
18
19
|
/**
|
|
19
20
|
* Encapsulates the full sequencer and publisher.
|
|
20
21
|
*/
|
|
21
22
|
export declare class SequencerClient {
|
|
23
|
+
protected publisherManager: PublisherManager<L1TxUtils>;
|
|
22
24
|
protected sequencer: Sequencer;
|
|
23
|
-
|
|
25
|
+
protected checkpointsBuilder: FullNodeCheckpointsBuilder;
|
|
26
|
+
protected validatorClient?: ValidatorClient | undefined;
|
|
27
|
+
private l1Metrics?;
|
|
28
|
+
private delayer_?;
|
|
29
|
+
constructor(publisherManager: PublisherManager<L1TxUtils>, sequencer: Sequencer, checkpointsBuilder: FullNodeCheckpointsBuilder, validatorClient?: ValidatorClient | undefined, l1Metrics?: L1Metrics | undefined, delayer_?: Delayer | undefined);
|
|
24
30
|
/**
|
|
25
|
-
* Initializes
|
|
31
|
+
* Initializes a new instance.
|
|
26
32
|
* @param config - Configuration for the sequencer, publisher, and L1 tx sender.
|
|
27
33
|
* @param p2pClient - P2P client that provides the txs to be sequenced.
|
|
28
34
|
* @param validatorClient - Validator client performs attestation duties when rotating proposers.
|
|
@@ -31,41 +37,52 @@ export declare class SequencerClient {
|
|
|
31
37
|
* @param l2BlockSource - Provides information about the previously published blocks.
|
|
32
38
|
* @param l1ToL2MessageSource - Provides access to L1 to L2 messages.
|
|
33
39
|
* @param prover - An instance of a block prover
|
|
34
|
-
* @param simulationProvider - An instance of a simulation provider
|
|
35
40
|
* @returns A new running instance.
|
|
36
41
|
*/
|
|
37
42
|
static new(config: SequencerClientConfig, deps: {
|
|
38
|
-
validatorClient: ValidatorClient
|
|
43
|
+
validatorClient: ValidatorClient;
|
|
39
44
|
p2pClient: P2P;
|
|
40
45
|
worldStateSynchronizer: WorldStateSynchronizer;
|
|
41
|
-
slasherClient:
|
|
42
|
-
|
|
43
|
-
l2BlockSource: L2BlockSource;
|
|
46
|
+
slasherClient: SlasherClientInterface | undefined;
|
|
47
|
+
checkpointsBuilder: FullNodeCheckpointsBuilder;
|
|
48
|
+
l2BlockSource: L2BlockSource & L2BlockSink;
|
|
44
49
|
l1ToL2MessageSource: L1ToL2MessageSource;
|
|
45
50
|
telemetry: TelemetryClient;
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
publisherFactory?: SequencerPublisherFactory;
|
|
52
|
+
blobClient: BlobClientInterface;
|
|
48
53
|
dateProvider: DateProvider;
|
|
49
54
|
epochCache?: EpochCache;
|
|
50
|
-
l1TxUtils
|
|
55
|
+
l1TxUtils: L1TxUtils[];
|
|
56
|
+
nodeKeyStore: KeystoreManager;
|
|
51
57
|
}): Promise<SequencerClient>;
|
|
52
58
|
/**
|
|
53
|
-
* Updates sequencer config.
|
|
59
|
+
* Updates sequencer and validator client config.
|
|
54
60
|
* @param config - New parameters.
|
|
55
61
|
*/
|
|
56
|
-
|
|
62
|
+
updateConfig(config: SequencerConfig & Partial<ValidatorClientFullConfig>): void;
|
|
63
|
+
/** Starts the sequencer. */
|
|
64
|
+
start(): Promise<void>;
|
|
57
65
|
/**
|
|
58
66
|
* Stops the sequencer from processing new txs.
|
|
59
67
|
*/
|
|
60
68
|
stop(): Promise<void>;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
get
|
|
68
|
-
get feeRecipient(): AztecAddress;
|
|
69
|
-
get forwarderAddress(): EthAddress;
|
|
69
|
+
getSequencer(): Sequencer;
|
|
70
|
+
/** Updates the publisher factory's node keystore adapter after a keystore reload. */
|
|
71
|
+
updatePublisherNodeKeyStore(adapter: NodeKeystoreAdapter): void;
|
|
72
|
+
/** Returns the shared tx delayer for sequencer L1 txs, if enabled. Test-only. */
|
|
73
|
+
getDelayer(): Delayer | undefined;
|
|
74
|
+
get validatorAddresses(): EthAddress[] | undefined;
|
|
75
|
+
get maxL2BlockGas(): number | undefined;
|
|
70
76
|
}
|
|
71
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Computes per-block L2 gas, DA gas, and TX count budgets based on the L1 rollup limits and the timetable.
|
|
79
|
+
* If the user explicitly set a limit, it is capped at the corresponding checkpoint limit.
|
|
80
|
+
* Otherwise, derives it as (checkpointLimit / maxBlocks) * multiplier, capped at the checkpoint limit.
|
|
81
|
+
*/
|
|
82
|
+
export declare function computeBlockLimits(config: SequencerClientConfig, rollupManaLimit: number, l1PublishingTime: number, log: ReturnType<typeof createLogger>): {
|
|
83
|
+
maxL2BlockGas: number;
|
|
84
|
+
maxDABlockGas: number;
|
|
85
|
+
maxTxsPerBlock: number;
|
|
86
|
+
maxBlocksPerCheckpoint: number;
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VxdWVuY2VyLWNsaWVudC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NsaWVudC9zZXF1ZW5jZXItY2xpZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFFckUsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBSWhELE9BQU8sRUFBRSxLQUFLLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUN0RSxPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxtQ0FBbUMsQ0FBQztBQUNyRSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFDM0QsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBQ3JELE9BQU8sS0FBSyxFQUF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0FBRyxPQUFPLENBQUMseUJBQXlCLENBQUMsUUFJL0U7SUFFRCw0QkFBNEI7SUFDZixLQUFLLGtCQUtqQjtJQUVEOztPQUVHO0lBQ1UsSUFBSSxrQkFLaEI7SUFFTSxZQUFZLElBQUksU0FBUyxDQUUvQjtJQUVELHFGQUFxRjtJQUM5RSwyQkFBMkIsQ0FBQyxPQUFPLEVBQUUsbUJBQW1CLEdBQUcsSUFBSSxDQUVyRTtJQUVELGlGQUFpRjtJQUNqRixVQUFVLElBQUksT0FBTyxHQUFHLFNBQVMsQ0FFaEM7SUFFRCxJQUFJLGtCQUFrQixJQUFJLFVBQVUsRUFBRSxHQUFHLFNBQVMsQ0FFakQ7SUFFRCxJQUFJLGFBQWEsSUFBSSxNQUFNLEdBQUcsU0FBUyxDQUV0QztDQUNGO0FBRUQ7Ozs7R0FJRztBQUNILHdCQUFnQixrQkFBa0IsQ0FDaEMsTUFBTSxFQUFFLHFCQUFxQixFQUM3QixlQUFlLEVBQUUsTUFBTSxFQUN2QixnQkFBZ0IsRUFBRSxNQUFNLEVBQ3hCLEdBQUcsRUFBRSxVQUFVLENBQUMsT0FBTyxZQUFZLENBQUMsR0FDbkM7SUFBRSxhQUFhLEVBQUUsTUFBTSxDQUFDO0lBQUMsYUFBYSxFQUFFLE1BQU0sQ0FBQztJQUFDLGNBQWMsRUFBRSxNQUFNLENBQUM7SUFBQyxzQkFBc0IsRUFBRSxNQUFNLENBQUE7Q0FBRSxDQTJFMUcifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequencer-client.d.ts","sourceRoot":"","sources":["../../src/client/sequencer-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"sequencer-client.d.ts","sourceRoot":"","sources":["../../src/client/sequencer-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,EAAE,UAAU,EAAE,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GAAG,SAAS,CAEtC;CACF;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,qBAAqB,EAC7B,eAAe,EAAE,MAAM,EACvB,gBAAgB,EAAE,MAAM,EACxB,GAAG,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,GACnC;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAC;IAAC,sBAAsB,EAAE,MAAM,CAAA;CAAE,CA2E1G"}
|
|
@@ -1,22 +1,38 @@
|
|
|
1
|
+
import { MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT } from '@aztec/constants';
|
|
1
2
|
import { EpochCache } from '@aztec/epoch-cache';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
3
|
+
import { isAnvilTestChain } from '@aztec/ethereum/chain';
|
|
4
|
+
import { getPublicClient } from '@aztec/ethereum/client';
|
|
5
|
+
import { GovernanceProposerContract, RollupContract } from '@aztec/ethereum/contracts';
|
|
6
|
+
import { PublisherManager } from '@aztec/ethereum/publisher-manager';
|
|
4
7
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
8
|
import { createLogger } from '@aztec/foundation/log';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
9
|
+
import { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
|
|
10
|
+
import { L1Metrics } from '@aztec/telemetry-client';
|
|
11
|
+
import { NodeKeystoreAdapter } from '@aztec/validator-client';
|
|
12
|
+
import { DefaultSequencerConfig, getPublisherConfigFromSequencerConfig } from '../config.js';
|
|
8
13
|
import { GlobalVariableBuilder } from '../global_variable_builder/index.js';
|
|
9
|
-
import {
|
|
14
|
+
import { SequencerPublisherFactory } from '../publisher/sequencer-publisher-factory.js';
|
|
10
15
|
import { Sequencer } from '../sequencer/index.js';
|
|
16
|
+
import { SequencerTimetable } from '../sequencer/timetable.js';
|
|
11
17
|
/**
|
|
12
18
|
* Encapsulates the full sequencer and publisher.
|
|
13
19
|
*/ export class SequencerClient {
|
|
20
|
+
publisherManager;
|
|
14
21
|
sequencer;
|
|
15
|
-
|
|
22
|
+
checkpointsBuilder;
|
|
23
|
+
validatorClient;
|
|
24
|
+
l1Metrics;
|
|
25
|
+
delayer_;
|
|
26
|
+
constructor(publisherManager, sequencer, checkpointsBuilder, validatorClient, l1Metrics, delayer_){
|
|
27
|
+
this.publisherManager = publisherManager;
|
|
16
28
|
this.sequencer = sequencer;
|
|
29
|
+
this.checkpointsBuilder = checkpointsBuilder;
|
|
30
|
+
this.validatorClient = validatorClient;
|
|
31
|
+
this.l1Metrics = l1Metrics;
|
|
32
|
+
this.delayer_ = delayer_;
|
|
17
33
|
}
|
|
18
34
|
/**
|
|
19
|
-
* Initializes
|
|
35
|
+
* Initializes a new instance.
|
|
20
36
|
* @param config - Configuration for the sequencer, publisher, and L1 tx sender.
|
|
21
37
|
* @param p2pClient - P2P client that provides the txs to be sequenced.
|
|
22
38
|
* @param validatorClient - Validator client performs attestation duties when rotating proposers.
|
|
@@ -25,93 +41,184 @@ import { Sequencer } from '../sequencer/index.js';
|
|
|
25
41
|
* @param l2BlockSource - Provides information about the previously published blocks.
|
|
26
42
|
* @param l1ToL2MessageSource - Provides access to L1 to L2 messages.
|
|
27
43
|
* @param prover - An instance of a block prover
|
|
28
|
-
* @param simulationProvider - An instance of a simulation provider
|
|
29
44
|
* @returns A new running instance.
|
|
30
45
|
*/ static async new(config, deps) {
|
|
31
|
-
const { validatorClient, p2pClient, worldStateSynchronizer, slasherClient,
|
|
32
|
-
const { l1RpcUrls: rpcUrls, l1ChainId: chainId
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
46
|
+
const { validatorClient, p2pClient, worldStateSynchronizer, slasherClient, checkpointsBuilder, l2BlockSource, l1ToL2MessageSource, telemetry: telemetryClient } = deps;
|
|
47
|
+
const { l1RpcUrls: rpcUrls, l1ChainId: chainId } = config;
|
|
48
|
+
const log = createLogger('sequencer');
|
|
49
|
+
const publicClient = getPublicClient(config);
|
|
50
|
+
const l1TxUtils = deps.l1TxUtils;
|
|
51
|
+
const l1Metrics = new L1Metrics(telemetryClient.getMeter('L1PublisherMetrics'), publicClient, l1TxUtils.map((x)=>x.getSenderAddress()));
|
|
52
|
+
const publisherManager = new PublisherManager(l1TxUtils, getPublisherConfigFromSequencerConfig(config), log.getBindings());
|
|
37
53
|
const rollupContract = new RollupContract(publicClient, config.l1Contracts.rollupAddress.toString());
|
|
38
|
-
const [l1GenesisTime, slotDuration] = await Promise.all([
|
|
54
|
+
const [l1GenesisTime, slotDuration, rollupVersion, rollupManaLimit] = await Promise.all([
|
|
39
55
|
rollupContract.getL1GenesisTime(),
|
|
40
|
-
rollupContract.getSlotDuration()
|
|
56
|
+
rollupContract.getSlotDuration(),
|
|
57
|
+
rollupContract.getVersion(),
|
|
58
|
+
rollupContract.getManaLimit().then(Number)
|
|
41
59
|
]);
|
|
42
|
-
const forwarderContract = config.customForwarderContractAddress && config.customForwarderContractAddress !== EthAddress.ZERO ? new ForwarderContract(publicClient, config.customForwarderContractAddress.toString(), config.l1Contracts.rollupAddress.toString()) : await ForwarderContract.create(walletClient.account.address, walletClient, publicClient, log, config.l1Contracts.rollupAddress.toString());
|
|
43
60
|
const governanceProposerContract = new GovernanceProposerContract(publicClient, config.l1Contracts.governanceProposerAddress.toString());
|
|
44
|
-
const slashingProposerAddress = await rollupContract.getSlashingProposerAddress();
|
|
45
|
-
const slashingProposerContract = new SlashingProposerContract(publicClient, slashingProposerAddress.toString());
|
|
46
61
|
const epochCache = deps.epochCache ?? await EpochCache.create(config.l1Contracts.rollupAddress, {
|
|
47
62
|
l1RpcUrls: rpcUrls,
|
|
48
63
|
l1ChainId: chainId,
|
|
49
64
|
viemPollingIntervalMS: config.viemPollingIntervalMS,
|
|
50
|
-
|
|
51
|
-
ethereumSlotDuration: config.ethereumSlotDuration,
|
|
52
|
-
aztecEpochDuration: config.aztecEpochDuration
|
|
65
|
+
ethereumSlotDuration: config.ethereumSlotDuration
|
|
53
66
|
}, {
|
|
54
67
|
dateProvider: deps.dateProvider
|
|
55
68
|
});
|
|
56
|
-
const
|
|
57
|
-
|
|
69
|
+
const slashFactoryContract = new SlashFactoryContract(publicClient, config.l1Contracts.slashFactoryAddress?.toString() ?? EthAddress.ZERO.toString());
|
|
70
|
+
const publisherFactory = deps.publisherFactory ?? new SequencerPublisherFactory(config, {
|
|
58
71
|
telemetry: telemetryClient,
|
|
59
|
-
|
|
60
|
-
rollupContract,
|
|
72
|
+
blobClient: deps.blobClient,
|
|
61
73
|
epochCache,
|
|
62
|
-
forwarderContract,
|
|
63
74
|
governanceProposerContract,
|
|
64
|
-
|
|
75
|
+
slashFactoryContract,
|
|
76
|
+
rollupContract,
|
|
77
|
+
dateProvider: deps.dateProvider,
|
|
78
|
+
publisherManager,
|
|
79
|
+
nodeKeyStore: NodeKeystoreAdapter.fromKeyStoreManager(deps.nodeKeyStore),
|
|
80
|
+
logger: log
|
|
65
81
|
});
|
|
66
|
-
const globalsBuilder = new GlobalVariableBuilder(config);
|
|
67
|
-
const publicProcessorFactory = new PublicProcessorFactory(contractDataSource, deps.dateProvider, telemetryClient);
|
|
68
82
|
const ethereumSlotDuration = config.ethereumSlotDuration;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
83
|
+
const globalsBuilder = new GlobalVariableBuilder({
|
|
84
|
+
...config,
|
|
85
|
+
l1GenesisTime,
|
|
86
|
+
slotDuration: Number(slotDuration),
|
|
87
|
+
ethereumSlotDuration,
|
|
88
|
+
rollupVersion
|
|
89
|
+
});
|
|
90
|
+
// When running in anvil, assume we can post a tx up until one second before the end of an L1 slot.
|
|
91
|
+
// Otherwise, we need the full L1 slot duration for publishing to ensure inclusion.
|
|
72
92
|
// In theory, the L1 slot has an initial 4s phase where the block is propagated, so we could
|
|
73
|
-
//
|
|
93
|
+
// reduce the publishing time allowance. However, we prefer being conservative.
|
|
74
94
|
// See https://www.blocknative.com/blog/anatomy-of-a-slot#7 for more info.
|
|
75
|
-
const
|
|
95
|
+
const l1PublishingTimeBasedOnChain = isAnvilTestChain(config.l1ChainId) ? 1 : ethereumSlotDuration;
|
|
96
|
+
const l1PublishingTime = config.l1PublishingTime ?? l1PublishingTimeBasedOnChain;
|
|
97
|
+
const { maxL2BlockGas, maxDABlockGas, maxTxsPerBlock, maxBlocksPerCheckpoint } = computeBlockLimits(config, rollupManaLimit, l1PublishingTime, log);
|
|
76
98
|
const l1Constants = {
|
|
77
99
|
l1GenesisTime,
|
|
78
100
|
slotDuration: Number(slotDuration),
|
|
79
|
-
ethereumSlotDuration
|
|
101
|
+
ethereumSlotDuration,
|
|
102
|
+
rollupManaLimit
|
|
80
103
|
};
|
|
81
|
-
const sequencer = new Sequencer(
|
|
104
|
+
const sequencer = new Sequencer(publisherFactory, validatorClient, globalsBuilder, p2pClient, worldStateSynchronizer, slasherClient, l2BlockSource, l1ToL2MessageSource, checkpointsBuilder, l1Constants, deps.dateProvider, epochCache, rollupContract, {
|
|
82
105
|
...config,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
106
|
+
l1PublishingTime,
|
|
107
|
+
maxL2BlockGas,
|
|
108
|
+
maxDABlockGas,
|
|
109
|
+
maxTxsPerBlock,
|
|
110
|
+
maxBlocksPerCheckpoint
|
|
111
|
+
}, telemetryClient, log);
|
|
112
|
+
sequencer.init();
|
|
113
|
+
// Extract the shared delayer from the first L1TxUtils instance (all instances share the same delayer)
|
|
114
|
+
const delayer = l1TxUtils[0]?.delayer;
|
|
115
|
+
return new SequencerClient(publisherManager, sequencer, checkpointsBuilder, validatorClient, l1Metrics, delayer);
|
|
88
116
|
}
|
|
89
117
|
/**
|
|
90
|
-
* Updates sequencer config.
|
|
118
|
+
* Updates sequencer and validator client config.
|
|
91
119
|
* @param config - New parameters.
|
|
92
|
-
*/
|
|
93
|
-
|
|
120
|
+
*/ updateConfig(config) {
|
|
121
|
+
this.sequencer.updateConfig(config);
|
|
122
|
+
this.checkpointsBuilder.updateConfig(config);
|
|
123
|
+
this.validatorClient?.updateConfig(config);
|
|
124
|
+
}
|
|
125
|
+
/** Starts the sequencer. */ async start() {
|
|
126
|
+
await this.validatorClient?.start();
|
|
127
|
+
this.sequencer.start();
|
|
128
|
+
this.l1Metrics?.start();
|
|
129
|
+
await this.publisherManager.loadState();
|
|
94
130
|
}
|
|
95
131
|
/**
|
|
96
132
|
* Stops the sequencer from processing new txs.
|
|
97
133
|
*/ async stop() {
|
|
98
134
|
await this.sequencer.stop();
|
|
135
|
+
await this.validatorClient?.stop();
|
|
136
|
+
this.publisherManager.interrupt();
|
|
137
|
+
this.l1Metrics?.stop();
|
|
99
138
|
}
|
|
100
|
-
|
|
101
|
-
this.sequencer
|
|
139
|
+
getSequencer() {
|
|
140
|
+
return this.sequencer;
|
|
102
141
|
}
|
|
103
|
-
/**
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
142
|
+
/** Updates the publisher factory's node keystore adapter after a keystore reload. */ updatePublisherNodeKeyStore(adapter) {
|
|
143
|
+
this.sequencer.updatePublisherNodeKeyStore(adapter);
|
|
144
|
+
}
|
|
145
|
+
/** Returns the shared tx delayer for sequencer L1 txs, if enabled. Test-only. */ getDelayer() {
|
|
146
|
+
return this.delayer_;
|
|
147
|
+
}
|
|
148
|
+
get validatorAddresses() {
|
|
149
|
+
return this.sequencer.getValidatorAddresses();
|
|
107
150
|
}
|
|
108
|
-
get
|
|
109
|
-
return this.sequencer.
|
|
151
|
+
get maxL2BlockGas() {
|
|
152
|
+
return this.sequencer.maxL2BlockGas;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Computes per-block L2 gas, DA gas, and TX count budgets based on the L1 rollup limits and the timetable.
|
|
157
|
+
* If the user explicitly set a limit, it is capped at the corresponding checkpoint limit.
|
|
158
|
+
* Otherwise, derives it as (checkpointLimit / maxBlocks) * multiplier, capped at the checkpoint limit.
|
|
159
|
+
*/ export function computeBlockLimits(config, rollupManaLimit, l1PublishingTime, log) {
|
|
160
|
+
const maxNumberOfBlocks = new SequencerTimetable({
|
|
161
|
+
ethereumSlotDuration: config.ethereumSlotDuration,
|
|
162
|
+
aztecSlotDuration: config.aztecSlotDuration,
|
|
163
|
+
l1PublishingTime,
|
|
164
|
+
p2pPropagationTime: config.attestationPropagationTime,
|
|
165
|
+
blockDurationMs: config.blockDurationMs,
|
|
166
|
+
enforce: config.enforceTimeTable ?? DefaultSequencerConfig.enforceTimeTable
|
|
167
|
+
}).maxNumberOfBlocks;
|
|
168
|
+
const multiplier = config.perBlockAllocationMultiplier ?? DefaultSequencerConfig.perBlockAllocationMultiplier;
|
|
169
|
+
// Compute maxL2BlockGas
|
|
170
|
+
let maxL2BlockGas;
|
|
171
|
+
if (config.maxL2BlockGas !== undefined) {
|
|
172
|
+
if (config.maxL2BlockGas > rollupManaLimit) {
|
|
173
|
+
log.warn(`Provided MAX_L2_BLOCK_GAS ${config.maxL2BlockGas} exceeds L1 rollup mana limit ${rollupManaLimit} (capping)`);
|
|
174
|
+
maxL2BlockGas = rollupManaLimit;
|
|
175
|
+
} else {
|
|
176
|
+
maxL2BlockGas = config.maxL2BlockGas;
|
|
177
|
+
}
|
|
178
|
+
} else {
|
|
179
|
+
maxL2BlockGas = Math.min(rollupManaLimit, Math.ceil(rollupManaLimit / maxNumberOfBlocks * multiplier));
|
|
110
180
|
}
|
|
111
|
-
|
|
112
|
-
|
|
181
|
+
// Compute maxDABlockGas
|
|
182
|
+
const daCheckpointLimit = MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT;
|
|
183
|
+
let maxDABlockGas;
|
|
184
|
+
if (config.maxDABlockGas !== undefined) {
|
|
185
|
+
if (config.maxDABlockGas > daCheckpointLimit) {
|
|
186
|
+
log.warn(`Provided MAX_DA_BLOCK_GAS ${config.maxDABlockGas} exceeds DA checkpoint limit ${daCheckpointLimit} (capping)`);
|
|
187
|
+
maxDABlockGas = daCheckpointLimit;
|
|
188
|
+
} else {
|
|
189
|
+
maxDABlockGas = config.maxDABlockGas;
|
|
190
|
+
}
|
|
191
|
+
} else {
|
|
192
|
+
maxDABlockGas = Math.min(daCheckpointLimit, Math.ceil(daCheckpointLimit / maxNumberOfBlocks * multiplier));
|
|
113
193
|
}
|
|
114
|
-
|
|
115
|
-
|
|
194
|
+
// Compute maxTxsPerBlock
|
|
195
|
+
const defaultMaxTxsPerBlock = 32;
|
|
196
|
+
let maxTxsPerBlock;
|
|
197
|
+
if (config.maxTxsPerBlock !== undefined) {
|
|
198
|
+
if (config.maxTxsPerCheckpoint !== undefined && config.maxTxsPerBlock > config.maxTxsPerCheckpoint) {
|
|
199
|
+
log.warn(`Provided MAX_TX_PER_BLOCK ${config.maxTxsPerBlock} exceeds MAX_TX_PER_CHECKPOINT ${config.maxTxsPerCheckpoint} (capping)`);
|
|
200
|
+
maxTxsPerBlock = config.maxTxsPerCheckpoint;
|
|
201
|
+
} else {
|
|
202
|
+
maxTxsPerBlock = config.maxTxsPerBlock;
|
|
203
|
+
}
|
|
204
|
+
} else if (config.maxTxsPerCheckpoint !== undefined) {
|
|
205
|
+
maxTxsPerBlock = Math.min(config.maxTxsPerCheckpoint, Math.ceil(config.maxTxsPerCheckpoint / maxNumberOfBlocks * multiplier));
|
|
206
|
+
} else {
|
|
207
|
+
maxTxsPerBlock = defaultMaxTxsPerBlock;
|
|
116
208
|
}
|
|
209
|
+
log.info(`Computed block limits L2=${maxL2BlockGas} DA=${maxDABlockGas} maxTxs=${maxTxsPerBlock}`, {
|
|
210
|
+
maxL2BlockGas,
|
|
211
|
+
maxDABlockGas,
|
|
212
|
+
maxTxsPerBlock,
|
|
213
|
+
rollupManaLimit,
|
|
214
|
+
daCheckpointLimit,
|
|
215
|
+
maxNumberOfBlocks,
|
|
216
|
+
multiplier
|
|
217
|
+
});
|
|
218
|
+
return {
|
|
219
|
+
maxL2BlockGas,
|
|
220
|
+
maxDABlockGas,
|
|
221
|
+
maxTxsPerBlock,
|
|
222
|
+
maxBlocksPerCheckpoint: maxNumberOfBlocks
|
|
223
|
+
};
|
|
117
224
|
}
|
package/dest/config.d.ts
CHANGED
|
@@ -1,29 +1,47 @@
|
|
|
1
|
-
import { type L1ContractsConfig
|
|
1
|
+
import { type L1ContractsConfig } from '@aztec/ethereum/config';
|
|
2
|
+
import { type L1ReaderConfig } from '@aztec/ethereum/l1-reader';
|
|
2
3
|
import { type ConfigMappingsType } from '@aztec/foundation/config';
|
|
3
|
-
import { type
|
|
4
|
-
import { type
|
|
4
|
+
import { type KeyStoreConfig } from '@aztec/node-keystore/config';
|
|
5
|
+
import { type P2PConfig } from '@aztec/p2p/config';
|
|
6
|
+
import { type ChainConfig, type SequencerConfig } from '@aztec/stdlib/config';
|
|
7
|
+
import { type ValidatorClientConfig } from '@aztec/validator-client/config';
|
|
8
|
+
import { type SequencerPublisherConfig, type SequencerTxSenderConfig } from './publisher/config.js';
|
|
5
9
|
export * from './publisher/config.js';
|
|
6
10
|
export type { SequencerConfig };
|
|
11
|
+
/**
|
|
12
|
+
* Default values for SequencerConfig.
|
|
13
|
+
* Centralized location for all sequencer configuration defaults.
|
|
14
|
+
*/
|
|
15
|
+
export declare const DefaultSequencerConfig: {
|
|
16
|
+
sequencerPollingIntervalMS: number;
|
|
17
|
+
minTxsPerBlock: number;
|
|
18
|
+
buildCheckpointIfEmpty: false;
|
|
19
|
+
publishTxsWithProposals: false;
|
|
20
|
+
perBlockAllocationMultiplier: number;
|
|
21
|
+
redistributeCheckpointBudget: true;
|
|
22
|
+
enforceTimeTable: true;
|
|
23
|
+
attestationPropagationTime: number;
|
|
24
|
+
secondsBeforeInvalidatingBlockAsCommitteeMember: number;
|
|
25
|
+
secondsBeforeInvalidatingBlockAsNonCommitteeMember: number;
|
|
26
|
+
skipCollectingAttestations: false;
|
|
27
|
+
skipInvalidateBlockAsProposer: false;
|
|
28
|
+
broadcastInvalidBlockProposal: false;
|
|
29
|
+
injectFakeAttestation: false;
|
|
30
|
+
injectHighSValueAttestation: false;
|
|
31
|
+
injectUnrecoverableSignatureAttestation: false;
|
|
32
|
+
fishermanMode: false;
|
|
33
|
+
shuffleAttestationOrdering: false;
|
|
34
|
+
skipPushProposedBlocksToArchiver: false;
|
|
35
|
+
skipPublishingCheckpointsPercent: number;
|
|
36
|
+
};
|
|
7
37
|
/**
|
|
8
38
|
* Configuration settings for the SequencerClient.
|
|
9
39
|
*/
|
|
10
|
-
export type SequencerClientConfig =
|
|
40
|
+
export type SequencerClientConfig = SequencerPublisherConfig & KeyStoreConfig & ValidatorClientConfig & SequencerTxSenderConfig & SequencerConfig & L1ReaderConfig & ChainConfig & Pick<P2PConfig, 'txPublicSetupAllowListExtend'> & Pick<L1ContractsConfig, 'ethereumSlotDuration' | 'aztecSlotDuration' | 'aztecEpochDuration'>;
|
|
11
41
|
export declare const sequencerConfigMappings: ConfigMappingsType<SequencerConfig>;
|
|
12
42
|
export declare const sequencerClientConfigMappings: ConfigMappingsType<SequencerClientConfig>;
|
|
13
43
|
/**
|
|
14
44
|
* Creates an instance of SequencerClientConfig out of environment variables using sensible defaults for integration testing if not set.
|
|
15
45
|
*/
|
|
16
46
|
export declare function getConfigEnvVars(): SequencerClientConfig;
|
|
17
|
-
|
|
18
|
-
* Parses a string to a list of allowed elements.
|
|
19
|
-
* Each encoded is expected to be of one of the following formats
|
|
20
|
-
* `I:${address}`
|
|
21
|
-
* `I:${address}:${selector}`
|
|
22
|
-
* `C:${classId}`
|
|
23
|
-
* `C:${classId}:${selector}`
|
|
24
|
-
*
|
|
25
|
-
* @param value The string to parse
|
|
26
|
-
* @returns A list of allowed elements
|
|
27
|
-
*/
|
|
28
|
-
export declare function parseSequencerAllowList(value: string): AllowedElement[];
|
|
29
|
-
//# sourceMappingURL=config.d.ts.map
|
|
47
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiw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FFLHNCQUFzQixHQUFHLG1CQUFtQixHQUFHLG9CQUFvQixDQUFDLENBQUM7QUFFL0YsZUFBTyxNQUFNLHVCQUF1QixFQUFFLGtCQUFrQixDQUFDLGVBQWUsQ0FtS3ZFLENBQUM7QUFFRixlQUFPLE1BQU0sNkJBQTZCLEVBQUUsa0JBQWtCLENBQUMscUJBQXFCLENBU25GLENBQUM7QUFFRjs7R0FFRztBQUNILHdCQUFnQixnQkFBZ0IsSUFBSSxxQkFBcUIsQ0FFeEQifQ==
|
package/dest/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAA6B,MAAM,wBAAwB,CAAC;AAC3F,OAAO,EAAE,KAAK,cAAc,EAA0B,MAAM,2BAA2B,CAAC;AACxF,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,KAAK,cAAc,EAA0B,MAAM,6BAA6B,CAAC;AAC1F,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,mBAAmB,CAAC;AAEtE,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,eAAe,EAGrB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,KAAK,qBAAqB,EAAiC,MAAM,gCAAgC,CAAC;AAE3G,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAG7B,MAAM,uBAAuB,CAAC;AAE/B,cAAc,uBAAuB,CAAC;AACtC,YAAY,EAAE,eAAe,EAAE,CAAC;AAEhC;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;CAqBA,CAAC;AAEpC;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,wBAAwB,GAC1D,cAAc,GACd,qBAAqB,GACrB,uBAAuB,GACvB,eAAe,GACf,cAAc,GACd,WAAW,GACX,IAAI,CAAC,SAAS,EAAE,8BAA8B,CAAC,GAC/C,IAAI,CAAC,iBAAiB,EAAE,sBAAsB,GAAG,mBAAmB,GAAG,oBAAoB,CAAC,CAAC;AAE/F,eAAO,MAAM,uBAAuB,EAAE,kBAAkB,CAAC,eAAe,CAmKvE,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,kBAAkB,CAAC,qBAAqB,CASnF,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,qBAAqB,CAExD"}
|