@aztec/ethereum 3.0.0-nightly.20251124 → 3.0.0-nightly.20251126

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.
@@ -1 +1 @@
1
- {"version":3,"file":"rollup_cheat_codes.d.ts","sourceRoot":"","sources":["../../src/test/rollup_cheat_codes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAGjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE1D,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,GAAG,EAMT,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,8CAA8C;AAC9C,qBAAa,gBAAgB;IAOzB,OAAO,CAAC,aAAa;IANvB,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,MAAM,CAA4D;IAE1E,OAAO,CAAC,MAAM,CAAuC;gBAG3C,aAAa,EAAE,aAAa,EACpC,SAAS,EAAE,IAAI,CAAC,mBAAmB,EAAE,eAAe,CAAC;IAavD,MAAM,CAAC,MAAM,CACX,OAAO,EAAE,MAAM,EAAE,EACjB,SAAS,EAAE,IAAI,CAAC,mBAAmB,EAAE,eAAe,CAAC,EACrD,YAAY,EAAE,YAAY,GACzB,gBAAgB;IAKnB,+BAA+B;IAClB,OAAO;IAKpB,gCAAgC;IACnB,QAAQ;IAKrB;;;OAGG;IACU,OAAO,IAAI,OAAO,CAAC;QAC9B,4BAA4B,CAAC,OAAO,EAAE,MAAM,CAAC;QAC7C,2BAA2B,CAAC,MAAM,EAAE,MAAM,CAAC;KAC5C,CAAC;IAQF;;OAEG;IACU,WAAW;IAmBxB,0EAA0E;IAC7D,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I,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAqCxE;;;OAGG;IACU,OAAO,CAClB,MAAM,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,qBAAqB,CAAC,OAAO,SAAS,EAAE,gBAAgB,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC;IAQ1G;;OAEG;IACU,UAAU;IASvB,4CAA4C;IAC/B,oBAAoB;IAQjC;;;OAGG;IACU,sBAAsB,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM;IAMtE;;;OAGG;IACU,qBAAqB,CAAC,QAAQ,EAAE,MAAM;CAWpD"}
@@ -43,25 +43,21 @@ import { EthCheatCodes } from './eth_cheat_codes.js';
43
43
  * Returns the pending and proven chain tips
44
44
  * @returns The pending and proven chain tips
45
45
  */ async getTips() {
46
- const res = await this.rollup.read.getTips();
47
- return {
48
- pending: res.pendingBlockNumber,
49
- proven: res.provenBlockNumber
50
- };
46
+ return await this.rollup.read.getTips();
51
47
  }
52
48
  /**
53
49
  * Logs the current state of the rollup contract.
54
50
  */ async debugRollup() {
55
51
  const rollup = new RollupContract(this.client, this.rollup.address);
56
- const pendingNum = await rollup.getBlockNumber();
57
- const provenNum = await rollup.getProvenBlockNumber();
52
+ const pendingNum = await rollup.getCheckpointNumber();
53
+ const provenNum = await rollup.getProvenCheckpointNumber();
58
54
  const validators = await rollup.getAttesters();
59
55
  const committee = await rollup.getCurrentEpochCommittee();
60
56
  const archive = await rollup.archive();
61
57
  const slot = await this.getSlot();
62
58
  const epochNum = await rollup.getEpochNumberForSlotNumber(slot);
63
- this.logger.info(`Pending block num: ${pendingNum}`);
64
- this.logger.info(`Proven block num: ${provenNum}`);
59
+ this.logger.info(`Pending checkpoint num: ${pendingNum}`);
60
+ this.logger.info(`Proven checkpoint num: ${provenNum}`);
65
61
  this.logger.info(`Validators: ${validators.map((v)=>v.toString()).join(', ')}`);
66
62
  this.logger.info(`Committee: ${committee?.map((v)=>v.toString()).join(', ')}`);
67
63
  this.logger.info(`Archive: ${archive}`);
@@ -144,36 +140,36 @@ import { EthCheatCodes } from './eth_cheat_codes.js';
144
140
  this.logger.warn(`Advanced ${howMany} slots up to slot ${slot} in epoch ${epoch}`);
145
141
  }
146
142
  /**
147
- * Marks the specified block (or latest if none) as proven
148
- * @param maybeBlockNumber - The block number to mark as proven (defaults to latest pending)
149
- */ markAsProven(maybeBlockNumber) {
143
+ * Marks the specified checkpoint (or latest if none) as proven
144
+ * @param maybeCheckpointNumber - The checkpoint number to mark as proven (defaults to latest pending)
145
+ */ markAsProven(maybeCheckpointNumber) {
150
146
  return this.ethCheatCodes.execWithPausedAnvil(async ()=>{
151
147
  const tipsBefore = await this.getTips();
152
148
  const { pending, proven } = tipsBefore;
153
- let blockNumber = maybeBlockNumber;
154
- if (blockNumber === undefined || blockNumber > pending) {
155
- blockNumber = pending;
149
+ let checkpointNumber = maybeCheckpointNumber;
150
+ if (checkpointNumber === undefined || checkpointNumber > pending) {
151
+ checkpointNumber = pending;
156
152
  }
157
- if (blockNumber <= proven) {
158
- this.logger.debug(`Block ${blockNumber} is already proven`);
153
+ if (checkpointNumber <= proven) {
154
+ this.logger.debug(`Checkpoint ${checkpointNumber} is already proven`);
159
155
  return;
160
156
  }
161
157
  // @note @LHerskind this is heavily dependent on the storage layout and size of values
162
158
  // The rollupStore is a struct and if the size of elements or the struct changes, this can break
163
- const provenBlockNumberSlot = hexToBigInt(RollupContract.stfStorageSlot);
159
+ const provenCheckpointNumberSlot = hexToBigInt(RollupContract.stfStorageSlot);
164
160
  // Need to pack it as a single 32 byte word
165
- const newValue = BigInt(tipsBefore.pending) << 128n | BigInt(blockNumber);
166
- await this.ethCheatCodes.store(EthAddress.fromString(this.rollup.address), provenBlockNumberSlot, newValue);
161
+ const newValue = BigInt(tipsBefore.pending) << 128n | BigInt(checkpointNumber);
162
+ await this.ethCheatCodes.store(EthAddress.fromString(this.rollup.address), provenCheckpointNumberSlot, newValue);
167
163
  const tipsAfter = await this.getTips();
168
164
  if (tipsAfter.pending < tipsAfter.proven) {
169
- throw new Error('Overwrote pending tip to a block in the past');
165
+ throw new Error('Overwrote pending tip to a checkpoint in the past');
170
166
  }
171
167
  this.logger.info(`Proven tip moved: ${tipsBefore.proven} -> ${tipsAfter.proven}. Pending tip: ${tipsAfter.pending}.`);
172
168
  });
173
169
  }
174
170
  /**
175
171
  * Overrides the inProgress field of the Inbox contract state
176
- * @param howMuch - How many blocks to move it forward
172
+ * @param howMuch - How many checkpoints to move it forward
177
173
  */ advanceInboxInProgress(howMuch) {
178
174
  return this.ethCheatCodes.execWithPausedAnvil(async ()=>{
179
175
  // Storage slot 2 contains the InboxState struct
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/ethereum",
3
- "version": "3.0.0-nightly.20251124",
3
+ "version": "3.0.0-nightly.20251126",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js",
@@ -31,10 +31,10 @@
31
31
  "../package.common.json"
32
32
  ],
33
33
  "dependencies": {
34
- "@aztec/blob-lib": "3.0.0-nightly.20251124",
35
- "@aztec/constants": "3.0.0-nightly.20251124",
36
- "@aztec/foundation": "3.0.0-nightly.20251124",
37
- "@aztec/l1-artifacts": "3.0.0-nightly.20251124",
34
+ "@aztec/blob-lib": "3.0.0-nightly.20251126",
35
+ "@aztec/constants": "3.0.0-nightly.20251126",
36
+ "@aztec/foundation": "3.0.0-nightly.20251126",
37
+ "@aztec/l1-artifacts": "3.0.0-nightly.20251126",
38
38
  "@viem/anvil": "^0.0.10",
39
39
  "dotenv": "^16.0.3",
40
40
  "lodash.chunk": "^4.2.0",
package/src/config.ts CHANGED
@@ -29,7 +29,9 @@ export type L1ContractsConfig = {
29
29
  /** The target validator committee size. */
30
30
  aztecTargetCommitteeSize: number;
31
31
  /** The number of epochs to lag behind the current epoch for validator selection. */
32
- lagInEpochs: number;
32
+ lagInEpochsForValidatorSet: number;
33
+ /** The number of epochs to lag behind the current epoch for randao selection. */
34
+ lagInEpochsForRandao: number;
33
35
  /** The number of epochs after an epoch ends that proofs are still accepted. */
34
36
  aztecProofSubmissionEpochs: number;
35
37
  /** The deposit amount for a validator */
@@ -77,7 +79,8 @@ export const DefaultL1ContractsConfig = {
77
79
  aztecSlotDuration: 36,
78
80
  aztecEpochDuration: 32,
79
81
  aztecTargetCommitteeSize: 48,
80
- lagInEpochs: 2,
82
+ lagInEpochsForValidatorSet: 2,
83
+ lagInEpochsForRandao: 2, // For PROD, this value should be > lagInEpochsForValidatorSet
81
84
  aztecProofSubmissionEpochs: 1, // you have a full epoch to submit a proof after the epoch to prove ends
82
85
  activationThreshold: 100n * 10n ** 18n,
83
86
  ejectionThreshold: 50n * 10n ** 18n,
@@ -90,7 +93,7 @@ export const DefaultL1ContractsConfig = {
90
93
  slashingExecutionDelayInRounds: 0, // round N may be submitted in round N + 1
91
94
  slashingVetoer: EthAddress.ZERO,
92
95
  governanceProposerRoundSize: 300,
93
- manaTarget: BigInt(1e10),
96
+ manaTarget: BigInt(100e6),
94
97
  provingCostPerMana: BigInt(100),
95
98
  exitDelaySeconds: 2 * 24 * 60 * 60,
96
99
  slasherFlavor: 'tally' as const,
@@ -200,14 +203,14 @@ const DefaultRewardConfig = {
200
203
  sequencerBps: 8000,
201
204
  rewardDistributor: EthAddress.ZERO.toString(),
202
205
  booster: EthAddress.ZERO.toString(),
203
- blockReward: 500n * 10n ** 18n,
206
+ checkpointReward: 500n * 10n ** 18n,
204
207
  };
205
208
 
206
209
  const MainnetRewardConfig = {
207
210
  sequencerBps: 7_000,
208
211
  rewardDistributor: EthAddress.ZERO.toString(),
209
212
  booster: EthAddress.ZERO.toString(),
210
- blockReward: 400n * 10n ** 18n,
213
+ checkpointReward: 400n * 10n ** 18n,
211
214
  };
212
215
 
213
216
  export const getRewardConfig = (networkName: NetworkNames) => {
@@ -321,10 +324,15 @@ export const l1ContractsConfigMappings: ConfigMappingsType<L1ContractsConfig> =
321
324
  description: 'The target validator committee size.',
322
325
  ...numberConfigHelper(DefaultL1ContractsConfig.aztecTargetCommitteeSize),
323
326
  },
324
- lagInEpochs: {
325
- env: 'AZTEC_LAG_IN_EPOCHS',
327
+ lagInEpochsForValidatorSet: {
328
+ env: 'AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET',
326
329
  description: 'The number of epochs to lag behind the current epoch for validator selection.',
327
- ...numberConfigHelper(DefaultL1ContractsConfig.lagInEpochs),
330
+ ...numberConfigHelper(DefaultL1ContractsConfig.lagInEpochsForValidatorSet),
331
+ },
332
+ lagInEpochsForRandao: {
333
+ env: 'AZTEC_LAG_IN_EPOCHS_FOR_RANDAO',
334
+ description: 'The number of epochs to lag behind the current epoch for randao selection.',
335
+ ...numberConfigHelper(DefaultL1ContractsConfig.lagInEpochsForRandao),
328
336
  },
329
337
  aztecProofSubmissionEpochs: {
330
338
  env: 'AZTEC_PROOF_SUBMISSION_EPOCHS',
@@ -228,8 +228,13 @@ export class RollupContract {
228
228
  }
229
229
 
230
230
  @memoize
231
- getLagInEpochs() {
232
- return this.rollup.read.getLagInEpochs();
231
+ getLagInEpochsForValidatorSet() {
232
+ return this.rollup.read.getLagInEpochsForValidatorSet();
233
+ }
234
+
235
+ @memoize
236
+ getLagInEpochsForRandao() {
237
+ return this.rollup.read.getLagInEpochsForRandao();
233
238
  }
234
239
 
235
240
  @memoize
@@ -332,16 +337,16 @@ export class RollupContract {
332
337
  return await slasher.getProposer();
333
338
  }
334
339
 
335
- getBlockReward() {
336
- return this.rollup.read.getBlockReward();
340
+ getCheckpointReward() {
341
+ return this.rollup.read.getCheckpointReward();
337
342
  }
338
343
 
339
- getBlockNumber() {
340
- return this.rollup.read.getPendingBlockNumber();
344
+ getCheckpointNumber() {
345
+ return this.rollup.read.getPendingCheckpointNumber();
341
346
  }
342
347
 
343
- getProvenBlockNumber() {
344
- return this.rollup.read.getProvenBlockNumber();
348
+ getProvenCheckpointNumber() {
349
+ return this.rollup.read.getProvenCheckpointNumber();
345
350
  }
346
351
 
347
352
  getSlotNumber() {
@@ -426,8 +431,8 @@ export class RollupContract {
426
431
  return result;
427
432
  }
428
433
 
429
- getBlock(blockNumber: bigint | number) {
430
- return this.rollup.read.getBlock([BigInt(blockNumber)]);
434
+ getCheckpoint(checkpointNumber: bigint | number) {
435
+ return this.rollup.read.getCheckpoint([BigInt(checkpointNumber)]);
431
436
  }
432
437
 
433
438
  getTips() {
@@ -454,8 +459,8 @@ export class RollupContract {
454
459
  return this.rollup.read.getCurrentEpoch();
455
460
  }
456
461
 
457
- getEpochNumberForBlock(blockNumber: bigint) {
458
- return this.rollup.read.getEpochForBlock([BigInt(blockNumber)]);
462
+ getEpochNumberForCheckpoint(checkpointNumber: bigint) {
463
+ return this.rollup.read.getEpochForCheckpoint([BigInt(checkpointNumber)]);
459
464
  }
460
465
 
461
466
  async getRollupAddresses(): Promise<L1RollupContractAddresses> {
@@ -539,15 +544,16 @@ export class RollupContract {
539
544
  * @dev Throws if unable to propose
540
545
  *
541
546
  * @param archive - The archive that we expect to be current state
542
- * @return [slot, blockNumber] - If you can propose, the L2 slot number and L2 block number of the next Ethereum block,
547
+ * @return [slot, checkpointNumber, timeOfNextL1Slot] - If you can propose, the L2 slot number, checkpoint number and
548
+ * timestamp of the next L1 block
543
549
  * @throws otherwise
544
550
  */
545
551
  public async canProposeAtNextEthBlock(
546
552
  archive: Buffer,
547
553
  account: `0x${string}` | Account,
548
554
  slotDuration: bigint | number,
549
- opts: { forcePendingBlockNumber?: number } = {},
550
- ): Promise<{ slot: bigint; blockNumber: bigint; timeOfNextL1Slot: bigint }> {
555
+ opts: { forcePendingCheckpointNumber?: number } = {},
556
+ ): Promise<{ slot: bigint; checkpointNumber: bigint; timeOfNextL1Slot: bigint }> {
551
557
  if (typeof slotDuration === 'number') {
552
558
  slotDuration = BigInt(slotDuration);
553
559
  }
@@ -557,35 +563,37 @@ export class RollupContract {
557
563
 
558
564
  try {
559
565
  const {
560
- result: [slot, blockNumber],
566
+ result: [slot, checkpointNumber],
561
567
  } = await this.client.simulateContract({
562
568
  address: this.address,
563
569
  abi: RollupAbi,
564
570
  functionName: 'canProposeAtTime',
565
571
  args: [timeOfNextL1Slot, `0x${archive.toString('hex')}`, who],
566
572
  account,
567
- stateOverride: await this.makePendingBlockNumberOverride(opts.forcePendingBlockNumber),
573
+ stateOverride: await this.makePendingCheckpointNumberOverride(opts.forcePendingCheckpointNumber),
568
574
  });
569
575
 
570
- return { slot, blockNumber, timeOfNextL1Slot };
576
+ return { slot, checkpointNumber, timeOfNextL1Slot };
571
577
  } catch (err: unknown) {
572
578
  throw formatViemError(err);
573
579
  }
574
580
  }
575
581
 
576
582
  /**
577
- * Returns a state override that sets the pending block number to the specified value. Useful for simulations.
578
- * Requires querying the current state of the contract to get the current proven block number, as they are both
583
+ * Returns a state override that sets the pending checkpoint number to the specified value. Useful for simulations.
584
+ * Requires querying the current state of the contract to get the current proven checkpoint number, as they are both
579
585
  * stored in the same slot. If the argument is undefined, it returns an empty override.
580
586
  */
581
- public async makePendingBlockNumberOverride(forcePendingBlockNumber: number | undefined): Promise<StateOverride> {
582
- if (forcePendingBlockNumber === undefined) {
587
+ public async makePendingCheckpointNumberOverride(
588
+ forcePendingCheckpointNumber: number | undefined,
589
+ ): Promise<StateOverride> {
590
+ if (forcePendingCheckpointNumber === undefined) {
583
591
  return [];
584
592
  }
585
593
  const slot = RollupContract.stfStorageSlot;
586
594
  const currentValue = await this.client.getStorageAt({ address: this.address, slot });
587
- const currentProvenBlockNumber = currentValue ? hexToBigInt(currentValue) & ((1n << 128n) - 1n) : 0n;
588
- const newValue = (BigInt(forcePendingBlockNumber) << 128n) | currentProvenBlockNumber;
595
+ const currentProvenCheckpointNumber = currentValue ? hexToBigInt(currentValue) & ((1n << 128n) - 1n) : 0n;
596
+ const newValue = (BigInt(forcePendingCheckpointNumber) << 128n) | currentProvenCheckpointNumber;
589
597
  return [
590
598
  {
591
599
  address: this.address,
@@ -596,7 +604,7 @@ export class RollupContract {
596
604
 
597
605
  /** Creates a request to Rollup#invalidateBadAttestation to be simulated or sent */
598
606
  public buildInvalidateBadAttestationRequest(
599
- blockNumber: number,
607
+ checkpointNumber: number,
600
608
  attestationsAndSigners: ViemCommitteeAttestations,
601
609
  committee: EthAddress[],
602
610
  invalidIndex: number,
@@ -607,7 +615,7 @@ export class RollupContract {
607
615
  abi: RollupAbi,
608
616
  functionName: 'invalidateBadAttestation',
609
617
  args: [
610
- BigInt(blockNumber),
618
+ BigInt(checkpointNumber),
611
619
  attestationsAndSigners,
612
620
  committee.map(addr => addr.toString()),
613
621
  BigInt(invalidIndex),
@@ -618,7 +626,7 @@ export class RollupContract {
618
626
 
619
627
  /** Creates a request to Rollup#invalidateInsufficientAttestations to be simulated or sent */
620
628
  public buildInvalidateInsufficientAttestationsRequest(
621
- blockNumber: number,
629
+ checkpointNumber: number,
622
630
  attestationsAndSigners: ViemCommitteeAttestations,
623
631
  committee: EthAddress[],
624
632
  ): L1TxRequest {
@@ -627,17 +635,17 @@ export class RollupContract {
627
635
  data: encodeFunctionData({
628
636
  abi: RollupAbi,
629
637
  functionName: 'invalidateInsufficientAttestations',
630
- args: [BigInt(blockNumber), attestationsAndSigners, committee.map(addr => addr.toString())],
638
+ args: [BigInt(checkpointNumber), attestationsAndSigners, committee.map(addr => addr.toString())],
631
639
  }),
632
640
  };
633
641
  }
634
642
 
635
643
  /** Calls getHasSubmitted directly. Returns whether the given prover has submitted a proof with the given length for the given epoch. */
636
- public getHasSubmittedProof(epochNumber: number, numberOfBlocksInEpoch: number, prover: Hex | EthAddress) {
644
+ public getHasSubmittedProof(epochNumber: number, numberOfCheckpointsInEpoch: number, prover: Hex | EthAddress) {
637
645
  if (prover instanceof EthAddress) {
638
646
  prover = prover.toString();
639
647
  }
640
- return this.rollup.read.getHasSubmitted([BigInt(epochNumber), BigInt(numberOfBlocksInEpoch), prover]);
648
+ return this.rollup.read.getHasSubmitted([BigInt(epochNumber), BigInt(numberOfCheckpointsInEpoch), prover]);
641
649
  }
642
650
 
643
651
  getManaBaseFeeAt(timestamp: bigint, inFeeAsset: boolean) {
@@ -648,9 +656,9 @@ export class RollupContract {
648
656
  return this.rollup.read.getSlotAt([timestamp]);
649
657
  }
650
658
 
651
- async status(blockNumber: bigint, options?: { blockNumber?: bigint }) {
659
+ async status(checkpointNumber: bigint, options?: { blockNumber?: bigint }) {
652
660
  await checkBlockTag(options?.blockNumber, this.client);
653
- return this.rollup.read.status([blockNumber], options);
661
+ return this.rollup.read.status([checkpointNumber], options);
654
662
  }
655
663
 
656
664
  async canPruneAtTime(timestamp: bigint, options?: { blockNumber?: bigint }) {
@@ -662,8 +670,8 @@ export class RollupContract {
662
670
  return this.rollup.read.archive();
663
671
  }
664
672
 
665
- archiveAt(blockNumber: bigint) {
666
- return this.rollup.read.archiveAt([blockNumber]);
673
+ archiveAt(checkpointNumber: bigint) {
674
+ return this.rollup.read.archiveAt([checkpointNumber]);
667
675
  }
668
676
 
669
677
  getSequencerRewards(address: Hex | EthAddress) {
@@ -705,8 +713,8 @@ export class RollupContract {
705
713
  return this.rollup.read.getStatus([address]);
706
714
  }
707
715
 
708
- getBlobCommitmentsHash(blockNumber: bigint) {
709
- return this.rollup.read.getBlobCommitmentsHash([blockNumber]);
716
+ getBlobCommitmentsHash(checkpointNumber: bigint) {
717
+ return this.rollup.read.getBlobCommitmentsHash([checkpointNumber]);
710
718
  }
711
719
 
712
720
  getCurrentBlobCommitmentsHash() {
@@ -761,15 +769,17 @@ export class RollupContract {
761
769
  );
762
770
  }
763
771
 
764
- public listenToBlockInvalidated(callback: (args: { blockNumber: bigint }) => unknown): WatchContractEventReturnType {
765
- return this.rollup.watchEvent.BlockInvalidated(
772
+ public listenToCheckpointInvalidated(
773
+ callback: (args: { checkpointNumber: bigint }) => unknown,
774
+ ): WatchContractEventReturnType {
775
+ return this.rollup.watchEvent.CheckpointInvalidated(
766
776
  {},
767
777
  {
768
778
  onLogs: logs => {
769
779
  for (const log of logs) {
770
780
  const args = log.args;
771
- if (args.blockNumber !== undefined) {
772
- callback({ blockNumber: args.blockNumber });
781
+ if (args.checkpointNumber !== undefined) {
782
+ callback({ checkpointNumber: args.checkpointNumber });
773
783
  }
774
784
  }
775
785
  },
@@ -487,9 +487,9 @@ export const deploySharedContracts = async (
487
487
  const rewardDistributorAddress = await registry.getRewardDistributor();
488
488
 
489
489
  if (!args.existingTokenAddress) {
490
- const blockReward = getRewardConfig(networkName).blockReward;
490
+ const checkpointReward = getRewardConfig(networkName).checkpointReward;
491
491
 
492
- const funding = blockReward * 200000n;
492
+ const funding = checkpointReward * 200000n;
493
493
  const { txHash: fundRewardDistributorTxHash } = await deployer.sendTransaction({
494
494
  to: feeAssetAddress.toString(),
495
495
  data: encodeFunctionData({
@@ -863,7 +863,8 @@ export const deployRollup = async (
863
863
  aztecSlotDuration: BigInt(args.aztecSlotDuration),
864
864
  aztecEpochDuration: BigInt(args.aztecEpochDuration),
865
865
  targetCommitteeSize: BigInt(args.aztecTargetCommitteeSize),
866
- lagInEpochs: BigInt(args.lagInEpochs),
866
+ lagInEpochsForValidatorSet: BigInt(args.lagInEpochsForValidatorSet),
867
+ lagInEpochsForRandao: BigInt(args.lagInEpochsForRandao),
867
868
  aztecProofSubmissionEpochs: BigInt(args.aztecProofSubmissionEpochs),
868
869
  slashingQuorum: BigInt(args.slashingQuorum ?? (args.slashingRoundSizeInEpochs * args.aztecEpochDuration) / 2 + 1),
869
870
  slashingRoundSize: BigInt(args.slashingRoundSizeInEpochs * args.aztecEpochDuration),
@@ -248,8 +248,7 @@ export class ReadOnlyL1TxUtils {
248
248
  this.logger?.debug('Using fixed priority fee per L1 gas', {
249
249
  fixedPriorityFeePerGas: gasConfig.fixedPriorityFeePerGas,
250
250
  });
251
- // try to maintain precision up to 1000000 wei
252
- priorityFee = BigInt(gasConfig.fixedPriorityFeePerGas * 1_000_000) * (WEI_CONST / 1_000_000n);
251
+ priorityFee = BigInt(Math.trunc(gasConfig.fixedPriorityFeePerGas * Number(WEI_CONST)));
253
252
  } else {
254
253
  // Get competitive priority fee (includes network estimate + analysis)
255
254
  priorityFee = this.getCompetitivePriorityFee(networkEstimateResult, pendingBlockResult, feeHistoryResult);
package/src/queries.ts CHANGED
@@ -33,7 +33,8 @@ export async function getL1ContractsConfig(
33
33
  aztecSlotDuration,
34
34
  aztecProofSubmissionEpochs,
35
35
  aztecTargetCommitteeSize,
36
- lagInEpochs,
36
+ lagInEpochsForValidatorSet,
37
+ lagInEpochsForRandao,
37
38
  activationThreshold,
38
39
  ejectionThreshold,
39
40
  localEjectionThreshold,
@@ -59,7 +60,8 @@ export async function getL1ContractsConfig(
59
60
  rollup.getSlotDuration(),
60
61
  rollup.getProofSubmissionEpochs(),
61
62
  rollup.getTargetCommitteeSize(),
62
- rollup.getLagInEpochs(),
63
+ rollup.getLagInEpochsForValidatorSet(),
64
+ rollup.getLagInEpochsForRandao(),
63
65
  rollup.getActivationThreshold(),
64
66
  rollup.getEjectionThreshold(),
65
67
  rollup.getLocalEjectionThreshold(),
@@ -87,7 +89,8 @@ export async function getL1ContractsConfig(
87
89
  aztecSlotDuration: Number(aztecSlotDuration),
88
90
  aztecProofSubmissionEpochs: Number(aztecProofSubmissionEpochs),
89
91
  aztecTargetCommitteeSize: Number(aztecTargetCommitteeSize),
90
- lagInEpochs: Number(lagInEpochs),
92
+ lagInEpochsForValidatorSet: Number(lagInEpochsForValidatorSet),
93
+ lagInEpochsForRandao: Number(lagInEpochsForRandao),
91
94
  governanceProposerQuorum: Number(governanceProposerQuorum),
92
95
  governanceProposerRoundSize: Number(governanceProposerRoundSize),
93
96
  activationThreshold,
@@ -10,8 +10,8 @@ import type { ViemClient } from '../types.js';
10
10
 
11
11
  export type ChainMonitorEventMap = {
12
12
  'l1-block': [{ l1BlockNumber: number; timestamp: bigint }];
13
- 'l2-block': [{ l2BlockNumber: number; l1BlockNumber: number; l2SlotNumber: number; timestamp: bigint }];
14
- 'l2-block-proven': [{ l2ProvenBlockNumber: number; l1BlockNumber: number; timestamp: bigint }];
13
+ checkpoint: [{ checkpointNumber: number; l1BlockNumber: number; l2SlotNumber: number; timestamp: bigint }];
14
+ 'checkpoint-proven': [{ provenCheckpointNumber: number; l1BlockNumber: number; timestamp: bigint }];
15
15
  'l2-messages': [{ totalL2Messages: number; l1BlockNumber: number }];
16
16
  'l2-epoch': [{ l2EpochNumber: number; timestamp: bigint; committee: EthAddress[] | undefined }];
17
17
  'l2-slot': [{ l2SlotNumber: number; timestamp: bigint }];
@@ -27,14 +27,14 @@ export class ChainMonitor extends EventEmitter<ChainMonitorEventMap> {
27
27
 
28
28
  /** Current L1 block number */
29
29
  public l1BlockNumber!: number;
30
- /** Current L2 block number */
31
- public l2BlockNumber!: number;
32
- /** Current L2 proven block number */
33
- public l2ProvenBlockNumber!: number;
34
- /** L1 timestamp for the current L2 block */
35
- public l2BlockTimestamp!: bigint;
36
- /** L1 timestamp for the proven L2 block */
37
- public l2ProvenBlockTimestamp!: bigint;
30
+ /** Current checkpoint number */
31
+ public checkpointNumber!: number;
32
+ /** Current proven checkpoint number */
33
+ public provenCheckpointNumber!: number;
34
+ /** L1 timestamp for the current checkpoint */
35
+ public checkpointTimestamp!: bigint;
36
+ /** L1 timestamp for the proven checkpoint */
37
+ public provenCheckpointTimestamp!: bigint;
38
38
  /** Total number of L2 messages pushed into the Inbox */
39
39
  public totalL2Messages: number = 0;
40
40
  /** Current L2 epoch number */
@@ -114,28 +114,28 @@ export class ChainMonitor extends EventEmitter<ChainMonitorEventMap> {
114
114
  this.emit('l1-block', { l1BlockNumber: newL1BlockNumber, timestamp });
115
115
  let msg = `L1 block ${newL1BlockNumber} mined at ${timestampString}`;
116
116
 
117
- const newL2BlockNumber = Number(await this.rollup.getBlockNumber());
118
- if (this.l2BlockNumber !== newL2BlockNumber) {
119
- const epochNumber = await this.rollup.getEpochNumberForBlock(BigInt(newL2BlockNumber));
120
- msg += ` with new L2 block ${newL2BlockNumber} for epoch ${epochNumber}`;
121
- this.l2BlockNumber = newL2BlockNumber;
122
- this.l2BlockTimestamp = timestamp;
123
- this.emit('l2-block', {
124
- l2BlockNumber: newL2BlockNumber,
117
+ const newCheckpointNumber = Number(await this.rollup.getCheckpointNumber());
118
+ if (this.checkpointNumber !== newCheckpointNumber) {
119
+ const epochNumber = await this.rollup.getEpochNumberForCheckpoint(BigInt(newCheckpointNumber));
120
+ msg += ` with new checkpoint ${newCheckpointNumber} for epoch ${epochNumber}`;
121
+ this.checkpointNumber = newCheckpointNumber;
122
+ this.checkpointTimestamp = timestamp;
123
+ this.emit('checkpoint', {
124
+ checkpointNumber: newCheckpointNumber,
125
125
  l1BlockNumber: newL1BlockNumber,
126
126
  l2SlotNumber: Number(l2SlotNumber),
127
127
  timestamp,
128
128
  });
129
129
  }
130
130
 
131
- const newL2ProvenBlockNumber = Number(await this.rollup.getProvenBlockNumber());
132
- if (this.l2ProvenBlockNumber !== newL2ProvenBlockNumber) {
133
- const epochNumber = await this.rollup.getEpochNumberForBlock(BigInt(newL2ProvenBlockNumber));
134
- msg += ` with proof up to L2 block ${newL2ProvenBlockNumber} for epoch ${epochNumber}`;
135
- this.l2ProvenBlockNumber = newL2ProvenBlockNumber;
136
- this.l2ProvenBlockTimestamp = timestamp;
137
- this.emit('l2-block-proven', {
138
- l2ProvenBlockNumber: newL2ProvenBlockNumber,
131
+ const newProvenCheckpointNumber = Number(await this.rollup.getProvenCheckpointNumber());
132
+ if (this.provenCheckpointNumber !== newProvenCheckpointNumber) {
133
+ const epochNumber = await this.rollup.getEpochNumberForCheckpoint(BigInt(newProvenCheckpointNumber));
134
+ msg += ` with proof up to checkpoint ${newProvenCheckpointNumber} for epoch ${epochNumber}`;
135
+ this.provenCheckpointNumber = newProvenCheckpointNumber;
136
+ this.provenCheckpointTimestamp = timestamp;
137
+ this.emit('checkpoint-proven', {
138
+ provenCheckpointNumber: newProvenCheckpointNumber,
139
139
  l1BlockNumber: newL1BlockNumber,
140
140
  timestamp,
141
141
  });
@@ -168,8 +168,8 @@ export class ChainMonitor extends EventEmitter<ChainMonitorEventMap> {
168
168
  l1BlockNumber: this.l1BlockNumber,
169
169
  l2SlotNumber,
170
170
  l2Epoch,
171
- l2BlockNumber: this.l2BlockNumber,
172
- l2ProvenBlockNumber: this.l2ProvenBlockNumber,
171
+ checkpointNumber: this.checkpointNumber,
172
+ provenCheckpointNumber: this.provenCheckpointNumber,
173
173
  totalL2Messages: this.totalL2Messages,
174
174
  committee,
175
175
  });
@@ -225,19 +225,19 @@ export class ChainMonitor extends EventEmitter<ChainMonitorEventMap> {
225
225
  });
226
226
  }
227
227
 
228
- public waitUntilL2Block(l2BlockNumber: number | bigint): Promise<void> {
229
- const targetBlock = typeof l2BlockNumber === 'bigint' ? l2BlockNumber.valueOf() : l2BlockNumber;
230
- if (this.l2BlockNumber >= targetBlock) {
228
+ public waitUntilCheckpoint(checkpointNumber: number | bigint): Promise<void> {
229
+ const targetBlock = typeof checkpointNumber === 'bigint' ? checkpointNumber.valueOf() : checkpointNumber;
230
+ if (this.checkpointNumber >= targetBlock) {
231
231
  return Promise.resolve();
232
232
  }
233
233
  return new Promise(resolve => {
234
- const listener = (data: { l2BlockNumber: number; timestamp: bigint }) => {
235
- if (data.l2BlockNumber >= targetBlock) {
236
- this.off('l2-block', listener);
234
+ const listener = (data: { checkpointNumber: number; timestamp: bigint }) => {
235
+ if (data.checkpointNumber >= targetBlock) {
236
+ this.off('checkpoint', listener);
237
237
  resolve();
238
238
  }
239
239
  };
240
- this.on('l2-block', listener);
240
+ this.on('checkpoint', listener);
241
241
  });
242
242
  }
243
243
  }