@aztec/sequencer-client 0.0.1-commit.b655e406 → 0.0.1-commit.b9865e97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +281 -21
- package/dest/client/index.d.ts +1 -1
- package/dest/client/sequencer-client.d.ts +26 -16
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +78 -37
- package/dest/config.d.ts +37 -8
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +139 -48
- package/dest/global_variable_builder/fee_predictor.d.ts +37 -0
- package/dest/global_variable_builder/fee_predictor.d.ts.map +1 -0
- package/dest/global_variable_builder/fee_predictor.js +128 -0
- package/dest/global_variable_builder/fee_provider.d.ts +21 -0
- package/dest/global_variable_builder/fee_provider.d.ts.map +1 -0
- package/dest/global_variable_builder/fee_provider.js +58 -0
- package/dest/global_variable_builder/global_builder.d.ts +24 -20
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +44 -65
- package/dest/global_variable_builder/index.d.ts +4 -2
- package/dest/global_variable_builder/index.d.ts.map +1 -1
- package/dest/global_variable_builder/index.js +2 -0
- 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 +55 -20
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +124 -34
- 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 +58 -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-bundle-simulator.d.ts +96 -0
- package/dest/publisher/sequencer-bundle-simulator.d.ts.map +1 -0
- package/dest/publisher/sequencer-bundle-simulator.js +198 -0
- package/dest/publisher/sequencer-publisher-factory.d.ts +15 -8
- package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-factory.js +28 -4
- 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 +137 -97
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +1004 -416
- package/dest/sequencer/automine/automine_factory.d.ts +54 -0
- package/dest/sequencer/automine/automine_factory.d.ts.map +1 -0
- package/dest/sequencer/automine/automine_factory.js +84 -0
- package/dest/sequencer/automine/automine_sequencer.d.ts +151 -0
- package/dest/sequencer/automine/automine_sequencer.d.ts.map +1 -0
- package/dest/sequencer/automine/automine_sequencer.js +509 -0
- package/dest/sequencer/chain_state_overrides.d.ts +61 -0
- package/dest/sequencer/chain_state_overrides.d.ts.map +1 -0
- package/dest/sequencer/chain_state_overrides.js +98 -0
- package/dest/sequencer/checkpoint_proposal_job.d.ts +150 -0
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_proposal_job.js +1793 -0
- package/dest/sequencer/checkpoint_proposal_job_metrics.d.ts +34 -0
- package/dest/sequencer/checkpoint_proposal_job_metrics.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_proposal_job_metrics.js +72 -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 +106 -0
- package/dest/sequencer/config.d.ts +3 -2
- package/dest/sequencer/config.d.ts.map +1 -1
- package/dest/sequencer/errors.d.ts +1 -1
- package/dest/sequencer/errors.d.ts.map +1 -1
- package/dest/sequencer/events.d.ts +92 -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 -4
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +257 -50
- package/dest/sequencer/sequencer.d.ts +175 -144
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +1022 -567
- package/dest/sequencer/timetable.d.ts +64 -16
- package/dest/sequencer/timetable.d.ts.map +1 -1
- package/dest/sequencer/timetable.js +154 -64
- 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 +105 -0
- package/package.json +32 -30
- package/src/client/sequencer-client.ts +105 -60
- package/src/config.ts +163 -57
- package/src/global_variable_builder/README.md +44 -0
- package/src/global_variable_builder/fee_predictor.ts +172 -0
- package/src/global_variable_builder/fee_provider.ts +75 -0
- package/src/global_variable_builder/global_builder.ts +63 -92
- package/src/global_variable_builder/index.ts +3 -1
- package/src/index.ts +5 -2
- package/src/publisher/config.ts +174 -51
- 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 +57 -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-bundle-simulator.ts +254 -0
- package/src/publisher/sequencer-publisher-factory.ts +45 -14
- package/src/publisher/sequencer-publisher-metrics.ts +19 -71
- package/src/publisher/sequencer-publisher.ts +798 -538
- package/src/sequencer/README.md +243 -0
- package/src/sequencer/automine/README.md +46 -0
- package/src/sequencer/automine/automine_factory.ts +145 -0
- package/src/sequencer/automine/automine_sequencer.ts +595 -0
- package/src/sequencer/chain_state_overrides.ts +162 -0
- package/src/sequencer/checkpoint_proposal_job.ts +1633 -0
- package/src/sequencer/checkpoint_proposal_job_metrics.ts +128 -0
- package/src/sequencer/checkpoint_voter.ts +119 -0
- package/src/sequencer/config.ts +2 -1
- package/src/sequencer/events.ts +76 -0
- package/src/sequencer/index.ts +5 -1
- package/src/sequencer/metrics.ts +330 -62
- package/src/sequencer/sequencer.ts +831 -748
- package/src/sequencer/timetable.ts +181 -81
- 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 +185 -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 -130
- 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 -218
- package/src/tx_validator/nullifier_cache.ts +0 -30
- package/src/tx_validator/tx_validator_factory.ts +0 -132
|
@@ -1,32 +1,25 @@
|
|
|
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';
|
|
23
|
-
import { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
|
|
15
|
+
import type { L2BlockSink, L2BlockSource, ProposedCheckpointSink } from '@aztec/stdlib/block';
|
|
16
|
+
import type { ValidatorClientFullConfig, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
24
17
|
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
25
18
|
import { L1Metrics, type TelemetryClient } from '@aztec/telemetry-client';
|
|
26
|
-
import { NodeKeystoreAdapter, type ValidatorClient } from '@aztec/validator-client';
|
|
19
|
+
import { FullNodeCheckpointsBuilder, NodeKeystoreAdapter, type ValidatorClient } from '@aztec/validator-client';
|
|
27
20
|
|
|
28
|
-
import type
|
|
29
|
-
import { GlobalVariableBuilder } from '../global_variable_builder/index.js';
|
|
21
|
+
import { type SequencerClientConfig, getPublisherConfigFromSequencerConfig } from '../config.js';
|
|
22
|
+
import type { GlobalVariableBuilder } from '../global_variable_builder/index.js';
|
|
30
23
|
import { SequencerPublisherFactory } from '../publisher/sequencer-publisher-factory.js';
|
|
31
24
|
import { Sequencer, type SequencerConfig } from '../sequencer/index.js';
|
|
32
25
|
|
|
@@ -35,11 +28,12 @@ import { Sequencer, type SequencerConfig } from '../sequencer/index.js';
|
|
|
35
28
|
*/
|
|
36
29
|
export class SequencerClient {
|
|
37
30
|
constructor(
|
|
38
|
-
protected publisherManager: PublisherManager<
|
|
31
|
+
protected publisherManager: PublisherManager<L1TxUtils>,
|
|
39
32
|
protected sequencer: Sequencer,
|
|
40
|
-
protected
|
|
33
|
+
protected checkpointsBuilder: FullNodeCheckpointsBuilder,
|
|
41
34
|
protected validatorClient?: ValidatorClient,
|
|
42
35
|
private l1Metrics?: L1Metrics,
|
|
36
|
+
private delayer_?: Delayer,
|
|
43
37
|
) {}
|
|
44
38
|
|
|
45
39
|
/**
|
|
@@ -57,20 +51,22 @@ export class SequencerClient {
|
|
|
57
51
|
public static async new(
|
|
58
52
|
config: SequencerClientConfig,
|
|
59
53
|
deps: {
|
|
60
|
-
validatorClient: ValidatorClient
|
|
54
|
+
validatorClient: ValidatorClient;
|
|
61
55
|
p2pClient: P2P;
|
|
62
56
|
worldStateSynchronizer: WorldStateSynchronizer;
|
|
63
57
|
slasherClient: SlasherClientInterface | undefined;
|
|
64
|
-
|
|
65
|
-
l2BlockSource: L2BlockSource;
|
|
58
|
+
checkpointsBuilder: FullNodeCheckpointsBuilder;
|
|
59
|
+
l2BlockSource: L2BlockSource & L2BlockSink & ProposedCheckpointSink;
|
|
66
60
|
l1ToL2MessageSource: L1ToL2MessageSource;
|
|
67
61
|
telemetry: TelemetryClient;
|
|
68
62
|
publisherFactory?: SequencerPublisherFactory;
|
|
69
|
-
|
|
63
|
+
blobClient: BlobClientInterface;
|
|
70
64
|
dateProvider: DateProvider;
|
|
71
65
|
epochCache?: EpochCache;
|
|
72
|
-
l1TxUtils:
|
|
66
|
+
l1TxUtils: L1TxUtils[];
|
|
67
|
+
funderL1TxUtils?: L1TxUtils;
|
|
73
68
|
nodeKeyStore: KeystoreManager;
|
|
69
|
+
globalVariableBuilder: GlobalVariableBuilder;
|
|
74
70
|
},
|
|
75
71
|
) {
|
|
76
72
|
const {
|
|
@@ -78,7 +74,7 @@ export class SequencerClient {
|
|
|
78
74
|
p2pClient,
|
|
79
75
|
worldStateSynchronizer,
|
|
80
76
|
slasherClient,
|
|
81
|
-
|
|
77
|
+
checkpointsBuilder,
|
|
82
78
|
l2BlockSource,
|
|
83
79
|
l1ToL2MessageSource,
|
|
84
80
|
telemetry: telemetryClient,
|
|
@@ -92,21 +88,25 @@ export class SequencerClient {
|
|
|
92
88
|
publicClient,
|
|
93
89
|
l1TxUtils.map(x => x.getSenderAddress()),
|
|
94
90
|
);
|
|
95
|
-
const publisherManager = new PublisherManager(l1TxUtils, config)
|
|
96
|
-
|
|
97
|
-
|
|
91
|
+
const publisherManager = new PublisherManager(l1TxUtils, getPublisherConfigFromSequencerConfig(config), {
|
|
92
|
+
bindings: log.getBindings(),
|
|
93
|
+
funder: deps.funderL1TxUtils,
|
|
94
|
+
});
|
|
95
|
+
const rollupContract = new RollupContract(publicClient, config.rollupAddress.toString());
|
|
96
|
+
const [l1GenesisTime, slotDuration, rollupManaLimit] = await Promise.all([
|
|
98
97
|
rollupContract.getL1GenesisTime(),
|
|
99
98
|
rollupContract.getSlotDuration(),
|
|
99
|
+
rollupContract.getManaLimit().then(Number),
|
|
100
100
|
] as const);
|
|
101
101
|
|
|
102
102
|
const governanceProposerContract = new GovernanceProposerContract(
|
|
103
103
|
publicClient,
|
|
104
|
-
config.
|
|
104
|
+
config.governanceProposerAddress.toString(),
|
|
105
105
|
);
|
|
106
106
|
const epochCache =
|
|
107
107
|
deps.epochCache ??
|
|
108
108
|
(await EpochCache.create(
|
|
109
|
-
config.
|
|
109
|
+
config.rollupAddress,
|
|
110
110
|
{
|
|
111
111
|
l1RpcUrls: rpcUrls,
|
|
112
112
|
l1ChainId: chainId,
|
|
@@ -116,51 +116,40 @@ export class SequencerClient {
|
|
|
116
116
|
{ dateProvider: deps.dateProvider },
|
|
117
117
|
));
|
|
118
118
|
|
|
119
|
-
const slashFactoryContract = new SlashFactoryContract(
|
|
120
|
-
publicClient,
|
|
121
|
-
config.l1Contracts.slashFactoryAddress?.toString() ?? EthAddress.ZERO.toString(),
|
|
122
|
-
);
|
|
123
|
-
|
|
124
119
|
const publisherFactory =
|
|
125
120
|
deps.publisherFactory ??
|
|
126
121
|
new SequencerPublisherFactory(config, {
|
|
127
122
|
telemetry: telemetryClient,
|
|
128
|
-
|
|
123
|
+
blobClient: deps.blobClient,
|
|
129
124
|
epochCache,
|
|
130
125
|
governanceProposerContract,
|
|
131
|
-
slashFactoryContract,
|
|
132
126
|
rollupContract,
|
|
133
127
|
dateProvider: deps.dateProvider,
|
|
134
128
|
publisherManager,
|
|
135
129
|
nodeKeyStore: NodeKeystoreAdapter.fromKeyStoreManager(deps.nodeKeyStore),
|
|
136
130
|
logger: log,
|
|
137
131
|
});
|
|
138
|
-
const globalsBuilder = new GlobalVariableBuilder(config);
|
|
139
132
|
|
|
140
133
|
const ethereumSlotDuration = config.ethereumSlotDuration;
|
|
141
134
|
|
|
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
|
-
}
|
|
135
|
+
const globalsBuilder = deps.globalVariableBuilder;
|
|
150
136
|
|
|
151
137
|
// 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.
|
|
138
|
+
// Otherwise, we need the full L1 slot duration for publishing to ensure inclusion.
|
|
154
139
|
// In theory, the L1 slot has an initial 4s phase where the block is propagated, so we could
|
|
155
|
-
//
|
|
140
|
+
// reduce the publishing time allowance. However, we prefer being conservative.
|
|
156
141
|
// See https://www.blocknative.com/blog/anatomy-of-a-slot#7 for more info.
|
|
157
|
-
const
|
|
158
|
-
|
|
142
|
+
const l1PublishingTimeBasedOnChain = isAnvilTestChain(config.l1ChainId) ? 1 : ethereumSlotDuration;
|
|
143
|
+
const l1PublishingTime = config.l1PublishingTime ?? l1PublishingTimeBasedOnChain;
|
|
144
|
+
|
|
145
|
+
const { maxL2BlockGas, maxDABlockGas, maxTxsPerBlock } = capPerBlockLimits(config, rollupManaLimit, log);
|
|
159
146
|
|
|
160
147
|
const l1Constants = {
|
|
161
148
|
l1GenesisTime,
|
|
162
149
|
slotDuration: Number(slotDuration),
|
|
163
150
|
ethereumSlotDuration,
|
|
151
|
+
rollupManaLimit,
|
|
152
|
+
epochDuration: config.aztecEpochDuration,
|
|
164
153
|
};
|
|
165
154
|
|
|
166
155
|
const sequencer = new Sequencer(
|
|
@@ -172,19 +161,22 @@ export class SequencerClient {
|
|
|
172
161
|
slasherClient,
|
|
173
162
|
l2BlockSource,
|
|
174
163
|
l1ToL2MessageSource,
|
|
175
|
-
|
|
164
|
+
checkpointsBuilder,
|
|
176
165
|
l1Constants,
|
|
177
166
|
deps.dateProvider,
|
|
178
167
|
epochCache,
|
|
179
168
|
rollupContract,
|
|
180
|
-
{ ...config,
|
|
169
|
+
{ ...config, l1PublishingTime, maxL2BlockGas, maxDABlockGas, maxTxsPerBlock },
|
|
181
170
|
telemetryClient,
|
|
182
171
|
log,
|
|
183
172
|
);
|
|
184
173
|
|
|
185
|
-
|
|
174
|
+
sequencer.init();
|
|
175
|
+
|
|
176
|
+
// Extract the shared delayer from the first L1TxUtils instance (all instances share the same delayer)
|
|
177
|
+
const delayer = l1TxUtils[0]?.delayer;
|
|
186
178
|
|
|
187
|
-
return new SequencerClient(publisherManager, sequencer,
|
|
179
|
+
return new SequencerClient(publisherManager, sequencer, checkpointsBuilder, validatorClient, l1Metrics, delayer);
|
|
188
180
|
}
|
|
189
181
|
|
|
190
182
|
/**
|
|
@@ -193,7 +185,7 @@ export class SequencerClient {
|
|
|
193
185
|
*/
|
|
194
186
|
public updateConfig(config: SequencerConfig & Partial<ValidatorClientFullConfig>) {
|
|
195
187
|
this.sequencer.updateConfig(config);
|
|
196
|
-
this.
|
|
188
|
+
this.checkpointsBuilder.updateConfig(config);
|
|
197
189
|
this.validatorClient?.updateConfig(config);
|
|
198
190
|
}
|
|
199
191
|
|
|
@@ -202,7 +194,7 @@ export class SequencerClient {
|
|
|
202
194
|
await this.validatorClient?.start();
|
|
203
195
|
this.sequencer.start();
|
|
204
196
|
this.l1Metrics?.start();
|
|
205
|
-
await this.publisherManager.
|
|
197
|
+
await this.publisherManager.start();
|
|
206
198
|
}
|
|
207
199
|
|
|
208
200
|
/**
|
|
@@ -211,14 +203,29 @@ export class SequencerClient {
|
|
|
211
203
|
public async stop() {
|
|
212
204
|
await this.sequencer.stop();
|
|
213
205
|
await this.validatorClient?.stop();
|
|
214
|
-
this.publisherManager.
|
|
206
|
+
await this.publisherManager.stop();
|
|
215
207
|
this.l1Metrics?.stop();
|
|
216
208
|
}
|
|
217
209
|
|
|
210
|
+
/** Triggers an immediate run of the sequencer, bypassing the polling interval. */
|
|
211
|
+
public trigger() {
|
|
212
|
+
return this.sequencer.trigger();
|
|
213
|
+
}
|
|
214
|
+
|
|
218
215
|
public getSequencer(): Sequencer {
|
|
219
216
|
return this.sequencer;
|
|
220
217
|
}
|
|
221
218
|
|
|
219
|
+
/** Updates the publisher factory's node keystore adapter after a keystore reload. */
|
|
220
|
+
public updatePublisherNodeKeyStore(adapter: NodeKeystoreAdapter): void {
|
|
221
|
+
this.sequencer.updatePublisherNodeKeyStore(adapter);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/** Returns the shared tx delayer for sequencer L1 txs, if enabled. Test-only. */
|
|
225
|
+
getDelayer(): Delayer | undefined {
|
|
226
|
+
return this.delayer_;
|
|
227
|
+
}
|
|
228
|
+
|
|
222
229
|
get validatorAddresses(): EthAddress[] | undefined {
|
|
223
230
|
return this.sequencer.getValidatorAddresses();
|
|
224
231
|
}
|
|
@@ -227,3 +234,41 @@ export class SequencerClient {
|
|
|
227
234
|
return this.sequencer.maxL2BlockGas;
|
|
228
235
|
}
|
|
229
236
|
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Caps operator-provided per-block limits at checkpoint-level limits.
|
|
240
|
+
* Returns undefined for any limit the operator didn't set — the checkpoint builder handles redistribution.
|
|
241
|
+
*/
|
|
242
|
+
function capPerBlockLimits(
|
|
243
|
+
config: SequencerClientConfig,
|
|
244
|
+
rollupManaLimit: number,
|
|
245
|
+
log: ReturnType<typeof createLogger>,
|
|
246
|
+
): { maxL2BlockGas: number | undefined; maxDABlockGas: number | undefined; maxTxsPerBlock: number | undefined } {
|
|
247
|
+
let maxL2BlockGas = config.maxL2BlockGas;
|
|
248
|
+
if (maxL2BlockGas !== undefined && maxL2BlockGas > rollupManaLimit) {
|
|
249
|
+
log.warn(`Provided MAX_L2_BLOCK_GAS ${maxL2BlockGas} exceeds rollup mana limit ${rollupManaLimit} (capping)`);
|
|
250
|
+
maxL2BlockGas = rollupManaLimit;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
let maxDABlockGas = config.maxDABlockGas;
|
|
254
|
+
if (maxDABlockGas !== undefined && maxDABlockGas > MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT) {
|
|
255
|
+
log.warn(
|
|
256
|
+
`Provided MAX_DA_BLOCK_GAS ${maxDABlockGas} exceeds DA checkpoint limit ${MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT} (capping)`,
|
|
257
|
+
);
|
|
258
|
+
maxDABlockGas = MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
let maxTxsPerBlock = config.maxTxsPerBlock;
|
|
262
|
+
if (
|
|
263
|
+
maxTxsPerBlock !== undefined &&
|
|
264
|
+
config.maxTxsPerCheckpoint !== undefined &&
|
|
265
|
+
maxTxsPerBlock > config.maxTxsPerCheckpoint
|
|
266
|
+
) {
|
|
267
|
+
log.warn(
|
|
268
|
+
`Provided MAX_TX_PER_BLOCK ${maxTxsPerBlock} exceeds MAX_TX_PER_CHECKPOINT ${config.maxTxsPerCheckpoint} (capping)`,
|
|
269
|
+
);
|
|
270
|
+
maxTxsPerBlock = config.maxTxsPerCheckpoint;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
return { maxL2BlockGas, maxDABlockGas, maxTxsPerBlock };
|
|
274
|
+
}
|
package/src/config.ts
CHANGED
|
@@ -1,82 +1,132 @@
|
|
|
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,
|
|
10
6
|
getConfigFromMappings,
|
|
11
7
|
numberConfigHelper,
|
|
8
|
+
optionalNumberConfigHelper,
|
|
12
9
|
pickConfigMappings,
|
|
13
10
|
} from '@aztec/foundation/config';
|
|
14
11
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
15
|
-
import { type KeyStoreConfig, keyStoreConfigMappings } from '@aztec/node-keystore';
|
|
16
|
-
import { type P2PConfig, p2pConfigMappings } from '@aztec/p2p';
|
|
12
|
+
import { type KeyStoreConfig, keyStoreConfigMappings } from '@aztec/node-keystore/config';
|
|
13
|
+
import { type P2PConfig, p2pConfigMappings } from '@aztec/p2p/config';
|
|
17
14
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
18
|
-
import {
|
|
19
|
-
|
|
15
|
+
import {
|
|
16
|
+
type ChainConfig,
|
|
17
|
+
DEFAULT_MAX_BLOCKS_PER_CHECKPOINT,
|
|
18
|
+
type SequencerConfig,
|
|
19
|
+
chainConfigMappings,
|
|
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
|
+
skipWaitForValidParentCheckpointOnL1: false,
|
|
54
|
+
broadcastInvalidBlockProposal: false,
|
|
55
|
+
broadcastInvalidCheckpointProposalOnly: false,
|
|
56
|
+
injectFakeAttestation: false,
|
|
57
|
+
injectHighSValueAttestation: false,
|
|
58
|
+
injectUnrecoverableSignatureAttestation: false,
|
|
59
|
+
fishermanMode: false,
|
|
60
|
+
shuffleAttestationOrdering: false,
|
|
61
|
+
skipPushProposedBlocksToArchiver: false,
|
|
62
|
+
skipPublishingCheckpointsPercent: 0,
|
|
63
|
+
maxBlocksPerCheckpoint: DEFAULT_MAX_BLOCKS_PER_CHECKPOINT,
|
|
64
|
+
} satisfies ResolvedSequencerConfig;
|
|
32
65
|
|
|
33
66
|
/**
|
|
34
67
|
* Configuration settings for the SequencerClient.
|
|
35
68
|
*/
|
|
36
|
-
export type SequencerClientConfig =
|
|
69
|
+
export type SequencerClientConfig = SequencerPublisherConfig &
|
|
37
70
|
KeyStoreConfig &
|
|
38
71
|
ValidatorClientConfig &
|
|
39
|
-
|
|
72
|
+
SequencerTxSenderConfig &
|
|
40
73
|
SequencerConfig &
|
|
41
74
|
L1ReaderConfig &
|
|
42
75
|
ChainConfig &
|
|
43
|
-
Pick<P2PConfig, '
|
|
76
|
+
Pick<P2PConfig, 'txPublicSetupAllowListExtend'> &
|
|
44
77
|
Pick<L1ContractsConfig, 'ethereumSlotDuration' | 'aztecSlotDuration' | 'aztecEpochDuration'>;
|
|
45
78
|
|
|
46
79
|
export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
47
|
-
|
|
48
|
-
env: '
|
|
49
|
-
description: 'The number of ms to wait between polling for
|
|
50
|
-
...numberConfigHelper(
|
|
80
|
+
sequencerPollingIntervalMS: {
|
|
81
|
+
env: 'SEQ_POLLING_INTERVAL_MS',
|
|
82
|
+
description: 'The number of ms to wait between polling for checking to build on the next slot.',
|
|
83
|
+
...numberConfigHelper(DefaultSequencerConfig.sequencerPollingIntervalMS),
|
|
51
84
|
},
|
|
52
|
-
|
|
53
|
-
env: '
|
|
54
|
-
description: 'The maximum number of txs
|
|
55
|
-
...
|
|
85
|
+
maxTxsPerCheckpoint: {
|
|
86
|
+
env: 'SEQ_MAX_TX_PER_CHECKPOINT',
|
|
87
|
+
description: 'The maximum number of txs across all blocks in a checkpoint.',
|
|
88
|
+
...optionalNumberConfigHelper(),
|
|
56
89
|
},
|
|
57
90
|
minTxsPerBlock: {
|
|
58
91
|
env: 'SEQ_MIN_TX_PER_BLOCK',
|
|
59
92
|
description: 'The minimum number of txs to include in a block.',
|
|
60
|
-
...numberConfigHelper(
|
|
93
|
+
...numberConfigHelper(DefaultSequencerConfig.minTxsPerBlock),
|
|
94
|
+
},
|
|
95
|
+
minValidTxsPerBlock: {
|
|
96
|
+
description:
|
|
97
|
+
'The minimum number of valid txs (after execution) to include in a block. If not set, falls back to minTxsPerBlock.',
|
|
61
98
|
},
|
|
62
99
|
publishTxsWithProposals: {
|
|
63
100
|
env: 'SEQ_PUBLISH_TXS_WITH_PROPOSALS',
|
|
64
101
|
description: 'Whether to publish txs with proposals.',
|
|
65
|
-
...booleanConfigHelper(
|
|
102
|
+
...booleanConfigHelper(DefaultSequencerConfig.publishTxsWithProposals),
|
|
66
103
|
},
|
|
67
104
|
maxL2BlockGas: {
|
|
68
105
|
env: 'SEQ_MAX_L2_BLOCK_GAS',
|
|
69
106
|
description: 'The maximum L2 block gas.',
|
|
70
|
-
...
|
|
107
|
+
...optionalNumberConfigHelper(),
|
|
71
108
|
},
|
|
72
109
|
maxDABlockGas: {
|
|
73
110
|
env: 'SEQ_MAX_DA_BLOCK_GAS',
|
|
74
111
|
description: 'The maximum DA block gas.',
|
|
75
|
-
...
|
|
112
|
+
...optionalNumberConfigHelper(),
|
|
113
|
+
},
|
|
114
|
+
perBlockAllocationMultiplier: {
|
|
115
|
+
env: 'SEQ_PER_BLOCK_ALLOCATION_MULTIPLIER',
|
|
116
|
+
description:
|
|
117
|
+
'Per-block gas budget multiplier for both L2 and DA gas. Budget per block is (checkpointLimit / maxBlocks) * multiplier.' +
|
|
118
|
+
' Values greater than one allow early blocks to use more than their even share, relying on checkpoint-level capping for later blocks.',
|
|
119
|
+
...numberConfigHelper(DefaultSequencerConfig.perBlockAllocationMultiplier),
|
|
120
|
+
},
|
|
121
|
+
redistributeCheckpointBudget: {
|
|
122
|
+
env: 'SEQ_REDISTRIBUTE_CHECKPOINT_BUDGET',
|
|
123
|
+
description:
|
|
124
|
+
'Redistribute remaining checkpoint budget evenly across remaining blocks instead of allowing a single block to consume the entire remaining budget.',
|
|
125
|
+
...booleanConfigHelper(DefaultSequencerConfig.redistributeCheckpointBudget),
|
|
76
126
|
},
|
|
77
127
|
coinbase: {
|
|
78
128
|
env: 'COINBASE',
|
|
79
|
-
parseEnv: (val: string) =>
|
|
129
|
+
parseEnv: (val: string) => EthAddress.fromString(val),
|
|
80
130
|
description: 'Recipient of block reward.',
|
|
81
131
|
},
|
|
82
132
|
feeRecipient: {
|
|
@@ -92,78 +142,134 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
92
142
|
env: 'ACVM_BINARY_PATH',
|
|
93
143
|
description: 'The path to the ACVM binary',
|
|
94
144
|
},
|
|
95
|
-
maxBlockSizeInBytes: {
|
|
96
|
-
env: 'SEQ_MAX_BLOCK_SIZE_IN_BYTES',
|
|
97
|
-
description: 'Max block size',
|
|
98
|
-
...numberConfigHelper(1024 * 1024),
|
|
99
|
-
},
|
|
100
145
|
enforceTimeTable: {
|
|
101
146
|
env: 'SEQ_ENFORCE_TIME_TABLE',
|
|
102
147
|
description: 'Whether to enforce the time table when building blocks',
|
|
103
|
-
...booleanConfigHelper(),
|
|
104
|
-
defaultValue: true,
|
|
148
|
+
...booleanConfigHelper(DefaultSequencerConfig.enforceTimeTable),
|
|
105
149
|
},
|
|
106
150
|
governanceProposerPayload: {
|
|
107
151
|
env: 'GOVERNANCE_PROPOSER_PAYLOAD_ADDRESS',
|
|
108
152
|
description: 'The address of the payload for the governanceProposer',
|
|
109
153
|
parseEnv: (val: string) => EthAddress.fromString(val),
|
|
110
|
-
defaultValue: EthAddress.ZERO,
|
|
111
154
|
},
|
|
112
|
-
|
|
113
|
-
env: '
|
|
114
|
-
description: 'How
|
|
115
|
-
|
|
116
|
-
},
|
|
117
|
-
attestationPropagationTime: {
|
|
118
|
-
env: 'SEQ_ATTESTATION_PROPAGATION_TIME',
|
|
119
|
-
description: 'How many seconds it takes for proposals and attestations to travel across the p2p layer (one-way)',
|
|
120
|
-
...numberConfigHelper(DEFAULT_ATTESTATION_PROPAGATION_TIME),
|
|
155
|
+
l1PublishingTime: {
|
|
156
|
+
env: 'SEQ_L1_PUBLISHING_TIME_ALLOWANCE_IN_SLOT',
|
|
157
|
+
description: 'How much time (in seconds) we allow in the slot for publishing the L1 tx (defaults to 1 L1 slot).',
|
|
158
|
+
...optionalNumberConfigHelper(),
|
|
121
159
|
},
|
|
122
160
|
fakeProcessingDelayPerTxMs: {
|
|
123
161
|
description: 'Used for testing to introduce a fake delay after processing each tx',
|
|
124
162
|
},
|
|
163
|
+
fakeThrowAfterProcessingTxCount: {
|
|
164
|
+
description: 'Used for testing to throw an error after processing N txs',
|
|
165
|
+
},
|
|
125
166
|
secondsBeforeInvalidatingBlockAsCommitteeMember: {
|
|
126
167
|
env: 'SEQ_SECONDS_BEFORE_INVALIDATING_BLOCK_AS_COMMITTEE_MEMBER',
|
|
127
168
|
description:
|
|
128
169
|
'How many seconds to wait before trying to invalidate a block from the pending chain as a committee member (zero to never invalidate).' +
|
|
129
170
|
' The next proposer is expected to invalidate, so the committee acts as a fallback.',
|
|
130
|
-
...numberConfigHelper(
|
|
171
|
+
...numberConfigHelper(DefaultSequencerConfig.secondsBeforeInvalidatingBlockAsCommitteeMember),
|
|
131
172
|
},
|
|
132
173
|
secondsBeforeInvalidatingBlockAsNonCommitteeMember: {
|
|
133
174
|
env: 'SEQ_SECONDS_BEFORE_INVALIDATING_BLOCK_AS_NON_COMMITTEE_MEMBER',
|
|
134
175
|
description:
|
|
135
176
|
'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
177
|
' The next proposer is expected to invalidate, then the committee, so other sequencers act as a fallback.',
|
|
137
|
-
...numberConfigHelper(
|
|
178
|
+
...numberConfigHelper(DefaultSequencerConfig.secondsBeforeInvalidatingBlockAsNonCommitteeMember),
|
|
138
179
|
},
|
|
139
180
|
skipCollectingAttestations: {
|
|
140
181
|
description:
|
|
141
182
|
'Whether to skip collecting attestations from validators and only use self-attestations (for testing only)',
|
|
142
|
-
...booleanConfigHelper(
|
|
183
|
+
...booleanConfigHelper(DefaultSequencerConfig.skipCollectingAttestations),
|
|
143
184
|
},
|
|
144
185
|
skipInvalidateBlockAsProposer: {
|
|
145
186
|
description: 'Do not invalidate the previous block if invalid when we are the proposer (for testing only)',
|
|
146
|
-
...booleanConfigHelper(
|
|
187
|
+
...booleanConfigHelper(DefaultSequencerConfig.skipInvalidateBlockAsProposer),
|
|
188
|
+
},
|
|
189
|
+
skipWaitForValidParentCheckpointOnL1: {
|
|
190
|
+
description:
|
|
191
|
+
'Bypass the parent checkpoint validity check before submitting a pipelined checkpoint, ' +
|
|
192
|
+
'allowing the proposer to publish even when the parent landed on L1 with invalid attestations (for testing only)',
|
|
193
|
+
...booleanConfigHelper(DefaultSequencerConfig.skipWaitForValidParentCheckpointOnL1),
|
|
147
194
|
},
|
|
148
195
|
broadcastInvalidBlockProposal: {
|
|
149
196
|
description: 'Broadcast invalid block proposals with corrupted state (for testing only)',
|
|
150
|
-
...booleanConfigHelper(
|
|
197
|
+
...booleanConfigHelper(DefaultSequencerConfig.broadcastInvalidBlockProposal),
|
|
198
|
+
},
|
|
199
|
+
invalidBlockProposalIndexWithinCheckpoint: {
|
|
200
|
+
description: 'Broadcast an invalid block proposal only at this indexWithinCheckpoint (for testing only)',
|
|
201
|
+
...optionalNumberConfigHelper(),
|
|
202
|
+
},
|
|
203
|
+
broadcastInvalidCheckpointProposalOnly: {
|
|
204
|
+
description:
|
|
205
|
+
'Broadcast invalid checkpoint proposals while keeping the underlying block proposals valid (for testing only). When unset, the checkpoint follows broadcastInvalidBlockProposal.',
|
|
206
|
+
...booleanConfigHelper(DefaultSequencerConfig.broadcastInvalidCheckpointProposalOnly),
|
|
151
207
|
},
|
|
152
208
|
injectFakeAttestation: {
|
|
153
209
|
description: 'Inject a fake attestation (for testing only)',
|
|
210
|
+
...booleanConfigHelper(DefaultSequencerConfig.injectFakeAttestation),
|
|
211
|
+
},
|
|
212
|
+
injectHighSValueAttestation: {
|
|
213
|
+
description: 'Inject a malleable attestation with a high-s value (for testing only)',
|
|
214
|
+
...booleanConfigHelper(DefaultSequencerConfig.injectHighSValueAttestation),
|
|
215
|
+
},
|
|
216
|
+
injectUnrecoverableSignatureAttestation: {
|
|
217
|
+
description: 'Inject an attestation with an unrecoverable signature (for testing only)',
|
|
218
|
+
...booleanConfigHelper(DefaultSequencerConfig.injectUnrecoverableSignatureAttestation),
|
|
219
|
+
},
|
|
220
|
+
fishermanMode: {
|
|
221
|
+
env: 'FISHERMAN_MODE',
|
|
222
|
+
description:
|
|
223
|
+
'Whether to run in fisherman mode: builds blocks on every slot for validation without publishing to L1',
|
|
224
|
+
...booleanConfigHelper(DefaultSequencerConfig.fishermanMode),
|
|
225
|
+
},
|
|
226
|
+
shuffleAttestationOrdering: {
|
|
227
|
+
description: 'Shuffle attestation ordering to create invalid ordering (for testing only)',
|
|
228
|
+
...booleanConfigHelper(DefaultSequencerConfig.shuffleAttestationOrdering),
|
|
229
|
+
},
|
|
230
|
+
...sharedSequencerConfigMappings,
|
|
231
|
+
buildCheckpointIfEmpty: {
|
|
232
|
+
env: 'SEQ_BUILD_CHECKPOINT_IF_EMPTY',
|
|
233
|
+
description: 'Have sequencer build and publish an empty checkpoint if there are no txs',
|
|
234
|
+
...booleanConfigHelper(DefaultSequencerConfig.buildCheckpointIfEmpty),
|
|
235
|
+
},
|
|
236
|
+
skipPushProposedBlocksToArchiver: {
|
|
237
|
+
description: 'Skip pushing proposed blocks to archiver (default: true)',
|
|
238
|
+
...booleanConfigHelper(DefaultSequencerConfig.skipPushProposedBlocksToArchiver),
|
|
239
|
+
},
|
|
240
|
+
minBlocksForCheckpoint: {
|
|
241
|
+
description: 'Minimum number of blocks required for a checkpoint proposal (test only)',
|
|
242
|
+
},
|
|
243
|
+
skipPublishingCheckpointsPercent: {
|
|
244
|
+
env: 'SEQ_SKIP_CHECKPOINT_PUBLISH_PERCENT',
|
|
245
|
+
description: 'Percent probability (0 - 100) of sequencer skipping checkpoint publishing (testing only)',
|
|
246
|
+
...numberConfigHelper(DefaultSequencerConfig.skipPublishingCheckpointsPercent),
|
|
247
|
+
},
|
|
248
|
+
skipBroadcastProposals: {
|
|
249
|
+
description: 'Skip broadcasting checkpoint and block proposals via gossipsub when proposer (for testing only)',
|
|
250
|
+
...booleanConfigHelper(false),
|
|
251
|
+
},
|
|
252
|
+
skipBroadcastCheckpointProposal: {
|
|
253
|
+
description:
|
|
254
|
+
'Skip broadcasting only the CheckpointProposal via gossipsub when proposer; the held last block is broadcast ' +
|
|
255
|
+
'standalone instead so peers still receive it as a proposed-but-uncheckpointed tip (for testing only)',
|
|
154
256
|
...booleanConfigHelper(false),
|
|
155
257
|
},
|
|
156
|
-
|
|
258
|
+
pauseProposingForSlots: {
|
|
259
|
+
description:
|
|
260
|
+
'List of slots for which the sequencer will not produce a proposal (for testing only). Attestation paths are unaffected.',
|
|
261
|
+
},
|
|
262
|
+
...pickConfigMappings(p2pConfigMappings, ['txPublicSetupAllowListExtend']),
|
|
157
263
|
};
|
|
158
264
|
|
|
159
265
|
export const sequencerClientConfigMappings: ConfigMappingsType<SequencerClientConfig> = {
|
|
266
|
+
...chainConfigMappings,
|
|
160
267
|
...validatorClientConfigMappings,
|
|
161
268
|
...sequencerConfigMappings,
|
|
162
269
|
...keyStoreConfigMappings,
|
|
163
270
|
...l1ReaderConfigMappings,
|
|
164
|
-
...
|
|
165
|
-
...
|
|
166
|
-
...chainConfigMappings,
|
|
271
|
+
...sequencerTxSenderConfigMappings,
|
|
272
|
+
...sequencerPublisherConfigMappings,
|
|
167
273
|
...pickConfigMappings(l1ContractsConfigMappings, ['ethereumSlotDuration', 'aztecSlotDuration', 'aztecEpochDuration']),
|
|
168
274
|
};
|
|
169
275
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Fee Prediction
|
|
2
|
+
|
|
3
|
+
The `FeePredictor` predicts min fees for upcoming L2 slots based on the current L1
|
|
4
|
+
oracle state and an assumed mana usage pattern.
|
|
5
|
+
|
|
6
|
+
## Prediction Window
|
|
7
|
+
|
|
8
|
+
The prediction covers `LAG = 2` entries (the next available slot plus 1 more).
|
|
9
|
+
A new oracle update can activate at `startSlot + LAG`, so only the first LAG entries
|
|
10
|
+
are guaranteed stable. Beyond that, L1 fees could change unpredictably.
|
|
11
|
+
|
|
12
|
+
Each entry uses:
|
|
13
|
+
|
|
14
|
+
- The **actual L1 fees** the oracle would return for that slot's timestamp (pre or post,
|
|
15
|
+
depending on whether the slot is before or after `slotOfChange`).
|
|
16
|
+
- A **configurable congestion assumption** (`ManaUsageEstimate`): none (0 mana), target
|
|
17
|
+
(steady state), or limit (worst case, 2x target).
|
|
18
|
+
|
|
19
|
+
The client picks `max(predicted[0..LAG-1])` as their `maxFeesPerGas`.
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
predicted[0] → fee at next slot (current oracle + current congestion)
|
|
23
|
+
predicted[1] → fee at next slot + 1 (congestion may change based on usage estimate)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Why LAG and not LIFETIME?
|
|
27
|
+
|
|
28
|
+
The L1 gas oracle has two timing constants:
|
|
29
|
+
|
|
30
|
+
- **LAG = 2 slots**: when new fees are queued, they activate LAG slots later
|
|
31
|
+
- **LIFETIME = 5 slots**: after an oracle update, the next update is rejected until
|
|
32
|
+
`slotOfChange + (LIFETIME - LAG)` slots have passed
|
|
33
|
+
|
|
34
|
+
If the oracle cooldown has already elapsed (i.e., no recent update), a new update can
|
|
35
|
+
be enqueued at any moment. Its new values would activate LAG slots later. This means
|
|
36
|
+
predictions beyond LAG slots could be invalidated by an oracle update that happens
|
|
37
|
+
right after we query.
|
|
38
|
+
|
|
39
|
+
With a LIFETIME-sized window, we'd give a false sense of coverage: the prediction
|
|
40
|
+
would look like it covers 6 slots, but slots beyond LAG could be wrong if an update
|
|
41
|
+
is enqueued after the prediction is computed.
|
|
42
|
+
|
|
43
|
+
By limiting to LAG entries, we guarantee that all predicted L1 fees are the ones that
|
|
44
|
+
will actually be used — no oracle update can change them within this window.
|