@aztec/sequencer-client 0.0.1-commit.733c4a3 → 0.0.1-commit.7689c7f
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 +282 -21
- package/dest/client/sequencer-client.d.ts +8 -3
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +53 -30
- package/dest/config.d.ts +28 -5
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +62 -27
- 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 +14 -14
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +16 -50
- 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 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -1
- package/dest/publisher/config.d.ts +15 -3
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +19 -4
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts +3 -4
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts.map +1 -1
- 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 +3 -5
- package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-factory.js +16 -3
- package/dest/publisher/sequencer-publisher.d.ts +77 -65
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +345 -512
- 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 +506 -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 +54 -11
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_proposal_job.js +776 -227
- 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 +1 -2
- package/dest/sequencer/checkpoint_voter.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_voter.js +2 -5
- package/dest/sequencer/events.d.ts +47 -2
- package/dest/sequencer/events.d.ts.map +1 -1
- package/dest/sequencer/index.d.ts +3 -1
- package/dest/sequencer/index.d.ts.map +1 -1
- package/dest/sequencer/index.js +2 -0
- package/dest/sequencer/metrics.d.ts +13 -10
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +45 -20
- package/dest/sequencer/sequencer.d.ts +59 -16
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +333 -119
- package/dest/sequencer/timetable.d.ts +17 -3
- package/dest/sequencer/timetable.d.ts.map +1 -1
- package/dest/sequencer/timetable.js +51 -43
- package/dest/sequencer/types.d.ts +2 -2
- package/dest/sequencer/types.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.d.ts +7 -9
- package/dest/test/mock_checkpoint_builder.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.js +39 -30
- package/dest/test/utils.d.ts +1 -1
- package/dest/test/utils.d.ts.map +1 -1
- package/dest/test/utils.js +7 -6
- package/package.json +27 -28
- package/src/client/sequencer-client.ts +72 -33
- package/src/config.ts +76 -27
- 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 +25 -62
- package/src/global_variable_builder/index.ts +3 -1
- package/src/index.ts +10 -1
- package/src/publisher/config.ts +40 -6
- package/src/publisher/l1_tx_failed_store/failed_tx_store.ts +3 -1
- package/src/publisher/sequencer-bundle-simulator.ts +254 -0
- package/src/publisher/sequencer-publisher-factory.ts +18 -6
- package/src/publisher/sequencer-publisher.ts +426 -567
- package/src/sequencer/README.md +152 -450
- package/src/sequencer/automine/README.md +46 -0
- package/src/sequencer/automine/automine_factory.ts +145 -0
- package/src/sequencer/automine/automine_sequencer.ts +592 -0
- package/src/sequencer/chain_state_overrides.ts +162 -0
- package/src/sequencer/checkpoint_proposal_job.ts +941 -256
- package/src/sequencer/checkpoint_proposal_job_metrics.ts +128 -0
- package/src/sequencer/checkpoint_voter.ts +1 -12
- package/src/sequencer/events.ts +50 -2
- package/src/sequencer/index.ts +2 -0
- package/src/sequencer/metrics.ts +57 -24
- package/src/sequencer/sequencer.ts +414 -132
- package/src/sequencer/timetable.ts +64 -52
- package/src/sequencer/types.ts +1 -1
- package/src/test/mock_checkpoint_builder.ts +51 -48
- package/src/test/utils.ts +28 -10
|
@@ -1,4 +1,5 @@
|
|
|
1
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
4
|
import { isAnvilTestChain } from '@aztec/ethereum/chain';
|
|
4
5
|
import { getPublicClient } from '@aztec/ethereum/client';
|
|
@@ -11,15 +12,14 @@ import type { DateProvider } from '@aztec/foundation/timer';
|
|
|
11
12
|
import type { KeystoreManager } from '@aztec/node-keystore';
|
|
12
13
|
import type { P2P } from '@aztec/p2p';
|
|
13
14
|
import type { SlasherClientInterface } from '@aztec/slasher';
|
|
14
|
-
import type { L2BlockSink, L2BlockSource } from '@aztec/stdlib/block';
|
|
15
|
+
import type { L2BlockSink, L2BlockSource, ProposedCheckpointSink } from '@aztec/stdlib/block';
|
|
15
16
|
import type { ValidatorClientFullConfig, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
16
|
-
import { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
|
|
17
17
|
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
18
18
|
import { L1Metrics, type TelemetryClient } from '@aztec/telemetry-client';
|
|
19
19
|
import { FullNodeCheckpointsBuilder, NodeKeystoreAdapter, type ValidatorClient } from '@aztec/validator-client';
|
|
20
20
|
|
|
21
21
|
import { type SequencerClientConfig, getPublisherConfigFromSequencerConfig } from '../config.js';
|
|
22
|
-
import { GlobalVariableBuilder } from '../global_variable_builder/index.js';
|
|
22
|
+
import type { GlobalVariableBuilder } from '../global_variable_builder/index.js';
|
|
23
23
|
import { SequencerPublisherFactory } from '../publisher/sequencer-publisher-factory.js';
|
|
24
24
|
import { Sequencer, type SequencerConfig } from '../sequencer/index.js';
|
|
25
25
|
|
|
@@ -56,7 +56,7 @@ export class SequencerClient {
|
|
|
56
56
|
worldStateSynchronizer: WorldStateSynchronizer;
|
|
57
57
|
slasherClient: SlasherClientInterface | undefined;
|
|
58
58
|
checkpointsBuilder: FullNodeCheckpointsBuilder;
|
|
59
|
-
l2BlockSource: L2BlockSource & L2BlockSink;
|
|
59
|
+
l2BlockSource: L2BlockSource & L2BlockSink & ProposedCheckpointSink;
|
|
60
60
|
l1ToL2MessageSource: L1ToL2MessageSource;
|
|
61
61
|
telemetry: TelemetryClient;
|
|
62
62
|
publisherFactory?: SequencerPublisherFactory;
|
|
@@ -64,7 +64,9 @@ export class SequencerClient {
|
|
|
64
64
|
dateProvider: DateProvider;
|
|
65
65
|
epochCache?: EpochCache;
|
|
66
66
|
l1TxUtils: L1TxUtils[];
|
|
67
|
+
funderL1TxUtils?: L1TxUtils;
|
|
67
68
|
nodeKeyStore: KeystoreManager;
|
|
69
|
+
globalVariableBuilder: GlobalVariableBuilder;
|
|
68
70
|
},
|
|
69
71
|
) {
|
|
70
72
|
const {
|
|
@@ -86,41 +88,35 @@ export class SequencerClient {
|
|
|
86
88
|
publicClient,
|
|
87
89
|
l1TxUtils.map(x => x.getSenderAddress()),
|
|
88
90
|
);
|
|
89
|
-
const publisherManager = new PublisherManager(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
);
|
|
94
|
-
const
|
|
95
|
-
const [l1GenesisTime, slotDuration, rollupVersion, rollupManaLimit] = await Promise.all([
|
|
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([
|
|
96
97
|
rollupContract.getL1GenesisTime(),
|
|
97
98
|
rollupContract.getSlotDuration(),
|
|
98
|
-
rollupContract.getVersion(),
|
|
99
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,
|
|
113
113
|
viemPollingIntervalMS: config.viemPollingIntervalMS,
|
|
114
114
|
ethereumSlotDuration: config.ethereumSlotDuration,
|
|
115
|
+
enableProposerPipelining: config.enableProposerPipelining,
|
|
115
116
|
},
|
|
116
117
|
{ dateProvider: deps.dateProvider },
|
|
117
118
|
));
|
|
118
119
|
|
|
119
|
-
const slashFactoryContract = new SlashFactoryContract(
|
|
120
|
-
publicClient,
|
|
121
|
-
config.l1Contracts.slashFactoryAddress?.toString() ?? EthAddress.ZERO.toString(),
|
|
122
|
-
);
|
|
123
|
-
|
|
124
120
|
const publisherFactory =
|
|
125
121
|
deps.publisherFactory ??
|
|
126
122
|
new SequencerPublisherFactory(config, {
|
|
@@ -128,7 +124,6 @@ export class SequencerClient {
|
|
|
128
124
|
blobClient: deps.blobClient,
|
|
129
125
|
epochCache,
|
|
130
126
|
governanceProposerContract,
|
|
131
|
-
slashFactoryContract,
|
|
132
127
|
rollupContract,
|
|
133
128
|
dateProvider: deps.dateProvider,
|
|
134
129
|
publisherManager,
|
|
@@ -137,17 +132,8 @@ export class SequencerClient {
|
|
|
137
132
|
});
|
|
138
133
|
|
|
139
134
|
const ethereumSlotDuration = config.ethereumSlotDuration;
|
|
140
|
-
const l1Constants = { l1GenesisTime, slotDuration: Number(slotDuration), ethereumSlotDuration };
|
|
141
|
-
|
|
142
|
-
const globalsBuilder = new GlobalVariableBuilder({ ...config, ...l1Constants, rollupVersion });
|
|
143
135
|
|
|
144
|
-
|
|
145
|
-
if (sequencerManaLimit > rollupManaLimit) {
|
|
146
|
-
log.warn(
|
|
147
|
-
`Provided maxL2BlockGas ${sequencerManaLimit} is greater than the max allowed by L1. Setting limit to ${rollupManaLimit}.`,
|
|
148
|
-
);
|
|
149
|
-
sequencerManaLimit = rollupManaLimit;
|
|
150
|
-
}
|
|
136
|
+
const globalsBuilder = deps.globalVariableBuilder;
|
|
151
137
|
|
|
152
138
|
// When running in anvil, assume we can post a tx up until one second before the end of an L1 slot.
|
|
153
139
|
// Otherwise, we need the full L1 slot duration for publishing to ensure inclusion.
|
|
@@ -157,6 +143,16 @@ export class SequencerClient {
|
|
|
157
143
|
const l1PublishingTimeBasedOnChain = isAnvilTestChain(config.l1ChainId) ? 1 : ethereumSlotDuration;
|
|
158
144
|
const l1PublishingTime = config.l1PublishingTime ?? l1PublishingTimeBasedOnChain;
|
|
159
145
|
|
|
146
|
+
const { maxL2BlockGas, maxDABlockGas, maxTxsPerBlock } = capPerBlockLimits(config, rollupManaLimit, log);
|
|
147
|
+
|
|
148
|
+
const l1Constants = {
|
|
149
|
+
l1GenesisTime,
|
|
150
|
+
slotDuration: Number(slotDuration),
|
|
151
|
+
ethereumSlotDuration,
|
|
152
|
+
rollupManaLimit,
|
|
153
|
+
epochDuration: config.aztecEpochDuration,
|
|
154
|
+
};
|
|
155
|
+
|
|
160
156
|
const sequencer = new Sequencer(
|
|
161
157
|
publisherFactory,
|
|
162
158
|
validatorClient,
|
|
@@ -171,7 +167,7 @@ export class SequencerClient {
|
|
|
171
167
|
deps.dateProvider,
|
|
172
168
|
epochCache,
|
|
173
169
|
rollupContract,
|
|
174
|
-
{ ...config, l1PublishingTime, maxL2BlockGas
|
|
170
|
+
{ ...config, l1PublishingTime, maxL2BlockGas, maxDABlockGas, maxTxsPerBlock },
|
|
175
171
|
telemetryClient,
|
|
176
172
|
log,
|
|
177
173
|
);
|
|
@@ -199,7 +195,7 @@ export class SequencerClient {
|
|
|
199
195
|
await this.validatorClient?.start();
|
|
200
196
|
this.sequencer.start();
|
|
201
197
|
this.l1Metrics?.start();
|
|
202
|
-
await this.publisherManager.
|
|
198
|
+
await this.publisherManager.start();
|
|
203
199
|
}
|
|
204
200
|
|
|
205
201
|
/**
|
|
@@ -208,10 +204,15 @@ export class SequencerClient {
|
|
|
208
204
|
public async stop() {
|
|
209
205
|
await this.sequencer.stop();
|
|
210
206
|
await this.validatorClient?.stop();
|
|
211
|
-
this.publisherManager.
|
|
207
|
+
await this.publisherManager.stop();
|
|
212
208
|
this.l1Metrics?.stop();
|
|
213
209
|
}
|
|
214
210
|
|
|
211
|
+
/** Triggers an immediate run of the sequencer, bypassing the polling interval. */
|
|
212
|
+
public trigger() {
|
|
213
|
+
return this.sequencer.trigger();
|
|
214
|
+
}
|
|
215
|
+
|
|
215
216
|
public getSequencer(): Sequencer {
|
|
216
217
|
return this.sequencer;
|
|
217
218
|
}
|
|
@@ -234,3 +235,41 @@ export class SequencerClient {
|
|
|
234
235
|
return this.sequencer.maxL2BlockGas;
|
|
235
236
|
}
|
|
236
237
|
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Caps operator-provided per-block limits at checkpoint-level limits.
|
|
241
|
+
* Returns undefined for any limit the operator didn't set — the checkpoint builder handles redistribution.
|
|
242
|
+
*/
|
|
243
|
+
function capPerBlockLimits(
|
|
244
|
+
config: SequencerClientConfig,
|
|
245
|
+
rollupManaLimit: number,
|
|
246
|
+
log: ReturnType<typeof createLogger>,
|
|
247
|
+
): { maxL2BlockGas: number | undefined; maxDABlockGas: number | undefined; maxTxsPerBlock: number | undefined } {
|
|
248
|
+
let maxL2BlockGas = config.maxL2BlockGas;
|
|
249
|
+
if (maxL2BlockGas !== undefined && maxL2BlockGas > rollupManaLimit) {
|
|
250
|
+
log.warn(`Provided MAX_L2_BLOCK_GAS ${maxL2BlockGas} exceeds rollup mana limit ${rollupManaLimit} (capping)`);
|
|
251
|
+
maxL2BlockGas = rollupManaLimit;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
let maxDABlockGas = config.maxDABlockGas;
|
|
255
|
+
if (maxDABlockGas !== undefined && maxDABlockGas > MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT) {
|
|
256
|
+
log.warn(
|
|
257
|
+
`Provided MAX_DA_BLOCK_GAS ${maxDABlockGas} exceeds DA checkpoint limit ${MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT} (capping)`,
|
|
258
|
+
);
|
|
259
|
+
maxDABlockGas = MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
let maxTxsPerBlock = config.maxTxsPerBlock;
|
|
263
|
+
if (
|
|
264
|
+
maxTxsPerBlock !== undefined &&
|
|
265
|
+
config.maxTxsPerCheckpoint !== undefined &&
|
|
266
|
+
maxTxsPerBlock > config.maxTxsPerCheckpoint
|
|
267
|
+
) {
|
|
268
|
+
log.warn(
|
|
269
|
+
`Provided MAX_TX_PER_BLOCK ${maxTxsPerBlock} exceeds MAX_TX_PER_CHECKPOINT ${config.maxTxsPerCheckpoint} (capping)`,
|
|
270
|
+
);
|
|
271
|
+
maxTxsPerBlock = config.maxTxsPerCheckpoint;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return { maxL2BlockGas, maxDABlockGas, maxTxsPerBlock };
|
|
275
|
+
}
|
package/src/config.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
booleanConfigHelper,
|
|
6
6
|
getConfigFromMappings,
|
|
7
7
|
numberConfigHelper,
|
|
8
|
+
optionalNumberConfigHelper,
|
|
8
9
|
pickConfigMappings,
|
|
9
10
|
} from '@aztec/foundation/config';
|
|
10
11
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
@@ -13,8 +14,11 @@ import { type P2PConfig, p2pConfigMappings } from '@aztec/p2p/config';
|
|
|
13
14
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
14
15
|
import {
|
|
15
16
|
type ChainConfig,
|
|
17
|
+
DEFAULT_MAX_BLOCKS_PER_CHECKPOINT,
|
|
18
|
+
type PipelineConfig,
|
|
16
19
|
type SequencerConfig,
|
|
17
20
|
chainConfigMappings,
|
|
21
|
+
pipelineConfigMappings,
|
|
18
22
|
sharedSequencerConfigMappings,
|
|
19
23
|
} from '@aztec/stdlib/config';
|
|
20
24
|
import type { ResolvedSequencerConfig } from '@aztec/stdlib/interfaces/server';
|
|
@@ -35,28 +39,31 @@ export type { SequencerConfig };
|
|
|
35
39
|
* Default values for SequencerConfig.
|
|
36
40
|
* Centralized location for all sequencer configuration defaults.
|
|
37
41
|
*/
|
|
38
|
-
export const DefaultSequencerConfig
|
|
42
|
+
export const DefaultSequencerConfig = {
|
|
39
43
|
sequencerPollingIntervalMS: 500,
|
|
40
|
-
maxTxsPerBlock: 32,
|
|
41
44
|
minTxsPerBlock: 1,
|
|
42
45
|
buildCheckpointIfEmpty: false,
|
|
43
46
|
publishTxsWithProposals: false,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
maxBlockSizeInBytes: 1024 * 1024,
|
|
47
|
+
perBlockAllocationMultiplier: 1.2,
|
|
48
|
+
redistributeCheckpointBudget: true,
|
|
47
49
|
enforceTimeTable: true,
|
|
48
50
|
attestationPropagationTime: DEFAULT_P2P_PROPAGATION_TIME,
|
|
49
51
|
secondsBeforeInvalidatingBlockAsCommitteeMember: 144, // 12 L1 blocks
|
|
50
52
|
secondsBeforeInvalidatingBlockAsNonCommitteeMember: 432, // 36 L1 blocks
|
|
51
53
|
skipCollectingAttestations: false,
|
|
52
54
|
skipInvalidateBlockAsProposer: false,
|
|
55
|
+
skipWaitForValidParentCheckpointOnL1: false,
|
|
53
56
|
broadcastInvalidBlockProposal: false,
|
|
57
|
+
broadcastInvalidCheckpointProposalOnly: false,
|
|
54
58
|
injectFakeAttestation: false,
|
|
59
|
+
injectHighSValueAttestation: false,
|
|
60
|
+
injectUnrecoverableSignatureAttestation: false,
|
|
55
61
|
fishermanMode: false,
|
|
56
62
|
shuffleAttestationOrdering: false,
|
|
57
63
|
skipPushProposedBlocksToArchiver: false,
|
|
58
64
|
skipPublishingCheckpointsPercent: 0,
|
|
59
|
-
|
|
65
|
+
maxBlocksPerCheckpoint: DEFAULT_MAX_BLOCKS_PER_CHECKPOINT,
|
|
66
|
+
} satisfies ResolvedSequencerConfig;
|
|
60
67
|
|
|
61
68
|
/**
|
|
62
69
|
* Configuration settings for the SequencerClient.
|
|
@@ -68,7 +75,8 @@ export type SequencerClientConfig = SequencerPublisherConfig &
|
|
|
68
75
|
SequencerConfig &
|
|
69
76
|
L1ReaderConfig &
|
|
70
77
|
ChainConfig &
|
|
71
|
-
|
|
78
|
+
PipelineConfig &
|
|
79
|
+
Pick<P2PConfig, 'txPublicSetupAllowListExtend'> &
|
|
72
80
|
Pick<L1ContractsConfig, 'ethereumSlotDuration' | 'aztecSlotDuration' | 'aztecEpochDuration'>;
|
|
73
81
|
|
|
74
82
|
export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
@@ -77,10 +85,10 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
77
85
|
description: 'The number of ms to wait between polling for checking to build on the next slot.',
|
|
78
86
|
...numberConfigHelper(DefaultSequencerConfig.sequencerPollingIntervalMS),
|
|
79
87
|
},
|
|
80
|
-
|
|
81
|
-
env: '
|
|
82
|
-
description: 'The maximum number of txs
|
|
83
|
-
...
|
|
88
|
+
maxTxsPerCheckpoint: {
|
|
89
|
+
env: 'SEQ_MAX_TX_PER_CHECKPOINT',
|
|
90
|
+
description: 'The maximum number of txs across all blocks in a checkpoint.',
|
|
91
|
+
...optionalNumberConfigHelper(),
|
|
84
92
|
},
|
|
85
93
|
minTxsPerBlock: {
|
|
86
94
|
env: 'SEQ_MIN_TX_PER_BLOCK',
|
|
@@ -99,16 +107,29 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
99
107
|
maxL2BlockGas: {
|
|
100
108
|
env: 'SEQ_MAX_L2_BLOCK_GAS',
|
|
101
109
|
description: 'The maximum L2 block gas.',
|
|
102
|
-
...
|
|
110
|
+
...optionalNumberConfigHelper(),
|
|
103
111
|
},
|
|
104
112
|
maxDABlockGas: {
|
|
105
113
|
env: 'SEQ_MAX_DA_BLOCK_GAS',
|
|
106
114
|
description: 'The maximum DA block gas.',
|
|
107
|
-
...
|
|
115
|
+
...optionalNumberConfigHelper(),
|
|
116
|
+
},
|
|
117
|
+
perBlockAllocationMultiplier: {
|
|
118
|
+
env: 'SEQ_PER_BLOCK_ALLOCATION_MULTIPLIER',
|
|
119
|
+
description:
|
|
120
|
+
'Per-block gas budget multiplier for both L2 and DA gas. Budget per block is (checkpointLimit / maxBlocks) * multiplier.' +
|
|
121
|
+
' Values greater than one allow early blocks to use more than their even share, relying on checkpoint-level capping for later blocks.',
|
|
122
|
+
...numberConfigHelper(DefaultSequencerConfig.perBlockAllocationMultiplier),
|
|
123
|
+
},
|
|
124
|
+
redistributeCheckpointBudget: {
|
|
125
|
+
env: 'SEQ_REDISTRIBUTE_CHECKPOINT_BUDGET',
|
|
126
|
+
description:
|
|
127
|
+
'Redistribute remaining checkpoint budget evenly across remaining blocks instead of allowing a single block to consume the entire remaining budget.',
|
|
128
|
+
...booleanConfigHelper(DefaultSequencerConfig.redistributeCheckpointBudget),
|
|
108
129
|
},
|
|
109
130
|
coinbase: {
|
|
110
131
|
env: 'COINBASE',
|
|
111
|
-
parseEnv: (val: string) =>
|
|
132
|
+
parseEnv: (val: string) => EthAddress.fromString(val),
|
|
112
133
|
description: 'Recipient of block reward.',
|
|
113
134
|
},
|
|
114
135
|
feeRecipient: {
|
|
@@ -124,11 +145,6 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
124
145
|
env: 'ACVM_BINARY_PATH',
|
|
125
146
|
description: 'The path to the ACVM binary',
|
|
126
147
|
},
|
|
127
|
-
maxBlockSizeInBytes: {
|
|
128
|
-
env: 'SEQ_MAX_BLOCK_SIZE_IN_BYTES',
|
|
129
|
-
description: 'Max block size',
|
|
130
|
-
...numberConfigHelper(DefaultSequencerConfig.maxBlockSizeInBytes),
|
|
131
|
-
},
|
|
132
148
|
enforceTimeTable: {
|
|
133
149
|
env: 'SEQ_ENFORCE_TIME_TABLE',
|
|
134
150
|
description: 'Whether to enforce the time table when building blocks',
|
|
@@ -142,12 +158,7 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
142
158
|
l1PublishingTime: {
|
|
143
159
|
env: 'SEQ_L1_PUBLISHING_TIME_ALLOWANCE_IN_SLOT',
|
|
144
160
|
description: 'How much time (in seconds) we allow in the slot for publishing the L1 tx (defaults to 1 L1 slot).',
|
|
145
|
-
|
|
146
|
-
},
|
|
147
|
-
attestationPropagationTime: {
|
|
148
|
-
env: 'SEQ_ATTESTATION_PROPAGATION_TIME',
|
|
149
|
-
description: 'How many seconds it takes for proposals and attestations to travel across the p2p layer (one-way)',
|
|
150
|
-
...numberConfigHelper(DefaultSequencerConfig.attestationPropagationTime),
|
|
161
|
+
...optionalNumberConfigHelper(),
|
|
151
162
|
},
|
|
152
163
|
fakeProcessingDelayPerTxMs: {
|
|
153
164
|
description: 'Used for testing to introduce a fake delay after processing each tx',
|
|
@@ -178,14 +189,37 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
178
189
|
description: 'Do not invalidate the previous block if invalid when we are the proposer (for testing only)',
|
|
179
190
|
...booleanConfigHelper(DefaultSequencerConfig.skipInvalidateBlockAsProposer),
|
|
180
191
|
},
|
|
192
|
+
skipWaitForValidParentCheckpointOnL1: {
|
|
193
|
+
description:
|
|
194
|
+
'Bypass the parent checkpoint validity check before submitting a pipelined checkpoint, ' +
|
|
195
|
+
'allowing the proposer to publish even when the parent landed on L1 with invalid attestations (for testing only)',
|
|
196
|
+
...booleanConfigHelper(DefaultSequencerConfig.skipWaitForValidParentCheckpointOnL1),
|
|
197
|
+
},
|
|
181
198
|
broadcastInvalidBlockProposal: {
|
|
182
199
|
description: 'Broadcast invalid block proposals with corrupted state (for testing only)',
|
|
183
200
|
...booleanConfigHelper(DefaultSequencerConfig.broadcastInvalidBlockProposal),
|
|
184
201
|
},
|
|
202
|
+
invalidBlockProposalIndexWithinCheckpoint: {
|
|
203
|
+
description: 'Broadcast an invalid block proposal only at this indexWithinCheckpoint (for testing only)',
|
|
204
|
+
...optionalNumberConfigHelper(),
|
|
205
|
+
},
|
|
206
|
+
broadcastInvalidCheckpointProposalOnly: {
|
|
207
|
+
description:
|
|
208
|
+
'Broadcast invalid checkpoint proposals while keeping the underlying block proposals valid (for testing only). When unset, the checkpoint follows broadcastInvalidBlockProposal.',
|
|
209
|
+
...booleanConfigHelper(DefaultSequencerConfig.broadcastInvalidCheckpointProposalOnly),
|
|
210
|
+
},
|
|
185
211
|
injectFakeAttestation: {
|
|
186
212
|
description: 'Inject a fake attestation (for testing only)',
|
|
187
213
|
...booleanConfigHelper(DefaultSequencerConfig.injectFakeAttestation),
|
|
188
214
|
},
|
|
215
|
+
injectHighSValueAttestation: {
|
|
216
|
+
description: 'Inject a malleable attestation with a high-s value (for testing only)',
|
|
217
|
+
...booleanConfigHelper(DefaultSequencerConfig.injectHighSValueAttestation),
|
|
218
|
+
},
|
|
219
|
+
injectUnrecoverableSignatureAttestation: {
|
|
220
|
+
description: 'Inject an attestation with an unrecoverable signature (for testing only)',
|
|
221
|
+
...booleanConfigHelper(DefaultSequencerConfig.injectUnrecoverableSignatureAttestation),
|
|
222
|
+
},
|
|
189
223
|
fishermanMode: {
|
|
190
224
|
env: 'FISHERMAN_MODE',
|
|
191
225
|
description:
|
|
@@ -214,17 +248,32 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
214
248
|
description: 'Percent probability (0 - 100) of sequencer skipping checkpoint publishing (testing only)',
|
|
215
249
|
...numberConfigHelper(DefaultSequencerConfig.skipPublishingCheckpointsPercent),
|
|
216
250
|
},
|
|
217
|
-
|
|
251
|
+
skipBroadcastProposals: {
|
|
252
|
+
description: 'Skip broadcasting checkpoint and block proposals via gossipsub when proposer (for testing only)',
|
|
253
|
+
...booleanConfigHelper(false),
|
|
254
|
+
},
|
|
255
|
+
skipBroadcastCheckpointProposal: {
|
|
256
|
+
description:
|
|
257
|
+
'Skip broadcasting only the CheckpointProposal via gossipsub when proposer; the held last block is broadcast ' +
|
|
258
|
+
'standalone instead so peers still receive it as a proposed-but-uncheckpointed tip (for testing only)',
|
|
259
|
+
...booleanConfigHelper(false),
|
|
260
|
+
},
|
|
261
|
+
pauseProposingForSlots: {
|
|
262
|
+
description:
|
|
263
|
+
'List of slots for which the sequencer will not produce a proposal (for testing only). Attestation paths are unaffected.',
|
|
264
|
+
},
|
|
265
|
+
...pickConfigMappings(p2pConfigMappings, ['txPublicSetupAllowListExtend']),
|
|
218
266
|
};
|
|
219
267
|
|
|
220
268
|
export const sequencerClientConfigMappings: ConfigMappingsType<SequencerClientConfig> = {
|
|
269
|
+
...chainConfigMappings,
|
|
221
270
|
...validatorClientConfigMappings,
|
|
222
271
|
...sequencerConfigMappings,
|
|
223
272
|
...keyStoreConfigMappings,
|
|
224
273
|
...l1ReaderConfigMappings,
|
|
225
274
|
...sequencerTxSenderConfigMappings,
|
|
226
275
|
...sequencerPublisherConfigMappings,
|
|
227
|
-
...
|
|
276
|
+
...pipelineConfigMappings,
|
|
228
277
|
...pickConfigMappings(l1ContractsConfigMappings, ['ethereumSlotDuration', 'aztecSlotDuration', 'aztecEpochDuration']),
|
|
229
278
|
};
|
|
230
279
|
|
|
@@ -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.
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { type L1FeeData, MAX_FEE_ASSET_PRICE_MODIFIER_BPS, type RollupContract } from '@aztec/ethereum/contracts';
|
|
2
|
+
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
3
|
+
import { times } from '@aztec/foundation/collection';
|
|
4
|
+
import type { DateProvider } from '@aztec/foundation/timer';
|
|
5
|
+
import { getSlotAtNextL1Block, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
6
|
+
import {
|
|
7
|
+
FEE_ORACLE_LAG,
|
|
8
|
+
GasFees,
|
|
9
|
+
MIN_ETH_PER_FEE_ASSET,
|
|
10
|
+
ManaUsageEstimate,
|
|
11
|
+
computeExcessMana,
|
|
12
|
+
computeManaMinFee,
|
|
13
|
+
} from '@aztec/stdlib/gas';
|
|
14
|
+
|
|
15
|
+
/** Cached rollup state for fee prediction. Refreshed once per L1 block. */
|
|
16
|
+
type FeeOracleState = {
|
|
17
|
+
lastSlot: SlotNumber;
|
|
18
|
+
excessMana: bigint;
|
|
19
|
+
ethPerFeeAsset: bigint;
|
|
20
|
+
manaTarget: bigint;
|
|
21
|
+
manaLimit: bigint;
|
|
22
|
+
provingCostPerManaEth: bigint;
|
|
23
|
+
epochDuration: bigint;
|
|
24
|
+
/** Pre-resolved L1 fees for each slot in the prediction window. */
|
|
25
|
+
l1FeesBySlot: L1FeeData[];
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Predicts min fees for LAG upcoming slots based on the L1 oracle state.
|
|
30
|
+
* A new oracle update can activate at startSlot + LAG, so only the first LAG entries
|
|
31
|
+
* are guaranteed stable. Caches L1 queries per L1 block and recomputes predictions
|
|
32
|
+
* for each mana usage estimate.
|
|
33
|
+
*/
|
|
34
|
+
export class FeePredictor {
|
|
35
|
+
private cachedState: Promise<FeeOracleState> | undefined;
|
|
36
|
+
private cachedL1BlockNumber: bigint | undefined;
|
|
37
|
+
|
|
38
|
+
private readonly slotDuration: number;
|
|
39
|
+
private readonly l1GenesisTime: bigint;
|
|
40
|
+
private readonly ethereumSlotDuration: number;
|
|
41
|
+
|
|
42
|
+
constructor(
|
|
43
|
+
private readonly rollupContract: RollupContract,
|
|
44
|
+
private readonly publicClient: { getBlockNumber: (opts?: { cacheTime?: number }) => Promise<bigint> },
|
|
45
|
+
private readonly dateProvider: DateProvider,
|
|
46
|
+
config: { slotDuration: number; l1GenesisTime: bigint; ethereumSlotDuration: number },
|
|
47
|
+
) {
|
|
48
|
+
this.slotDuration = config.slotDuration;
|
|
49
|
+
this.l1GenesisTime = config.l1GenesisTime;
|
|
50
|
+
this.ethereumSlotDuration = config.ethereumSlotDuration;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Returns predicted min fees for each slot in the prediction window. */
|
|
54
|
+
async getPredictedMinFees(manaUsage: ManaUsageEstimate): Promise<GasFees[]> {
|
|
55
|
+
const state = await this.getState();
|
|
56
|
+
return this.computePredictions(state, manaUsage);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Fetches and caches rollup state. Refreshes when L1 block number advances. */
|
|
60
|
+
private async getState(): Promise<FeeOracleState> {
|
|
61
|
+
const blockNumber = await this.publicClient.getBlockNumber({ cacheTime: 0 });
|
|
62
|
+
if (this.cachedL1BlockNumber === undefined || blockNumber > this.cachedL1BlockNumber) {
|
|
63
|
+
this.cachedL1BlockNumber = blockNumber;
|
|
64
|
+
this.cachedState = this.fetchState(blockNumber);
|
|
65
|
+
}
|
|
66
|
+
return this.cachedState!;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
private async fetchState(blockNumber: bigint): Promise<FeeOracleState> {
|
|
70
|
+
// Pin all non-constant queries to this L1 block number for a consistent snapshot.
|
|
71
|
+
const opts = { blockNumber };
|
|
72
|
+
|
|
73
|
+
// Cached constants don't need pinning
|
|
74
|
+
const [manaTarget, manaLimit, provingCostPerManaEth, epochDuration] = await Promise.all([
|
|
75
|
+
this.rollupContract.getManaTarget(),
|
|
76
|
+
this.rollupContract.getManaLimit(),
|
|
77
|
+
this.rollupContract.getProvingCostPerMana(),
|
|
78
|
+
this.rollupContract.getEpochDuration(),
|
|
79
|
+
]);
|
|
80
|
+
|
|
81
|
+
// First, compute the earliest possible nextSlot independently of the checkpoint, so we can
|
|
82
|
+
// evaluate pruneability at the prediction start timestamp instead of the current L1 block time.
|
|
83
|
+
// This avoids an epoch-boundary edge case where the effective parent differs between now and nextSlot.
|
|
84
|
+
const slotConfig = { slotDuration: this.slotDuration, l1GenesisTime: this.l1GenesisTime };
|
|
85
|
+
const currentSlot = await this.rollupContract.getSlotNumber(opts);
|
|
86
|
+
|
|
87
|
+
const slotAtNextL1Block = getSlotAtNextL1Block(BigInt(this.dateProvider.nowInSeconds()), {
|
|
88
|
+
l1GenesisTime: this.l1GenesisTime,
|
|
89
|
+
slotDuration: this.slotDuration,
|
|
90
|
+
ethereumSlotDuration: this.ethereumSlotDuration,
|
|
91
|
+
});
|
|
92
|
+
const preliminaryNextSlot = SlotNumber(Math.max(currentSlot, slotAtNextL1Block));
|
|
93
|
+
const nextSlotTimestamp = getTimestampForSlot(preliminaryNextSlot, slotConfig);
|
|
94
|
+
|
|
95
|
+
// Resolve the effective checkpoint at the prediction start timestamp
|
|
96
|
+
const lastCheckpoint = await this.rollupContract.getEffectivePendingCheckpoint(nextSlotTimestamp, opts);
|
|
97
|
+
const lastSlot = lastCheckpoint.slotNumber;
|
|
98
|
+
// Refine nextSlot: also account for the slot after the last checkpoint
|
|
99
|
+
const nextSlot = SlotNumber(Math.max(SlotNumber.add(lastSlot, 1), preliminaryNextSlot));
|
|
100
|
+
const feeHeader = lastCheckpoint.feeHeader;
|
|
101
|
+
|
|
102
|
+
const slotCount = FEE_ORACLE_LAG;
|
|
103
|
+
const timestamps = times(slotCount, i => getTimestampForSlot(SlotNumber.add(nextSlot, i), slotConfig));
|
|
104
|
+
const l1FeesBySlot = await Promise.all(timestamps.map(ts => this.rollupContract.getL1FeesAt(ts, opts)));
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
lastSlot,
|
|
108
|
+
excessMana: computeExcessMana(feeHeader.excessMana, feeHeader.manaUsed, manaTarget),
|
|
109
|
+
ethPerFeeAsset: feeHeader.ethPerFeeAsset,
|
|
110
|
+
manaTarget,
|
|
111
|
+
manaLimit,
|
|
112
|
+
provingCostPerManaEth,
|
|
113
|
+
epochDuration: BigInt(epochDuration),
|
|
114
|
+
l1FeesBySlot,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** Computes per-slot fee predictions given cached state and a mana usage assumption. */
|
|
119
|
+
private computePredictions(state: FeeOracleState, manaUsage: ManaUsageEstimate): GasFees[] {
|
|
120
|
+
const assumedManaUsed = this.getAssumedManaUsed(state, manaUsage);
|
|
121
|
+
|
|
122
|
+
const result: GasFees[] = [];
|
|
123
|
+
let { excessMana } = state;
|
|
124
|
+
let { ethPerFeeAsset } = state;
|
|
125
|
+
|
|
126
|
+
// Slot 0: current state (next available slot after last checkpoint)
|
|
127
|
+
result.push(this.computeGasFees(state, excessMana, ethPerFeeAsset, state.l1FeesBySlot[0]));
|
|
128
|
+
|
|
129
|
+
// Slots 1..LAG-1: advance excessMana with the assumed mana usage per checkpoint,
|
|
130
|
+
// and decay ethPerFeeAsset by MAX_FEE_ASSET_PRICE_MODIFIER_BPS per slot for conservative estimates.
|
|
131
|
+
// Lower ethPerFeeAsset means higher fees in fee asset terms.
|
|
132
|
+
for (let i = 1; i < state.l1FeesBySlot.length; i++) {
|
|
133
|
+
excessMana = computeExcessMana(excessMana, assumedManaUsed, state.manaTarget);
|
|
134
|
+
const decayed = (ethPerFeeAsset * (10000n - MAX_FEE_ASSET_PRICE_MODIFIER_BPS)) / 10000n;
|
|
135
|
+
ethPerFeeAsset = decayed < MIN_ETH_PER_FEE_ASSET ? MIN_ETH_PER_FEE_ASSET : decayed;
|
|
136
|
+
result.push(this.computeGasFees(state, excessMana, ethPerFeeAsset, state.l1FeesBySlot[i]));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return result;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
private getAssumedManaUsed(state: FeeOracleState, manaUsage: ManaUsageEstimate): bigint {
|
|
143
|
+
switch (manaUsage) {
|
|
144
|
+
case ManaUsageEstimate.None:
|
|
145
|
+
return 0n;
|
|
146
|
+
case ManaUsageEstimate.Target:
|
|
147
|
+
return state.manaTarget;
|
|
148
|
+
case ManaUsageEstimate.Limit:
|
|
149
|
+
return state.manaLimit;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
private computeGasFees(
|
|
154
|
+
state: FeeOracleState,
|
|
155
|
+
excessMana: bigint,
|
|
156
|
+
ethPerFeeAsset: bigint,
|
|
157
|
+
l1Fees: L1FeeData,
|
|
158
|
+
): GasFees {
|
|
159
|
+
return new GasFees(
|
|
160
|
+
0,
|
|
161
|
+
computeManaMinFee({
|
|
162
|
+
l1BaseFee: l1Fees.baseFee,
|
|
163
|
+
l1BlobFee: l1Fees.blobFee,
|
|
164
|
+
manaTarget: state.manaTarget,
|
|
165
|
+
epochDuration: state.epochDuration,
|
|
166
|
+
provingCostPerManaEth: state.provingCostPerManaEth,
|
|
167
|
+
excessMana,
|
|
168
|
+
ethPerFeeAsset,
|
|
169
|
+
}),
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
}
|