@aztec/sequencer-client 0.0.1-commit.ff7989d6c → 0.0.1-commit.fff30aa
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 +5 -1
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +41 -19
- package/dest/config.d.ts +24 -4
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +29 -16
- package/dest/global_variable_builder/global_builder.d.ts +13 -7
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +22 -21
- package/dest/global_variable_builder/index.d.ts +2 -2
- package/dest/global_variable_builder/index.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.d.ts +15 -8
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +65 -36
- package/dest/sequencer/checkpoint_proposal_job.d.ts +4 -4
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_proposal_job.js +103 -69
- 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/sequencer.d.ts +13 -7
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +18 -17
- package/dest/sequencer/timetable.d.ts +4 -3
- package/dest/sequencer/timetable.d.ts.map +1 -1
- package/dest/sequencer/timetable.js +6 -7
- 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 +41 -30
- package/package.json +28 -28
- package/src/client/sequencer-client.ts +53 -14
- package/src/config.ts +35 -19
- package/src/global_variable_builder/global_builder.ts +22 -23
- package/src/global_variable_builder/index.ts +1 -1
- package/src/publisher/sequencer-publisher.ts +61 -44
- package/src/sequencer/checkpoint_proposal_job.ts +161 -99
- package/src/sequencer/checkpoint_voter.ts +1 -12
- package/src/sequencer/sequencer.ts +21 -18
- package/src/sequencer/timetable.ts +7 -7
- package/src/sequencer/types.ts +1 -1
- package/src/test/mock_checkpoint_builder.ts +53 -48
|
@@ -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';
|
|
@@ -19,7 +20,7 @@ import { L1Metrics, type TelemetryClient } from '@aztec/telemetry-client';
|
|
|
19
20
|
import { FullNodeCheckpointsBuilder, NodeKeystoreAdapter, type ValidatorClient } from '@aztec/validator-client';
|
|
20
21
|
|
|
21
22
|
import { type SequencerClientConfig, getPublisherConfigFromSequencerConfig } from '../config.js';
|
|
22
|
-
import { GlobalVariableBuilder } from '../global_variable_builder/index.js';
|
|
23
|
+
import type { GlobalVariableBuilder } from '../global_variable_builder/index.js';
|
|
23
24
|
import { SequencerPublisherFactory } from '../publisher/sequencer-publisher-factory.js';
|
|
24
25
|
import { Sequencer, type SequencerConfig } from '../sequencer/index.js';
|
|
25
26
|
|
|
@@ -65,6 +66,7 @@ export class SequencerClient {
|
|
|
65
66
|
epochCache?: EpochCache;
|
|
66
67
|
l1TxUtils: L1TxUtils[];
|
|
67
68
|
nodeKeyStore: KeystoreManager;
|
|
69
|
+
globalVariableBuilder: GlobalVariableBuilder;
|
|
68
70
|
},
|
|
69
71
|
) {
|
|
70
72
|
const {
|
|
@@ -92,10 +94,9 @@ export class SequencerClient {
|
|
|
92
94
|
log.getBindings(),
|
|
93
95
|
);
|
|
94
96
|
const rollupContract = new RollupContract(publicClient, config.l1Contracts.rollupAddress.toString());
|
|
95
|
-
const [l1GenesisTime, slotDuration,
|
|
97
|
+
const [l1GenesisTime, slotDuration, rollupManaLimit] = await Promise.all([
|
|
96
98
|
rollupContract.getL1GenesisTime(),
|
|
97
99
|
rollupContract.getSlotDuration(),
|
|
98
|
-
rollupContract.getVersion(),
|
|
99
100
|
rollupContract.getManaLimit().then(Number),
|
|
100
101
|
] as const);
|
|
101
102
|
|
|
@@ -137,17 +138,8 @@ export class SequencerClient {
|
|
|
137
138
|
});
|
|
138
139
|
|
|
139
140
|
const ethereumSlotDuration = config.ethereumSlotDuration;
|
|
140
|
-
const l1Constants = { l1GenesisTime, slotDuration: Number(slotDuration), ethereumSlotDuration };
|
|
141
141
|
|
|
142
|
-
const globalsBuilder =
|
|
143
|
-
|
|
144
|
-
let sequencerManaLimit = config.maxL2BlockGas ?? rollupManaLimit;
|
|
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
|
-
}
|
|
142
|
+
const globalsBuilder = deps.globalVariableBuilder;
|
|
151
143
|
|
|
152
144
|
// When running in anvil, assume we can post a tx up until one second before the end of an L1 slot.
|
|
153
145
|
// Otherwise, we need the full L1 slot duration for publishing to ensure inclusion.
|
|
@@ -157,6 +149,10 @@ export class SequencerClient {
|
|
|
157
149
|
const l1PublishingTimeBasedOnChain = isAnvilTestChain(config.l1ChainId) ? 1 : ethereumSlotDuration;
|
|
158
150
|
const l1PublishingTime = config.l1PublishingTime ?? l1PublishingTimeBasedOnChain;
|
|
159
151
|
|
|
152
|
+
const { maxL2BlockGas, maxDABlockGas, maxTxsPerBlock } = capPerBlockLimits(config, rollupManaLimit, log);
|
|
153
|
+
|
|
154
|
+
const l1Constants = { l1GenesisTime, slotDuration: Number(slotDuration), ethereumSlotDuration, rollupManaLimit };
|
|
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
|
);
|
|
@@ -212,6 +208,11 @@ export class SequencerClient {
|
|
|
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
|
@@ -35,15 +35,13 @@ export type { SequencerConfig };
|
|
|
35
35
|
* Default values for SequencerConfig.
|
|
36
36
|
* Centralized location for all sequencer configuration defaults.
|
|
37
37
|
*/
|
|
38
|
-
export const DefaultSequencerConfig
|
|
38
|
+
export const DefaultSequencerConfig = {
|
|
39
39
|
sequencerPollingIntervalMS: 500,
|
|
40
|
-
maxTxsPerBlock: 32,
|
|
41
40
|
minTxsPerBlock: 1,
|
|
42
41
|
buildCheckpointIfEmpty: false,
|
|
43
42
|
publishTxsWithProposals: false,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
maxBlockSizeInBytes: 1024 * 1024,
|
|
43
|
+
perBlockAllocationMultiplier: 1.2,
|
|
44
|
+
redistributeCheckpointBudget: true,
|
|
47
45
|
enforceTimeTable: true,
|
|
48
46
|
attestationPropagationTime: DEFAULT_P2P_PROPAGATION_TIME,
|
|
49
47
|
secondsBeforeInvalidatingBlockAsCommitteeMember: 144, // 12 L1 blocks
|
|
@@ -52,11 +50,13 @@ export const DefaultSequencerConfig: ResolvedSequencerConfig = {
|
|
|
52
50
|
skipInvalidateBlockAsProposer: false,
|
|
53
51
|
broadcastInvalidBlockProposal: false,
|
|
54
52
|
injectFakeAttestation: false,
|
|
53
|
+
injectHighSValueAttestation: false,
|
|
54
|
+
injectUnrecoverableSignatureAttestation: false,
|
|
55
55
|
fishermanMode: false,
|
|
56
56
|
shuffleAttestationOrdering: false,
|
|
57
57
|
skipPushProposedBlocksToArchiver: false,
|
|
58
58
|
skipPublishingCheckpointsPercent: 0,
|
|
59
|
-
};
|
|
59
|
+
} satisfies ResolvedSequencerConfig;
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
* Configuration settings for the SequencerClient.
|
|
@@ -68,7 +68,7 @@ export type SequencerClientConfig = SequencerPublisherConfig &
|
|
|
68
68
|
SequencerConfig &
|
|
69
69
|
L1ReaderConfig &
|
|
70
70
|
ChainConfig &
|
|
71
|
-
Pick<P2PConfig, '
|
|
71
|
+
Pick<P2PConfig, 'txPublicSetupAllowListExtend'> &
|
|
72
72
|
Pick<L1ContractsConfig, 'ethereumSlotDuration' | 'aztecSlotDuration' | 'aztecEpochDuration'>;
|
|
73
73
|
|
|
74
74
|
export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
@@ -77,10 +77,10 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
77
77
|
description: 'The number of ms to wait between polling for checking to build on the next slot.',
|
|
78
78
|
...numberConfigHelper(DefaultSequencerConfig.sequencerPollingIntervalMS),
|
|
79
79
|
},
|
|
80
|
-
|
|
81
|
-
env: '
|
|
82
|
-
description: 'The maximum number of txs
|
|
83
|
-
|
|
80
|
+
maxTxsPerCheckpoint: {
|
|
81
|
+
env: 'SEQ_MAX_TX_PER_CHECKPOINT',
|
|
82
|
+
description: 'The maximum number of txs across all blocks in a checkpoint.',
|
|
83
|
+
parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
|
|
84
84
|
},
|
|
85
85
|
minTxsPerBlock: {
|
|
86
86
|
env: 'SEQ_MIN_TX_PER_BLOCK',
|
|
@@ -99,12 +99,25 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
99
99
|
maxL2BlockGas: {
|
|
100
100
|
env: 'SEQ_MAX_L2_BLOCK_GAS',
|
|
101
101
|
description: 'The maximum L2 block gas.',
|
|
102
|
-
|
|
102
|
+
parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
|
|
103
103
|
},
|
|
104
104
|
maxDABlockGas: {
|
|
105
105
|
env: 'SEQ_MAX_DA_BLOCK_GAS',
|
|
106
106
|
description: 'The maximum DA block gas.',
|
|
107
|
-
|
|
107
|
+
parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
|
|
108
|
+
},
|
|
109
|
+
perBlockAllocationMultiplier: {
|
|
110
|
+
env: 'SEQ_PER_BLOCK_ALLOCATION_MULTIPLIER',
|
|
111
|
+
description:
|
|
112
|
+
'Per-block gas budget multiplier for both L2 and DA gas. Budget per block is (checkpointLimit / maxBlocks) * multiplier.' +
|
|
113
|
+
' Values greater than one allow early blocks to use more than their even share, relying on checkpoint-level capping for later blocks.',
|
|
114
|
+
...numberConfigHelper(DefaultSequencerConfig.perBlockAllocationMultiplier),
|
|
115
|
+
},
|
|
116
|
+
redistributeCheckpointBudget: {
|
|
117
|
+
env: 'SEQ_REDISTRIBUTE_CHECKPOINT_BUDGET',
|
|
118
|
+
description:
|
|
119
|
+
'Redistribute remaining checkpoint budget evenly across remaining blocks instead of allowing a single block to consume the entire remaining budget.',
|
|
120
|
+
...booleanConfigHelper(DefaultSequencerConfig.redistributeCheckpointBudget),
|
|
108
121
|
},
|
|
109
122
|
coinbase: {
|
|
110
123
|
env: 'COINBASE',
|
|
@@ -124,11 +137,6 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
124
137
|
env: 'ACVM_BINARY_PATH',
|
|
125
138
|
description: 'The path to the ACVM binary',
|
|
126
139
|
},
|
|
127
|
-
maxBlockSizeInBytes: {
|
|
128
|
-
env: 'SEQ_MAX_BLOCK_SIZE_IN_BYTES',
|
|
129
|
-
description: 'Max block size',
|
|
130
|
-
...numberConfigHelper(DefaultSequencerConfig.maxBlockSizeInBytes),
|
|
131
|
-
},
|
|
132
140
|
enforceTimeTable: {
|
|
133
141
|
env: 'SEQ_ENFORCE_TIME_TABLE',
|
|
134
142
|
description: 'Whether to enforce the time table when building blocks',
|
|
@@ -186,6 +194,14 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
186
194
|
description: 'Inject a fake attestation (for testing only)',
|
|
187
195
|
...booleanConfigHelper(DefaultSequencerConfig.injectFakeAttestation),
|
|
188
196
|
},
|
|
197
|
+
injectHighSValueAttestation: {
|
|
198
|
+
description: 'Inject a malleable attestation with a high-s value (for testing only)',
|
|
199
|
+
...booleanConfigHelper(DefaultSequencerConfig.injectHighSValueAttestation),
|
|
200
|
+
},
|
|
201
|
+
injectUnrecoverableSignatureAttestation: {
|
|
202
|
+
description: 'Inject an attestation with an unrecoverable signature (for testing only)',
|
|
203
|
+
...booleanConfigHelper(DefaultSequencerConfig.injectUnrecoverableSignatureAttestation),
|
|
204
|
+
},
|
|
189
205
|
fishermanMode: {
|
|
190
206
|
env: 'FISHERMAN_MODE',
|
|
191
207
|
description:
|
|
@@ -214,7 +230,7 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
214
230
|
description: 'Percent probability (0 - 100) of sequencer skipping checkpoint publishing (testing only)',
|
|
215
231
|
...numberConfigHelper(DefaultSequencerConfig.skipPublishingCheckpointsPercent),
|
|
216
232
|
},
|
|
217
|
-
...pickConfigMappings(p2pConfigMappings, ['
|
|
233
|
+
...pickConfigMappings(p2pConfigMappings, ['txPublicSetupAllowListExtend']),
|
|
218
234
|
};
|
|
219
235
|
|
|
220
236
|
export const sequencerClientConfigMappings: ConfigMappingsType<SequencerClientConfig> = {
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
2
|
-
import type { L1ContractsConfig } from '@aztec/ethereum/config';
|
|
3
1
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
4
|
-
import type {
|
|
2
|
+
import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
|
|
5
3
|
import type { ViemPublicClient } from '@aztec/ethereum/types';
|
|
6
4
|
import { BlockNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
7
5
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
8
6
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
9
7
|
import { createLogger } from '@aztec/foundation/log';
|
|
8
|
+
import type { DateProvider } from '@aztec/foundation/timer';
|
|
10
9
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
11
|
-
import { type L1RollupConstants, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
10
|
+
import { type L1RollupConstants, getNextL1SlotTimestamp, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
12
11
|
import { GasFees } from '@aztec/stdlib/gas';
|
|
13
12
|
import type {
|
|
14
13
|
CheckpointGlobalVariables,
|
|
@@ -16,7 +15,12 @@ import type {
|
|
|
16
15
|
} from '@aztec/stdlib/tx';
|
|
17
16
|
import { GlobalVariables } from '@aztec/stdlib/tx';
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
/** Configuration for the GlobalVariableBuilder (excludes L1 client config). */
|
|
19
|
+
export type GlobalVariableBuilderConfig = {
|
|
20
|
+
l1Contracts: Pick<L1ContractAddresses, 'rollupAddress'>;
|
|
21
|
+
ethereumSlotDuration: number;
|
|
22
|
+
rollupVersion: bigint;
|
|
23
|
+
} & Pick<L1RollupConstants, 'slotDuration' | 'l1GenesisTime'>;
|
|
20
24
|
|
|
21
25
|
/**
|
|
22
26
|
* Simple global variables builder.
|
|
@@ -27,7 +31,6 @@ export class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
|
|
|
27
31
|
private currentL1BlockNumber: bigint | undefined = undefined;
|
|
28
32
|
|
|
29
33
|
private readonly rollupContract: RollupContract;
|
|
30
|
-
private readonly publicClient: ViemPublicClient;
|
|
31
34
|
private readonly ethereumSlotDuration: number;
|
|
32
35
|
private readonly aztecSlotDuration: number;
|
|
33
36
|
private readonly l1GenesisTime: bigint;
|
|
@@ -36,28 +39,18 @@ export class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
|
|
|
36
39
|
private version: Fr;
|
|
37
40
|
|
|
38
41
|
constructor(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
private readonly dateProvider: DateProvider,
|
|
43
|
+
private readonly publicClient: ViemPublicClient,
|
|
44
|
+
config: GlobalVariableBuilderConfig,
|
|
42
45
|
) {
|
|
43
|
-
const { l1RpcUrls, l1ChainId: chainId, l1Contracts } = config;
|
|
44
|
-
|
|
45
|
-
const chain = createEthereumChain(l1RpcUrls, chainId);
|
|
46
|
-
|
|
47
46
|
this.version = new Fr(config.rollupVersion);
|
|
48
|
-
this.chainId = new Fr(
|
|
47
|
+
this.chainId = new Fr(this.publicClient.chain!.id);
|
|
49
48
|
|
|
50
49
|
this.ethereumSlotDuration = config.ethereumSlotDuration;
|
|
51
50
|
this.aztecSlotDuration = config.slotDuration;
|
|
52
51
|
this.l1GenesisTime = config.l1GenesisTime;
|
|
53
52
|
|
|
54
|
-
this.
|
|
55
|
-
chain: chain.chainInfo,
|
|
56
|
-
transport: fallback(chain.rpcUrls.map(url => http(url, { batch: false }))),
|
|
57
|
-
pollingInterval: config.viemPollingIntervalMS,
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
this.rollupContract = new RollupContract(this.publicClient, l1Contracts.rollupAddress);
|
|
53
|
+
this.rollupContract = new RollupContract(this.publicClient, config.l1Contracts.rollupAddress);
|
|
61
54
|
}
|
|
62
55
|
|
|
63
56
|
/**
|
|
@@ -73,7 +66,10 @@ export class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
|
|
|
73
66
|
const earliestTimestamp = await this.rollupContract.getTimestampForSlot(
|
|
74
67
|
SlotNumber.fromBigInt(BigInt(lastCheckpoint.slotNumber) + 1n),
|
|
75
68
|
);
|
|
76
|
-
const nextEthTimestamp =
|
|
69
|
+
const nextEthTimestamp = getNextL1SlotTimestamp(this.dateProvider.nowInSeconds(), {
|
|
70
|
+
l1GenesisTime: this.l1GenesisTime,
|
|
71
|
+
ethereumSlotDuration: this.ethereumSlotDuration,
|
|
72
|
+
});
|
|
77
73
|
const timestamp = earliestTimestamp > nextEthTimestamp ? earliestTimestamp : nextEthTimestamp;
|
|
78
74
|
|
|
79
75
|
return new GasFees(0, await this.rollupContract.getManaMinFeeAt(timestamp, true));
|
|
@@ -108,7 +104,10 @@ export class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
|
|
|
108
104
|
const slot: SlotNumber =
|
|
109
105
|
maybeSlot ??
|
|
110
106
|
(await this.rollupContract.getSlotAt(
|
|
111
|
-
|
|
107
|
+
getNextL1SlotTimestamp(this.dateProvider.nowInSeconds(), {
|
|
108
|
+
l1GenesisTime: this.l1GenesisTime,
|
|
109
|
+
ethereumSlotDuration: this.ethereumSlotDuration,
|
|
110
|
+
}),
|
|
112
111
|
));
|
|
113
112
|
|
|
114
113
|
const checkpointGlobalVariables = await this.buildCheckpointGlobalVariables(coinbase, feeRecipient, slot);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { GlobalVariableBuilder } from './global_builder.js';
|
|
1
|
+
export { GlobalVariableBuilder, type GlobalVariableBuilderConfig } from './global_builder.js';
|