@aztec/ethereum 3.0.0-nightly.20251128 → 3.0.0-nightly.20251202

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.
Files changed (35) hide show
  1. package/dest/contracts/empire_base.d.ts +6 -5
  2. package/dest/contracts/empire_base.d.ts.map +1 -1
  3. package/dest/contracts/empire_base.js +1 -1
  4. package/dest/contracts/empire_slashing_proposer.d.ts +5 -4
  5. package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -1
  6. package/dest/contracts/empire_slashing_proposer.js +8 -2
  7. package/dest/contracts/governance_proposer.d.ts +5 -4
  8. package/dest/contracts/governance_proposer.d.ts.map +1 -1
  9. package/dest/contracts/governance_proposer.js +8 -2
  10. package/dest/contracts/rollup.d.ts +22 -35
  11. package/dest/contracts/rollup.d.ts.map +1 -1
  12. package/dest/contracts/rollup.js +22 -25
  13. package/dest/contracts/tally_slashing_proposer.d.ts +6 -5
  14. package/dest/contracts/tally_slashing_proposer.d.ts.map +1 -1
  15. package/dest/contracts/tally_slashing_proposer.js +3 -3
  16. package/dest/deploy_l1_contracts.d.ts +6 -6
  17. package/dest/deploy_l1_contracts.d.ts.map +1 -1
  18. package/dest/deploy_l1_contracts.js +4 -3
  19. package/dest/l1_artifacts.d.ts +4 -66
  20. package/dest/l1_artifacts.d.ts.map +1 -1
  21. package/dest/test/chain_monitor.d.ts +17 -15
  22. package/dest/test/chain_monitor.d.ts.map +1 -1
  23. package/dest/test/chain_monitor.js +10 -12
  24. package/dest/test/rollup_cheat_codes.d.ts +6 -6
  25. package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
  26. package/dest/test/rollup_cheat_codes.js +15 -13
  27. package/package.json +5 -5
  28. package/src/contracts/empire_base.ts +6 -5
  29. package/src/contracts/empire_slashing_proposer.ts +11 -5
  30. package/src/contracts/governance_proposer.ts +11 -5
  31. package/src/contracts/rollup.ts +38 -53
  32. package/src/contracts/tally_slashing_proposer.ts +8 -7
  33. package/src/deploy_l1_contracts.ts +4 -3
  34. package/src/test/chain_monitor.ts +23 -23
  35. package/src/test/rollup_cheat_codes.ts +17 -16
@@ -1,6 +1,6 @@
1
1
  import { RollupContract, type ViemPublicClient } from '@aztec/ethereum';
2
2
  import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
