@aztec/sequencer-client 0.0.1-commit.9b94fc1 → 0.0.1-commit.9ee6fcc6
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/sequencer-client.d.ts +24 -16
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +73 -32
- package/dest/config.d.ts +35 -9
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +106 -44
- package/dest/global_variable_builder/global_builder.d.ts +27 -14
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +65 -54
- package/dest/global_variable_builder/index.d.ts +2 -2
- package/dest/global_variable_builder/index.d.ts.map +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 +53 -20
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +124 -39
- package/dest/publisher/index.d.ts +2 -1
- package/dest/publisher/index.d.ts.map +1 -1
- 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 +15 -6
- package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-factory.js +28 -3
- package/dest/publisher/sequencer-publisher-metrics.d.ts +3 -3
- package/dest/publisher/sequencer-publisher-metrics.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-metrics.js +23 -86
- package/dest/publisher/sequencer-publisher.d.ts +79 -49
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +932 -155
- package/dest/sequencer/checkpoint_proposal_job.d.ts +108 -0
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_proposal_job.js +1289 -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 +3 -2
- package/dest/sequencer/config.d.ts.map +1 -1
- package/dest/sequencer/events.d.ts +47 -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 +42 -6
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +227 -72
- package/dest/sequencer/sequencer.d.ts +125 -134
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +754 -652
- package/dest/sequencer/timetable.d.ts +54 -16
- package/dest/sequencer/timetable.d.ts.map +1 -1
- package/dest/sequencer/timetable.js +147 -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 +14 -8
- package/dest/sequencer/utils.d.ts.map +1 -1
- package/dest/sequencer/utils.js +7 -4
- package/dest/test/index.d.ts +6 -7
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.d.ts +95 -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 +31 -30
- package/src/client/sequencer-client.ts +97 -55
- package/src/config.ts +124 -53
- package/src/global_variable_builder/global_builder.ts +76 -73
- package/src/global_variable_builder/index.ts +1 -1
- package/src/index.ts +1 -7
- package/src/publisher/config.ts +163 -50
- package/src/publisher/index.ts +3 -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 +43 -10
- package/src/publisher/sequencer-publisher-metrics.ts +19 -71
- package/src/publisher/sequencer-publisher.ts +635 -200
- package/src/sequencer/README.md +531 -0
- package/src/sequencer/checkpoint_proposal_job.ts +1049 -0
- package/src/sequencer/checkpoint_voter.ts +130 -0
- package/src/sequencer/config.ts +2 -1
- package/src/sequencer/events.ts +27 -0
- package/src/sequencer/index.ts +3 -1
- package/src/sequencer/metrics.ts +282 -82
- package/src/sequencer/sequencer.ts +521 -859
- package/src/sequencer/timetable.ts +178 -83
- package/src/sequencer/types.ts +6 -0
- package/src/sequencer/utils.ts +18 -9
- package/src/test/index.ts +5 -6
- package/src/test/mock_checkpoint_builder.ts +323 -0
- package/src/test/utils.ts +167 -0
- package/dest/sequencer/block_builder.d.ts +0 -27
- package/dest/sequencer/block_builder.d.ts.map +0 -1
- package/dest/sequencer/block_builder.js +0 -134
- package/dest/tx_validator/nullifier_cache.d.ts +0 -14
- package/dest/tx_validator/nullifier_cache.d.ts.map +0 -1
- package/dest/tx_validator/nullifier_cache.js +0 -24
- package/dest/tx_validator/tx_validator_factory.d.ts +0 -17
- package/dest/tx_validator/tx_validator_factory.d.ts.map +0 -1
- package/dest/tx_validator/tx_validator_factory.js +0 -53
- package/src/sequencer/block_builder.ts +0 -222
- package/src/tx_validator/nullifier_cache.ts +0 -30
- package/src/tx_validator/tx_validator_factory.ts +0 -132
|
@@ -1,32 +1,26 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BlobClientInterface } from '@aztec/blob-client/client';
|
|
2
|
+
import { MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT } from '@aztec/constants';
|
|
2
3
|
import { EpochCache } from '@aztec/epoch-cache';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
isAnvilTestChain,
|
|
9
|
-
} from '@aztec/ethereum';
|
|
10
|
-
import { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
|
|
4
|
+
import { isAnvilTestChain } from '@aztec/ethereum/chain';
|
|
5
|
+
import { getPublicClient } from '@aztec/ethereum/client';
|
|
6
|
+
import { GovernanceProposerContract, RollupContract } from '@aztec/ethereum/contracts';
|
|
7
|
+
import { type Delayer, L1TxUtils } from '@aztec/ethereum/l1-tx-utils';
|
|
8
|
+
import { PublisherManager } from '@aztec/ethereum/publisher-manager';
|
|
11
9
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
12
10
|
import { createLogger } from '@aztec/foundation/log';
|
|
13
11
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
14
12
|
import type { KeystoreManager } from '@aztec/node-keystore';
|
|
15
13
|
import type { P2P } from '@aztec/p2p';
|
|
16
14
|
import type { SlasherClientInterface } from '@aztec/slasher';
|
|
17
|
-
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
18
|
-
import type {
|
|
19
|
-
IFullNodeBlockBuilder,
|
|
20
|
-
ValidatorClientFullConfig,
|
|
21
|
-
WorldStateSynchronizer,
|
|
22
|
-
} from '@aztec/stdlib/interfaces/server';
|
|
15
|
+
import type { L2BlockSink, L2BlockSource } from '@aztec/stdlib/block';
|
|
16
|
+
import type { ValidatorClientFullConfig, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
23
17
|
import { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
|
|
24
18
|
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
25
19
|
import { L1Metrics, type TelemetryClient } from '@aztec/telemetry-client';
|
|
26
|
-
import { NodeKeystoreAdapter, type ValidatorClient } from '@aztec/validator-client';
|
|
20
|
+
import { FullNodeCheckpointsBuilder, NodeKeystoreAdapter, type ValidatorClient } from '@aztec/validator-client';
|
|
27
21
|
|
|
28
|
-
import type
|
|
29
|
-
import { GlobalVariableBuilder } from '../global_variable_builder/index.js';
|
|
22
|
+
import { type SequencerClientConfig, getPublisherConfigFromSequencerConfig } from '../config.js';
|
|
23
|
+
import type { GlobalVariableBuilder } from '../global_variable_builder/index.js';
|
|
30
24
|
import { SequencerPublisherFactory } from '../publisher/sequencer-publisher-factory.js';
|
|
31
25
|
import { Sequencer, type SequencerConfig } from '../sequencer/index.js';
|
|
32
26
|
|
|
@@ -35,11 +29,12 @@ import { Sequencer, type SequencerConfig } from '../sequencer/index.js';
|
|
|
35
29
|
*/
|
|
36
30
|
export class SequencerClient {
|
|
37
31
|
constructor(
|
|
38
|
-
protected publisherManager: PublisherManager<
|
|
32
|
+
protected publisherManager: PublisherManager<L1TxUtils>,
|
|
39
33
|
protected sequencer: Sequencer,
|
|
40
|
-
protected
|
|
34
|
+
protected checkpointsBuilder: FullNodeCheckpointsBuilder,
|
|
41
35
|
protected validatorClient?: ValidatorClient,
|
|
42
36
|
private l1Metrics?: L1Metrics,
|
|
37
|
+
private delayer_?: Delayer,
|
|
43
38
|
) {}
|
|
44
39
|
|
|
45
40
|
/**
|
|
@@ -57,20 +52,22 @@ export class SequencerClient {
|
|
|
57
52
|
public static async new(
|
|
58
53
|
config: SequencerClientConfig,
|
|
59
54
|
deps: {
|
|
60
|
-
validatorClient: ValidatorClient
|
|
55
|
+
validatorClient: ValidatorClient;
|
|
61
56
|
p2pClient: P2P;
|
|
62
57
|
worldStateSynchronizer: WorldStateSynchronizer;
|
|
63
58
|
slasherClient: SlasherClientInterface | undefined;
|
|
64
|
-
|
|
65
|
-
l2BlockSource: L2BlockSource;
|
|
59
|
+
checkpointsBuilder: FullNodeCheckpointsBuilder;
|
|
60
|
+
l2BlockSource: L2BlockSource & L2BlockSink;
|
|
66
61
|
l1ToL2MessageSource: L1ToL2MessageSource;
|
|
67
62
|
telemetry: TelemetryClient;
|
|
68
63
|
publisherFactory?: SequencerPublisherFactory;
|
|
69
|
-
|
|
64
|
+
blobClient: BlobClientInterface;
|
|
70
65
|
dateProvider: DateProvider;
|
|
71
66
|
epochCache?: EpochCache;
|
|
72
|
-
l1TxUtils:
|
|
67
|
+
l1TxUtils: L1TxUtils[];
|
|
68
|
+
funderL1TxUtils?: L1TxUtils;
|
|
73
69
|
nodeKeyStore: KeystoreManager;
|
|
70
|
+
globalVariableBuilder: GlobalVariableBuilder;
|
|
74
71
|
},
|
|
75
72
|
) {
|
|
76
73
|
const {
|
|
@@ -78,7 +75,7 @@ export class SequencerClient {
|
|
|
78
75
|
p2pClient,
|
|
79
76
|
worldStateSynchronizer,
|
|
80
77
|
slasherClient,
|
|
81
|
-
|
|
78
|
+
checkpointsBuilder,
|
|
82
79
|
l2BlockSource,
|
|
83
80
|
l1ToL2MessageSource,
|
|
84
81
|
telemetry: telemetryClient,
|
|
@@ -92,11 +89,15 @@ export class SequencerClient {
|
|
|
92
89
|
publicClient,
|
|
93
90
|
l1TxUtils.map(x => x.getSenderAddress()),
|
|
94
91
|
);
|
|
95
|
-
const publisherManager = new PublisherManager(l1TxUtils, config)
|
|
92
|
+
const publisherManager = new PublisherManager(l1TxUtils, getPublisherConfigFromSequencerConfig(config), {
|
|
93
|
+
bindings: log.getBindings(),
|
|
94
|
+
funder: deps.funderL1TxUtils,
|
|
95
|
+
});
|
|
96
96
|
const rollupContract = new RollupContract(publicClient, config.l1Contracts.rollupAddress.toString());
|
|
97
|
-
const [l1GenesisTime, slotDuration] = await Promise.all([
|
|
97
|
+
const [l1GenesisTime, slotDuration, rollupManaLimit] = await Promise.all([
|
|
98
98
|
rollupContract.getL1GenesisTime(),
|
|
99
99
|
rollupContract.getSlotDuration(),
|
|
100
|
+
rollupContract.getManaLimit().then(Number),
|
|
100
101
|
] as const);
|
|
101
102
|
|
|
102
103
|
const governanceProposerContract = new GovernanceProposerContract(
|
|
@@ -112,6 +113,7 @@ export class SequencerClient {
|
|
|
112
113
|
l1ChainId: chainId,
|
|
113
114
|
viemPollingIntervalMS: config.viemPollingIntervalMS,
|
|
114
115
|
ethereumSlotDuration: config.ethereumSlotDuration,
|
|
116
|
+
enableProposerPipelining: config.enableProposerPipelining,
|
|
115
117
|
},
|
|
116
118
|
{ dateProvider: deps.dateProvider },
|
|
117
119
|
));
|
|
@@ -125,7 +127,7 @@ export class SequencerClient {
|
|
|
125
127
|
deps.publisherFactory ??
|
|
126
128
|
new SequencerPublisherFactory(config, {
|
|
127
129
|
telemetry: telemetryClient,
|
|
128
|
-
|
|
130
|
+
blobClient: deps.blobClient,
|
|
129
131
|
epochCache,
|
|
130
132
|
governanceProposerContract,
|
|
131
133
|
slashFactoryContract,
|
|
@@ -135,33 +137,22 @@ export class SequencerClient {
|
|
|
135
137
|
nodeKeyStore: NodeKeystoreAdapter.fromKeyStoreManager(deps.nodeKeyStore),
|
|
136
138
|
logger: log,
|
|
137
139
|
});
|
|
138
|
-
const globalsBuilder = new GlobalVariableBuilder(config);
|
|
139
140
|
|
|
140
141
|
const ethereumSlotDuration = config.ethereumSlotDuration;
|
|
141
142
|
|
|
142
|
-
const
|
|
143
|
-
let sequencerManaLimit = config.maxL2BlockGas ?? rollupManaLimit;
|
|
144
|
-
if (sequencerManaLimit > rollupManaLimit) {
|
|
145
|
-
log.warn(
|
|
146
|
-
`Provided maxL2BlockGas of ${sequencerManaLimit} is greater than the maximum allowed by the L1 (${rollupManaLimit}), setting limit to ${rollupManaLimit}`,
|
|
147
|
-
);
|
|
148
|
-
sequencerManaLimit = rollupManaLimit;
|
|
149
|
-
}
|
|
143
|
+
const globalsBuilder = deps.globalVariableBuilder;
|
|
150
144
|
|
|
151
145
|
// When running in anvil, assume we can post a tx up until one second before the end of an L1 slot.
|
|
152
|
-
// Otherwise,
|
|
153
|
-
// maxL1TxInclusionTimeIntoSlot of zero) to get the tx into that L1 slot.
|
|
146
|
+
// Otherwise, we need the full L1 slot duration for publishing to ensure inclusion.
|
|
154
147
|
// In theory, the L1 slot has an initial 4s phase where the block is propagated, so we could
|
|
155
|
-
//
|
|
148
|
+
// reduce the publishing time allowance. However, we prefer being conservative.
|
|
156
149
|
// See https://www.blocknative.com/blog/anatomy-of-a-slot#7 for more info.
|
|
157
|
-
const
|
|
158
|
-
const
|
|
150
|
+
const l1PublishingTimeBasedOnChain = isAnvilTestChain(config.l1ChainId) ? 1 : ethereumSlotDuration;
|
|
151
|
+
const l1PublishingTime = config.l1PublishingTime ?? l1PublishingTimeBasedOnChain;
|
|
159
152
|
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
ethereumSlotDuration,
|
|
164
|
-
};
|
|
153
|
+
const { maxL2BlockGas, maxDABlockGas, maxTxsPerBlock } = capPerBlockLimits(config, rollupManaLimit, log);
|
|
154
|
+
|
|
155
|
+
const l1Constants = { l1GenesisTime, slotDuration: Number(slotDuration), ethereumSlotDuration, rollupManaLimit };
|
|
165
156
|
|
|
166
157
|
const sequencer = new Sequencer(
|
|
167
158
|
publisherFactory,
|
|
@@ -172,19 +163,22 @@ export class SequencerClient {
|
|
|
172
163
|
slasherClient,
|
|
173
164
|
l2BlockSource,
|
|
174
165
|
l1ToL2MessageSource,
|
|
175
|
-
|
|
166
|
+
checkpointsBuilder,
|
|
176
167
|
l1Constants,
|
|
177
168
|
deps.dateProvider,
|
|
178
169
|
epochCache,
|
|
179
170
|
rollupContract,
|
|
180
|
-
{ ...config,
|
|
171
|
+
{ ...config, l1PublishingTime, maxL2BlockGas, maxDABlockGas, maxTxsPerBlock },
|
|
181
172
|
telemetryClient,
|
|
182
173
|
log,
|
|
183
174
|
);
|
|
184
175
|
|
|
185
|
-
|
|
176
|
+
sequencer.init();
|
|
177
|
+
|
|
178
|
+
// Extract the shared delayer from the first L1TxUtils instance (all instances share the same delayer)
|
|
179
|
+
const delayer = l1TxUtils[0]?.delayer;
|
|
186
180
|
|
|
187
|
-
return new SequencerClient(publisherManager, sequencer,
|
|
181
|
+
return new SequencerClient(publisherManager, sequencer, checkpointsBuilder, validatorClient, l1Metrics, delayer);
|
|
188
182
|
}
|
|
189
183
|
|
|
190
184
|
/**
|
|
@@ -193,7 +187,7 @@ export class SequencerClient {
|
|
|
193
187
|
*/
|
|
194
188
|
public updateConfig(config: SequencerConfig & Partial<ValidatorClientFullConfig>) {
|
|
195
189
|
this.sequencer.updateConfig(config);
|
|
196
|
-
this.
|
|
190
|
+
this.checkpointsBuilder.updateConfig(config);
|
|
197
191
|
this.validatorClient?.updateConfig(config);
|
|
198
192
|
}
|
|
199
193
|
|
|
@@ -202,7 +196,7 @@ export class SequencerClient {
|
|
|
202
196
|
await this.validatorClient?.start();
|
|
203
197
|
this.sequencer.start();
|
|
204
198
|
this.l1Metrics?.start();
|
|
205
|
-
await this.publisherManager.
|
|
199
|
+
await this.publisherManager.start();
|
|
206
200
|
}
|
|
207
201
|
|
|
208
202
|
/**
|
|
@@ -211,7 +205,7 @@ export class SequencerClient {
|
|
|
211
205
|
public async stop() {
|
|
212
206
|
await this.sequencer.stop();
|
|
213
207
|
await this.validatorClient?.stop();
|
|
214
|
-
this.publisherManager.
|
|
208
|
+
await this.publisherManager.stop();
|
|
215
209
|
this.l1Metrics?.stop();
|
|
216
210
|
}
|
|
217
211
|
|
|
@@ -219,6 +213,16 @@ export class SequencerClient {
|
|
|
219
213
|
return this.sequencer;
|
|
220
214
|
}
|
|
221
215
|
|
|
216
|
+
/** Updates the publisher factory's node keystore adapter after a keystore reload. */
|
|
217
|
+
public updatePublisherNodeKeyStore(adapter: NodeKeystoreAdapter): void {
|
|
218
|
+
this.sequencer.updatePublisherNodeKeyStore(adapter);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/** Returns the shared tx delayer for sequencer L1 txs, if enabled. Test-only. */
|
|
222
|
+
getDelayer(): Delayer | undefined {
|
|
223
|
+
return this.delayer_;
|
|
224
|
+
}
|
|
225
|
+
|
|
222
226
|
get validatorAddresses(): EthAddress[] | undefined {
|
|
223
227
|
return this.sequencer.getValidatorAddresses();
|
|
224
228
|
}
|
|
@@ -227,3 +231,41 @@ export class SequencerClient {
|
|
|
227
231
|
return this.sequencer.maxL2BlockGas;
|
|
228
232
|
}
|
|
229
233
|
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Caps operator-provided per-block limits at checkpoint-level limits.
|
|
237
|
+
* Returns undefined for any limit the operator didn't set — the checkpoint builder handles redistribution.
|
|
238
|
+
*/
|
|
239
|
+
function capPerBlockLimits(
|
|
240
|
+
config: SequencerClientConfig,
|
|
241
|
+
rollupManaLimit: number,
|
|
242
|
+
log: ReturnType<typeof createLogger>,
|
|
243
|
+
): { maxL2BlockGas: number | undefined; maxDABlockGas: number | undefined; maxTxsPerBlock: number | undefined } {
|
|
244
|
+
let maxL2BlockGas = config.maxL2BlockGas;
|
|
245
|
+
if (maxL2BlockGas !== undefined && maxL2BlockGas > rollupManaLimit) {
|
|
246
|
+
log.warn(`Provided MAX_L2_BLOCK_GAS ${maxL2BlockGas} exceeds rollup mana limit ${rollupManaLimit} (capping)`);
|
|
247
|
+
maxL2BlockGas = rollupManaLimit;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
let maxDABlockGas = config.maxDABlockGas;
|
|
251
|
+
if (maxDABlockGas !== undefined && maxDABlockGas > MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT) {
|
|
252
|
+
log.warn(
|
|
253
|
+
`Provided MAX_DA_BLOCK_GAS ${maxDABlockGas} exceeds DA checkpoint limit ${MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT} (capping)`,
|
|
254
|
+
);
|
|
255
|
+
maxDABlockGas = MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
let maxTxsPerBlock = config.maxTxsPerBlock;
|
|
259
|
+
if (
|
|
260
|
+
maxTxsPerBlock !== undefined &&
|
|
261
|
+
config.maxTxsPerCheckpoint !== undefined &&
|
|
262
|
+
maxTxsPerBlock > config.maxTxsPerCheckpoint
|
|
263
|
+
) {
|
|
264
|
+
log.warn(
|
|
265
|
+
`Provided MAX_TX_PER_BLOCK ${maxTxsPerBlock} exceeds MAX_TX_PER_CHECKPOINT ${config.maxTxsPerCheckpoint} (capping)`,
|
|
266
|
+
);
|
|
267
|
+
maxTxsPerBlock = config.maxTxsPerCheckpoint;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return { maxL2BlockGas, maxDABlockGas, maxTxsPerBlock };
|
|
271
|
+
}
|
package/src/config.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
type L1ReaderConfig,
|
|
4
|
-
l1ContractsConfigMappings,
|
|
5
|
-
l1ReaderConfigMappings,
|
|
6
|
-
} from '@aztec/ethereum';
|
|
1
|
+
import { type L1ContractsConfig, l1ContractsConfigMappings } from '@aztec/ethereum/config';
|
|
2
|
+
import { type L1ReaderConfig, l1ReaderConfigMappings } from '@aztec/ethereum/l1-reader';
|
|
7
3
|
import {
|
|
8
4
|
type ConfigMappingsType,
|
|
9
5
|
booleanConfigHelper,
|
|
@@ -12,67 +8,119 @@ import {
|
|
|
12
8
|
pickConfigMappings,
|
|
13
9
|
} from '@aztec/foundation/config';
|
|
14
10
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
15
|
-
import { type KeyStoreConfig, keyStoreConfigMappings } from '@aztec/node-keystore';
|
|
16
|
-
import { type P2PConfig, p2pConfigMappings } from '@aztec/p2p';
|
|
11
|
+
import { type KeyStoreConfig, keyStoreConfigMappings } from '@aztec/node-keystore/config';
|
|
12
|
+
import { type P2PConfig, p2pConfigMappings } from '@aztec/p2p/config';
|
|
17
13
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
18
|
-
import {
|
|
19
|
-
|
|
14
|
+
import {
|
|
15
|
+
type ChainConfig,
|
|
16
|
+
type PipelineConfig,
|
|
17
|
+
type SequencerConfig,
|
|
18
|
+
chainConfigMappings,
|
|
19
|
+
pipelineConfigMappings,
|
|
20
|
+
sharedSequencerConfigMappings,
|
|
21
|
+
} from '@aztec/stdlib/config';
|
|
22
|
+
import type { ResolvedSequencerConfig } from '@aztec/stdlib/interfaces/server';
|
|
23
|
+
import { DEFAULT_P2P_PROPAGATION_TIME } from '@aztec/stdlib/timetable';
|
|
24
|
+
import { type ValidatorClientConfig, validatorClientConfigMappings } from '@aztec/validator-client/config';
|
|
20
25
|
|
|
21
26
|
import {
|
|
22
|
-
type
|
|
23
|
-
type
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
type SequencerPublisherConfig,
|
|
28
|
+
type SequencerTxSenderConfig,
|
|
29
|
+
sequencerPublisherConfigMappings,
|
|
30
|
+
sequencerTxSenderConfigMappings,
|
|
26
31
|
} from './publisher/config.js';
|
|
27
32
|
|
|
28
33
|
export * from './publisher/config.js';
|
|
29
34
|
export type { SequencerConfig };
|
|
30
35
|
|
|
31
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Default values for SequencerConfig.
|
|
38
|
+
* Centralized location for all sequencer configuration defaults.
|
|
39
|
+
*/
|
|
40
|
+
export const DefaultSequencerConfig = {
|
|
41
|
+
sequencerPollingIntervalMS: 500,
|
|
42
|
+
minTxsPerBlock: 1,
|
|
43
|
+
buildCheckpointIfEmpty: false,
|
|
44
|
+
publishTxsWithProposals: false,
|
|
45
|
+
perBlockAllocationMultiplier: 1.2,
|
|
46
|
+
redistributeCheckpointBudget: true,
|
|
47
|
+
enforceTimeTable: true,
|
|
48
|
+
attestationPropagationTime: DEFAULT_P2P_PROPAGATION_TIME,
|
|
49
|
+
secondsBeforeInvalidatingBlockAsCommitteeMember: 144, // 12 L1 blocks
|
|
50
|
+
secondsBeforeInvalidatingBlockAsNonCommitteeMember: 432, // 36 L1 blocks
|
|
51
|
+
skipCollectingAttestations: false,
|
|
52
|
+
skipInvalidateBlockAsProposer: false,
|
|
53
|
+
broadcastInvalidBlockProposal: false,
|
|
54
|
+
injectFakeAttestation: false,
|
|
55
|
+
injectHighSValueAttestation: false,
|
|
56
|
+
injectUnrecoverableSignatureAttestation: false,
|
|
57
|
+
fishermanMode: false,
|
|
58
|
+
shuffleAttestationOrdering: false,
|
|
59
|
+
skipPushProposedBlocksToArchiver: false,
|
|
60
|
+
skipPublishingCheckpointsPercent: 0,
|
|
61
|
+
} satisfies ResolvedSequencerConfig;
|
|
32
62
|
|
|
33
63
|
/**
|
|
34
64
|
* Configuration settings for the SequencerClient.
|
|
35
65
|
*/
|
|
36
|
-
export type SequencerClientConfig =
|
|
66
|
+
export type SequencerClientConfig = SequencerPublisherConfig &
|
|
37
67
|
KeyStoreConfig &
|
|
38
68
|
ValidatorClientConfig &
|
|
39
|
-
|
|
69
|
+
SequencerTxSenderConfig &
|
|
40
70
|
SequencerConfig &
|
|
41
71
|
L1ReaderConfig &
|
|
42
72
|
ChainConfig &
|
|
43
|
-
|
|
73
|
+
PipelineConfig &
|
|
74
|
+
Pick<P2PConfig, 'txPublicSetupAllowListExtend'> &
|
|
44
75
|
Pick<L1ContractsConfig, 'ethereumSlotDuration' | 'aztecSlotDuration' | 'aztecEpochDuration'>;
|
|
45
76
|
|
|
46
77
|
export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
47
|
-
|
|
48
|
-
env: '
|
|
49
|
-
description: 'The number of ms to wait between polling for
|
|
50
|
-
...numberConfigHelper(
|
|
78
|
+
sequencerPollingIntervalMS: {
|
|
79
|
+
env: 'SEQ_POLLING_INTERVAL_MS',
|
|
80
|
+
description: 'The number of ms to wait between polling for checking to build on the next slot.',
|
|
81
|
+
...numberConfigHelper(DefaultSequencerConfig.sequencerPollingIntervalMS),
|
|
51
82
|
},
|
|
52
|
-
|
|
53
|
-
env: '
|
|
54
|
-
description: 'The maximum number of txs
|
|
55
|
-
|
|
83
|
+
maxTxsPerCheckpoint: {
|
|
84
|
+
env: 'SEQ_MAX_TX_PER_CHECKPOINT',
|
|
85
|
+
description: 'The maximum number of txs across all blocks in a checkpoint.',
|
|
86
|
+
parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
|
|
56
87
|
},
|
|
57
88
|
minTxsPerBlock: {
|
|
58
89
|
env: 'SEQ_MIN_TX_PER_BLOCK',
|
|
59
90
|
description: 'The minimum number of txs to include in a block.',
|
|
60
|
-
...numberConfigHelper(
|
|
91
|
+
...numberConfigHelper(DefaultSequencerConfig.minTxsPerBlock),
|
|
92
|
+
},
|
|
93
|
+
minValidTxsPerBlock: {
|
|
94
|
+
description:
|
|
95
|
+
'The minimum number of valid txs (after execution) to include in a block. If not set, falls back to minTxsPerBlock.',
|
|
61
96
|
},
|
|
62
97
|
publishTxsWithProposals: {
|
|
63
98
|
env: 'SEQ_PUBLISH_TXS_WITH_PROPOSALS',
|
|
64
99
|
description: 'Whether to publish txs with proposals.',
|
|
65
|
-
...booleanConfigHelper(
|
|
100
|
+
...booleanConfigHelper(DefaultSequencerConfig.publishTxsWithProposals),
|
|
66
101
|
},
|
|
67
102
|
maxL2BlockGas: {
|
|
68
103
|
env: 'SEQ_MAX_L2_BLOCK_GAS',
|
|
69
104
|
description: 'The maximum L2 block gas.',
|
|
70
|
-
|
|
105
|
+
parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
|
|
71
106
|
},
|
|
72
107
|
maxDABlockGas: {
|
|
73
108
|
env: 'SEQ_MAX_DA_BLOCK_GAS',
|
|
74
109
|
description: 'The maximum DA block gas.',
|
|
75
|
-
|
|
110
|
+
parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
|
|
111
|
+
},
|
|
112
|
+
perBlockAllocationMultiplier: {
|
|
113
|
+
env: 'SEQ_PER_BLOCK_ALLOCATION_MULTIPLIER',
|
|
114
|
+
description:
|
|
115
|
+
'Per-block gas budget multiplier for both L2 and DA gas. Budget per block is (checkpointLimit / maxBlocks) * multiplier.' +
|
|
116
|
+
' Values greater than one allow early blocks to use more than their even share, relying on checkpoint-level capping for later blocks.',
|
|
117
|
+
...numberConfigHelper(DefaultSequencerConfig.perBlockAllocationMultiplier),
|
|
118
|
+
},
|
|
119
|
+
redistributeCheckpointBudget: {
|
|
120
|
+
env: 'SEQ_REDISTRIBUTE_CHECKPOINT_BUDGET',
|
|
121
|
+
description:
|
|
122
|
+
'Redistribute remaining checkpoint budget evenly across remaining blocks instead of allowing a single block to consume the entire remaining budget.',
|
|
123
|
+
...booleanConfigHelper(DefaultSequencerConfig.redistributeCheckpointBudget),
|
|
76
124
|
},
|
|
77
125
|
coinbase: {
|
|
78
126
|
env: 'COINBASE',
|
|
@@ -92,78 +140,100 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
92
140
|
env: 'ACVM_BINARY_PATH',
|
|
93
141
|
description: 'The path to the ACVM binary',
|
|
94
142
|
},
|
|
95
|
-
maxBlockSizeInBytes: {
|
|
96
|
-
env: 'SEQ_MAX_BLOCK_SIZE_IN_BYTES',
|
|
97
|
-
description: 'Max block size',
|
|
98
|
-
...numberConfigHelper(1024 * 1024),
|
|
99
|
-
},
|
|
100
143
|
enforceTimeTable: {
|
|
101
144
|
env: 'SEQ_ENFORCE_TIME_TABLE',
|
|
102
145
|
description: 'Whether to enforce the time table when building blocks',
|
|
103
|
-
...booleanConfigHelper(),
|
|
104
|
-
defaultValue: true,
|
|
146
|
+
...booleanConfigHelper(DefaultSequencerConfig.enforceTimeTable),
|
|
105
147
|
},
|
|
106
148
|
governanceProposerPayload: {
|
|
107
149
|
env: 'GOVERNANCE_PROPOSER_PAYLOAD_ADDRESS',
|
|
108
150
|
description: 'The address of the payload for the governanceProposer',
|
|
109
151
|
parseEnv: (val: string) => EthAddress.fromString(val),
|
|
110
|
-
defaultValue: EthAddress.ZERO,
|
|
111
152
|
},
|
|
112
|
-
|
|
113
|
-
env: '
|
|
114
|
-
description: 'How
|
|
153
|
+
l1PublishingTime: {
|
|
154
|
+
env: 'SEQ_L1_PUBLISHING_TIME_ALLOWANCE_IN_SLOT',
|
|
155
|
+
description: 'How much time (in seconds) we allow in the slot for publishing the L1 tx (defaults to 1 L1 slot).',
|
|
115
156
|
parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
|
|
116
157
|
},
|
|
117
158
|
attestationPropagationTime: {
|
|
118
159
|
env: 'SEQ_ATTESTATION_PROPAGATION_TIME',
|
|
119
160
|
description: 'How many seconds it takes for proposals and attestations to travel across the p2p layer (one-way)',
|
|
120
|
-
...numberConfigHelper(
|
|
161
|
+
...numberConfigHelper(DefaultSequencerConfig.attestationPropagationTime),
|
|
121
162
|
},
|
|
122
163
|
fakeProcessingDelayPerTxMs: {
|
|
123
164
|
description: 'Used for testing to introduce a fake delay after processing each tx',
|
|
124
165
|
},
|
|
166
|
+
fakeThrowAfterProcessingTxCount: {
|
|
167
|
+
description: 'Used for testing to throw an error after processing N txs',
|
|
168
|
+
},
|
|
125
169
|
secondsBeforeInvalidatingBlockAsCommitteeMember: {
|
|
126
170
|
env: 'SEQ_SECONDS_BEFORE_INVALIDATING_BLOCK_AS_COMMITTEE_MEMBER',
|
|
127
171
|
description:
|
|
128
172
|
'How many seconds to wait before trying to invalidate a block from the pending chain as a committee member (zero to never invalidate).' +
|
|
129
173
|
' The next proposer is expected to invalidate, so the committee acts as a fallback.',
|
|
130
|
-
...numberConfigHelper(
|
|
174
|
+
...numberConfigHelper(DefaultSequencerConfig.secondsBeforeInvalidatingBlockAsCommitteeMember),
|
|
131
175
|
},
|
|
132
176
|
secondsBeforeInvalidatingBlockAsNonCommitteeMember: {
|
|
133
177
|
env: 'SEQ_SECONDS_BEFORE_INVALIDATING_BLOCK_AS_NON_COMMITTEE_MEMBER',
|
|
134
178
|
description:
|
|
135
179
|
'How many seconds to wait before trying to invalidate a block from the pending chain as a non-committee member (zero to never invalidate).' +
|
|
136
180
|
' The next proposer is expected to invalidate, then the committee, so other sequencers act as a fallback.',
|
|
137
|
-
...numberConfigHelper(
|
|
181
|
+
...numberConfigHelper(DefaultSequencerConfig.secondsBeforeInvalidatingBlockAsNonCommitteeMember),
|
|
138
182
|
},
|
|
139
183
|
skipCollectingAttestations: {
|
|
140
184
|
description:
|
|
141
185
|
'Whether to skip collecting attestations from validators and only use self-attestations (for testing only)',
|
|
142
|
-
...booleanConfigHelper(
|
|
186
|
+
...booleanConfigHelper(DefaultSequencerConfig.skipCollectingAttestations),
|
|
143
187
|
},
|
|
144
188
|
skipInvalidateBlockAsProposer: {
|
|
145
189
|
description: 'Do not invalidate the previous block if invalid when we are the proposer (for testing only)',
|
|
146
|
-
...booleanConfigHelper(
|
|
190
|
+
...booleanConfigHelper(DefaultSequencerConfig.skipInvalidateBlockAsProposer),
|
|
147
191
|
},
|
|
148
192
|
broadcastInvalidBlockProposal: {
|
|
149
193
|
description: 'Broadcast invalid block proposals with corrupted state (for testing only)',
|
|
150
|
-
...booleanConfigHelper(
|
|
194
|
+
...booleanConfigHelper(DefaultSequencerConfig.broadcastInvalidBlockProposal),
|
|
151
195
|
},
|
|
152
196
|
injectFakeAttestation: {
|
|
153
197
|
description: 'Inject a fake attestation (for testing only)',
|
|
154
|
-
...booleanConfigHelper(
|
|
198
|
+
...booleanConfigHelper(DefaultSequencerConfig.injectFakeAttestation),
|
|
199
|
+
},
|
|
200
|
+
injectHighSValueAttestation: {
|
|
201
|
+
description: 'Inject a malleable attestation with a high-s value (for testing only)',
|
|
202
|
+
...booleanConfigHelper(DefaultSequencerConfig.injectHighSValueAttestation),
|
|
203
|
+
},
|
|
204
|
+
injectUnrecoverableSignatureAttestation: {
|
|
205
|
+
description: 'Inject an attestation with an unrecoverable signature (for testing only)',
|
|
206
|
+
...booleanConfigHelper(DefaultSequencerConfig.injectUnrecoverableSignatureAttestation),
|
|
155
207
|
},
|
|
156
208
|
fishermanMode: {
|
|
157
209
|
env: 'FISHERMAN_MODE',
|
|
158
210
|
description:
|
|
159
211
|
'Whether to run in fisherman mode: builds blocks on every slot for validation without publishing to L1',
|
|
160
|
-
...booleanConfigHelper(
|
|
212
|
+
...booleanConfigHelper(DefaultSequencerConfig.fishermanMode),
|
|
161
213
|
},
|
|
162
214
|
shuffleAttestationOrdering: {
|
|
163
215
|
description: 'Shuffle attestation ordering to create invalid ordering (for testing only)',
|
|
164
|
-
...booleanConfigHelper(
|
|
216
|
+
...booleanConfigHelper(DefaultSequencerConfig.shuffleAttestationOrdering),
|
|
217
|
+
},
|
|
218
|
+
...sharedSequencerConfigMappings,
|
|
219
|
+
buildCheckpointIfEmpty: {
|
|
220
|
+
env: 'SEQ_BUILD_CHECKPOINT_IF_EMPTY',
|
|
221
|
+
description: 'Have sequencer build and publish an empty checkpoint if there are no txs',
|
|
222
|
+
...booleanConfigHelper(DefaultSequencerConfig.buildCheckpointIfEmpty),
|
|
223
|
+
},
|
|
224
|
+
skipPushProposedBlocksToArchiver: {
|
|
225
|
+
description: 'Skip pushing proposed blocks to archiver (default: true)',
|
|
226
|
+
...booleanConfigHelper(DefaultSequencerConfig.skipPushProposedBlocksToArchiver),
|
|
227
|
+
},
|
|
228
|
+
minBlocksForCheckpoint: {
|
|
229
|
+
description: 'Minimum number of blocks required for a checkpoint proposal (test only)',
|
|
230
|
+
},
|
|
231
|
+
skipPublishingCheckpointsPercent: {
|
|
232
|
+
env: 'SEQ_SKIP_CHECKPOINT_PUBLISH_PERCENT',
|
|
233
|
+
description: 'Percent probability (0 - 100) of sequencer skipping checkpoint publishing (testing only)',
|
|
234
|
+
...numberConfigHelper(DefaultSequencerConfig.skipPublishingCheckpointsPercent),
|
|
165
235
|
},
|
|
166
|
-
...pickConfigMappings(p2pConfigMappings, ['
|
|
236
|
+
...pickConfigMappings(p2pConfigMappings, ['txPublicSetupAllowListExtend']),
|
|
167
237
|
};
|
|
168
238
|
|
|
169
239
|
export const sequencerClientConfigMappings: ConfigMappingsType<SequencerClientConfig> = {
|
|
@@ -171,9 +241,10 @@ export const sequencerClientConfigMappings: ConfigMappingsType<SequencerClientCo
|
|
|
171
241
|
...sequencerConfigMappings,
|
|
172
242
|
...keyStoreConfigMappings,
|
|
173
243
|
...l1ReaderConfigMappings,
|
|
174
|
-
...
|
|
175
|
-
...
|
|
244
|
+
...sequencerTxSenderConfigMappings,
|
|
245
|
+
...sequencerPublisherConfigMappings,
|
|
176
246
|
...chainConfigMappings,
|
|
247
|
+
...pipelineConfigMappings,
|
|
177
248
|
...pickConfigMappings(l1ContractsConfigMappings, ['ethereumSlotDuration', 'aztecSlotDuration', 'aztecEpochDuration']),
|
|
178
249
|
};
|
|
179
250
|
|