@aztec/ethereum 3.0.0-rc.5 → 4.0.0-nightly.20260107
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.js +6 -2
- package/dest/config.d.ts +4 -1
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +6 -0
- package/dest/contracts/empire_base.d.ts +2 -1
- package/dest/contracts/empire_base.d.ts.map +1 -1
- package/dest/contracts/empire_slashing_proposer.d.ts +2 -1
- package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/empire_slashing_proposer.js +9 -0
- package/dest/contracts/governance_proposer.d.ts +2 -1
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +391 -8
- package/dest/contracts/inbox.d.ts +5 -1
- package/dest/contracts/inbox.d.ts.map +1 -1
- package/dest/contracts/inbox.js +4 -0
- package/dest/contracts/rollup.d.ts +125 -73
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +614 -125
- package/dest/deploy_aztec_l1_contracts.d.ts +3 -1
- package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -1
- package/dest/deploy_aztec_l1_contracts.js +7 -2
- package/dest/l1_artifacts.d.ts +3370 -104
- package/dest/l1_artifacts.d.ts.map +1 -1
- package/dest/l1_contract_addresses.d.ts +1 -1
- package/dest/l1_contract_addresses.d.ts.map +1 -1
- package/dest/l1_contract_addresses.js +3 -3
- package/dest/l1_tx_utils/constants.d.ts +7 -1
- package/dest/l1_tx_utils/constants.d.ts.map +1 -1
- package/dest/l1_tx_utils/constants.js +25 -0
- package/dest/l1_tx_utils/fee-strategies/index.d.ts +10 -0
- package/dest/l1_tx_utils/fee-strategies/index.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/index.js +12 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts +8 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.js +129 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts +23 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.js +191 -0
- package/dest/l1_tx_utils/fee-strategies/types.d.ts +51 -0
- package/dest/l1_tx_utils/fee-strategies/types.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/types.js +3 -0
- package/dest/l1_tx_utils/index.d.ts +3 -1
- package/dest/l1_tx_utils/index.d.ts.map +1 -1
- package/dest/l1_tx_utils/index.js +2 -0
- package/dest/l1_tx_utils/l1_fee_analyzer.d.ts +233 -0
- package/dest/l1_tx_utils/l1_fee_analyzer.d.ts.map +1 -0
- package/dest/l1_tx_utils/l1_fee_analyzer.js +506 -0
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +4 -15
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/readonly_l1_tx_utils.js +34 -142
- package/dest/queries.d.ts +1 -1
- package/dest/queries.d.ts.map +1 -1
- package/dest/queries.js +8 -3
- package/dest/test/chain_monitor.js +1 -2
- package/dest/test/eth_cheat_codes.js +3 -1
- package/dest/test/rollup_cheat_codes.js +3 -1
- package/dest/test/tx_delayer.js +1 -1
- package/dest/utils.d.ts +14 -2
- package/dest/utils.d.ts.map +1 -1
- package/dest/utils.js +18 -0
- package/package.json +6 -5
- package/src/client.ts +2 -2
- package/src/config.ts +8 -0
- package/src/contracts/empire_base.ts +1 -1
- package/src/contracts/empire_slashing_proposer.ts +6 -1
- package/src/contracts/governance_proposer.ts +6 -1
- package/src/contracts/inbox.ts +5 -0
- package/src/contracts/rollup.ts +252 -84
- package/src/deploy_aztec_l1_contracts.ts +12 -2
- package/src/l1_contract_addresses.ts +22 -20
- package/src/l1_tx_utils/constants.ts +11 -0
- package/src/l1_tx_utils/fee-strategies/index.ts +22 -0
- package/src/l1_tx_utils/fee-strategies/p75_competitive.ts +163 -0
- package/src/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.ts +245 -0
- package/src/l1_tx_utils/fee-strategies/types.ts +56 -0
- package/src/l1_tx_utils/index.ts +2 -0
- package/src/l1_tx_utils/l1_fee_analyzer.ts +803 -0
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +46 -184
- package/src/queries.ts +8 -2
- package/src/test/chain_monitor.ts +1 -1
- package/src/test/eth_cheat_codes.ts +1 -1
- package/src/test/rollup_cheat_codes.ts +1 -1
- package/src/test/tx_delayer.ts +1 -1
- package/src/utils.ts +29 -0
package/src/contracts/rollup.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { CheckpointNumber, EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
4
|
import { memoize } from '@aztec/foundation/decorators';
|
|
3
5
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
6
|
import type { ViemSignature } from '@aztec/foundation/eth-signature';
|
|
7
|
+
import { makeBackoff, retry } from '@aztec/foundation/retry';
|
|
5
8
|
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
|
|
6
9
|
import { RollupStorage } from '@aztec/l1-artifacts/RollupStorage';
|
|
7
10
|
|
|
@@ -89,6 +92,103 @@ export enum SlashingProposerType {
|
|
|
89
92
|
Empire = 2,
|
|
90
93
|
}
|
|
91
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Status of a validator/attester in the staking system.
|
|
97
|
+
* Matches the Status enum in StakingLib.sol
|
|
98
|
+
*/
|
|
99
|
+
export enum AttesterStatus {
|
|
100
|
+
NONE = 0,
|
|
101
|
+
VALIDATING = 1,
|
|
102
|
+
ZOMBIE = 2,
|
|
103
|
+
EXITING = 3,
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Fee header data for a checkpoint
|
|
108
|
+
*/
|
|
109
|
+
export type FeeHeader = {
|
|
110
|
+
excessMana: bigint;
|
|
111
|
+
manaUsed: bigint;
|
|
112
|
+
feeAssetPriceNumerator: bigint;
|
|
113
|
+
congestionCost: bigint;
|
|
114
|
+
proverCost: bigint;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Checkpoint log data returned from the rollup contract
|
|
119
|
+
*/
|
|
120
|
+
export type CheckpointLog = {
|
|
121
|
+
archive: Fr;
|
|
122
|
+
headerHash: Buffer32;
|
|
123
|
+
blobCommitmentsHash: Buffer32;
|
|
124
|
+
attestationsHash: Buffer32;
|
|
125
|
+
payloadDigest: Buffer32;
|
|
126
|
+
slotNumber: SlotNumber;
|
|
127
|
+
feeHeader: FeeHeader;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* L1 fee data (base fee and blob fee)
|
|
132
|
+
*/
|
|
133
|
+
export type L1FeeData = {
|
|
134
|
+
baseFee: bigint;
|
|
135
|
+
blobFee: bigint;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Reward configuration for the rollup
|
|
140
|
+
*/
|
|
141
|
+
export type RewardConfig = {
|
|
142
|
+
rewardDistributor: EthAddress;
|
|
143
|
+
sequencerBps: bigint;
|
|
144
|
+
booster: EthAddress;
|
|
145
|
+
checkpointReward: bigint;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Exit information for a validator
|
|
150
|
+
*/
|
|
151
|
+
export type Exit = {
|
|
152
|
+
withdrawalId: bigint;
|
|
153
|
+
amount: bigint;
|
|
154
|
+
exitableAt: bigint;
|
|
155
|
+
recipientOrWithdrawer: EthAddress;
|
|
156
|
+
isRecipient: boolean;
|
|
157
|
+
exists: boolean;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Attester configuration including public key and withdrawer
|
|
162
|
+
*/
|
|
163
|
+
export type AttesterConfig = {
|
|
164
|
+
publicKey: {
|
|
165
|
+
x: bigint;
|
|
166
|
+
y: bigint;
|
|
167
|
+
};
|
|
168
|
+
withdrawer: EthAddress;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Complete view of an attester's state
|
|
173
|
+
*/
|
|
174
|
+
export type AttesterView = {
|
|
175
|
+
status: AttesterStatus;
|
|
176
|
+
effectiveBalance: bigint;
|
|
177
|
+
exit: Exit;
|
|
178
|
+
config: AttesterConfig;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Return for a status call
|
|
183
|
+
*/
|
|
184
|
+
export type RollupStatusResponse = {
|
|
185
|
+
provenCheckpointNumber: CheckpointNumber;
|
|
186
|
+
provenArchive: Fr;
|
|
187
|
+
pendingCheckpointNumber: CheckpointNumber;
|
|
188
|
+
pendingArchive: Fr;
|
|
189
|
+
archiveOfMyCheckpoint: Fr;
|
|
190
|
+
};
|
|
191
|
+
|
|
92
192
|
export class RollupContract {
|
|
93
193
|
private readonly rollup: GetContractReturnType<typeof RollupAbi, ViemClient>;
|
|
94
194
|
|
|
@@ -130,8 +230,8 @@ export class RollupContract {
|
|
|
130
230
|
this.rollup = getContract({ address, abi: RollupAbi, client });
|
|
131
231
|
}
|
|
132
232
|
|
|
133
|
-
getGSE() {
|
|
134
|
-
return this.rollup.read.getGSE();
|
|
233
|
+
async getGSE(): Promise<EthAddress> {
|
|
234
|
+
return EthAddress.fromString(await this.rollup.read.getGSE());
|
|
135
235
|
}
|
|
136
236
|
|
|
137
237
|
public get address() {
|
|
@@ -173,23 +273,23 @@ export class RollupContract {
|
|
|
173
273
|
}
|
|
174
274
|
|
|
175
275
|
@memoize
|
|
176
|
-
getL1StartBlock() {
|
|
276
|
+
getL1StartBlock(): Promise<bigint> {
|
|
177
277
|
return this.rollup.read.L1_BLOCK_AT_GENESIS();
|
|
178
278
|
}
|
|
179
279
|
|
|
180
280
|
@memoize
|
|
181
|
-
getL1GenesisTime() {
|
|
281
|
+
getL1GenesisTime(): Promise<bigint> {
|
|
182
282
|
return this.rollup.read.getGenesisTime();
|
|
183
283
|
}
|
|
184
284
|
|
|
185
285
|
@memoize
|
|
186
|
-
getProofSubmissionEpochs() {
|
|
187
|
-
return this.rollup.read.getProofSubmissionEpochs();
|
|
286
|
+
async getProofSubmissionEpochs(): Promise<number> {
|
|
287
|
+
return Number(await this.rollup.read.getProofSubmissionEpochs());
|
|
188
288
|
}
|
|
189
289
|
|
|
190
290
|
@memoize
|
|
191
|
-
getEpochDuration() {
|
|
192
|
-
return this.rollup.read.getEpochDuration();
|
|
291
|
+
async getEpochDuration(): Promise<number> {
|
|
292
|
+
return Number(await this.rollup.read.getEpochDuration());
|
|
193
293
|
}
|
|
194
294
|
|
|
195
295
|
@memoize
|
|
@@ -198,68 +298,68 @@ export class RollupContract {
|
|
|
198
298
|
}
|
|
199
299
|
|
|
200
300
|
@memoize
|
|
201
|
-
getTargetCommitteeSize() {
|
|
202
|
-
return this.rollup.read.getTargetCommitteeSize();
|
|
301
|
+
async getTargetCommitteeSize(): Promise<number> {
|
|
302
|
+
return Number(await this.rollup.read.getTargetCommitteeSize());
|
|
203
303
|
}
|
|
204
304
|
|
|
205
305
|
@memoize
|
|
206
|
-
getEjectionThreshold() {
|
|
306
|
+
getEjectionThreshold(): Promise<bigint> {
|
|
207
307
|
return this.rollup.read.getEjectionThreshold();
|
|
208
308
|
}
|
|
209
309
|
|
|
210
310
|
@memoize
|
|
211
|
-
getLocalEjectionThreshold() {
|
|
311
|
+
getLocalEjectionThreshold(): Promise<bigint> {
|
|
212
312
|
return this.rollup.read.getLocalEjectionThreshold();
|
|
213
313
|
}
|
|
214
314
|
|
|
215
315
|
@memoize
|
|
216
|
-
getLagInEpochsForValidatorSet() {
|
|
217
|
-
return this.rollup.read.getLagInEpochsForValidatorSet();
|
|
316
|
+
async getLagInEpochsForValidatorSet(): Promise<number> {
|
|
317
|
+
return Number(await this.rollup.read.getLagInEpochsForValidatorSet());
|
|
218
318
|
}
|
|
219
319
|
|
|
220
320
|
@memoize
|
|
221
|
-
getLagInEpochsForRandao() {
|
|
222
|
-
return this.rollup.read.getLagInEpochsForRandao();
|
|
321
|
+
async getLagInEpochsForRandao(): Promise<number> {
|
|
322
|
+
return Number(await this.rollup.read.getLagInEpochsForRandao());
|
|
223
323
|
}
|
|
224
324
|
|
|
225
325
|
@memoize
|
|
226
|
-
getActivationThreshold() {
|
|
326
|
+
getActivationThreshold(): Promise<bigint> {
|
|
227
327
|
return this.rollup.read.getActivationThreshold();
|
|
228
328
|
}
|
|
229
329
|
|
|
230
330
|
@memoize
|
|
231
|
-
getExitDelay() {
|
|
232
|
-
return this.rollup.read.getExitDelay();
|
|
331
|
+
async getExitDelay(): Promise<number> {
|
|
332
|
+
return Number(await this.rollup.read.getExitDelay());
|
|
233
333
|
}
|
|
234
334
|
|
|
235
335
|
@memoize
|
|
236
|
-
getManaTarget() {
|
|
336
|
+
getManaTarget(): Promise<bigint> {
|
|
237
337
|
return this.rollup.read.getManaTarget();
|
|
238
338
|
}
|
|
239
339
|
|
|
240
340
|
@memoize
|
|
241
|
-
getProvingCostPerMana() {
|
|
341
|
+
getProvingCostPerMana(): Promise<bigint> {
|
|
242
342
|
return this.rollup.read.getProvingCostPerManaInEth();
|
|
243
343
|
}
|
|
244
344
|
|
|
245
345
|
@memoize
|
|
246
|
-
getProvingCostPerManaInFeeAsset() {
|
|
346
|
+
getProvingCostPerManaInFeeAsset(): Promise<bigint> {
|
|
247
347
|
return this.rollup.read.getProvingCostPerManaInFeeAsset();
|
|
248
348
|
}
|
|
249
349
|
|
|
250
350
|
@memoize
|
|
251
|
-
getManaLimit() {
|
|
351
|
+
getManaLimit(): Promise<bigint> {
|
|
252
352
|
return this.rollup.read.getManaLimit();
|
|
253
353
|
}
|
|
254
354
|
|
|
255
355
|
@memoize
|
|
256
|
-
getVersion() {
|
|
356
|
+
getVersion(): Promise<bigint> {
|
|
257
357
|
return this.rollup.read.getVersion();
|
|
258
358
|
}
|
|
259
359
|
|
|
260
360
|
@memoize
|
|
261
|
-
async getGenesisArchiveTreeRoot(): Promise
|
|
262
|
-
return await this.rollup.read.archiveAt([0n]);
|
|
361
|
+
async getGenesisArchiveTreeRoot(): Promise<Fr> {
|
|
362
|
+
return Fr.fromString(await this.rollup.read.archiveAt([0n]));
|
|
263
363
|
}
|
|
264
364
|
|
|
265
365
|
/**
|
|
@@ -291,27 +391,27 @@ export class RollupContract {
|
|
|
291
391
|
};
|
|
292
392
|
}
|
|
293
393
|
|
|
294
|
-
getSlasherAddress() {
|
|
295
|
-
return this.rollup.read.getSlasher();
|
|
394
|
+
async getSlasherAddress(): Promise<EthAddress> {
|
|
395
|
+
return EthAddress.fromString(await this.rollup.read.getSlasher());
|
|
296
396
|
}
|
|
297
397
|
|
|
298
398
|
/**
|
|
299
399
|
* Returns a SlasherContract instance for interacting with the slasher contract.
|
|
300
400
|
*/
|
|
301
401
|
async getSlasherContract(): Promise<SlasherContract | undefined> {
|
|
302
|
-
const slasherAddress =
|
|
402
|
+
const slasherAddress = await this.getSlasherAddress();
|
|
303
403
|
if (slasherAddress.isZero()) {
|
|
304
404
|
return undefined;
|
|
305
405
|
}
|
|
306
406
|
return new SlasherContract(this.client, slasherAddress);
|
|
307
407
|
}
|
|
308
408
|
|
|
309
|
-
getOwner() {
|
|
310
|
-
return this.rollup.read.owner();
|
|
409
|
+
async getOwner(): Promise<EthAddress> {
|
|
410
|
+
return EthAddress.fromString(await this.rollup.read.owner());
|
|
311
411
|
}
|
|
312
412
|
|
|
313
|
-
getActiveAttesterCount() {
|
|
314
|
-
return this.rollup.read.getActiveAttesterCount();
|
|
413
|
+
async getActiveAttesterCount(): Promise<number> {
|
|
414
|
+
return Number(await this.rollup.read.getActiveAttesterCount());
|
|
315
415
|
}
|
|
316
416
|
|
|
317
417
|
public async getSlashingProposerAddress() {
|
|
@@ -322,7 +422,7 @@ export class RollupContract {
|
|
|
322
422
|
return await slasher.getProposer();
|
|
323
423
|
}
|
|
324
424
|
|
|
325
|
-
getCheckpointReward() {
|
|
425
|
+
getCheckpointReward(): Promise<bigint> {
|
|
326
426
|
return this.rollup.read.getCheckpointReward();
|
|
327
427
|
}
|
|
328
428
|
|
|
@@ -338,15 +438,19 @@ export class RollupContract {
|
|
|
338
438
|
return SlotNumber.fromBigInt(await this.rollup.read.getCurrentSlot());
|
|
339
439
|
}
|
|
340
440
|
|
|
341
|
-
getL1FeesAt(timestamp: bigint) {
|
|
342
|
-
|
|
441
|
+
async getL1FeesAt(timestamp: bigint): Promise<L1FeeData> {
|
|
442
|
+
const result = await this.rollup.read.getL1FeesAt([timestamp]);
|
|
443
|
+
return {
|
|
444
|
+
baseFee: result.baseFee,
|
|
445
|
+
blobFee: result.blobFee,
|
|
446
|
+
};
|
|
343
447
|
}
|
|
344
448
|
|
|
345
|
-
getFeeAssetPerEth() {
|
|
449
|
+
getFeeAssetPerEth(): Promise<bigint> {
|
|
346
450
|
return this.rollup.read.getFeeAssetPerEth();
|
|
347
451
|
}
|
|
348
452
|
|
|
349
|
-
async getCommitteeAt(timestamp: bigint): Promise<
|
|
453
|
+
async getCommitteeAt(timestamp: bigint): Promise<EthAddress[] | undefined> {
|
|
350
454
|
const { result } = await this.client
|
|
351
455
|
.simulateContract({
|
|
352
456
|
address: this.address,
|
|
@@ -361,22 +465,22 @@ export class RollupContract {
|
|
|
361
465
|
throw e;
|
|
362
466
|
});
|
|
363
467
|
|
|
364
|
-
return result;
|
|
468
|
+
return result ? result.map(addr => EthAddress.fromString(addr)) : undefined;
|
|
365
469
|
}
|
|
366
470
|
|
|
367
|
-
getSampleSeedAt(timestamp: bigint) {
|
|
368
|
-
return this.rollup.read.getSampleSeedAt([timestamp]);
|
|
471
|
+
async getSampleSeedAt(timestamp: bigint): Promise<Buffer32> {
|
|
472
|
+
return Buffer32.fromBigInt(await this.rollup.read.getSampleSeedAt([timestamp]));
|
|
369
473
|
}
|
|
370
474
|
|
|
371
|
-
getCurrentSampleSeed() {
|
|
372
|
-
return this.rollup.read.getCurrentSampleSeed();
|
|
475
|
+
async getCurrentSampleSeed(): Promise<Buffer32> {
|
|
476
|
+
return Buffer32.fromBigInt(await this.rollup.read.getCurrentSampleSeed());
|
|
373
477
|
}
|
|
374
478
|
|
|
375
479
|
async getCurrentEpoch(): Promise<EpochNumber> {
|
|
376
480
|
return EpochNumber.fromBigInt(await this.rollup.read.getCurrentEpoch());
|
|
377
481
|
}
|
|
378
482
|
|
|
379
|
-
async getCurrentEpochCommittee(): Promise<
|
|
483
|
+
async getCurrentEpochCommittee(): Promise<EthAddress[] | undefined> {
|
|
380
484
|
const { result } = await this.client
|
|
381
485
|
.simulateContract({
|
|
382
486
|
address: this.address,
|
|
@@ -391,10 +495,10 @@ export class RollupContract {
|
|
|
391
495
|
throw e;
|
|
392
496
|
});
|
|
393
497
|
|
|
394
|
-
return result;
|
|
498
|
+
return result ? result.map(addr => EthAddress.fromString(addr)) : undefined;
|
|
395
499
|
}
|
|
396
500
|
|
|
397
|
-
async getCurrentProposer() {
|
|
501
|
+
async getCurrentProposer(): Promise<EthAddress> {
|
|
398
502
|
const { result } = await this.client.simulateContract({
|
|
399
503
|
address: this.address,
|
|
400
504
|
abi: RollupAbi,
|
|
@@ -402,10 +506,10 @@ export class RollupContract {
|
|
|
402
506
|
args: [],
|
|
403
507
|
});
|
|
404
508
|
|
|
405
|
-
return result;
|
|
509
|
+
return EthAddress.fromString(result);
|
|
406
510
|
}
|
|
407
511
|
|
|
408
|
-
async getProposerAt(timestamp: bigint) {
|
|
512
|
+
async getProposerAt(timestamp: bigint): Promise<EthAddress> {
|
|
409
513
|
const { result } = await this.client.simulateContract({
|
|
410
514
|
address: this.address,
|
|
411
515
|
abi: RollupAbi,
|
|
@@ -413,11 +517,41 @@ export class RollupContract {
|
|
|
413
517
|
args: [timestamp],
|
|
414
518
|
});
|
|
415
519
|
|
|
416
|
-
return result;
|
|
520
|
+
return EthAddress.fromString(result);
|
|
417
521
|
}
|
|
418
522
|
|
|
419
|
-
getCheckpoint(checkpointNumber: CheckpointNumber) {
|
|
420
|
-
|
|
523
|
+
async getCheckpoint(checkpointNumber: CheckpointNumber): Promise<CheckpointLog> {
|
|
524
|
+
const result = await this.rollup.read.getCheckpoint([BigInt(checkpointNumber)]);
|
|
525
|
+
return {
|
|
526
|
+
archive: Fr.fromString(result.archive),
|
|
527
|
+
headerHash: Buffer32.fromString(result.headerHash),
|
|
528
|
+
blobCommitmentsHash: Buffer32.fromString(result.blobCommitmentsHash),
|
|
529
|
+
attestationsHash: Buffer32.fromString(result.attestationsHash),
|
|
530
|
+
payloadDigest: Buffer32.fromString(result.payloadDigest),
|
|
531
|
+
slotNumber: SlotNumber.fromBigInt(result.slotNumber),
|
|
532
|
+
feeHeader: {
|
|
533
|
+
excessMana: result.feeHeader.excessMana,
|
|
534
|
+
manaUsed: result.feeHeader.manaUsed,
|
|
535
|
+
feeAssetPriceNumerator: result.feeHeader.feeAssetPriceNumerator,
|
|
536
|
+
congestionCost: result.feeHeader.congestionCost,
|
|
537
|
+
proverCost: result.feeHeader.proverCost,
|
|
538
|
+
},
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
/** Returns the pending checkpoint from the rollup contract */
|
|
543
|
+
getPendingCheckpoint() {
|
|
544
|
+
// We retry because of race conditions during prunes: we may get a pending checkpoint number which is immediately
|
|
545
|
+
// reorged out due to a prune happening, causing the subsequent getCheckpoint call to fail. So we try again in that case.
|
|
546
|
+
return retry(
|
|
547
|
+
async () => {
|
|
548
|
+
const pendingCheckpointNumber = await this.getCheckpointNumber();
|
|
549
|
+
const pendingCheckpoint = await this.getCheckpoint(pendingCheckpointNumber);
|
|
550
|
+
return pendingCheckpoint;
|
|
551
|
+
},
|
|
552
|
+
'getting pending checkpoint',
|
|
553
|
+
makeBackoff([0.5, 0.5, 0.5]),
|
|
554
|
+
);
|
|
421
555
|
}
|
|
422
556
|
|
|
423
557
|
async getTips(): Promise<{ pending: CheckpointNumber; proven: CheckpointNumber }> {
|
|
@@ -428,16 +562,16 @@ export class RollupContract {
|
|
|
428
562
|
};
|
|
429
563
|
}
|
|
430
564
|
|
|
431
|
-
getTimestampForSlot(slot: SlotNumber) {
|
|
565
|
+
getTimestampForSlot(slot: SlotNumber): Promise<bigint> {
|
|
432
566
|
return this.rollup.read.getTimestampForSlot([BigInt(slot)]);
|
|
433
567
|
}
|
|
434
568
|
|
|
435
|
-
getEntryQueueLength() {
|
|
436
|
-
return this.rollup.read.getEntryQueueLength();
|
|
569
|
+
async getEntryQueueLength(): Promise<number> {
|
|
570
|
+
return Number(await this.rollup.read.getEntryQueueLength());
|
|
437
571
|
}
|
|
438
572
|
|
|
439
|
-
getAvailableValidatorFlushes() {
|
|
440
|
-
return this.rollup.read.getAvailableValidatorFlushes();
|
|
573
|
+
async getAvailableValidatorFlushes(): Promise<number> {
|
|
574
|
+
return Number(await this.rollup.read.getAvailableValidatorFlushes());
|
|
441
575
|
}
|
|
442
576
|
|
|
443
577
|
async getNextFlushableEpoch(): Promise<EpochNumber> {
|
|
@@ -493,10 +627,11 @@ export class RollupContract {
|
|
|
493
627
|
return EpochNumber.fromBigInt(await this.rollup.read.getEpochAtSlot([BigInt(slotNumber)]));
|
|
494
628
|
}
|
|
495
629
|
|
|
496
|
-
getEpochProofPublicInputs(
|
|
630
|
+
async getEpochProofPublicInputs(
|
|
497
631
|
args: readonly [bigint, bigint, EpochProofPublicInputArgs, readonly `0x${string}`[], `0x${string}`],
|
|
498
|
-
) {
|
|
499
|
-
|
|
632
|
+
): Promise<Fr[]> {
|
|
633
|
+
const result = await this.rollup.read.getEpochProofPublicInputs(args);
|
|
634
|
+
return result.map(Fr.fromString);
|
|
500
635
|
}
|
|
501
636
|
|
|
502
637
|
public async validateHeader(
|
|
@@ -638,7 +773,7 @@ export class RollupContract {
|
|
|
638
773
|
return this.rollup.read.getHasSubmitted([BigInt(epochNumber), BigInt(numberOfCheckpointsInEpoch), prover]);
|
|
639
774
|
}
|
|
640
775
|
|
|
641
|
-
getManaBaseFeeAt(timestamp: bigint, inFeeAsset: boolean) {
|
|
776
|
+
getManaBaseFeeAt(timestamp: bigint, inFeeAsset: boolean): Promise<bigint> {
|
|
642
777
|
return this.rollup.read.getManaBaseFeeAt([timestamp, inFeeAsset]);
|
|
643
778
|
}
|
|
644
779
|
|
|
@@ -646,77 +781,110 @@ export class RollupContract {
|
|
|
646
781
|
return SlotNumber.fromBigInt(await this.rollup.read.getSlotAt([timestamp]));
|
|
647
782
|
}
|
|
648
783
|
|
|
649
|
-
async status(checkpointNumber: CheckpointNumber, options?: { blockNumber?: bigint }) {
|
|
784
|
+
async status(checkpointNumber: CheckpointNumber, options?: { blockNumber?: bigint }): Promise<RollupStatusResponse> {
|
|
650
785
|
await checkBlockTag(options?.blockNumber, this.client);
|
|
651
|
-
|
|
786
|
+
const result = await this.rollup.read.status([BigInt(checkpointNumber)], options);
|
|
787
|
+
return {
|
|
788
|
+
provenCheckpointNumber: CheckpointNumber.fromBigInt(result[0]),
|
|
789
|
+
provenArchive: Fr.fromString(result[1]),
|
|
790
|
+
pendingCheckpointNumber: CheckpointNumber.fromBigInt(result[2]),
|
|
791
|
+
pendingArchive: Fr.fromString(result[3]),
|
|
792
|
+
archiveOfMyCheckpoint: Fr.fromString(result[4]),
|
|
793
|
+
};
|
|
652
794
|
}
|
|
653
795
|
|
|
654
|
-
async canPruneAtTime(timestamp: bigint, options?: { blockNumber?: bigint }) {
|
|
796
|
+
async canPruneAtTime(timestamp: bigint, options?: { blockNumber?: bigint }): Promise<boolean> {
|
|
655
797
|
await checkBlockTag(options?.blockNumber, this.client);
|
|
656
798
|
return this.rollup.read.canPruneAtTime([timestamp], options);
|
|
657
799
|
}
|
|
658
800
|
|
|
659
|
-
archive() {
|
|
660
|
-
return this.rollup.read.archive();
|
|
801
|
+
async archive(): Promise<Fr> {
|
|
802
|
+
return Fr.fromString(await this.rollup.read.archive());
|
|
661
803
|
}
|
|
662
804
|
|
|
663
|
-
archiveAt(checkpointNumber: CheckpointNumber) {
|
|
664
|
-
return this.rollup.read.archiveAt([BigInt(checkpointNumber)]);
|
|
805
|
+
async archiveAt(checkpointNumber: CheckpointNumber): Promise<Fr> {
|
|
806
|
+
return Fr.fromString(await this.rollup.read.archiveAt([BigInt(checkpointNumber)]));
|
|
665
807
|
}
|
|
666
808
|
|
|
667
|
-
getSequencerRewards(address: Hex | EthAddress) {
|
|
809
|
+
getSequencerRewards(address: Hex | EthAddress): Promise<bigint> {
|
|
668
810
|
if (address instanceof EthAddress) {
|
|
669
811
|
address = address.toString();
|
|
670
812
|
}
|
|
671
813
|
return this.rollup.read.getSequencerRewards([address]);
|
|
672
814
|
}
|
|
673
815
|
|
|
674
|
-
getSpecificProverRewardsForEpoch(epoch: bigint, prover: Hex | EthAddress) {
|
|
816
|
+
getSpecificProverRewardsForEpoch(epoch: bigint, prover: Hex | EthAddress): Promise<bigint> {
|
|
675
817
|
if (prover instanceof EthAddress) {
|
|
676
818
|
prover = prover.toString();
|
|
677
819
|
}
|
|
678
820
|
return this.rollup.read.getSpecificProverRewardsForEpoch([epoch, prover]);
|
|
679
821
|
}
|
|
680
822
|
|
|
681
|
-
async getAttesters() {
|
|
823
|
+
async getAttesters(): Promise<EthAddress[]> {
|
|
682
824
|
const attesterSize = await this.getActiveAttesterCount();
|
|
683
825
|
const gse = new GSEContract(this.client, await this.getGSE());
|
|
684
826
|
const ts = (await this.client.getBlock()).timestamp;
|
|
685
827
|
|
|
686
|
-
const indices = Array.from({ length:
|
|
828
|
+
const indices = Array.from({ length: attesterSize }, (_, i) => BigInt(i));
|
|
687
829
|
const chunks = chunk(indices, 1000);
|
|
688
830
|
|
|
689
|
-
|
|
831
|
+
const results = await Promise.all(chunks.map(chunk => gse.getAttestersFromIndicesAtTime(this.address, ts, chunk)));
|
|
832
|
+
return results.flat().map(addr => EthAddress.fromString(addr));
|
|
690
833
|
}
|
|
691
834
|
|
|
692
|
-
getAttesterView(address: Hex | EthAddress) {
|
|
835
|
+
async getAttesterView(address: Hex | EthAddress): Promise<AttesterView> {
|
|
693
836
|
if (address instanceof EthAddress) {
|
|
694
837
|
address = address.toString();
|
|
695
838
|
}
|
|
696
|
-
|
|
839
|
+
const result = await this.rollup.read.getAttesterView([address]);
|
|
840
|
+
return {
|
|
841
|
+
status: result.status as AttesterStatus,
|
|
842
|
+
effectiveBalance: result.effectiveBalance,
|
|
843
|
+
exit: {
|
|
844
|
+
withdrawalId: result.exit.withdrawalId,
|
|
845
|
+
amount: result.exit.amount,
|
|
846
|
+
exitableAt: result.exit.exitableAt,
|
|
847
|
+
recipientOrWithdrawer: EthAddress.fromString(result.exit.recipientOrWithdrawer),
|
|
848
|
+
isRecipient: result.exit.isRecipient,
|
|
849
|
+
exists: result.exit.exists,
|
|
850
|
+
},
|
|
851
|
+
config: {
|
|
852
|
+
publicKey: {
|
|
853
|
+
x: result.config.publicKey.x,
|
|
854
|
+
y: result.config.publicKey.y,
|
|
855
|
+
},
|
|
856
|
+
withdrawer: EthAddress.fromString(result.config.withdrawer),
|
|
857
|
+
},
|
|
858
|
+
};
|
|
697
859
|
}
|
|
698
860
|
|
|
699
|
-
getStatus(address: Hex | EthAddress) {
|
|
861
|
+
async getStatus(address: Hex | EthAddress): Promise<AttesterStatus> {
|
|
700
862
|
if (address instanceof EthAddress) {
|
|
701
863
|
address = address.toString();
|
|
702
864
|
}
|
|
703
|
-
return this.rollup.read.getStatus([address]);
|
|
865
|
+
return (await this.rollup.read.getStatus([address])) as AttesterStatus;
|
|
704
866
|
}
|
|
705
867
|
|
|
706
|
-
getBlobCommitmentsHash(checkpointNumber: CheckpointNumber) {
|
|
707
|
-
return this.rollup.read.getBlobCommitmentsHash([BigInt(checkpointNumber)]);
|
|
868
|
+
async getBlobCommitmentsHash(checkpointNumber: CheckpointNumber): Promise<Buffer32> {
|
|
869
|
+
return Buffer32.fromString(await this.rollup.read.getBlobCommitmentsHash([BigInt(checkpointNumber)]));
|
|
708
870
|
}
|
|
709
871
|
|
|
710
|
-
getCurrentBlobCommitmentsHash() {
|
|
711
|
-
return this.rollup.read.getCurrentBlobCommitmentsHash();
|
|
872
|
+
async getCurrentBlobCommitmentsHash(): Promise<Buffer32> {
|
|
873
|
+
return Buffer32.fromString(await this.rollup.read.getCurrentBlobCommitmentsHash());
|
|
712
874
|
}
|
|
713
875
|
|
|
714
|
-
getStakingAsset() {
|
|
715
|
-
return this.rollup.read.getStakingAsset();
|
|
876
|
+
async getStakingAsset(): Promise<EthAddress> {
|
|
877
|
+
return EthAddress.fromString(await this.rollup.read.getStakingAsset());
|
|
716
878
|
}
|
|
717
879
|
|
|
718
|
-
getRewardConfig() {
|
|
719
|
-
|
|
880
|
+
async getRewardConfig(): Promise<RewardConfig> {
|
|
881
|
+
const result = await this.rollup.read.getRewardConfig();
|
|
882
|
+
return {
|
|
883
|
+
rewardDistributor: EthAddress.fromString(result.rewardDistributor),
|
|
884
|
+
sequencerBps: BigInt(result.sequencerBps),
|
|
885
|
+
booster: EthAddress.fromString(result.booster),
|
|
886
|
+
checkpointReward: result.checkpointReward,
|
|
887
|
+
};
|
|
720
888
|
}
|
|
721
889
|
|
|
722
890
|
setupEpoch(l1TxUtils: L1TxUtils) {
|
|
@@ -246,11 +246,20 @@ export async function deployAztecL1Contracts(
|
|
|
246
246
|
const FORGE_SCRIPT = 'script/deploy/DeployAztecL1Contracts.s.sol';
|
|
247
247
|
await maybeForgeForceProductionBuild(l1ContractsPath, FORGE_SCRIPT, chainId);
|
|
248
248
|
|
|
249
|
-
|
|
249
|
+
// Verify contracts on Etherscan when on mainnet/sepolia and ETHERSCAN_API_KEY is available.
|
|
250
|
+
const isVerifiableChain = chainId === mainnet.id || chainId === sepolia.id;
|
|
251
|
+
const shouldVerify = isVerifiableChain && !!process.env.ETHERSCAN_API_KEY;
|
|
252
|
+
|
|
253
|
+
if (isVerifiableChain && !process.env.ETHERSCAN_API_KEY) {
|
|
254
|
+
logger.warn(
|
|
255
|
+
`Deploying to chain ${chainId} (${chainId === mainnet.id ? 'mainnet' : 'sepolia'}) without ETHERSCAN_API_KEY. ` +
|
|
256
|
+
`Contracts will NOT be verified on Etherscan. Set ETHERSCAN_API_KEY environment variable to enable verification.`,
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
|
|
250
260
|
// From heuristic testing. More caused issues with anvil.
|
|
251
261
|
const MAGIC_ANVIL_BATCH_SIZE = 12;
|
|
252
262
|
// Anvil seems to stall with unbounded batch size. Otherwise no max batch size is desirable.
|
|
253
|
-
// On sepolia and mainnet, we verify on etherscan (if etherscan API key is in env)
|
|
254
263
|
const forgeArgs = [
|
|
255
264
|
'script',
|
|
256
265
|
FORGE_SCRIPT,
|
|
@@ -468,6 +477,7 @@ export function getDeployRollupForUpgradeEnvVars(
|
|
|
468
477
|
AZTEC_TARGET_COMMITTEE_SIZE: args.aztecTargetCommitteeSize.toString(),
|
|
469
478
|
AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET: args.lagInEpochsForValidatorSet.toString(),
|
|
470
479
|
AZTEC_LAG_IN_EPOCHS_FOR_RANDAO: args.lagInEpochsForRandao.toString(),
|
|
480
|
+
AZTEC_INBOX_LAG: args.inboxLag?.toString(),
|
|
471
481
|
AZTEC_PROOF_SUBMISSION_EPOCHS: args.aztecProofSubmissionEpochs.toString(),
|
|
472
482
|
AZTEC_LOCAL_EJECTION_THRESHOLD: args.localEjectionThreshold.toString(),
|
|
473
483
|
AZTEC_SLASHING_LIFETIME_IN_ROUNDS: args.slashingLifetimeInRounds.toString(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ConfigMappingsType } from '@aztec/foundation/config';
|
|
2
2
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
-
import {
|
|
3
|
+
import { schemas, zodFor } from '@aztec/foundation/schemas';
|
|
4
4
|
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
|
|
@@ -35,25 +35,27 @@ export type L1ContractAddresses = {
|
|
|
35
35
|
dateGatedRelayerAddress?: EthAddress | undefined;
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
export const L1ContractAddressesSchema =
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
38
|
+
export const L1ContractAddressesSchema = zodFor<L1ContractAddresses>()(
|
|
39
|
+
z.object({
|
|
40
|
+
rollupAddress: schemas.EthAddress,
|
|
41
|
+
registryAddress: schemas.EthAddress,
|
|
42
|
+
inboxAddress: schemas.EthAddress,
|
|
43
|
+
outboxAddress: schemas.EthAddress,
|
|
44
|
+
feeJuiceAddress: schemas.EthAddress,
|
|
45
|
+
stakingAssetAddress: schemas.EthAddress,
|
|
46
|
+
feeJuicePortalAddress: schemas.EthAddress,
|
|
47
|
+
coinIssuerAddress: schemas.EthAddress,
|
|
48
|
+
rewardDistributorAddress: schemas.EthAddress,
|
|
49
|
+
governanceProposerAddress: schemas.EthAddress,
|
|
50
|
+
governanceAddress: schemas.EthAddress,
|
|
51
|
+
slashFactoryAddress: schemas.EthAddress.optional(),
|
|
52
|
+
feeAssetHandlerAddress: schemas.EthAddress.optional(),
|
|
53
|
+
stakingAssetHandlerAddress: schemas.EthAddress.optional(),
|
|
54
|
+
zkPassportVerifierAddress: schemas.EthAddress.optional(),
|
|
55
|
+
gseAddress: schemas.EthAddress.optional(),
|
|
56
|
+
dateGatedRelayerAddress: schemas.EthAddress.optional(),
|
|
57
|
+
}),
|
|
58
|
+
);
|
|
57
59
|
|
|
58
60
|
const parseEnv = (val: string) => EthAddress.fromString(val);
|
|
59
61
|
|
|
@@ -16,3 +16,14 @@ export const MIN_BLOB_REPLACEMENT_BUMP_PERCENTAGE = 100;
|
|
|
16
16
|
|
|
17
17
|
// Avg ethereum block time is ~12s
|
|
18
18
|
export const BLOCK_TIME_MS = 12_000;
|
|
19
|
+
|
|
20
|
+
// Gas per blob (EIP-4844)
|
|
21
|
+
export const GAS_PER_BLOB = 131072n;
|
|
22
|
+
|
|
23
|
+
// Blob capacity schedule based on Ethereum upgrades
|
|
24
|
+
export const BLOB_CAPACITY_SCHEDULE = [
|
|
25
|
+
{ timestamp: 1734357600, target: 14, max: 21 }, // BPO2: Dec 17, 2025
|
|
26
|
+
{ timestamp: 1733752800, target: 10, max: 15 }, // BPO1: Dec 9, 2025
|
|
27
|
+
{ timestamp: 1733234400, target: 6, max: 9 }, // Fusaka: Dec 3, 2025
|
|
28
|
+
{ timestamp: 0, target: 6, max: 9 }, // Pectra/earlier
|
|
29
|
+
];
|