3
- import { EpochNumber } from '@aztec/foundation/branded-types';
3
+ import { EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
4
4
  import { EthAddress } from '@aztec/foundation/eth-address';
5
5
  import { createLogger } from '@aztec/foundation/log';
6
6
  import type { DateProvider } from '@aztec/foundation/timer';
@@ -50,15 +50,15 @@ export class RollupCheatCodes {
50
50
  }
51
51
 
52
52
  /** Returns the current slot */
53
- public async getSlot() {
53
+ public async getSlot(): Promise<SlotNumber> {
54
54
  const ts = BigInt((await this.client.getBlock()).timestamp);
55
- return await this.rollup.read.getSlotAt([ts]);
55
+ return SlotNumber.fromBigInt(await this.rollup.read.getSlotAt([ts]));
56
56
  }
57
57
 
58
58
  /** Returns the current epoch */
59
59
  public async getEpoch(): Promise<EpochNumber> {
60
60
  const slotNumber = await this.getSlot();
61
- return EpochNumber.fromBigInt(await this.rollup.read.getEpochAtSlot([slotNumber]));
61
+ return EpochNumber.fromBigInt(await this.rollup.read.getEpochAtSlot([BigInt(slotNumber)]));
62
62
  }
63
63
 
64
64
  /**
@@ -97,13 +97,13 @@ export class RollupCheatCodes {
97
97
  /** Fetches the epoch and slot duration config from the rollup contract */
98
98
  public async getConfig(): Promise<{
99
99
  /** Epoch duration */ epochDuration: bigint;
100
- /** Slot duration */ slotDuration: bigint;
100
+ /** Slot duration */ slotDuration: number;
101
101
  }> {
102
102
  const [epochDuration, slotDuration] = await Promise.all([
103
103
  this.rollup.read.getEpochDuration(),
104
104
  this.rollup.read.getSlotDuration(),
105
105
  ]);
106
- return { epochDuration, slotDuration };
106
+ return { epochDuration, slotDuration: Number(slotDuration) };
107
107
  }
108
108
 
109
109
  /**
@@ -112,15 +112,15 @@ export class RollupCheatCodes {
112
112
  * @param opts - Options
113
113
  */
114
114
  public async advanceToEpoch(
115
- epoch: EpochNumber | bigint | number,
115
+ epoch: EpochNumber,
116
116
  opts: {
117
117
  /** Offset in seconds */
118
118
  offset?: number;
119
119
  } = {},
120
120
  ) {
121
121
  const { epochDuration: slotsInEpoch } = await this.getConfig();
122
- const timestamp =
123
- (await this.rollup.read.getTimestampForSlot([BigInt(epoch) * slotsInEpoch])) + BigInt(opts.offset ?? 0);
122
+ const slotNumber = SlotNumber(epoch * Number(slotsInEpoch));
123
+ const timestamp = (await this.rollup.read.getTimestampForSlot([BigInt(slotNumber)])) + BigInt(opts.offset ?? 0);
124
124
  try {
125
125
  await this.ethCheatCodes.warp(Number(timestamp), { ...opts, silent: true, resetBlockInterval: true });
126
126
  this.logger.warn(`Warped to epoch ${epoch}`);
@@ -134,8 +134,8 @@ export class RollupCheatCodes {
134
134
  public async advanceToNextEpoch() {
135
135
  const slot = await this.getSlot();
136
136
  const { epochDuration, slotDuration } = await this.getConfig();
137
- const slotsUntilNextEpoch = epochDuration - (slot % epochDuration) + 1n;
138
- const timeToNextEpoch = slotsUntilNextEpoch * slotDuration;
137
+ const slotsUntilNextEpoch = epochDuration - (BigInt(slot) % epochDuration) + 1n;
138
+ const timeToNextEpoch = slotsUntilNextEpoch * BigInt(slotDuration);
139
139
  const l1Timestamp = BigInt((await this.client.getBlock()).timestamp);
140
140
  await this.ethCheatCodes.warp(Number(l1Timestamp + timeToNextEpoch), {
141
141
  silent: true,
@@ -147,10 +147,11 @@ export class RollupCheatCodes {
147
147
  /** Warps time in L1 until the beginning of the next slot. */
148
148
  public async advanceToNextSlot() {
149
149
  const currentSlot = await this.getSlot();
150
- const timestamp = await this.rollup.read.getTimestampForSlot([currentSlot + 1n]);
150
+ const nextSlot = SlotNumber(currentSlot + 1);
151
+ const timestamp = await this.rollup.read.getTimestampForSlot([BigInt(nextSlot)]);
151
152
  await this.ethCheatCodes.warp(Number(timestamp), { silent: true, resetBlockInterval: true });
152
- this.logger.warn(`Advanced to slot ${currentSlot + 1n}`);
153
- return [timestamp, currentSlot + 1n];
153
+ this.logger.warn(`Advanced to slot ${nextSlot}`);
154
+ return [timestamp, nextSlot];
154
155
  }
155
156
 
156
157
  /**
@@ -159,8 +160,8 @@ export class RollupCheatCodes {
159
160
  */
160
161
  public async advanceSlots(howMany: number) {
161
162
  const l1Timestamp = (await this.client.getBlock()).timestamp;
162
- const slotDuration = await this.rollup.read.getSlotDuration();
163
- const timeToWarp = BigInt(howMany) * slotDuration;
163
+ const slotDuration = Number(await this.rollup.read.getSlotDuration());
164
+ const timeToWarp = BigInt(howMany) * BigInt(slotDuration);
164
165
  await this.ethCheatCodes.warp(l1Timestamp + timeToWarp, { silent: true, resetBlockInterval: true });
165
166
  const [slot, epoch] = await Promise.all([this.getSlot(), this.getEpoch()]);
166
167
  this.logger.warn(`Advanced ${howMany} slots up to slot ${slot} in epoch ${epoch}`);