@aztec/sequencer-client 0.0.1-commit.c80b6263 → 0.0.1-commit.cf93bcc56
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 +12 -7
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +15 -4
- package/dest/config.d.ts +3 -4
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +17 -12
- package/dest/global_variable_builder/global_builder.d.ts +2 -4
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/publisher/config.d.ts +31 -17
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +101 -42
- 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 +13 -2
- package/dest/publisher/sequencer-publisher.d.ts +16 -8
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +80 -39
- package/dest/sequencer/checkpoint_proposal_job.d.ts +29 -6
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_proposal_job.js +97 -53
- package/dest/sequencer/metrics.d.ts +17 -5
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +86 -15
- package/dest/sequencer/sequencer.d.ts +12 -7
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +24 -26
- package/dest/sequencer/timetable.d.ts +1 -4
- package/dest/sequencer/timetable.d.ts.map +1 -1
- package/dest/sequencer/timetable.js +1 -4
- 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 +7 -5
- package/dest/test/mock_checkpoint_builder.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.js +6 -6
- 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 +28 -28
- package/src/client/sequencer-client.ts +25 -7
- package/src/config.ts +26 -19
- package/src/global_variable_builder/global_builder.ts +1 -1
- package/src/publisher/config.ts +112 -43
- package/src/publisher/sequencer-publisher-factory.ts +23 -6
- package/src/publisher/sequencer-publisher.ts +96 -45
- package/src/sequencer/checkpoint_proposal_job.ts +134 -70
- package/src/sequencer/metrics.ts +92 -18
- package/src/sequencer/sequencer.ts +32 -31
- package/src/sequencer/timetable.ts +6 -5
- package/src/test/index.ts +2 -4
- package/src/test/mock_checkpoint_builder.ts +14 -5
- package/src/test/utils.ts +5 -2
|
@@ -12,7 +12,7 @@ import type { DateProvider } from '@aztec/foundation/timer';
|
|
|
12
12
|
import type { TypedEventEmitter } from '@aztec/foundation/types';
|
|
13
13
|
import type { P2P } from '@aztec/p2p';
|
|
14
14
|
import type { SlasherClientInterface } from '@aztec/slasher';
|
|
15
|
-
import type {
|
|
15
|
+
import type { BlockData, L2BlockSink, L2BlockSource, ValidateCheckpointResult } from '@aztec/stdlib/block';
|
|
16
16
|
import type { Checkpoint } from '@aztec/stdlib/checkpoint';
|
|
17
17
|
import { getSlotAtTimestamp, getSlotStartBuildTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
18
18
|
import {
|
|
@@ -25,7 +25,7 @@ import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
|
25
25
|
import { pickFromSchema } from '@aztec/stdlib/schemas';
|
|
26
26
|
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
27
27
|
import { Attributes, type TelemetryClient, type Tracer, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
|
|
28
|
-
import { FullNodeCheckpointsBuilder, type ValidatorClient } from '@aztec/validator-client';
|
|
28
|
+
import { FullNodeCheckpointsBuilder, NodeKeystoreAdapter, type ValidatorClient } from '@aztec/validator-client';
|
|
29
29
|
|
|
30
30
|
import EventEmitter from 'node:events';
|
|
31
31
|
|
|
@@ -60,6 +60,9 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
60
60
|
/** The last slot for which we attempted to perform our voting duties with degraded block production */
|
|
61
61
|
private lastSlotForFallbackVote: SlotNumber | undefined;
|
|
62
62
|
|
|
63
|
+
/** The last slot for which we logged "no committee" warning, to avoid spam */
|
|
64
|
+
private lastSlotForNoCommitteeWarning: SlotNumber | undefined;
|
|
65
|
+
|
|
63
66
|
/** The last slot for which we triggered a checkpoint proposal job, to prevent duplicate attempts. */
|
|
64
67
|
private lastSlotForCheckpointProposalJob: SlotNumber | undefined;
|
|
65
68
|
|
|
@@ -72,14 +75,6 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
72
75
|
/** The maximum number of seconds that the sequencer can be into a slot to transition to a particular state. */
|
|
73
76
|
protected timetable!: SequencerTimetable;
|
|
74
77
|
|
|
75
|
-
// This shouldn't be here as this gets re-created each time we build/propose a block.
|
|
76
|
-
// But we have a number of tests that abuse/rely on this class having a permanent publisher.
|
|
77
|
-
// As long as those tests only configure a single publisher they will continue to work.
|
|
78
|
-
// This will get re-assigned every time the sequencer goes to build a new block to a publisher that is valid
|
|
79
|
-
// for the block proposer.
|
|
80
|
-
// TODO(palla/mbps): Remove this field and fix tests
|
|
81
|
-
protected publisher: SequencerPublisher | undefined;
|
|
82
|
-
|
|
83
78
|
/** Config for the sequencer */
|
|
84
79
|
protected config: ResolvedSequencerConfig = DefaultSequencerConfig;
|
|
85
80
|
|
|
@@ -131,10 +126,9 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
131
126
|
);
|
|
132
127
|
}
|
|
133
128
|
|
|
134
|
-
/** Initializes the sequencer (precomputes tables
|
|
135
|
-
public
|
|
129
|
+
/** Initializes the sequencer (precomputes tables). Takes about 3s. */
|
|
130
|
+
public init() {
|
|
136
131
|
getKzg();
|
|
137
|
-
this.publisher = (await this.publisherFactory.create(undefined)).publisher;
|
|
138
132
|
}
|
|
139
133
|
|
|
140
134
|
/** Starts the sequencer and moves to IDLE state. */
|
|
@@ -153,7 +147,7 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
153
147
|
public async stop(): Promise<void> {
|
|
154
148
|
this.log.info(`Stopping sequencer`);
|
|
155
149
|
this.setState(SequencerState.STOPPING, undefined, { force: true });
|
|
156
|
-
this.
|
|
150
|
+
this.publisherFactory.interruptAll();
|
|
157
151
|
await this.runningPromise?.stop();
|
|
158
152
|
this.setState(SequencerState.STOPPED, undefined, { force: true });
|
|
159
153
|
this.log.info('Stopped sequencer');
|
|
@@ -166,7 +160,6 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
166
160
|
} catch (err) {
|
|
167
161
|
this.emit('checkpoint-error', { error: err as Error });
|
|
168
162
|
if (err instanceof SequencerTooSlowError) {
|
|
169
|
-
// TODO(palla/mbps): Add missing states
|
|
170
163
|
// Log as warn only if we had to abort halfway through the block proposal
|
|
171
164
|
const logLvl = [SequencerState.INITIALIZING_CHECKPOINT, SequencerState.PROPOSER_CHECK].includes(
|
|
172
165
|
err.proposedState,
|
|
@@ -307,12 +300,12 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
307
300
|
}
|
|
308
301
|
|
|
309
302
|
// Check that the slot is not taken by a block already (should never happen, since only us can propose for this slot)
|
|
310
|
-
if (syncedTo.
|
|
303
|
+
if (syncedTo.blockData && syncedTo.blockData.header.getSlot() >= slot) {
|
|
311
304
|
this.log.warn(
|
|
312
305
|
`Cannot propose block at next L2 slot ${slot} since that slot was taken by block ${syncedTo.blockNumber}`,
|
|
313
|
-
{ ...logCtx, block: syncedTo.
|
|
306
|
+
{ ...logCtx, block: syncedTo.blockData.header.toInspect() },
|
|
314
307
|
);
|
|
315
|
-
this.metrics.
|
|
308
|
+
this.metrics.recordCheckpointPrecheckFailed('slot_already_taken');
|
|
316
309
|
return undefined;
|
|
317
310
|
}
|
|
318
311
|
|
|
@@ -323,7 +316,6 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
323
316
|
const proposerForPublisher = this.config.fishermanMode ? undefined : proposer;
|
|
324
317
|
const { attestorAddress, publisher } = await this.publisherFactory.create(proposerForPublisher);
|
|
325
318
|
this.log.verbose(`Created publisher at address ${publisher.getSenderAddress()} for attestor ${attestorAddress}`);
|
|
326
|
-
this.publisher = publisher;
|
|
327
319
|
|
|
328
320
|
// In fisherman mode, set the actual proposer's address for simulations
|
|
329
321
|
if (this.config.fishermanMode && proposer) {
|
|
@@ -348,7 +340,7 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
348
340
|
logCtx,
|
|
349
341
|
);
|
|
350
342
|
this.emit('proposer-rollup-check-failed', { reason: 'Rollup contract check failed', slot });
|
|
351
|
-
this.metrics.
|
|
343
|
+
this.metrics.recordCheckpointPrecheckFailed('rollup_contract_check_failed');
|
|
352
344
|
return undefined;
|
|
353
345
|
}
|
|
354
346
|
|
|
@@ -358,7 +350,7 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
358
350
|
{ ...logCtx, rollup: canProposeCheck, expectedSlot: slot },
|
|
359
351
|
);
|
|
360
352
|
this.emit('proposer-rollup-check-failed', { reason: 'Slot mismatch', slot });
|
|
361
|
-
this.metrics.
|
|
353
|
+
this.metrics.recordCheckpointPrecheckFailed('slot_mismatch');
|
|
362
354
|
return undefined;
|
|
363
355
|
}
|
|
364
356
|
|
|
@@ -368,11 +360,12 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
368
360
|
{ ...logCtx, rollup: canProposeCheck, expectedSlot: slot },
|
|
369
361
|
);
|
|
370
362
|
this.emit('proposer-rollup-check-failed', { reason: 'Block mismatch', slot });
|
|
371
|
-
this.metrics.
|
|
363
|
+
this.metrics.recordCheckpointPrecheckFailed('block_number_mismatch');
|
|
372
364
|
return undefined;
|
|
373
365
|
}
|
|
374
366
|
|
|
375
367
|
this.lastSlotForCheckpointProposalJob = slot;
|
|
368
|
+
await this.p2pClient.prepareForSlot(slot);
|
|
376
369
|
this.log.info(`Preparing checkpoint proposal ${checkpointNumber} at slot ${slot}`, { ...logCtx, proposer });
|
|
377
370
|
|
|
378
371
|
// Create and return the checkpoint proposal job
|
|
@@ -529,18 +522,18 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
529
522
|
};
|
|
530
523
|
}
|
|
531
524
|
|
|
532
|
-
const
|
|
533
|
-
if (!
|
|
525
|
+
const blockData = await this.l2BlockSource.getBlockData(blockNumber);
|
|
526
|
+
if (!blockData) {
|
|
534
527
|
// this shouldn't really happen because a moment ago we checked that all components were in sync
|
|
535
|
-
this.log.error(`Failed to get L2 block ${blockNumber} from the archiver with all components in sync`);
|
|
528
|
+
this.log.error(`Failed to get L2 block data ${blockNumber} from the archiver with all components in sync`);
|
|
536
529
|
return undefined;
|
|
537
530
|
}
|
|
538
531
|
|
|
539
532
|
return {
|
|
540
|
-
|
|
541
|
-
blockNumber:
|
|
542
|
-
checkpointNumber:
|
|
543
|
-
archive:
|
|
533
|
+
blockData,
|
|
534
|
+
blockNumber: blockData.header.getBlockNumber(),
|
|
535
|
+
checkpointNumber: blockData.checkpointNumber,
|
|
536
|
+
archive: blockData.archive.root,
|
|
544
537
|
l1Timestamp,
|
|
545
538
|
pendingChainValidationStatus,
|
|
546
539
|
};
|
|
@@ -557,7 +550,10 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
557
550
|
proposer = await this.epochCache.getProposerAttesterAddressInSlot(slot);
|
|
558
551
|
} catch (e) {
|
|
559
552
|
if (e instanceof NoCommitteeError) {
|
|
560
|
-
this.
|
|
553
|
+
if (this.lastSlotForNoCommitteeWarning !== slot) {
|
|
554
|
+
this.lastSlotForNoCommitteeWarning = slot;
|
|
555
|
+
this.log.warn(`Cannot propose at next L2 slot ${slot} since the committee does not exist on L1`);
|
|
556
|
+
}
|
|
561
557
|
return [false, undefined];
|
|
562
558
|
}
|
|
563
559
|
this.log.error(`Error getting proposer for slot ${slot}`, e);
|
|
@@ -860,6 +856,11 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
860
856
|
return this.validatorClient?.getValidatorAddresses();
|
|
861
857
|
}
|
|
862
858
|
|
|
859
|
+
/** Updates the publisher factory's node keystore adapter after a keystore reload. */
|
|
860
|
+
public updatePublisherNodeKeyStore(adapter: NodeKeystoreAdapter): void {
|
|
861
|
+
this.publisherFactory.updateNodeKeyStore(adapter);
|
|
862
|
+
}
|
|
863
|
+
|
|
863
864
|
public getConfig() {
|
|
864
865
|
return this.config;
|
|
865
866
|
}
|
|
@@ -870,7 +871,7 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
870
871
|
}
|
|
871
872
|
|
|
872
873
|
type SequencerSyncCheckResult = {
|
|
873
|
-
|
|
874
|
+
blockData?: BlockData;
|
|
874
875
|
checkpointNumber: CheckpointNumber;
|
|
875
876
|
blockNumber: BlockNumber;
|
|
876
877
|
archive: Fr;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { createLogger } from '@aztec/aztec.js/log';
|
|
2
|
+
import {
|
|
3
|
+
CHECKPOINT_ASSEMBLE_TIME,
|
|
4
|
+
CHECKPOINT_INITIALIZATION_TIME,
|
|
5
|
+
DEFAULT_P2P_PROPAGATION_TIME,
|
|
6
|
+
MIN_EXECUTION_TIME,
|
|
7
|
+
} from '@aztec/stdlib/timetable';
|
|
2
8
|
|
|
3
|
-
import { DEFAULT_ATTESTATION_PROPAGATION_TIME as DEFAULT_P2P_PROPAGATION_TIME } from '../config.js';
|
|
4
9
|
import { SequencerTooSlowError } from './errors.js';
|
|
5
10
|
import type { SequencerMetrics } from './metrics.js';
|
|
6
11
|
import { SequencerState } from './utils.js';
|
|
7
12
|
|
|
8
|
-
export const MIN_EXECUTION_TIME = 2;
|
|
9
|
-
export const CHECKPOINT_INITIALIZATION_TIME = 1;
|
|
10
|
-
export const CHECKPOINT_ASSEMBLE_TIME = 1;
|
|
11
|
-
|
|
12
13
|
export class SequencerTimetable {
|
|
13
14
|
/**
|
|
14
15
|
* How late into the slot can we be to start working. Computed as the total time needed for assembling and publishing a block,
|
package/src/test/index.ts
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { L1TxUtils } from '@aztec/ethereum/l1-tx-utils';
|
|
2
2
|
import type { PublisherManager } from '@aztec/ethereum/publisher-manager';
|
|
3
3
|
import type { PublicProcessorFactory } from '@aztec/simulator/server';
|
|
4
4
|
import type { FullNodeCheckpointsBuilder, ValidatorClient } from '@aztec/validator-client';
|
|
5
5
|
|
|
6
6
|
import { SequencerClient } from '../client/sequencer-client.js';
|
|
7
7
|
import type { SequencerPublisherFactory } from '../publisher/sequencer-publisher-factory.js';
|
|
8
|
-
import type { SequencerPublisher } from '../publisher/sequencer-publisher.js';
|
|
9
8
|
import { Sequencer } from '../sequencer/sequencer.js';
|
|
10
9
|
import type { SequencerTimetable } from '../sequencer/timetable.js';
|
|
11
10
|
|
|
12
11
|
class TestSequencer_ extends Sequencer {
|
|
13
12
|
declare public publicProcessorFactory: PublicProcessorFactory;
|
|
14
13
|
declare public timetable: SequencerTimetable;
|
|
15
|
-
declare public publisher: SequencerPublisher;
|
|
16
14
|
declare public publisherFactory: SequencerPublisherFactory;
|
|
17
15
|
declare public validatorClient: ValidatorClient;
|
|
18
16
|
declare public checkpointsBuilder: FullNodeCheckpointsBuilder;
|
|
@@ -22,7 +20,7 @@ export type TestSequencer = TestSequencer_;
|
|
|
22
20
|
|
|
23
21
|
class TestSequencerClient_ extends SequencerClient {
|
|
24
22
|
declare public sequencer: TestSequencer;
|
|
25
|
-
declare public publisherManager: PublisherManager<
|
|
23
|
+
declare public publisherManager: PublisherManager<L1TxUtils>;
|
|
26
24
|
}
|
|
27
25
|
|
|
28
26
|
export type TestSequencerClient = TestSequencerClient_;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
-
import { Timer } from '@aztec/foundation/timer';
|
|
4
3
|
import { L2Block } from '@aztec/stdlib/block';
|
|
5
4
|
import { Checkpoint } from '@aztec/stdlib/checkpoint';
|
|
6
5
|
import { Gas } from '@aztec/stdlib/gas';
|
|
@@ -14,7 +13,7 @@ import type {
|
|
|
14
13
|
import { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
15
14
|
import { makeAppendOnlyTreeSnapshot } from '@aztec/stdlib/testing';
|
|
16
15
|
import type { CheckpointGlobalVariables, Tx } from '@aztec/stdlib/tx';
|
|
17
|
-
import type {
|
|
16
|
+
import type { BuildBlockInCheckpointResult } from '@aztec/validator-client';
|
|
18
17
|
|
|
19
18
|
/**
|
|
20
19
|
* A fake CheckpointBuilder for testing that implements the same interface as the real one.
|
|
@@ -76,7 +75,7 @@ export class MockCheckpointBuilder implements ICheckpointBlockBuilder {
|
|
|
76
75
|
blockNumber: BlockNumber,
|
|
77
76
|
timestamp: bigint,
|
|
78
77
|
opts: PublicProcessorLimits,
|
|
79
|
-
): Promise<
|
|
78
|
+
): Promise<BuildBlockInCheckpointResult> {
|
|
80
79
|
this.buildBlockCalls.push({ blockNumber, timestamp, opts });
|
|
81
80
|
|
|
82
81
|
if (this.errorOnBuild) {
|
|
@@ -117,7 +116,6 @@ export class MockCheckpointBuilder implements ICheckpointBlockBuilder {
|
|
|
117
116
|
publicGas: Gas.empty(),
|
|
118
117
|
publicProcessorDuration: 0,
|
|
119
118
|
numTxs: block?.body?.txEffects?.length ?? usedTxs.length,
|
|
120
|
-
blockBuildingTimer: new Timer(),
|
|
121
119
|
usedTxs,
|
|
122
120
|
failedTxs: [],
|
|
123
121
|
usedTxBlobFields: block?.body?.txEffects?.reduce((sum, tx) => sum + tx.getNumBlobFields(), 0) ?? 0,
|
|
@@ -207,6 +205,7 @@ export class MockCheckpointsBuilder implements ICheckpointsBuilder {
|
|
|
207
205
|
constants: CheckpointGlobalVariables;
|
|
208
206
|
l1ToL2Messages: Fr[];
|
|
209
207
|
previousCheckpointOutHashes: Fr[];
|
|
208
|
+
feeAssetPriceModifier: bigint;
|
|
210
209
|
}> = [];
|
|
211
210
|
public openCheckpointCalls: Array<{
|
|
212
211
|
checkpointNumber: CheckpointNumber;
|
|
@@ -214,6 +213,7 @@ export class MockCheckpointsBuilder implements ICheckpointsBuilder {
|
|
|
214
213
|
l1ToL2Messages: Fr[];
|
|
215
214
|
previousCheckpointOutHashes: Fr[];
|
|
216
215
|
existingBlocks: L2Block[];
|
|
216
|
+
feeAssetPriceModifier: bigint;
|
|
217
217
|
}> = [];
|
|
218
218
|
public updateConfigCalls: Array<Partial<FullNodeBlockBuilderConfig>> = [];
|
|
219
219
|
|
|
@@ -259,11 +259,18 @@ export class MockCheckpointsBuilder implements ICheckpointsBuilder {
|
|
|
259
259
|
startCheckpoint(
|
|
260
260
|
checkpointNumber: CheckpointNumber,
|
|
261
261
|
constants: CheckpointGlobalVariables,
|
|
262
|
+
feeAssetPriceModifier: bigint,
|
|
262
263
|
l1ToL2Messages: Fr[],
|
|
263
264
|
previousCheckpointOutHashes: Fr[],
|
|
264
265
|
_fork: MerkleTreeWriteOperations,
|
|
265
266
|
): Promise<ICheckpointBlockBuilder> {
|
|
266
|
-
this.startCheckpointCalls.push({
|
|
267
|
+
this.startCheckpointCalls.push({
|
|
268
|
+
checkpointNumber,
|
|
269
|
+
constants,
|
|
270
|
+
l1ToL2Messages,
|
|
271
|
+
previousCheckpointOutHashes,
|
|
272
|
+
feeAssetPriceModifier,
|
|
273
|
+
});
|
|
267
274
|
|
|
268
275
|
if (!this.checkpointBuilder) {
|
|
269
276
|
// Auto-create a builder if none was set
|
|
@@ -276,6 +283,7 @@ export class MockCheckpointsBuilder implements ICheckpointsBuilder {
|
|
|
276
283
|
openCheckpoint(
|
|
277
284
|
checkpointNumber: CheckpointNumber,
|
|
278
285
|
constants: CheckpointGlobalVariables,
|
|
286
|
+
feeAssetPriceModifier: bigint,
|
|
279
287
|
l1ToL2Messages: Fr[],
|
|
280
288
|
previousCheckpointOutHashes: Fr[],
|
|
281
289
|
_fork: MerkleTreeWriteOperations,
|
|
@@ -287,6 +295,7 @@ export class MockCheckpointsBuilder implements ICheckpointsBuilder {
|
|
|
287
295
|
l1ToL2Messages,
|
|
288
296
|
previousCheckpointOutHashes,
|
|
289
297
|
existingBlocks,
|
|
298
|
+
feeAssetPriceModifier,
|
|
290
299
|
});
|
|
291
300
|
|
|
292
301
|
if (!this.checkpointBuilder) {
|
package/src/test/utils.ts
CHANGED
|
@@ -56,6 +56,7 @@ export async function makeBlock(txs: Tx[], globalVariables: GlobalVariables): Pr
|
|
|
56
56
|
export function mockPendingTxs(p2p: MockProxy<P2P>, txs: Tx[]): void {
|
|
57
57
|
p2p.getPendingTxCount.mockResolvedValue(txs.length);
|
|
58
58
|
p2p.iteratePendingTxs.mockImplementation(() => mockTxIterator(Promise.resolve(txs)));
|
|
59
|
+
p2p.iterateEligiblePendingTxs.mockImplementation(() => mockTxIterator(Promise.resolve(txs)));
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
/**
|
|
@@ -118,10 +119,11 @@ export function createCheckpointProposal(
|
|
|
118
119
|
block: L2Block,
|
|
119
120
|
checkpointSignature: Signature,
|
|
120
121
|
blockSignature?: Signature,
|
|
122
|
+
feeAssetPriceModifier: bigint = 0n,
|
|
121
123
|
): CheckpointProposal {
|
|
122
124
|
const txHashes = block.body.txEffects.map(tx => tx.txHash);
|
|
123
125
|
const checkpointHeader = createCheckpointHeaderFromBlock(block);
|
|
124
|
-
return new CheckpointProposal(checkpointHeader, block.archive.root, checkpointSignature, {
|
|
126
|
+
return new CheckpointProposal(checkpointHeader, block.archive.root, feeAssetPriceModifier, checkpointSignature, {
|
|
125
127
|
blockHeader: block.header,
|
|
126
128
|
indexWithinCheckpoint: block.indexWithinCheckpoint,
|
|
127
129
|
txHashes,
|
|
@@ -138,9 +140,10 @@ export function createCheckpointAttestation(
|
|
|
138
140
|
block: L2Block,
|
|
139
141
|
signature: Signature,
|
|
140
142
|
sender: EthAddress,
|
|
143
|
+
feeAssetPriceModifier: bigint = 0n,
|
|
141
144
|
): CheckpointAttestation {
|
|
142
145
|
const checkpointHeader = createCheckpointHeaderFromBlock(block);
|
|
143
|
-
const payload = new ConsensusPayload(checkpointHeader, block.archive.root);
|
|
146
|
+
const payload = new ConsensusPayload(checkpointHeader, block.archive.root, feeAssetPriceModifier);
|
|
144
147
|
const attestation = new CheckpointAttestation(payload, signature, signature);
|
|
145
148
|
// Set sender directly for testing (bypasses signature recovery)
|
|
146
149
|
(attestation as any).sender = sender;
|