@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.
- package/dest/contracts/empire_base.d.ts +6 -5
- package/dest/contracts/empire_base.d.ts.map +1 -1
- package/dest/contracts/empire_base.js +1 -1
- package/dest/contracts/empire_slashing_proposer.d.ts +5 -4
- package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/empire_slashing_proposer.js +8 -2
- package/dest/contracts/governance_proposer.d.ts +5 -4
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +8 -2
- package/dest/contracts/rollup.d.ts +22 -35
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +22 -25
- package/dest/contracts/tally_slashing_proposer.d.ts +6 -5
- package/dest/contracts/tally_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/tally_slashing_proposer.js +3 -3
- package/dest/deploy_l1_contracts.d.ts +6 -6
- package/dest/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/deploy_l1_contracts.js +4 -3
- package/dest/l1_artifacts.d.ts +4 -66
- package/dest/l1_artifacts.d.ts.map +1 -1
- package/dest/test/chain_monitor.d.ts +17 -15
- package/dest/test/chain_monitor.d.ts.map +1 -1
- package/dest/test/chain_monitor.js +10 -12
- package/dest/test/rollup_cheat_codes.d.ts +6 -6
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
- package/dest/test/rollup_cheat_codes.js +15 -13
- package/package.json +5 -5
- package/src/contracts/empire_base.ts +6 -5
- package/src/contracts/empire_slashing_proposer.ts +11 -5
- package/src/contracts/governance_proposer.ts +11 -5
- package/src/contracts/rollup.ts +38 -53
- package/src/contracts/tally_slashing_proposer.ts +8 -7
- package/src/deploy_l1_contracts.ts +4 -3
- package/src/test/chain_monitor.ts +23 -23
- 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:
|
|
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
|
|
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
|
|
123
|
-
|
|
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
|
|
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 ${
|
|
153
|
-
return [timestamp,
|
|
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}`);
|