@aztec/sequencer-client 0.0.1-commit.f2ce05ee → 0.0.1-commit.f5d02921e
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 +15 -7
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +60 -26
- package/dest/config.d.ts +26 -6
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +44 -21
- package/dest/global_variable_builder/global_builder.d.ts +15 -11
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +29 -25
- package/dest/global_variable_builder/index.d.ts +2 -2
- package/dest/global_variable_builder/index.d.ts.map +1 -1
- package/dest/publisher/config.d.ts +47 -17
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +121 -42
- package/dest/publisher/index.d.ts +2 -1
- package/dest/publisher/index.d.ts.map +1 -1
- package/dest/publisher/l1_tx_failed_store/factory.d.ts +11 -0
- package/dest/publisher/l1_tx_failed_store/factory.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/factory.js +22 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts +59 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.js +1 -0
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts +15 -0
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.js +34 -0
- package/dest/publisher/l1_tx_failed_store/index.d.ts +4 -0
- package/dest/publisher/l1_tx_failed_store/index.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/index.js +2 -0
- package/dest/publisher/sequencer-publisher-factory.d.ts +11 -3
- package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-factory.js +27 -2
- package/dest/publisher/sequencer-publisher.d.ts +76 -30
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +396 -71
- package/dest/sequencer/checkpoint_proposal_job.d.ts +33 -8
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_proposal_job.js +345 -172
- 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 +2 -1
- package/dest/sequencer/events.d.ts.map +1 -1
- package/dest/sequencer/metrics.d.ts +21 -5
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +97 -15
- package/dest/sequencer/sequencer.d.ts +40 -17
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +145 -91
- 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/index.d.ts +3 -5
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.d.ts +11 -11
- package/dest/test/mock_checkpoint_builder.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.js +45 -34
- package/dest/test/utils.d.ts +3 -3
- package/dest/test/utils.d.ts.map +1 -1
- package/dest/test/utils.js +5 -4
- package/package.json +27 -28
- package/src/client/sequencer-client.ts +76 -23
- package/src/config.ts +56 -27
- package/src/global_variable_builder/global_builder.ts +38 -27
- package/src/global_variable_builder/index.ts +1 -1
- package/src/publisher/config.ts +153 -43
- package/src/publisher/index.ts +3 -0
- package/src/publisher/l1_tx_failed_store/factory.ts +32 -0
- package/src/publisher/l1_tx_failed_store/failed_tx_store.ts +55 -0
- package/src/publisher/l1_tx_failed_store/file_store_failed_tx_store.ts +46 -0
- package/src/publisher/l1_tx_failed_store/index.ts +3 -0
- package/src/publisher/sequencer-publisher-factory.ts +38 -6
- package/src/publisher/sequencer-publisher.ts +442 -95
- package/src/sequencer/checkpoint_proposal_job.ts +454 -178
- package/src/sequencer/checkpoint_voter.ts +1 -12
- package/src/sequencer/events.ts +1 -1
- package/src/sequencer/metrics.ts +106 -18
- package/src/sequencer/sequencer.ts +208 -107
- package/src/sequencer/timetable.ts +7 -7
- package/src/sequencer/types.ts +1 -1
- package/src/test/index.ts +2 -4
- package/src/test/mock_checkpoint_builder.ts +63 -49
- package/src/test/utils.ts +5 -2
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { NUM_CHECKPOINT_END_MARKER_FIELDS, getNumBlockEndBlobFields } from '@aztec/blob-lib/encoding';
|
|
2
|
-
import { BLOBS_PER_CHECKPOINT, FIELDS_PER_BLOB } from '@aztec/constants';
|
|
3
1
|
import type { EpochCache } from '@aztec/epoch-cache';
|
|
2
|
+
import { type FeeHeader, RollupContract } from '@aztec/ethereum/contracts';
|
|
4
3
|
import {
|
|
5
4
|
BlockNumber,
|
|
6
5
|
CheckpointNumber,
|
|
@@ -9,6 +8,11 @@ import {
|
|
|
9
8
|
SlotNumber,
|
|
10
9
|
} from '@aztec/foundation/branded-types';
|
|
11
10
|
import { randomInt } from '@aztec/foundation/crypto/random';
|
|
11
|
+
import {
|
|
12
|
+
flipSignature,
|
|
13
|
+
generateRecoverableSignature,
|
|
14
|
+
generateUnrecoverableSignature,
|
|
15
|
+
} from '@aztec/foundation/crypto/secp256k1-signer';
|
|
12
16
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
13
17
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
14
18
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
@@ -27,18 +31,23 @@ import {
|
|
|
27
31
|
type L2BlockSource,
|
|
28
32
|
MaliciousCommitteeAttestationsAndSigners,
|
|
29
33
|
} from '@aztec/stdlib/block';
|
|
30
|
-
import type
|
|
31
|
-
import { getSlotStartBuildTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
34
|
+
import { type Checkpoint, type ProposedCheckpointData, validateCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
35
|
+
import { computeQuorum, getSlotStartBuildTimestamp, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
32
36
|
import { Gas } from '@aztec/stdlib/gas';
|
|
33
37
|
import {
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
type BlockBuilderOptions,
|
|
39
|
+
InsufficientValidTxsError,
|
|
36
40
|
type ResolvedSequencerConfig,
|
|
37
41
|
type WorldStateSynchronizer,
|
|
38
42
|
} from '@aztec/stdlib/interfaces/server';
|
|
39
43
|
import { type L1ToL2MessageSource, computeInHashFromL1ToL2Messages } from '@aztec/stdlib/messaging';
|
|
40
|
-
import type {
|
|
41
|
-
|
|
44
|
+
import type {
|
|
45
|
+
BlockProposal,
|
|
46
|
+
BlockProposalOptions,
|
|
47
|
+
CheckpointProposal,
|
|
48
|
+
CheckpointProposalOptions,
|
|
49
|
+
} from '@aztec/stdlib/p2p';
|
|
50
|
+
import { orderAttestations, trimAttestations } from '@aztec/stdlib/p2p';
|
|
42
51
|
import type { L2BlockBuiltStats } from '@aztec/stdlib/stats';
|
|
43
52
|
import { type FailedTx, Tx } from '@aztec/stdlib/tx';
|
|
44
53
|
import { AttestationTimeoutError } from '@aztec/stdlib/validators';
|
|
@@ -59,6 +68,13 @@ import { SequencerState } from './utils.js';
|
|
|
59
68
|
/** How much time to sleep while waiting for min transactions to accumulate for a block */
|
|
60
69
|
const TXS_POLLING_MS = 500;
|
|
61
70
|
|
|
71
|
+
/** Result from proposeCheckpoint when a checkpoint was successfully built and attested. */
|
|
72
|
+
type CheckpointProposalResult = {
|
|
73
|
+
checkpoint: Checkpoint;
|
|
74
|
+
attestations: CommitteeAttestationsAndSigners;
|
|
75
|
+
attestationsSignature: Signature;
|
|
76
|
+
};
|
|
77
|
+
|
|
62
78
|
/**
|
|
63
79
|
* Handles the execution of a checkpoint proposal after the initial preparation phase.
|
|
64
80
|
* This includes building blocks, collecting attestations, and publishing the checkpoint to L1,
|
|
@@ -68,9 +84,16 @@ const TXS_POLLING_MS = 500;
|
|
|
68
84
|
export class CheckpointProposalJob implements Traceable {
|
|
69
85
|
protected readonly log: Logger;
|
|
70
86
|
|
|
87
|
+
/** Tracks the fire-and-forget L1 submission promise so it can be awaited during shutdown. */
|
|
88
|
+
private pendingL1Submission: Promise<void> | undefined;
|
|
89
|
+
|
|
90
|
+
/** Fee header override computed during proposeCheckpoint, reused in enqueueCheckpointForSubmission. */
|
|
91
|
+
private computedForceProposedFeeHeader?: { checkpointNumber: CheckpointNumber; feeHeader: FeeHeader };
|
|
92
|
+
|
|
71
93
|
constructor(
|
|
72
|
-
private readonly
|
|
73
|
-
private readonly
|
|
94
|
+
private readonly slotNow: SlotNumber,
|
|
95
|
+
private readonly targetSlot: SlotNumber,
|
|
96
|
+
private readonly targetEpoch: EpochNumber,
|
|
74
97
|
private readonly checkpointNumber: CheckpointNumber,
|
|
75
98
|
private readonly syncedToBlockNumber: BlockNumber,
|
|
76
99
|
// TODO(palla/mbps): Can we remove the proposer in favor of attestorAddress? Need to check fisherman-node flows.
|
|
@@ -97,13 +120,25 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
97
120
|
private readonly setStateFn: (state: SequencerState, slot?: SlotNumber) => void,
|
|
98
121
|
public readonly tracer: Tracer,
|
|
99
122
|
bindings?: LoggerBindings,
|
|
123
|
+
private readonly proposedCheckpointData?: ProposedCheckpointData,
|
|
100
124
|
) {
|
|
101
|
-
this.log = createLogger('sequencer:checkpoint-proposal', {
|
|
125
|
+
this.log = createLogger('sequencer:checkpoint-proposal', {
|
|
126
|
+
...bindings,
|
|
127
|
+
instanceId: `slot-${this.slotNow}`,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** Awaits the pending L1 submission if one is in progress. Call during shutdown. */
|
|
132
|
+
public async awaitPendingSubmission(): Promise<void> {
|
|
133
|
+
this.log.info('Awaiting pending L1 payload submission');
|
|
134
|
+
await this.pendingL1Submission;
|
|
102
135
|
}
|
|
103
136
|
|
|
104
137
|
/**
|
|
105
138
|
* Executes the checkpoint proposal job.
|
|
106
|
-
*
|
|
139
|
+
* Builds blocks, collects attestations, enqueues requests, and schedules L1 submission as a
|
|
140
|
+
* background task so the work loop can return to IDLE immediately.
|
|
141
|
+
* Returns the built checkpoint if successful, undefined otherwise.
|
|
107
142
|
*/
|
|
108
143
|
@trackSpan('CheckpointProposalJob.execute')
|
|
109
144
|
public async execute(): Promise<Checkpoint | undefined> {
|
|
@@ -111,7 +146,7 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
111
146
|
// In fisherman mode, we simulate slashing but don't actually publish to L1
|
|
112
147
|
// These are constant for the whole slot, so we only enqueue them once
|
|
113
148
|
const votesPromises = new CheckpointVoter(
|
|
114
|
-
this.
|
|
149
|
+
this.targetSlot,
|
|
115
150
|
this.publisher,
|
|
116
151
|
this.attestorAddress,
|
|
117
152
|
this.validatorClient,
|
|
@@ -122,14 +157,16 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
122
157
|
this.log,
|
|
123
158
|
).enqueueVotes();
|
|
124
159
|
|
|
125
|
-
// Build and propose the checkpoint.
|
|
126
|
-
|
|
160
|
+
// Build and propose the checkpoint. Builds blocks, broadcasts, collects attestations, and signs.
|
|
161
|
+
// Does NOT enqueue to L1 yet — that happens after the pipeline sleep.
|
|
162
|
+
const proposalResult = await this.proposeCheckpoint();
|
|
163
|
+
const checkpoint = proposalResult?.checkpoint;
|
|
127
164
|
|
|
128
165
|
// Wait until the voting promises have resolved, so all requests are enqueued (not sent)
|
|
129
166
|
await Promise.all(votesPromises);
|
|
130
167
|
|
|
131
168
|
if (checkpoint) {
|
|
132
|
-
this.metrics.
|
|
169
|
+
this.metrics.recordCheckpointProposalSuccess();
|
|
133
170
|
}
|
|
134
171
|
|
|
135
172
|
// Do not post anything to L1 if we are fishermen, but do perform L1 fee analysis
|
|
@@ -138,47 +175,135 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
138
175
|
return;
|
|
139
176
|
}
|
|
140
177
|
|
|
141
|
-
//
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
} else if (checkpoint) {
|
|
150
|
-
this.eventEmitter.emit('checkpoint-publish-failed', { ...l1Response, slot: this.slot });
|
|
151
|
-
return undefined;
|
|
178
|
+
// Enqueue the checkpoint for L1 submission
|
|
179
|
+
if (proposalResult) {
|
|
180
|
+
try {
|
|
181
|
+
await this.enqueueCheckpointForSubmission(proposalResult);
|
|
182
|
+
} catch (err) {
|
|
183
|
+
this.log.error(`Failed to enqueue checkpoint for L1 submission at slot ${this.targetSlot}`, err);
|
|
184
|
+
// Continue to sendRequestsAt so votes are still sent
|
|
185
|
+
}
|
|
152
186
|
}
|
|
187
|
+
|
|
188
|
+
// Compute the earliest time to submit: pipeline slot start when pipelining, now otherwise.
|
|
189
|
+
const submitAfter = this.epochCache.isProposerPipeliningEnabled()
|
|
190
|
+
? new Date(Number(getTimestampForSlot(this.targetSlot, this.l1Constants)) * 1000)
|
|
191
|
+
: new Date(this.dateProvider.now());
|
|
192
|
+
|
|
193
|
+
// TODO(https://github.com/AztecProtocol/aztec-packages/pull/21250): should discard the pending submission if a reorg occurs underneath
|
|
194
|
+
|
|
195
|
+
// Schedule L1 submission in the background so the work loop returns immediately.
|
|
196
|
+
// The publisher will sleep until submitAfter, then send the bundled requests.
|
|
197
|
+
// The promise is stored so it can be awaited during shutdown.
|
|
198
|
+
this.pendingL1Submission = this.publisher
|
|
199
|
+
.sendRequestsAt(submitAfter)
|
|
200
|
+
.then(async l1Response => {
|
|
201
|
+
const proposedAction = l1Response?.successfulActions.find(a => a === 'propose');
|
|
202
|
+
if (proposedAction) {
|
|
203
|
+
this.eventEmitter.emit('checkpoint-published', { checkpoint: this.checkpointNumber, slot: this.targetSlot });
|
|
204
|
+
const coinbase = checkpoint?.header.coinbase;
|
|
205
|
+
await this.metrics.incFilledSlot(this.publisher.getSenderAddress().toString(), coinbase);
|
|
206
|
+
} else if (checkpoint) {
|
|
207
|
+
this.eventEmitter.emit('checkpoint-publish-failed', { ...l1Response, slot: this.targetSlot });
|
|
208
|
+
|
|
209
|
+
if (this.epochCache.isProposerPipeliningEnabled()) {
|
|
210
|
+
this.metrics.recordPipelineDiscard();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
})
|
|
214
|
+
.catch(err => {
|
|
215
|
+
this.log.error(`Background L1 submission failed for slot ${this.targetSlot}`, err);
|
|
216
|
+
if (checkpoint) {
|
|
217
|
+
this.eventEmitter.emit('checkpoint-publish-failed', { slot: this.targetSlot });
|
|
218
|
+
|
|
219
|
+
if (this.epochCache.isProposerPipeliningEnabled()) {
|
|
220
|
+
this.metrics.recordPipelineDiscard();
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
// Return the built checkpoint immediately — the work loop is now unblocked
|
|
226
|
+
return checkpoint;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** Enqueues the checkpoint for L1 submission. Called after pipeline sleep in execute(). */
|
|
230
|
+
private async enqueueCheckpointForSubmission(result: CheckpointProposalResult): Promise<void> {
|
|
231
|
+
const { checkpoint, attestations, attestationsSignature } = result;
|
|
232
|
+
|
|
233
|
+
this.setStateFn(SequencerState.PUBLISHING_CHECKPOINT, this.targetSlot);
|
|
234
|
+
const aztecSlotDuration = this.l1Constants.slotDuration;
|
|
235
|
+
const submissionSlotStart = Number(getTimestampForSlot(this.targetSlot, this.l1Constants));
|
|
236
|
+
const txTimeoutAt = new Date((submissionSlotStart + aztecSlotDuration) * 1000);
|
|
237
|
+
|
|
238
|
+
// If we have been configured to potentially skip publishing checkpoint then roll the dice here
|
|
239
|
+
if (
|
|
240
|
+
this.config.skipPublishingCheckpointsPercent !== undefined &&
|
|
241
|
+
this.config.skipPublishingCheckpointsPercent > 0
|
|
242
|
+
) {
|
|
243
|
+
const roll = Math.max(0, randomInt(100));
|
|
244
|
+
if (roll < this.config.skipPublishingCheckpointsPercent) {
|
|
245
|
+
this.log.warn(
|
|
246
|
+
`Skipping publishing proposal for checkpoint ${checkpoint.number}. Configured percentage: ${this.config.skipPublishingCheckpointsPercent}, generated value: ${roll}`,
|
|
247
|
+
);
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
await this.publisher.enqueueProposeCheckpoint(checkpoint, attestations, attestationsSignature, {
|
|
253
|
+
txTimeoutAt,
|
|
254
|
+
forcePendingCheckpointNumber: this.invalidateCheckpoint?.forcePendingCheckpointNumber,
|
|
255
|
+
forceProposedFeeHeader: this.computedForceProposedFeeHeader,
|
|
256
|
+
});
|
|
153
257
|
}
|
|
154
258
|
|
|
155
259
|
@trackSpan('CheckpointProposalJob.proposeCheckpoint', function () {
|
|
156
260
|
return {
|
|
157
261
|
// nullish operator needed for tests
|
|
158
262
|
[Attributes.COINBASE]: this.validatorClient.getCoinbaseForAttestor(this.attestorAddress)?.toString(),
|
|
159
|
-
[Attributes.SLOT_NUMBER]: this.
|
|
263
|
+
[Attributes.SLOT_NUMBER]: this.targetSlot,
|
|
160
264
|
};
|
|
161
265
|
})
|
|
162
|
-
private async proposeCheckpoint(): Promise<
|
|
266
|
+
private async proposeCheckpoint(): Promise<CheckpointProposalResult | undefined> {
|
|
163
267
|
try {
|
|
164
268
|
// Get operator configured coinbase and fee recipient for this attestor
|
|
165
269
|
const coinbase = this.validatorClient.getCoinbaseForAttestor(this.attestorAddress);
|
|
166
270
|
const feeRecipient = this.validatorClient.getFeeRecipientForAttestor(this.attestorAddress);
|
|
167
271
|
|
|
168
272
|
// Start the checkpoint
|
|
169
|
-
this.setStateFn(SequencerState.INITIALIZING_CHECKPOINT, this.
|
|
170
|
-
this.
|
|
273
|
+
this.setStateFn(SequencerState.INITIALIZING_CHECKPOINT, this.targetSlot);
|
|
274
|
+
this.log.info(`Starting checkpoint proposal`, {
|
|
275
|
+
buildSlot: this.slotNow,
|
|
276
|
+
submissionSlot: this.targetSlot,
|
|
277
|
+
pipelining: this.epochCache.isProposerPipeliningEnabled(),
|
|
278
|
+
proposer: this.proposer?.toString(),
|
|
279
|
+
coinbase: coinbase.toString(),
|
|
280
|
+
});
|
|
281
|
+
this.metrics.incOpenSlot(this.targetSlot, this.proposer?.toString() ?? 'unknown');
|
|
171
282
|
|
|
172
283
|
// Enqueues checkpoint invalidation (constant for the whole slot)
|
|
173
284
|
if (this.invalidateCheckpoint && !this.config.skipInvalidateBlockAsProposer) {
|
|
174
285
|
this.publisher.enqueueInvalidateCheckpoint(this.invalidateCheckpoint);
|
|
175
286
|
}
|
|
176
287
|
|
|
177
|
-
// Create checkpoint builder for the slot
|
|
288
|
+
// Create checkpoint builder for the slot.
|
|
289
|
+
// When pipelining, force the proposed checkpoint number and fee header to our parent so the
|
|
290
|
+
// fee computation sees the same chain tip that L1 will see once the previous pipelined checkpoint lands.
|
|
291
|
+
const isPipelining = this.epochCache.isProposerPipeliningEnabled();
|
|
292
|
+
const parentCheckpointNumber = isPipelining ? CheckpointNumber(this.checkpointNumber - 1) : undefined;
|
|
293
|
+
|
|
294
|
+
// Compute the parent's fee header override when pipelining
|
|
295
|
+
if (isPipelining && this.proposedCheckpointData) {
|
|
296
|
+
this.computedForceProposedFeeHeader = await this.computeForceProposedFeeHeader(parentCheckpointNumber!);
|
|
297
|
+
}
|
|
298
|
+
|
|
178
299
|
const checkpointGlobalVariables = await this.globalsBuilder.buildCheckpointGlobalVariables(
|
|
179
300
|
coinbase,
|
|
180
301
|
feeRecipient,
|
|
181
|
-
this.
|
|
302
|
+
this.targetSlot,
|
|
303
|
+
{
|
|
304
|
+
forcePendingCheckpointNumber: parentCheckpointNumber,
|
|
305
|
+
forceProposedFeeHeader: this.computedForceProposedFeeHeader,
|
|
306
|
+
},
|
|
182
307
|
);
|
|
183
308
|
|
|
184
309
|
// Collect L1 to L2 messages for the checkpoint and compute their hash
|
|
@@ -186,18 +311,21 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
186
311
|
const inHash = computeInHashFromL1ToL2Messages(l1ToL2Messages);
|
|
187
312
|
|
|
188
313
|
// Collect the out hashes of all the checkpoints before this one in the same epoch
|
|
189
|
-
const
|
|
190
|
-
c => c.
|
|
191
|
-
|
|
192
|
-
|
|
314
|
+
const previousCheckpointOutHashes = (await this.l2BlockSource.getCheckpointsDataForEpoch(this.targetEpoch))
|
|
315
|
+
.filter(c => c.checkpointNumber < this.checkpointNumber)
|
|
316
|
+
.map(c => c.checkpointOutHash);
|
|
317
|
+
|
|
318
|
+
// Get the fee asset price modifier from the oracle
|
|
319
|
+
const feeAssetPriceModifier = await this.publisher.getFeeAssetPriceModifier();
|
|
193
320
|
|
|
194
321
|
// Create a long-lived forked world state for the checkpoint builder
|
|
195
|
-
using fork = await this.worldState.fork(this.syncedToBlockNumber, { closeDelayMs: 12_000 });
|
|
322
|
+
await using fork = await this.worldState.fork(this.syncedToBlockNumber, { closeDelayMs: 12_000 });
|
|
196
323
|
|
|
197
324
|
// Create checkpoint builder for the entire slot
|
|
198
325
|
const checkpointBuilder = await this.checkpointsBuilder.startCheckpoint(
|
|
199
326
|
this.checkpointNumber,
|
|
200
327
|
checkpointGlobalVariables,
|
|
328
|
+
feeAssetPriceModifier,
|
|
201
329
|
l1ToL2Messages,
|
|
202
330
|
previousCheckpointOutHashes,
|
|
203
331
|
fork,
|
|
@@ -217,6 +345,7 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
217
345
|
|
|
218
346
|
let blocksInCheckpoint: L2Block[] = [];
|
|
219
347
|
let blockPendingBroadcast: { block: L2Block; txs: Tx[] } | undefined = undefined;
|
|
348
|
+
const checkpointBuildTimer = new Timer();
|
|
220
349
|
|
|
221
350
|
try {
|
|
222
351
|
// Main loop: build blocks for the checkpoint
|
|
@@ -239,29 +368,67 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
239
368
|
}
|
|
240
369
|
|
|
241
370
|
if (blocksInCheckpoint.length === 0) {
|
|
242
|
-
this.log.warn(`No blocks were built for slot ${this.
|
|
243
|
-
this.eventEmitter.emit('checkpoint-empty', { slot: this.
|
|
371
|
+
this.log.warn(`No blocks were built for slot ${this.targetSlot}`, { slot: this.targetSlot });
|
|
372
|
+
this.eventEmitter.emit('checkpoint-empty', { slot: this.targetSlot });
|
|
373
|
+
return undefined;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
const minBlocksForCheckpoint = this.config.minBlocksForCheckpoint;
|
|
377
|
+
if (minBlocksForCheckpoint !== undefined && blocksInCheckpoint.length < minBlocksForCheckpoint) {
|
|
378
|
+
this.log.warn(
|
|
379
|
+
`Checkpoint has fewer blocks than minimum (${blocksInCheckpoint.length} < ${minBlocksForCheckpoint}), skipping proposal`,
|
|
380
|
+
{ slot: this.targetSlot, blocksBuilt: blocksInCheckpoint.length, minBlocksForCheckpoint },
|
|
381
|
+
);
|
|
244
382
|
return undefined;
|
|
245
383
|
}
|
|
246
384
|
|
|
247
385
|
// Assemble and broadcast the checkpoint proposal, including the last block that was not
|
|
248
386
|
// broadcasted yet, and wait to collect the committee attestations.
|
|
249
|
-
this.setStateFn(SequencerState.ASSEMBLING_CHECKPOINT, this.
|
|
387
|
+
this.setStateFn(SequencerState.ASSEMBLING_CHECKPOINT, this.targetSlot);
|
|
250
388
|
const checkpoint = await checkpointBuilder.completeCheckpoint();
|
|
251
389
|
|
|
390
|
+
// Final validation: per-block limits are only checked if the operator set them explicitly.
|
|
391
|
+
// Otherwise, checkpoint-level budgets were already enforced by the redistribution logic.
|
|
392
|
+
try {
|
|
393
|
+
validateCheckpoint(checkpoint, {
|
|
394
|
+
rollupManaLimit: this.l1Constants.rollupManaLimit,
|
|
395
|
+
maxL2BlockGas: this.config.maxL2BlockGas,
|
|
396
|
+
maxDABlockGas: this.config.maxDABlockGas,
|
|
397
|
+
maxTxsPerBlock: this.config.maxTxsPerBlock,
|
|
398
|
+
maxTxsPerCheckpoint: this.config.maxTxsPerCheckpoint,
|
|
399
|
+
});
|
|
400
|
+
} catch (err) {
|
|
401
|
+
this.log.error(`Built an invalid checkpoint at slot ${this.slotNow} (skipping proposal)`, err, {
|
|
402
|
+
checkpoint: checkpoint.header.toInspect(),
|
|
403
|
+
});
|
|
404
|
+
return undefined;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
// Record checkpoint-level build metrics
|
|
408
|
+
this.metrics.recordCheckpointBuild(
|
|
409
|
+
checkpointBuildTimer.ms(),
|
|
410
|
+
blocksInCheckpoint.length,
|
|
411
|
+
checkpoint.getStats().txCount,
|
|
412
|
+
Number(checkpoint.header.totalManaUsed.toBigInt()),
|
|
413
|
+
);
|
|
414
|
+
|
|
252
415
|
// Do not collect attestations nor publish to L1 in fisherman mode
|
|
253
416
|
if (this.config.fishermanMode) {
|
|
254
417
|
this.log.info(
|
|
255
|
-
`Built checkpoint for slot ${this.
|
|
418
|
+
`Built checkpoint for slot ${this.targetSlot} with ${blocksInCheckpoint.length} blocks. ` +
|
|
256
419
|
`Skipping proposal in fisherman mode.`,
|
|
257
420
|
{
|
|
258
|
-
slot: this.
|
|
421
|
+
slot: this.targetSlot,
|
|
259
422
|
checkpoint: checkpoint.header.toInspect(),
|
|
260
423
|
blocksBuilt: blocksInCheckpoint.length,
|
|
261
424
|
},
|
|
262
425
|
);
|
|
263
426
|
this.metrics.recordCheckpointSuccess();
|
|
264
|
-
return
|
|
427
|
+
return {
|
|
428
|
+
checkpoint,
|
|
429
|
+
attestations: CommitteeAttestationsAndSigners.empty(),
|
|
430
|
+
attestationsSignature: Signature.empty(),
|
|
431
|
+
};
|
|
265
432
|
}
|
|
266
433
|
|
|
267
434
|
// Include the block pending broadcast in the checkpoint proposal if any
|
|
@@ -275,6 +442,7 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
275
442
|
const proposal = await this.validatorClient.createCheckpointProposal(
|
|
276
443
|
checkpoint.header,
|
|
277
444
|
checkpoint.archive.root,
|
|
445
|
+
feeAssetPriceModifier,
|
|
278
446
|
lastBlock,
|
|
279
447
|
this.proposer,
|
|
280
448
|
checkpointProposalOptions,
|
|
@@ -283,7 +451,7 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
283
451
|
const blockProposedAt = this.dateProvider.now();
|
|
284
452
|
await this.p2pClient.broadcastCheckpointProposal(proposal);
|
|
285
453
|
|
|
286
|
-
this.setStateFn(SequencerState.COLLECTING_ATTESTATIONS, this.
|
|
454
|
+
this.setStateFn(SequencerState.COLLECTING_ATTESTATIONS, this.targetSlot);
|
|
287
455
|
const attestations = await this.waitForAttestations(proposal);
|
|
288
456
|
const blockAttestedAt = this.dateProvider.now();
|
|
289
457
|
|
|
@@ -296,7 +464,7 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
296
464
|
attestationsSignature = await this.validatorClient.signAttestationsAndSigners(
|
|
297
465
|
attestations,
|
|
298
466
|
signer,
|
|
299
|
-
this.
|
|
467
|
+
this.targetSlot,
|
|
300
468
|
this.checkpointNumber,
|
|
301
469
|
);
|
|
302
470
|
} catch (err) {
|
|
@@ -308,24 +476,15 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
308
476
|
throw err;
|
|
309
477
|
}
|
|
310
478
|
|
|
311
|
-
//
|
|
312
|
-
|
|
313
|
-
const aztecSlotDuration = this.l1Constants.slotDuration;
|
|
314
|
-
const slotStartBuildTimestamp = this.getSlotStartBuildTimestamp();
|
|
315
|
-
const txTimeoutAt = new Date((slotStartBuildTimestamp + aztecSlotDuration) * 1000);
|
|
316
|
-
await this.publisher.enqueueProposeCheckpoint(checkpoint, attestations, attestationsSignature, {
|
|
317
|
-
txTimeoutAt,
|
|
318
|
-
forcePendingCheckpointNumber: this.invalidateCheckpoint?.forcePendingCheckpointNumber,
|
|
319
|
-
});
|
|
320
|
-
|
|
321
|
-
return checkpoint;
|
|
479
|
+
// Return the result for the caller to enqueue after the pipeline sleep
|
|
480
|
+
return { checkpoint, attestations, attestationsSignature };
|
|
322
481
|
} catch (err) {
|
|
323
482
|
if (err && (err instanceof DutyAlreadySignedError || err instanceof SlashingProtectionError)) {
|
|
324
483
|
// swallow this error. It's already been logged by a function deeper in the stack
|
|
325
484
|
return undefined;
|
|
326
485
|
}
|
|
327
486
|
|
|
328
|
-
this.log.error(`Error building checkpoint at slot ${this.
|
|
487
|
+
this.log.error(`Error building checkpoint at slot ${this.targetSlot}`, err);
|
|
329
488
|
return undefined;
|
|
330
489
|
}
|
|
331
490
|
}
|
|
@@ -347,9 +506,6 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
347
506
|
const txHashesAlreadyIncluded = new Set<string>();
|
|
348
507
|
const initialBlockNumber = BlockNumber(this.syncedToBlockNumber + 1);
|
|
349
508
|
|
|
350
|
-
// Remaining blob fields available for blocks (checkpoint end marker already subtracted)
|
|
351
|
-
let remainingBlobFields = BLOBS_PER_CHECKPOINT * FIELDS_PER_BLOB - NUM_CHECKPOINT_END_MARKER_FIELDS;
|
|
352
|
-
|
|
353
509
|
// Last block in the checkpoint will usually be flagged as pending broadcast, so we send it along with the checkpoint proposal
|
|
354
510
|
let blockPendingBroadcast: { block: L2Block; txs: Tx[] } | undefined = undefined;
|
|
355
511
|
|
|
@@ -363,7 +519,7 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
363
519
|
|
|
364
520
|
if (!timingInfo.canStart) {
|
|
365
521
|
this.log.debug(`Not enough time left in slot to start another block`, {
|
|
366
|
-
slot: this.
|
|
522
|
+
slot: this.targetSlot,
|
|
367
523
|
blocksBuilt,
|
|
368
524
|
secondsIntoSlot,
|
|
369
525
|
});
|
|
@@ -382,7 +538,6 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
382
538
|
blockNumber,
|
|
383
539
|
indexWithinCheckpoint,
|
|
384
540
|
txHashesAlreadyIncluded,
|
|
385
|
-
remainingBlobFields,
|
|
386
541
|
});
|
|
387
542
|
|
|
388
543
|
// TODO(palla/mbps): Review these conditions. We may want to keep trying in some scenarios.
|
|
@@ -399,8 +554,8 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
399
554
|
} else if ('error' in buildResult) {
|
|
400
555
|
// If there was an error building the block, just exit the loop and give up the rest of the slot
|
|
401
556
|
if (!(buildResult.error instanceof SequencerInterruptedError)) {
|
|
402
|
-
this.log.warn(`Halting block building for slot ${this.
|
|
403
|
-
slot: this.
|
|
557
|
+
this.log.warn(`Halting block building for slot ${this.targetSlot}`, {
|
|
558
|
+
slot: this.targetSlot,
|
|
404
559
|
blocksBuilt,
|
|
405
560
|
error: buildResult.error,
|
|
406
561
|
});
|
|
@@ -408,26 +563,16 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
408
563
|
break;
|
|
409
564
|
}
|
|
410
565
|
|
|
411
|
-
const { block, usedTxs
|
|
566
|
+
const { block, usedTxs } = buildResult;
|
|
412
567
|
blocksInCheckpoint.push(block);
|
|
413
|
-
|
|
414
|
-
// Update remaining blob fields for the next block
|
|
415
|
-
remainingBlobFields = newRemainingBlobFields;
|
|
416
|
-
|
|
417
|
-
// Sync the proposed block to the archiver to make it available
|
|
418
|
-
// Note that the checkpoint builder uses its own fork so it should not need to wait for this syncing
|
|
419
|
-
// Eventually we should refactor the checkpoint builder to not need a separate long-lived fork
|
|
420
|
-
// Fire and forget - don't block the critical path, but log errors
|
|
421
|
-
this.syncProposedBlockToArchiver(block).catch(err => {
|
|
422
|
-
this.log.error(`Failed to sync proposed block ${block.number} to archiver`, { blockNumber: block.number, err });
|
|
423
|
-
});
|
|
424
|
-
|
|
425
568
|
usedTxs.forEach(tx => txHashesAlreadyIncluded.add(tx.txHash.toString()));
|
|
426
569
|
|
|
427
|
-
// If this is the last block,
|
|
570
|
+
// If this is the last block, sync it to the archiver and exit the loop
|
|
571
|
+
// so we can build the checkpoint and start collecting attestations.
|
|
428
572
|
if (timingInfo.isLastBlock) {
|
|
429
|
-
this.
|
|
430
|
-
|
|
573
|
+
await this.syncProposedBlockToArchiver(block);
|
|
574
|
+
this.log.verbose(`Completed final block ${blockNumber} for slot ${this.targetSlot}`, {
|
|
575
|
+
slot: this.targetSlot,
|
|
431
576
|
blockNumber,
|
|
432
577
|
blocksBuilt,
|
|
433
578
|
});
|
|
@@ -435,38 +580,61 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
435
580
|
break;
|
|
436
581
|
}
|
|
437
582
|
|
|
438
|
-
//
|
|
439
|
-
//
|
|
440
|
-
if
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
}
|
|
583
|
+
// Broadcast the block proposal (unless we're in fisherman mode) unless the block is the last one,
|
|
584
|
+
// in which case we'll broadcast it along with the checkpoint at the end of the loop.
|
|
585
|
+
// Note that we only send the block to the archiver if we manage to create the proposal, so if there's
|
|
586
|
+
// a HA error we don't pollute our archiver with a block that won't make it to the chain.
|
|
587
|
+
const proposal = await this.createBlockProposal(block, inHash, usedTxs, blockProposalOptions);
|
|
588
|
+
|
|
589
|
+
// Sync the proposed block to the archiver to make it available, only after we've managed to sign the proposal.
|
|
590
|
+
// We wait for the sync to succeed, as this helps catch consistency errors, even if it means we lose some time for block-building.
|
|
591
|
+
// If this throws, we abort the entire checkpoint.
|
|
592
|
+
await this.syncProposedBlockToArchiver(block);
|
|
593
|
+
|
|
594
|
+
// Once we have a signed proposal and the archiver agreed with our proposed block, then we broadcast it.
|
|
595
|
+
proposal && (await this.p2pClient.broadcastProposal(proposal));
|
|
452
596
|
|
|
453
597
|
// Wait until the next block's start time
|
|
454
598
|
await this.waitUntilNextSubslot(timingInfo.deadline);
|
|
455
599
|
}
|
|
456
600
|
|
|
457
|
-
this.log.verbose(`Block building loop completed for slot ${this.
|
|
458
|
-
slot: this.
|
|
601
|
+
this.log.verbose(`Block building loop completed for slot ${this.targetSlot}`, {
|
|
602
|
+
slot: this.targetSlot,
|
|
459
603
|
blocksBuilt: blocksInCheckpoint.length,
|
|
460
604
|
});
|
|
461
605
|
|
|
462
606
|
return { blocksInCheckpoint, blockPendingBroadcast };
|
|
463
607
|
}
|
|
464
608
|
|
|
609
|
+
/** Creates a block proposal for a given block via the validator client (unless in fisherman mode) */
|
|
610
|
+
private createBlockProposal(
|
|
611
|
+
block: L2Block,
|
|
612
|
+
inHash: Fr,
|
|
613
|
+
usedTxs: Tx[],
|
|
614
|
+
blockProposalOptions: BlockProposalOptions,
|
|
615
|
+
): Promise<BlockProposal | undefined> {
|
|
616
|
+
if (this.config.fishermanMode) {
|
|
617
|
+
this.log.info(`Skipping block proposal for block ${block.number} in fisherman mode`);
|
|
618
|
+
return Promise.resolve(undefined);
|
|
619
|
+
}
|
|
620
|
+
return this.validatorClient.createBlockProposal(
|
|
621
|
+
block.header,
|
|
622
|
+
block.indexWithinCheckpoint,
|
|
623
|
+
inHash,
|
|
624
|
+
block.archive.root,
|
|
625
|
+
usedTxs,
|
|
626
|
+
this.proposer,
|
|
627
|
+
blockProposalOptions,
|
|
628
|
+
);
|
|
629
|
+
}
|
|
630
|
+
|
|
465
631
|
/** Sleeps until it is time to produce the next block in the slot */
|
|
466
632
|
@trackSpan('CheckpointProposalJob.waitUntilNextSubslot')
|
|
467
633
|
private async waitUntilNextSubslot(nextSubslotStart: number) {
|
|
468
|
-
this.setStateFn(SequencerState.WAITING_UNTIL_NEXT_BLOCK, this.
|
|
469
|
-
this.log.verbose(`Waiting until time for the next block at ${nextSubslotStart}s into slot`, {
|
|
634
|
+
this.setStateFn(SequencerState.WAITING_UNTIL_NEXT_BLOCK, this.targetSlot);
|
|
635
|
+
this.log.verbose(`Waiting until time for the next block at ${nextSubslotStart}s into slot`, {
|
|
636
|
+
slot: this.targetSlot,
|
|
637
|
+
});
|
|
470
638
|
await this.waitUntilTimeInSlot(nextSubslotStart);
|
|
471
639
|
}
|
|
472
640
|
|
|
@@ -481,34 +649,25 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
481
649
|
indexWithinCheckpoint: IndexWithinCheckpoint;
|
|
482
650
|
buildDeadline: Date | undefined;
|
|
483
651
|
txHashesAlreadyIncluded: Set<string>;
|
|
484
|
-
remainingBlobFields: number;
|
|
485
652
|
},
|
|
486
|
-
): Promise<{ block: L2Block; usedTxs: Tx[]
|
|
487
|
-
const {
|
|
488
|
-
|
|
489
|
-
forceCreate,
|
|
490
|
-
blockNumber,
|
|
491
|
-
indexWithinCheckpoint,
|
|
492
|
-
buildDeadline,
|
|
493
|
-
txHashesAlreadyIncluded,
|
|
494
|
-
remainingBlobFields,
|
|
495
|
-
} = opts;
|
|
653
|
+
): Promise<{ block: L2Block; usedTxs: Tx[] } | { error: Error } | undefined> {
|
|
654
|
+
const { blockTimestamp, forceCreate, blockNumber, indexWithinCheckpoint, buildDeadline, txHashesAlreadyIncluded } =
|
|
655
|
+
opts;
|
|
496
656
|
|
|
497
657
|
this.log.verbose(
|
|
498
|
-
`Preparing block ${blockNumber} index ${indexWithinCheckpoint} at checkpoint ${this.checkpointNumber} for slot ${this.
|
|
658
|
+
`Preparing block ${blockNumber} index ${indexWithinCheckpoint} at checkpoint ${this.checkpointNumber} for slot ${this.targetSlot}`,
|
|
499
659
|
{ ...checkpointBuilder.getConstantData(), ...opts },
|
|
500
660
|
);
|
|
501
661
|
|
|
502
662
|
try {
|
|
503
663
|
// Wait until we have enough txs to build the block
|
|
504
|
-
const minTxs = this.
|
|
505
|
-
const { availableTxs, canStartBuilding } = await this.waitForMinTxs(opts);
|
|
664
|
+
const { availableTxs, canStartBuilding, minTxs } = await this.waitForMinTxs(opts);
|
|
506
665
|
if (!canStartBuilding) {
|
|
507
666
|
this.log.warn(
|
|
508
|
-
`Not enough txs to build block ${blockNumber} at index ${indexWithinCheckpoint} in slot ${this.
|
|
509
|
-
{ blockNumber, slot: this.
|
|
667
|
+
`Not enough txs to build block ${blockNumber} at index ${indexWithinCheckpoint} in slot ${this.targetSlot} (got ${availableTxs} txs but needs ${minTxs})`,
|
|
668
|
+
{ blockNumber, slot: this.targetSlot, indexWithinCheckpoint },
|
|
510
669
|
);
|
|
511
|
-
this.eventEmitter.emit('block-tx-count-check-failed', { minTxs, availableTxs, slot: this.
|
|
670
|
+
this.eventEmitter.emit('block-tx-count-check-failed', { minTxs, availableTxs, slot: this.targetSlot });
|
|
512
671
|
this.metrics.recordBlockProposalFailed('insufficient_txs');
|
|
513
672
|
return undefined;
|
|
514
673
|
}
|
|
@@ -516,29 +675,36 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
516
675
|
// Create iterator to pending txs. We filter out txs already included in previous blocks in the checkpoint
|
|
517
676
|
// just in case p2p failed to sync the provisional block and didn't get to remove those txs from the mempool yet.
|
|
518
677
|
const pendingTxs = filter(
|
|
519
|
-
this.p2pClient.
|
|
678
|
+
this.p2pClient.iterateEligiblePendingTxs(),
|
|
520
679
|
tx => !txHashesAlreadyIncluded.has(tx.txHash.toString()),
|
|
521
680
|
);
|
|
522
681
|
|
|
523
682
|
this.log.debug(
|
|
524
|
-
`Building block ${blockNumber} at index ${indexWithinCheckpoint} for slot ${this.
|
|
525
|
-
{ slot: this.
|
|
683
|
+
`Building block ${blockNumber} at index ${indexWithinCheckpoint} for slot ${this.targetSlot} with ${availableTxs} available txs`,
|
|
684
|
+
{ slot: this.targetSlot, blockNumber, indexWithinCheckpoint },
|
|
526
685
|
);
|
|
527
|
-
this.setStateFn(SequencerState.CREATING_BLOCK, this.
|
|
686
|
+
this.setStateFn(SequencerState.CREATING_BLOCK, this.targetSlot);
|
|
528
687
|
|
|
529
|
-
//
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
const blockBuilderOptions:
|
|
688
|
+
// Per-block limits are operator overrides (from SEQ_MAX_L2_BLOCK_GAS etc.) further capped
|
|
689
|
+
// by remaining checkpoint-level budgets inside CheckpointBuilder before each block is built.
|
|
690
|
+
// minValidTxs is passed into the builder so it can reject the block *before* updating state.
|
|
691
|
+
const minValidTxs = forceCreate ? 0 : (this.config.minValidTxsPerBlock ?? minTxs);
|
|
692
|
+
const blockBuilderOptions: BlockBuilderOptions = {
|
|
534
693
|
maxTransactions: this.config.maxTxsPerBlock,
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
694
|
+
maxBlockGas:
|
|
695
|
+
this.config.maxL2BlockGas !== undefined || this.config.maxDABlockGas !== undefined
|
|
696
|
+
? new Gas(this.config.maxDABlockGas ?? Infinity, this.config.maxL2BlockGas ?? Infinity)
|
|
697
|
+
: undefined,
|
|
538
698
|
deadline: buildDeadline,
|
|
699
|
+
isBuildingProposal: true,
|
|
700
|
+
minValidTxs,
|
|
701
|
+
maxBlocksPerCheckpoint: this.timetable.maxNumberOfBlocks,
|
|
702
|
+
perBlockAllocationMultiplier: this.config.perBlockAllocationMultiplier,
|
|
539
703
|
};
|
|
540
704
|
|
|
541
|
-
// Actually build the block by executing txs
|
|
705
|
+
// Actually build the block by executing txs. The builder throws InsufficientValidTxsError
|
|
706
|
+
// if the number of successfully processed txs is below minValidTxs, ensuring state is not
|
|
707
|
+
// updated for blocks that will be discarded.
|
|
542
708
|
const buildResult = await this.buildSingleBlockWithCheckpointBuilder(
|
|
543
709
|
checkpointBuilder,
|
|
544
710
|
pendingTxs,
|
|
@@ -550,22 +716,27 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
550
716
|
// If any txs failed during execution, drop them from the mempool so we don't pick them up again
|
|
551
717
|
await this.dropFailedTxsFromP2P(buildResult.failedTxs);
|
|
552
718
|
|
|
553
|
-
|
|
554
|
-
// too long, then we may not get to minTxsPerBlock after executing public functions.
|
|
555
|
-
const minValidTxs = this.config.minValidTxsPerBlock ?? minTxs;
|
|
556
|
-
const numTxs = buildResult.status === 'no-valid-txs' ? 0 : buildResult.numTxs;
|
|
557
|
-
if (buildResult.status === 'no-valid-txs' || (!forceCreate && numTxs < minValidTxs)) {
|
|
719
|
+
if (buildResult.status === 'insufficient-valid-txs') {
|
|
558
720
|
this.log.warn(
|
|
559
|
-
`Block ${blockNumber} at index ${indexWithinCheckpoint} on slot ${this.
|
|
560
|
-
{
|
|
721
|
+
`Block ${blockNumber} at index ${indexWithinCheckpoint} on slot ${this.targetSlot} has too few valid txs to be proposed`,
|
|
722
|
+
{
|
|
723
|
+
slot: this.targetSlot,
|
|
724
|
+
blockNumber,
|
|
725
|
+
numTxs: buildResult.processedCount,
|
|
726
|
+
indexWithinCheckpoint,
|
|
727
|
+
minValidTxs,
|
|
728
|
+
},
|
|
561
729
|
);
|
|
562
|
-
this.eventEmitter.emit('block-build-failed', {
|
|
730
|
+
this.eventEmitter.emit('block-build-failed', {
|
|
731
|
+
reason: `Insufficient valid txs`,
|
|
732
|
+
slot: this.targetSlot,
|
|
733
|
+
});
|
|
563
734
|
this.metrics.recordBlockProposalFailed('insufficient_valid_txs');
|
|
564
735
|
return undefined;
|
|
565
736
|
}
|
|
566
737
|
|
|
567
738
|
// Block creation succeeded, emit stats and metrics
|
|
568
|
-
const {
|
|
739
|
+
const { block, publicProcessorDuration, usedTxs, blockBuildDuration, numTxs } = buildResult;
|
|
569
740
|
|
|
570
741
|
const blockStats = {
|
|
571
742
|
eventName: 'l2-block-built',
|
|
@@ -576,33 +747,42 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
576
747
|
|
|
577
748
|
const blockHash = await block.hash();
|
|
578
749
|
const txHashes = block.body.txEffects.map(tx => tx.txHash);
|
|
579
|
-
const manaPerSec =
|
|
750
|
+
const manaPerSec = block.header.totalManaUsed.toNumberUnsafe() / (blockBuildDuration / 1000);
|
|
580
751
|
|
|
581
752
|
this.log.info(
|
|
582
|
-
`Built block ${block.number} at checkpoint ${this.checkpointNumber} for slot ${this.
|
|
753
|
+
`Built block ${block.number} at checkpoint ${this.checkpointNumber} for slot ${this.targetSlot} with ${numTxs} txs`,
|
|
583
754
|
{ blockHash, txHashes, manaPerSec, ...blockStats },
|
|
584
755
|
);
|
|
585
756
|
|
|
586
|
-
|
|
587
|
-
|
|
757
|
+
// `slot` is the target/submission slot (may be one ahead when pipelining),
|
|
758
|
+
// `buildSlot` is the wall-clock slot during which the block was actually built.
|
|
759
|
+
this.eventEmitter.emit('block-proposed', {
|
|
760
|
+
blockNumber: block.number,
|
|
761
|
+
slot: this.targetSlot,
|
|
762
|
+
buildSlot: this.slotNow,
|
|
763
|
+
});
|
|
764
|
+
this.metrics.recordBuiltBlock(blockBuildDuration, block.header.totalManaUsed.toNumberUnsafe());
|
|
588
765
|
|
|
589
|
-
return { block, usedTxs
|
|
766
|
+
return { block, usedTxs };
|
|
590
767
|
} catch (err: any) {
|
|
591
|
-
this.eventEmitter.emit('block-build-failed', {
|
|
592
|
-
|
|
768
|
+
this.eventEmitter.emit('block-build-failed', {
|
|
769
|
+
reason: err.message,
|
|
770
|
+
slot: this.targetSlot,
|
|
771
|
+
});
|
|
772
|
+
this.log.error(`Error building block`, err, { blockNumber, slot: this.targetSlot });
|
|
593
773
|
this.metrics.recordBlockProposalFailed(err.name || 'unknown_error');
|
|
594
774
|
this.metrics.recordFailedBlock();
|
|
595
775
|
return { error: err };
|
|
596
776
|
}
|
|
597
777
|
}
|
|
598
778
|
|
|
599
|
-
/** Uses the checkpoint builder to build a block, catching
|
|
779
|
+
/** Uses the checkpoint builder to build a block, catching InsufficientValidTxsError. */
|
|
600
780
|
private async buildSingleBlockWithCheckpointBuilder(
|
|
601
781
|
checkpointBuilder: CheckpointBuilder,
|
|
602
782
|
pendingTxs: AsyncIterable<Tx>,
|
|
603
783
|
blockNumber: BlockNumber,
|
|
604
784
|
blockTimestamp: bigint,
|
|
605
|
-
blockBuilderOptions:
|
|
785
|
+
blockBuilderOptions: BlockBuilderOptions,
|
|
606
786
|
) {
|
|
607
787
|
try {
|
|
608
788
|
const workTimer = new Timer();
|
|
@@ -610,8 +790,12 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
610
790
|
const blockBuildDuration = workTimer.ms();
|
|
611
791
|
return { ...result, blockBuildDuration, status: 'success' as const };
|
|
612
792
|
} catch (err: unknown) {
|
|
613
|
-
if (isErrorClass(err,
|
|
614
|
-
return {
|
|
793
|
+
if (isErrorClass(err, InsufficientValidTxsError)) {
|
|
794
|
+
return {
|
|
795
|
+
failedTxs: err.failedTxs,
|
|
796
|
+
processedCount: err.processedCount,
|
|
797
|
+
status: 'insufficient-valid-txs' as const,
|
|
798
|
+
};
|
|
615
799
|
}
|
|
616
800
|
throw err;
|
|
617
801
|
}
|
|
@@ -624,7 +808,7 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
624
808
|
blockNumber: BlockNumber;
|
|
625
809
|
indexWithinCheckpoint: IndexWithinCheckpoint;
|
|
626
810
|
buildDeadline: Date | undefined;
|
|
627
|
-
}): Promise<{ canStartBuilding: boolean; availableTxs: number }> {
|
|
811
|
+
}): Promise<{ canStartBuilding: boolean; availableTxs: number; minTxs: number }> {
|
|
628
812
|
const { indexWithinCheckpoint, blockNumber, buildDeadline, forceCreate } = opts;
|
|
629
813
|
|
|
630
814
|
// We only allow a block with 0 txs in the first block of the checkpoint
|
|
@@ -641,20 +825,20 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
641
825
|
// If we're past deadline, or we have no deadline, give up
|
|
642
826
|
const now = this.dateProvider.nowAsDate();
|
|
643
827
|
if (startBuildingDeadline === undefined || now >= startBuildingDeadline) {
|
|
644
|
-
return { canStartBuilding: false, availableTxs
|
|
828
|
+
return { canStartBuilding: false, availableTxs, minTxs };
|
|
645
829
|
}
|
|
646
830
|
|
|
647
831
|
// Wait a bit before checking again
|
|
648
|
-
this.setStateFn(SequencerState.WAITING_FOR_TXS, this.
|
|
832
|
+
this.setStateFn(SequencerState.WAITING_FOR_TXS, this.targetSlot);
|
|
649
833
|
this.log.verbose(
|
|
650
|
-
`Waiting for enough txs to build block ${blockNumber} at index ${indexWithinCheckpoint} in slot ${this.
|
|
651
|
-
{ blockNumber, slot: this.
|
|
834
|
+
`Waiting for enough txs to build block ${blockNumber} at index ${indexWithinCheckpoint} in slot ${this.targetSlot} (have ${availableTxs} but need ${minTxs})`,
|
|
835
|
+
{ blockNumber, slot: this.targetSlot, indexWithinCheckpoint },
|
|
652
836
|
);
|
|
653
837
|
await this.waitForTxsPollingInterval();
|
|
654
838
|
availableTxs = await this.p2pClient.getPendingTxCount();
|
|
655
839
|
}
|
|
656
840
|
|
|
657
|
-
return { canStartBuilding: true, availableTxs };
|
|
841
|
+
return { canStartBuilding: true, availableTxs, minTxs };
|
|
658
842
|
}
|
|
659
843
|
|
|
660
844
|
/**
|
|
@@ -680,7 +864,7 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
680
864
|
this.log.debug(`Attesting committee length is ${committee.length}`, { committee });
|
|
681
865
|
}
|
|
682
866
|
|
|
683
|
-
const numberOfRequiredAttestations =
|
|
867
|
+
const numberOfRequiredAttestations = computeQuorum(committee.length);
|
|
684
868
|
|
|
685
869
|
if (this.config.skipCollectingAttestations) {
|
|
686
870
|
this.log.warn('Skipping attestation collection as per config (attesting with own keys only)');
|
|
@@ -706,11 +890,28 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
706
890
|
|
|
707
891
|
collectedAttestationsCount = attestations.length;
|
|
708
892
|
|
|
893
|
+
// Trim attestations to minimum required to save L1 calldata gas
|
|
894
|
+
const localAddresses = this.validatorClient.getValidatorAddresses();
|
|
895
|
+
const trimmed = trimAttestations(
|
|
896
|
+
attestations,
|
|
897
|
+
numberOfRequiredAttestations,
|
|
898
|
+
this.attestorAddress,
|
|
899
|
+
localAddresses,
|
|
900
|
+
);
|
|
901
|
+
if (trimmed.length < attestations.length) {
|
|
902
|
+
this.log.debug(`Trimmed attestations from ${attestations.length} to ${trimmed.length} for L1 submission`);
|
|
903
|
+
}
|
|
904
|
+
|
|
709
905
|
// Rollup contract requires that the signatures are provided in the order of the committee
|
|
710
|
-
const sorted = orderAttestations(
|
|
906
|
+
const sorted = orderAttestations(trimmed, committee);
|
|
711
907
|
|
|
712
908
|
// Manipulate the attestations if we've been configured to do so
|
|
713
|
-
if (
|
|
909
|
+
if (
|
|
910
|
+
this.config.injectFakeAttestation ||
|
|
911
|
+
this.config.injectHighSValueAttestation ||
|
|
912
|
+
this.config.injectUnrecoverableSignatureAttestation ||
|
|
913
|
+
this.config.shuffleAttestationOrdering
|
|
914
|
+
) {
|
|
714
915
|
return this.manipulateAttestations(proposal.slotNumber, epoch, seed, committee, sorted);
|
|
715
916
|
}
|
|
716
917
|
|
|
@@ -739,7 +940,11 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
739
940
|
this.epochCache.computeProposerIndex(slotNumber, epoch, seed, BigInt(committee.length)),
|
|
740
941
|
);
|
|
741
942
|
|
|
742
|
-
if (
|
|
943
|
+
if (
|
|
944
|
+
this.config.injectFakeAttestation ||
|
|
945
|
+
this.config.injectHighSValueAttestation ||
|
|
946
|
+
this.config.injectUnrecoverableSignatureAttestation
|
|
947
|
+
) {
|
|
743
948
|
// Find non-empty attestations that are not from the proposer
|
|
744
949
|
const nonProposerIndices: number[] = [];
|
|
745
950
|
for (let i = 0; i < attestations.length; i++) {
|
|
@@ -749,8 +954,20 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
749
954
|
}
|
|
750
955
|
if (nonProposerIndices.length > 0) {
|
|
751
956
|
const targetIndex = nonProposerIndices[randomInt(nonProposerIndices.length)];
|
|
752
|
-
this.
|
|
753
|
-
|
|
957
|
+
if (this.config.injectHighSValueAttestation) {
|
|
958
|
+
this.log.warn(
|
|
959
|
+
`Injecting high-s value attestation in checkpoint for slot ${slotNumber} at index ${targetIndex}`,
|
|
960
|
+
);
|
|
961
|
+
unfreeze(attestations[targetIndex]).signature = flipSignature(attestations[targetIndex].signature);
|
|
962
|
+
} else if (this.config.injectUnrecoverableSignatureAttestation) {
|
|
963
|
+
this.log.warn(
|
|
964
|
+
`Injecting unrecoverable signature attestation in checkpoint for slot ${slotNumber} at index ${targetIndex}`,
|
|
965
|
+
);
|
|
966
|
+
unfreeze(attestations[targetIndex]).signature = generateUnrecoverableSignature();
|
|
967
|
+
} else {
|
|
968
|
+
this.log.warn(`Injecting fake attestation in checkpoint for slot ${slotNumber} at index ${targetIndex}`);
|
|
969
|
+
unfreeze(attestations[targetIndex]).signature = generateRecoverableSignature();
|
|
970
|
+
}
|
|
754
971
|
}
|
|
755
972
|
return new CommitteeAttestationsAndSigners(attestations);
|
|
756
973
|
}
|
|
@@ -759,11 +976,20 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
759
976
|
this.log.warn(`Shuffling attestation ordering in checkpoint for slot ${slotNumber} (proposer #${proposerIndex})`);
|
|
760
977
|
|
|
761
978
|
const shuffled = [...attestations];
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
979
|
+
|
|
980
|
+
// Find two non-proposer positions that both have non-empty signatures to swap.
|
|
981
|
+
// This ensures the bitmap doesn't change, so the MaliciousCommitteeAttestationsAndSigners
|
|
982
|
+
// signers array stays correctly aligned with L1's committee reconstruction.
|
|
983
|
+
const swappable: number[] = [];
|
|
984
|
+
for (let k = 0; k < shuffled.length; k++) {
|
|
985
|
+
if (!shuffled[k].signature.isEmpty() && k !== proposerIndex) {
|
|
986
|
+
swappable.push(k);
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
if (swappable.length >= 2) {
|
|
990
|
+
const [i, j] = [swappable[0], swappable[1]];
|
|
991
|
+
[shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
|
|
992
|
+
}
|
|
767
993
|
|
|
768
994
|
const signers = new CommitteeAttestationsAndSigners(attestations).getSigners();
|
|
769
995
|
return new MaliciousCommitteeAttestationsAndSigners(shuffled, signers);
|
|
@@ -779,7 +1005,7 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
779
1005
|
const failedTxData = failedTxs.map(fail => fail.tx);
|
|
780
1006
|
const failedTxHashes = failedTxData.map(tx => tx.getTxHash());
|
|
781
1007
|
this.log.verbose(`Dropping failed txs ${failedTxHashes.join(', ')}`);
|
|
782
|
-
await this.p2pClient.
|
|
1008
|
+
await this.p2pClient.handleFailedExecution(failedTxHashes);
|
|
783
1009
|
}
|
|
784
1010
|
|
|
785
1011
|
/**
|
|
@@ -788,7 +1014,7 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
788
1014
|
* would never receive its own block without this explicit sync.
|
|
789
1015
|
*/
|
|
790
1016
|
private async syncProposedBlockToArchiver(block: L2Block): Promise<void> {
|
|
791
|
-
if (this.config.skipPushProposedBlocksToArchiver
|
|
1017
|
+
if (this.config.skipPushProposedBlocksToArchiver) {
|
|
792
1018
|
this.log.warn(`Skipping push of proposed block ${block.number} to archiver`, {
|
|
793
1019
|
blockNumber: block.number,
|
|
794
1020
|
slot: block.header.globalVariables.slotNumber,
|
|
@@ -806,22 +1032,22 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
806
1032
|
private async handleCheckpointEndAsFisherman(checkpoint: Checkpoint | undefined) {
|
|
807
1033
|
// Perform L1 fee analysis before clearing requests
|
|
808
1034
|
// The callback is invoked asynchronously after the next block is mined
|
|
809
|
-
const feeAnalysis = await this.publisher.analyzeL1Fees(this.
|
|
1035
|
+
const feeAnalysis = await this.publisher.analyzeL1Fees(this.targetSlot, analysis =>
|
|
810
1036
|
this.metrics.recordFishermanFeeAnalysis(analysis),
|
|
811
1037
|
);
|
|
812
1038
|
|
|
813
1039
|
if (checkpoint) {
|
|
814
|
-
this.log.info(`Validation checkpoint building SUCCEEDED for slot ${this.
|
|
1040
|
+
this.log.info(`Validation checkpoint building SUCCEEDED for slot ${this.targetSlot}`, {
|
|
815
1041
|
...checkpoint.toCheckpointInfo(),
|
|
816
1042
|
...checkpoint.getStats(),
|
|
817
1043
|
feeAnalysisId: feeAnalysis?.id,
|
|
818
1044
|
});
|
|
819
1045
|
} else {
|
|
820
|
-
this.log.warn(`Validation block building FAILED for slot ${this.
|
|
821
|
-
slot: this.
|
|
1046
|
+
this.log.warn(`Validation block building FAILED for slot ${this.targetSlot}`, {
|
|
1047
|
+
slot: this.targetSlot,
|
|
822
1048
|
feeAnalysisId: feeAnalysis?.id,
|
|
823
1049
|
});
|
|
824
|
-
this.metrics.
|
|
1050
|
+
this.metrics.recordCheckpointProposalFailed('block_build_failed');
|
|
825
1051
|
}
|
|
826
1052
|
|
|
827
1053
|
this.publisher.clearPendingRequests();
|
|
@@ -832,15 +1058,15 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
832
1058
|
*/
|
|
833
1059
|
private handleHASigningError(err: any, errorContext: string): boolean {
|
|
834
1060
|
if (err instanceof DutyAlreadySignedError) {
|
|
835
|
-
this.log.info(`${errorContext} for slot ${this.
|
|
836
|
-
slot: this.
|
|
1061
|
+
this.log.info(`${errorContext} for slot ${this.targetSlot} already signed by another HA node, yielding`, {
|
|
1062
|
+
slot: this.targetSlot,
|
|
837
1063
|
signedByNode: err.signedByNode,
|
|
838
1064
|
});
|
|
839
1065
|
return true;
|
|
840
1066
|
}
|
|
841
1067
|
if (err instanceof SlashingProtectionError) {
|
|
842
|
-
this.log.info(`${errorContext} for slot ${this.
|
|
843
|
-
slot: this.
|
|
1068
|
+
this.log.info(`${errorContext} for slot ${this.targetSlot} blocked by slashing protection, yielding`, {
|
|
1069
|
+
slot: this.targetSlot,
|
|
844
1070
|
existingMessageHash: err.existingMessageHash,
|
|
845
1071
|
attemptedMessageHash: err.attemptedMessageHash,
|
|
846
1072
|
});
|
|
@@ -849,6 +1075,56 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
849
1075
|
return false;
|
|
850
1076
|
}
|
|
851
1077
|
|
|
1078
|
+
/**
|
|
1079
|
+
* In times of congestion we need to simulate using the correct fee header override for the previous block
|
|
1080
|
+
* We calculate the correct fee header values.
|
|
1081
|
+
*
|
|
1082
|
+
* If we are in block 1, or the checkpoint we are querying does not exist, we return undefined. However
|
|
1083
|
+
* If we are pipelining - where this function is called, the grandparentCheckpointNumber should always exist
|
|
1084
|
+
* @param parentCheckpointNumber
|
|
1085
|
+
* @returns
|
|
1086
|
+
*/
|
|
1087
|
+
protected async computeForceProposedFeeHeader(parentCheckpointNumber: CheckpointNumber): Promise<
|
|
1088
|
+
| {
|
|
1089
|
+
checkpointNumber: CheckpointNumber;
|
|
1090
|
+
feeHeader: FeeHeader;
|
|
1091
|
+
}
|
|
1092
|
+
| undefined
|
|
1093
|
+
> {
|
|
1094
|
+
if (!this.proposedCheckpointData) {
|
|
1095
|
+
return undefined;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
const rollup = this.publisher.rollupContract;
|
|
1099
|
+
const grandparentCheckpointNumber = CheckpointNumber(this.checkpointNumber - 2);
|
|
1100
|
+
try {
|
|
1101
|
+
const [grandparentCheckpoint, manaTarget] = await Promise.all([
|
|
1102
|
+
rollup.getCheckpoint(grandparentCheckpointNumber),
|
|
1103
|
+
rollup.getManaTarget(),
|
|
1104
|
+
]);
|
|
1105
|
+
|
|
1106
|
+
if (!grandparentCheckpoint || !grandparentCheckpoint.feeHeader) {
|
|
1107
|
+
this.log.error(
|
|
1108
|
+
`Grandparent checkpoint or its feeHeader is undefined for checkpointNumber=${grandparentCheckpointNumber.toString()}`,
|
|
1109
|
+
);
|
|
1110
|
+
return undefined;
|
|
1111
|
+
} else {
|
|
1112
|
+
const parentFeeHeader = RollupContract.computeChildFeeHeader(
|
|
1113
|
+
grandparentCheckpoint.feeHeader,
|
|
1114
|
+
this.proposedCheckpointData.totalManaUsed,
|
|
1115
|
+
this.proposedCheckpointData.feeAssetPriceModifier,
|
|
1116
|
+
manaTarget,
|
|
1117
|
+
);
|
|
1118
|
+
return { checkpointNumber: parentCheckpointNumber, feeHeader: parentFeeHeader };
|
|
1119
|
+
}
|
|
1120
|
+
} catch (err) {
|
|
1121
|
+
this.log.error(
|
|
1122
|
+
`Failed to fetch grandparent checkpoint or mana target for checkpointNumber=${grandparentCheckpointNumber.toString()}: ${err}`,
|
|
1123
|
+
);
|
|
1124
|
+
return undefined;
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
|
|
852
1128
|
/** Waits until a specific time within the current slot */
|
|
853
1129
|
@trackSpan('CheckpointProposalJob.waitUntilTimeInSlot')
|
|
854
1130
|
protected async waitUntilTimeInSlot(targetSecondsIntoSlot: number): Promise<void> {
|
|
@@ -863,7 +1139,7 @@ export class CheckpointProposalJob implements Traceable {
|
|
|
863
1139
|
}
|
|
864
1140
|
|
|
865
1141
|
private getSlotStartBuildTimestamp(): number {
|
|
866
|
-
return getSlotStartBuildTimestamp(this.
|
|
1142
|
+
return getSlotStartBuildTimestamp(this.slotNow, this.l1Constants);
|
|
867
1143
|
}
|
|
868
1144
|
|
|
869
1145
|
private getSecondsIntoSlot(): number {
|