@aztec/ethereum 0.0.1-commit.f504929 → 0.0.1-commit.f650c0a5c

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 (83) hide show
  1. package/dest/client.d.ts +10 -2
  2. package/dest/client.d.ts.map +1 -1
  3. package/dest/client.js +13 -7
  4. package/dest/config.d.ts +6 -6
  5. package/dest/config.d.ts.map +1 -1
  6. package/dest/config.js +5 -9
  7. package/dest/contracts/inbox.d.ts +3 -3
  8. package/dest/contracts/inbox.d.ts.map +1 -1
  9. package/dest/contracts/inbox.js +5 -6
  10. package/dest/contracts/index.d.ts +2 -3
  11. package/dest/contracts/index.d.ts.map +1 -1
  12. package/dest/contracts/index.js +1 -2
  13. package/dest/contracts/multicall.d.ts +51 -2
  14. package/dest/contracts/multicall.d.ts.map +1 -1
  15. package/dest/contracts/multicall.js +85 -0
  16. package/dest/contracts/rollup.d.ts +44 -14
  17. package/dest/contracts/rollup.d.ts.map +1 -1
  18. package/dest/contracts/rollup.js +201 -50
  19. package/dest/contracts/{tally_slashing_proposer.d.ts → slashing_proposer.d.ts} +3 -4
  20. package/dest/contracts/slashing_proposer.d.ts.map +1 -0
  21. package/dest/contracts/{tally_slashing_proposer.js → slashing_proposer.js} +13 -15
  22. package/dest/deploy_aztec_l1_contracts.d.ts +3 -6
  23. package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -1
  24. package/dest/deploy_aztec_l1_contracts.js +2 -4
  25. package/dest/generated/l1-contracts-defaults.d.ts +1 -1
  26. package/dest/generated/l1-contracts-defaults.js +1 -1
  27. package/dest/l1_artifacts.d.ts +8176 -15179
  28. package/dest/l1_artifacts.d.ts.map +1 -1
  29. package/dest/l1_artifacts.js +9 -24
  30. package/dest/l1_contract_addresses.d.ts +1 -5
  31. package/dest/l1_contract_addresses.d.ts.map +1 -1
  32. package/dest/l1_contract_addresses.js +0 -6
  33. package/dest/l1_reader.d.ts +3 -1
  34. package/dest/l1_reader.d.ts.map +1 -1
  35. package/dest/l1_reader.js +6 -1
  36. package/dest/l1_tx_utils/l1_tx_utils.d.ts +3 -1
  37. package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -1
  38. package/dest/l1_tx_utils/l1_tx_utils.js +34 -26
  39. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +1 -1
  40. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -1
  41. package/dest/l1_tx_utils/readonly_l1_tx_utils.js +8 -4
  42. package/dest/publisher_manager.d.ts +21 -7
  43. package/dest/publisher_manager.d.ts.map +1 -1
  44. package/dest/publisher_manager.js +81 -7
  45. package/dest/queries.js +3 -3
  46. package/dest/test/chain_monitor.d.ts +22 -3
  47. package/dest/test/chain_monitor.d.ts.map +1 -1
  48. package/dest/test/chain_monitor.js +33 -2
  49. package/dest/test/eth_cheat_codes.d.ts +6 -4
  50. package/dest/test/eth_cheat_codes.d.ts.map +1 -1
  51. package/dest/test/eth_cheat_codes.js +6 -4
  52. package/dest/test/start_anvil.d.ts +15 -1
  53. package/dest/test/start_anvil.d.ts.map +1 -1
  54. package/dest/test/start_anvil.js +17 -2
  55. package/dest/utils.d.ts +1 -1
  56. package/dest/utils.d.ts.map +1 -1
  57. package/dest/utils.js +16 -12
  58. package/package.json +5 -5
  59. package/src/client.ts +10 -2
  60. package/src/config.ts +9 -13
  61. package/src/contracts/inbox.ts +4 -4
  62. package/src/contracts/index.ts +1 -2
  63. package/src/contracts/multicall.ts +65 -1
  64. package/src/contracts/rollup.ts +230 -53
  65. package/src/contracts/{tally_slashing_proposer.ts → slashing_proposer.ts} +14 -16
  66. package/src/deploy_aztec_l1_contracts.ts +1 -5
  67. package/src/generated/l1-contracts-defaults.ts +1 -1
  68. package/src/l1_artifacts.ts +12 -35
  69. package/src/l1_contract_addresses.ts +0 -7
  70. package/src/l1_reader.ts +13 -1
  71. package/src/l1_tx_utils/l1_tx_utils.ts +24 -14
  72. package/src/l1_tx_utils/readonly_l1_tx_utils.ts +8 -4
  73. package/src/publisher_manager.ts +105 -10
  74. package/src/queries.ts +3 -3
  75. package/src/test/chain_monitor.ts +60 -3
  76. package/src/test/eth_cheat_codes.ts +6 -4
  77. package/src/test/start_anvil.ts +33 -2
  78. package/src/utils.ts +17 -14
  79. package/dest/contracts/empire_slashing_proposer.d.ts +0 -69
  80. package/dest/contracts/empire_slashing_proposer.d.ts.map +0 -1
  81. package/dest/contracts/empire_slashing_proposer.js +0 -216
  82. package/dest/contracts/tally_slashing_proposer.d.ts.map +0 -1
  83. package/src/contracts/empire_slashing_proposer.ts +0 -265
@@ -4,6 +4,7 @@ import { Fr } from '@aztec/foundation/curves/bn254';
4
4
  import { memoize } from '@aztec/foundation/decorators';
5
5
  import { EthAddress } from '@aztec/foundation/eth-address';
6
6
  import type { ViemSignature } from '@aztec/foundation/eth-signature';
7
+ import { createLogger } from '@aztec/foundation/log';
7
8
  import { makeBackoff, retry } from '@aztec/foundation/retry';
8
9
  import { EscapeHatchAbi } from '@aztec/l1-artifacts/EscapeHatchAbi';
9
10
  import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
@@ -16,6 +17,7 @@ import {
16
17
  type Hex,
17
18
  type StateOverride,
18
19
  type WatchContractEventReturnType,
20
+ encodeAbiParameters,
19
21
  encodeFunctionData,
20
22
  getContract,
21
23
  hexToBigInt,
@@ -29,11 +31,10 @@ import type { L1ReaderConfig } from '../l1_reader.js';
29
31
  import type { L1TxRequest, L1TxUtils } from '../l1_tx_utils/index.js';
30
32
  import type { ViemClient } from '../types.js';
31
33
  import { formatViemError } from '../utils.js';
32
- import { EmpireSlashingProposerContract } from './empire_slashing_proposer.js';
33
34
  import { GSEContract } from './gse.js';
34
35
  import type { L1EventLog } from './log.js';
35
36
  import { SlasherContract } from './slasher_contract.js';
36
- import { TallySlashingProposerContract } from './tally_slashing_proposer.js';
37
+ import { SlashingProposerContract } from './slashing_proposer.js';
37
38
  import { checkBlockTag } from './utils.js';
38
39
 
39
40
  export type ViemCommitteeAttestation = {
@@ -55,7 +56,6 @@ export type L1RollupContractAddresses = Pick<
55
56
  | 'feeJuiceAddress'
56
57
  | 'stakingAssetAddress'
57
58
  | 'rewardDistributorAddress'
58
- | 'slashFactoryAddress'
59
59
  | 'gseAddress'
60
60
  >;
61
61
 
@@ -85,12 +85,6 @@ export type ViemGasFees = {
85
85
  feePerL2Gas: bigint;
86
86
  };
87
87
 
88
- export enum SlashingProposerType {
89
- None = 0,
90
- Tally = 1,
91
- Empire = 2,
92
- }
93
-
94
88
  /**
95
89
  * Status of a validator/attester in the staking system.
96
90
  * Matches the Status enum in StakingLib.sol
@@ -134,6 +128,14 @@ export type L1FeeData = {
134
128
  blobFee: bigint;
135
129
  };
136
130
 
131
+ /** Components of the minimum fee per mana, as returned by the L1 rollup contract. */
132
+ export type ManaMinFeeComponents = {
133
+ sequencerCost: bigint;
134
+ proverCost: bigint;
135
+ congestionCost: bigint;
136
+ congestionMultiplier: bigint;
137
+ };
138
+
137
139
  /**
138
140
  * Reward configuration for the rollup
139
141
  */
@@ -204,6 +206,7 @@ export type CheckpointProposedLog = L1EventLog<CheckpointProposedArgs>;
204
206
 
205
207
  export class RollupContract {
206
208
  private readonly rollup: GetContractReturnType<typeof RollupAbi, ViemClient>;
209
+ private readonly logger = createLogger('ethereum:rollup');
207
210
 
208
211
  private static cachedStfStorageSlot: Hex | undefined;
209
212
  private cachedEscapeHatch?: {
@@ -259,34 +262,18 @@ export class RollupContract {
259
262
  return this.rollup;
260
263
  }
261
264
 
262
- public async getSlashingProposer(): Promise<
263
- EmpireSlashingProposerContract | TallySlashingProposerContract | undefined
264
- > {
265
+ public async getSlashingProposer(): Promise<SlashingProposerContract | undefined> {
265
266
  const slasher = await this.getSlasherContract();
266
267
  if (!slasher) {
267
268
  return undefined;
268
269
  }
269
270
 
270
271
  const proposerAddress = await slasher.getProposer();
271
- const proposerAbi = [
272
- {
273
- type: 'function',
274
- name: 'SLASHING_PROPOSER_TYPE',
275
- inputs: [],
276
- outputs: [{ name: '', type: 'uint8', internalType: 'enum SlasherFlavor' }],
277
- stateMutability: 'view',
278
- },
279
- ] as const;
280
-
281
- const proposer = getContract({ address: proposerAddress.toString(), abi: proposerAbi, client: this.client });
282
- const proposerType = await proposer.read.SLASHING_PROPOSER_TYPE();
283
- if (proposerType === SlashingProposerType.Tally.valueOf()) {
284
- return new TallySlashingProposerContract(this.client, proposerAddress);
285
- } else if (proposerType === SlashingProposerType.Empire.valueOf()) {
286
- return new EmpireSlashingProposerContract(this.client, proposerAddress);
287
- } else {
288
- throw new Error(`Unknown slashing proposer type: ${proposerType}`);
272
+ if (proposerAddress.isZero()) {
273
+ return undefined;
289
274
  }
275
+
276
+ return new SlashingProposerContract(this.client, proposerAddress);
290
277
  }
291
278
 
292
279
  @memoize
@@ -379,6 +366,20 @@ export class RollupContract {
379
366
  return Fr.fromString(await this.rollup.read.archiveAt([0n]));
380
367
  }
381
368
 
369
+ @memoize
370
+ async getVkTreeRoot(): Promise<Fr> {
371
+ const slot = BigInt(RollupContract.stfStorageSlot) + 3n;
372
+ const value = await this.client.getStorageAt({ address: this.address, slot: `0x${slot.toString(16)}` });
373
+ return Fr.fromString(value ?? '0x0');
374
+ }
375
+
376
+ @memoize
377
+ async getProtocolContractsHash(): Promise<Fr> {
378
+ const slot = BigInt(RollupContract.stfStorageSlot) + 4n;
379
+ const value = await this.client.getStorageAt({ address: this.address, slot: `0x${slot.toString(16)}` });
380
+ return Fr.fromString(value ?? '0x0');
381
+ }
382
+
382
383
  /**
383
384
  * Returns rollup constants used for epoch queries.
384
385
  * Return type is `L1RollupConstants` which is defined in stdlib,
@@ -392,16 +393,25 @@ export class RollupContract {
392
393
  epochDuration: number;
393
394
  proofSubmissionEpochs: number;
394
395
  targetCommitteeSize: number;
396
+ rollupManaLimit: number;
395
397
  }> {
396
- const [l1StartBlock, l1GenesisTime, slotDuration, epochDuration, proofSubmissionEpochs, targetCommitteeSize] =
397
- await Promise.all([
398
- this.getL1StartBlock(),
399
- this.getL1GenesisTime(),
400
- this.getSlotDuration(),
401
- this.getEpochDuration(),
402
- this.getProofSubmissionEpochs(),
403
- this.getTargetCommitteeSize(),
404
- ]);
398
+ const [
399
+ l1StartBlock,
400
+ l1GenesisTime,
401
+ slotDuration,
402
+ epochDuration,
403
+ proofSubmissionEpochs,
404
+ targetCommitteeSize,
405
+ rollupManaLimit,
406
+ ] = await Promise.all([
407
+ this.getL1StartBlock(),
408
+ this.getL1GenesisTime(),
409
+ this.getSlotDuration(),
410
+ this.getEpochDuration(),
411
+ this.getProofSubmissionEpochs(),
412
+ this.getTargetCommitteeSize(),
413
+ this.getManaLimit(),
414
+ ]);
405
415
  return {
406
416
  l1StartBlock,
407
417
  l1GenesisTime,
@@ -409,6 +419,7 @@ export class RollupContract {
409
419
  epochDuration: Number(epochDuration),
410
420
  proofSubmissionEpochs: Number(proofSubmissionEpochs),
411
421
  targetCommitteeSize,
422
+ rollupManaLimit: Number(rollupManaLimit),
412
423
  };
413
424
  }
414
425
 
@@ -463,7 +474,11 @@ export class RollupContract {
463
474
 
464
475
  const [isOpen] = await escapeHatch.read.isHatchOpen([BigInt(epoch)]);
465
476
  return isOpen;
466
- } catch {
477
+ } catch (err) {
478
+ this.logger.warn('isEscapeHatchOpen failed (treating as closed); RPC or contract error may cause liveness risk', {
479
+ epoch: Number(epoch),
480
+ error: err,
481
+ });
467
482
  return false;
468
483
  }
469
484
  }
@@ -503,8 +518,9 @@ export class RollupContract {
503
518
  return CheckpointNumber.fromBigInt(await this.rollup.read.getPendingCheckpointNumber());
504
519
  }
505
520
 
506
- async getProvenCheckpointNumber(): Promise<CheckpointNumber> {
507
- return CheckpointNumber.fromBigInt(await this.rollup.read.getProvenCheckpointNumber());
521
+ async getProvenCheckpointNumber(options?: { blockNumber?: bigint }): Promise<CheckpointNumber> {
522
+ await checkBlockTag(options?.blockNumber, this.client);
523
+ return CheckpointNumber.fromBigInt(await this.rollup.read.getProvenCheckpointNumber(options));
508
524
  }
509
525
 
510
526
  async getSlotNumber(): Promise<SlotNumber> {
@@ -745,16 +761,23 @@ export class RollupContract {
745
761
  * timestamp of the next L1 block
746
762
  * @throws otherwise
747
763
  */
748
- public async canProposeAtNextEthBlock(
764
+ public async canProposeAt(
749
765
  archive: Buffer,
750
766
  account: `0x${string}` | Account,
751
- slotDuration: number,
752
- opts: { forcePendingCheckpointNumber?: CheckpointNumber } = {},
767
+ timestamp: bigint,
768
+ opts: {
769
+ forcePendingCheckpointNumber?: CheckpointNumber;
770
+ forceArchive?: { checkpointNumber: CheckpointNumber; archive: Fr };
771
+ } = {},
753
772
  ): Promise<{ slot: SlotNumber; checkpointNumber: CheckpointNumber; timeOfNextL1Slot: bigint }> {
754
- const latestBlock = await this.client.getBlock();
755
- const timeOfNextL1Slot = latestBlock.timestamp + BigInt(slotDuration);
773
+ const timeOfNextL1Slot = timestamp;
756
774
  const who = typeof account === 'string' ? account : account.address;
757
775
 
776
+ const stateOverride = RollupContract.mergeStateOverrides(
777
+ await this.makePendingCheckpointNumberOverride(opts.forcePendingCheckpointNumber),
778
+ opts.forceArchive ? this.makeArchiveOverride(opts.forceArchive.checkpointNumber, opts.forceArchive.archive) : [],
779
+ );
780
+
758
781
  try {
759
782
  const {
760
783
  result: [slot, checkpointNumber],
@@ -764,7 +787,7 @@ export class RollupContract {
764
787
  functionName: 'canProposeAtTime',
765
788
  args: [timeOfNextL1Slot, `0x${archive.toString('hex')}`, who],
766
789
  account,
767
- stateOverride: await this.makePendingCheckpointNumberOverride(opts.forcePendingCheckpointNumber),
790
+ stateOverride,
768
791
  });
769
792
 
770
793
  return {
@@ -800,6 +823,151 @@ export class RollupContract {
800
823
  ];
801
824
  }
802
825
 
826
+ /**
827
+ * Returns a state override that sets tempCheckpointLogs[checkpointNumber].feeHeader to the compressed fee header.
828
+ * Used when simulating a propose call where the parent checkpoint hasn't landed on L1 yet (pipelining).
829
+ */
830
+ public async makeFeeHeaderOverride(checkpointNumber: CheckpointNumber, feeHeader: FeeHeader): Promise<StateOverride> {
831
+ const { epochDuration, proofSubmissionEpochs } = await this.getRollupConstants();
832
+ const roundaboutSize = BigInt(epochDuration * (proofSubmissionEpochs + 1) + 1);
833
+ const circularIndex = BigInt(checkpointNumber) % roundaboutSize;
834
+
835
+ // tempCheckpointLogs is at offset 2 in RollupStore
836
+ const tempCheckpointLogsMappingBase = hexToBigInt(RollupContract.stfStorageSlot) + 2n;
837
+
838
+ // Solidity mapping slot: keccak256(abi.encode(key, baseSlot))
839
+ const structBaseSlot = hexToBigInt(
840
+ keccak256(
841
+ encodeAbiParameters([{ type: 'uint256' }, { type: 'uint256' }], [circularIndex, tempCheckpointLogsMappingBase]),
842
+ ),
843
+ );
844
+
845
+ // feeHeader is the 7th field (offset 6) in CompressedTempCheckpointLog
846
+ const feeHeaderSlot = structBaseSlot + 6n;
847
+ const compressed = RollupContract.compressFeeHeader(feeHeader);
848
+
849
+ return [
850
+ {
851
+ address: this.address,
852
+ stateDiff: [
853
+ {
854
+ slot: `0x${feeHeaderSlot.toString(16).padStart(64, '0')}`,
855
+ value: `0x${compressed.toString(16).padStart(64, '0')}`,
856
+ },
857
+ ],
858
+ },
859
+ ];
860
+ }
861
+
862
+ /**
863
+ * Returns a state override that sets archives[checkpointNumber] to the given archive value.
864
+ * Used when simulating a canProposeAtTime call where the local archive differs from L1
865
+ * (e.g. pipelining where the parent checkpoint hasn't landed on L1 yet).
866
+ */
867
+ public makeArchiveOverride(checkpointNumber: CheckpointNumber, archive: Fr): StateOverride {
868
+ const archivesMappingBase = hexToBigInt(RollupContract.stfStorageSlot) + 1n;
869
+ const archiveSlot = hexToBigInt(
870
+ keccak256(
871
+ encodeAbiParameters(
872
+ [{ type: 'uint256' }, { type: 'uint256' }],
873
+ [BigInt(checkpointNumber), archivesMappingBase],
874
+ ),
875
+ ),
876
+ );
877
+ return [
878
+ {
879
+ address: this.address,
880
+ stateDiff: [
881
+ {
882
+ slot: `0x${archiveSlot.toString(16).padStart(64, '0')}`,
883
+ value: archive.toString(),
884
+ },
885
+ ],
886
+ },
887
+ ];
888
+ }
889
+
890
+ /** Merges multiple StateOverride arrays, combining stateDiff entries for the same address. */
891
+ public static mergeStateOverrides(...overrides: StateOverride[]): StateOverride {
892
+ type StateDiffEntry = { slot: `0x${string}`; value: `0x${string}` };
893
+ const byAddress = new Map<string, { address: `0x${string}`; balance?: bigint; stateDiff: StateDiffEntry[] }>();
894
+ for (const override of overrides) {
895
+ for (const entry of override) {
896
+ const key = entry.address.toLowerCase();
897
+ const existing = byAddress.get(key);
898
+ if (existing) {
899
+ existing.stateDiff.push(...(entry.stateDiff ?? []));
900
+ if (entry.balance !== undefined) {
901
+ existing.balance = entry.balance;
902
+ }
903
+ } else {
904
+ byAddress.set(key, {
905
+ address: entry.address,
906
+ balance: entry.balance,
907
+ stateDiff: [...(entry.stateDiff ?? [])],
908
+ });
909
+ }
910
+ }
911
+ }
912
+ return [...byAddress.values()];
913
+ }
914
+
915
+ /** Compresses a FeeHeader into a uint256 matching FeeHeaderLib.compress() in FeeStructs.sol. */
916
+ public static compressFeeHeader(feeHeader: FeeHeader): bigint {
917
+ const MASK_48_BITS = (1n << 48n) - 1n;
918
+ const MASK_64_BITS = (1n << 64n) - 1n;
919
+ const MASK_63_BITS = (1n << 63n) - 1n;
920
+
921
+ let value = BigInt(feeHeader.manaUsed) & ((1n << 32n) - 1n); // bits [0:31]
922
+ value |= (feeHeader.excessMana < MASK_48_BITS ? feeHeader.excessMana : MASK_48_BITS) << 32n; // bits [32:79]
923
+ value |= (BigInt(feeHeader.ethPerFeeAsset) & MASK_48_BITS) << 80n; // bits [80:127]
924
+ value |= (feeHeader.congestionCost < MASK_64_BITS ? feeHeader.congestionCost : MASK_64_BITS) << 128n; // bits [128:191]
925
+ value |= (feeHeader.proverCost < MASK_63_BITS ? feeHeader.proverCost : MASK_63_BITS) << 192n; // bits [192:254]
926
+ value |= 1n << 255n; // preheat flag
927
+ return value;
928
+ }
929
+
930
+ /** Computes the fee header for a child checkpoint given parent fee header and child data.
931
+ * Must stay in sync with Solidity FeeLib.sol (computeNewEthPerFeeAsset, clampedAdd). */
932
+ public static computeChildFeeHeader(
933
+ parentFeeHeader: FeeHeader,
934
+ childManaUsed: bigint,
935
+ feeAssetPriceModifier: bigint,
936
+ manaTarget: bigint,
937
+ ): FeeHeader {
938
+ const MIN_ETH_PER_FEE_ASSET = 100n;
939
+ const MAX_ETH_PER_FEE_ASSET = 100_000_000_000_000n; // 1e14, matches FeeLib.sol
940
+
941
+ // excessMana = clampedAdd(parent.excessMana + parent.manaUsed, -manaTarget)
942
+ const sum = parentFeeHeader.excessMana + parentFeeHeader.manaUsed;
943
+ const excessMana = sum > manaTarget ? sum - manaTarget : 0n;
944
+
945
+ // ethPerFeeAsset = computeNewEthPerFeeAsset(max(parent.ethPerFeeAsset, MIN), modifier)
946
+ const parentPrice =
947
+ parentFeeHeader.ethPerFeeAsset > MIN_ETH_PER_FEE_ASSET ? parentFeeHeader.ethPerFeeAsset : MIN_ETH_PER_FEE_ASSET;
948
+ let newPrice: bigint;
949
+ if (feeAssetPriceModifier >= 0n) {
950
+ newPrice = (parentPrice * (10_000n + feeAssetPriceModifier)) / 10_000n;
951
+ } else {
952
+ const absMod = -feeAssetPriceModifier;
953
+ newPrice = (parentPrice * (10_000n - absMod)) / 10_000n;
954
+ }
955
+ if (newPrice < MIN_ETH_PER_FEE_ASSET) {
956
+ newPrice = MIN_ETH_PER_FEE_ASSET;
957
+ }
958
+ if (newPrice > MAX_ETH_PER_FEE_ASSET) {
959
+ newPrice = MAX_ETH_PER_FEE_ASSET;
960
+ }
961
+
962
+ return {
963
+ excessMana,
964
+ manaUsed: childManaUsed,
965
+ ethPerFeeAsset: newPrice,
966
+ congestionCost: 0n,
967
+ proverCost: 0n,
968
+ };
969
+ }
970
+
803
971
  /** Creates a request to Rollup#invalidateBadAttestation to be simulated or sent */
804
972
  public buildInvalidateBadAttestationRequest(
805
973
  checkpointNumber: CheckpointNumber,
@@ -848,8 +1016,18 @@ export class RollupContract {
848
1016
  return this.rollup.read.getHasSubmitted([BigInt(epochNumber), BigInt(numberOfCheckpointsInEpoch), prover]);
849
1017
  }
850
1018
 
851
- getManaMinFeeAt(timestamp: bigint, inFeeAsset: boolean): Promise<bigint> {
852
- return this.rollup.read.getManaMinFeeAt([timestamp, inFeeAsset]);
1019
+ getManaMinFeeAt(timestamp: bigint, inFeeAsset: boolean, stateOverride?: StateOverride): Promise<bigint> {
1020
+ return this.rollup.read.getManaMinFeeAt([timestamp, inFeeAsset], { stateOverride });
1021
+ }
1022
+
1023
+ async getManaMinFeeComponentsAt(timestamp: bigint, inFeeAsset: boolean): Promise<ManaMinFeeComponents> {
1024
+ const result = await this.rollup.read.getManaMinFeeComponentsAt([timestamp, inFeeAsset]);
1025
+ return {
1026
+ sequencerCost: result.sequencerCost,
1027
+ proverCost: result.proverCost,
1028
+ congestionCost: result.congestionCost,
1029
+ congestionMultiplier: result.congestionMultiplier,
1030
+ };
853
1031
  }
854
1032
 
855
1033
  async getSlotAt(timestamp: bigint): Promise<SlotNumber> {
@@ -895,11 +1073,10 @@ export class RollupContract {
895
1073
  return this.rollup.read.getSpecificProverRewardsForEpoch([epoch, prover]);
896
1074
  }
897
1075
 
898
- async getAttesters(): Promise<EthAddress[]> {
1076
+ async getAttesters(timestamp?: bigint): Promise<EthAddress[]> {
899
1077
  const attesterSize = await this.getActiveAttesterCount();
900
1078
  const gse = new GSEContract(this.client, await this.getGSE());
901
- const ts = (await this.client.getBlock()).timestamp;
902
-
1079
+ const ts = timestamp ?? (await this.client.getBlock()).timestamp;
903
1080
  const indices = Array.from({ length: attesterSize }, (_, i) => BigInt(i));
904
1081
  const chunks = chunk(indices, 1000);
905
1082
 
@@ -7,7 +7,7 @@ import { EthAddress } from '@aztec/foundation/eth-address';
7
7
  import { Signature } from '@aztec/foundation/eth-signature';
8
8
  import { hexToBuffer } from '@aztec/foundation/string';
9
9
  import { SlasherAbi } from '@aztec/l1-artifacts/SlasherAbi';
10
- import { TallySlashingProposerAbi } from '@aztec/l1-artifacts/TallySlashingProposerAbi';
10
+ import { SlashingProposerAbi } from '@aztec/l1-artifacts/SlashingProposerAbi';
11
11
 
12
12
  import {
13
13
  type GetContractReturnType,
@@ -19,13 +19,11 @@ import {
19
19
  } from 'viem';
20
20
 
21
21
  /**
22
- * Wrapper around the TallySlashingProposer contract that provides
22
+ * Wrapper around the SlashingProposer contract that provides
23
23
  * a TypeScript interface for interacting with the consensus-based slashing system.
24
24
  */
25
- export class TallySlashingProposerContract {
26
- private readonly contract: GetContractReturnType<typeof TallySlashingProposerAbi, ViemClient>;
27
-
28
- public readonly type = 'tally' as const;
25
+ export class SlashingProposerContract {
26
+ private readonly contract: GetContractReturnType<typeof SlashingProposerAbi, ViemClient>;
29
27
 
30
28
  constructor(
31
29
  public readonly client: ViemClient,
@@ -33,7 +31,7 @@ export class TallySlashingProposerContract {
33
31
  ) {
34
32
  this.contract = getContract({
35
33
  address: typeof address === 'string' ? address : address.toString(),
36
- abi: TallySlashingProposerAbi,
34
+ abi: SlashingProposerAbi,
37
35
  client,
38
36
  });
39
37
  }
@@ -136,12 +134,12 @@ export class TallySlashingProposerContract {
136
134
 
137
135
  /** Tries to extract a VoteCast event from the given logs. */
138
136
  public tryExtractVoteCastEvent(logs: Log[]) {
139
- return tryExtractEvent(logs, this.address.toString(), TallySlashingProposerAbi, 'VoteCast');
137
+ return tryExtractEvent(logs, this.address.toString(), SlashingProposerAbi, 'VoteCast');
140
138
  }
141
139
 
142
140
  /** Tries to extract a RoundExecuted event from the given logs. */
143
141
  public tryExtractRoundExecutedEvent(logs: Log[]) {
144
- return tryExtractEvent(logs, this.address.toString(), TallySlashingProposerAbi, 'RoundExecuted');
142
+ return tryExtractEvent(logs, this.address.toString(), SlashingProposerAbi, 'RoundExecuted');
145
143
  }
146
144
 
147
145
  /**
@@ -161,9 +159,9 @@ export class TallySlashingProposerContract {
161
159
 
162
160
  return {
163
161
  to: this.contract.address,
164
- abi: TallySlashingProposerAbi,
162
+ abi: SlashingProposerAbi,
165
163
  data: encodeFunctionData({
166
- abi: TallySlashingProposerAbi,
164
+ abi: SlashingProposerAbi,
167
165
  functionName: 'vote',
168
166
  args: [votes, signature.toViemSignature()],
169
167
  }),
@@ -173,7 +171,7 @@ export class TallySlashingProposerContract {
173
171
  /** Returns the typed data definition to EIP712-sign for voting */
174
172
  public buildVoteTypedData(votes: Hex, slot: SlotNumber): TypedDataDefinition {
175
173
  const domain = {
176
- name: 'TallySlashingProposer',
174
+ name: 'SlashingProposer',
177
175
  version: '1',
178
176
  chainId: this.client.chain.id,
179
177
  verifyingContract: this.contract.address,
@@ -209,9 +207,9 @@ export class TallySlashingProposerContract {
209
207
  public buildVoteRequestWithSignature(votes: Hex, signature: { v: number; r: Hex; s: Hex }): L1TxRequest {
210
208
  return {
211
209
  to: this.contract.address,
212
- abi: TallySlashingProposerAbi,
210
+ abi: SlashingProposerAbi,
213
211
  data: encodeFunctionData({
214
- abi: TallySlashingProposerAbi,
212
+ abi: SlashingProposerAbi,
215
213
  functionName: 'vote',
216
214
  args: [votes, signature],
217
215
  }),
@@ -227,9 +225,9 @@ export class TallySlashingProposerContract {
227
225
  public buildExecuteRoundRequest(round: bigint, committees: EthAddress[][]): L1TxRequest {
228
226
  return {
229
227
  to: this.contract.address,
230
- abi: mergeAbis([TallySlashingProposerAbi, SlasherAbi]),
228
+ abi: mergeAbis([SlashingProposerAbi, SlasherAbi]),
231
229
  data: encodeFunctionData({
232
- abi: TallySlashingProposerAbi,
230
+ abi: SlashingProposerAbi,
233
231
  functionName: 'executeRound',
234
232
  args: [round, committees.map(c => c.map(addr => addr.toString()))],
235
233
  }),
@@ -230,7 +230,6 @@ export function computeValidatorData(operator: Operator): ValidatorJson {
230
230
  export interface RollupUpgradeAddresses {
231
231
  rollupAddress: string;
232
232
  verifierAddress: string;
233
- slashFactoryAddress: string;
234
233
  inboxAddress: string;
235
234
  outboxAddress: string;
236
235
  feeJuicePortalAddress: string;
@@ -243,7 +242,6 @@ export interface RollupUpgradeAddresses {
243
242
  export interface ForgeRollupUpgradeResult {
244
243
  rollupAddress: Hex;
245
244
  verifierAddress: Hex;
246
- slashFactoryAddress: Hex;
247
245
  inboxAddress: Hex;
248
246
  outboxAddress: Hex;
249
247
  feeJuicePortalAddress: Hex;
@@ -403,7 +401,6 @@ export async function deployAztecL1Contracts(
403
401
  governanceProposerAddress: EthAddress.fromString(result.governanceProposerAddress),
404
402
  governanceAddress: EthAddress.fromString(result.governanceAddress),
405
403
  stakingAssetAddress: EthAddress.fromString(result.stakingAssetAddress),
406
- slashFactoryAddress: result.slashFactoryAddress ? EthAddress.fromString(result.slashFactoryAddress) : undefined,
407
404
  feeAssetHandlerAddress: result.feeAssetHandlerAddress
408
405
  ? EthAddress.fromString(result.feeAssetHandlerAddress)
409
406
  : undefined,
@@ -585,7 +582,7 @@ export function getDeployRollupForUpgradeEnvVars(
585
582
  AZTEC_EXIT_DELAY_SECONDS: args.exitDelaySeconds.toString(),
586
583
  AZTEC_PROVING_COST_PER_MANA: args.provingCostPerMana.toString(),
587
584
  AZTEC_INITIAL_ETH_PER_FEE_ASSET: args.initialEthPerFeeAsset.toString(),
588
- AZTEC_SLASHER_FLAVOR: args.slasherFlavor,
585
+ AZTEC_SLASHER_ENABLED: args.slasherEnabled ? 'true' : 'false',
589
586
  AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS: args.slashingRoundSizeInEpochs.toString(),
590
587
  AZTEC_SLASHING_QUORUM: args.slashingQuorum?.toString(),
591
588
  AZTEC_SLASHING_OFFSET_IN_ROUNDS: args.slashingOffsetInRounds.toString(),
@@ -645,6 +642,5 @@ export const deployRollupForUpgrade = async (
645
642
 
646
643
  return {
647
644
  rollup,
648
- slashFactoryAddress: result.slashFactoryAddress,
649
645
  };
650
646
  };
@@ -18,7 +18,7 @@ export const l1ContractsDefaultEnv = {
18
18
  AZTEC_MANA_TARGET: 100000000,
19
19
  AZTEC_PROVING_COST_PER_MANA: 100,
20
20
  AZTEC_INITIAL_ETH_PER_FEE_ASSET: 10000000,
21
- AZTEC_SLASHER_FLAVOR: 'tally',
21
+ AZTEC_SLASHER_ENABLED: true,
22
22
  AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS: 4,
23
23
  AZTEC_SLASHING_LIFETIME_IN_ROUNDS: 5,
24
24
  AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS: 0,
@@ -3,10 +3,6 @@ import {
3
3
  CoinIssuerBytecode,
4
4
  DateGatedRelayerAbi,
5
5
  DateGatedRelayerBytecode,
6
- EmpireSlasherDeploymentExtLibAbi,
7
- EmpireSlasherDeploymentExtLibBytecode,
8
- EmpireSlashingProposerAbi,
9
- EmpireSlashingProposerBytecode,
10
6
  FeeAssetHandlerAbi,
11
7
  FeeAssetHandlerBytecode,
12
8
  FeeJuicePortalAbi,
@@ -42,16 +38,14 @@ import {
42
38
  RollupLinkReferences,
43
39
  RollupOperationsExtLibAbi,
44
40
  RollupOperationsExtLibBytecode,
45
- SlashFactoryAbi,
46
- SlashFactoryBytecode,
47
41
  SlasherAbi,
48
42
  SlasherBytecode,
43
+ SlasherDeploymentExtLibAbi,
44
+ SlasherDeploymentExtLibBytecode,
45
+ SlashingProposerAbi,
46
+ SlashingProposerBytecode,
49
47
  StakingAssetHandlerAbi,
50
48
  StakingAssetHandlerBytecode,
51
- TallySlasherDeploymentExtLibAbi,
52
- TallySlasherDeploymentExtLibBytecode,
53
- TallySlashingProposerAbi,
54
- TallySlashingProposerBytecode,
55
49
  TestERC20Abi,
56
50
  TestERC20Bytecode,
57
51
  ValidatorOperationsExtLibAbi,
@@ -107,15 +101,10 @@ export const RollupArtifact = {
107
101
  contractAbi: RewardExtLibAbi,
108
102
  contractBytecode: RewardExtLibBytecode as Hex,
109
103
  },
110
- TallySlasherDeploymentExtLib: {
111
- name: 'TallySlasherDeploymentExtLib',
112
- contractAbi: TallySlasherDeploymentExtLibAbi,
113
- contractBytecode: TallySlasherDeploymentExtLibBytecode as Hex,
114
- },
115
- EmpireSlasherDeploymentExtLib: {
116
- name: 'EmpireSlasherDeploymentExtLib',
117
- contractAbi: EmpireSlasherDeploymentExtLibAbi,
118
- contractBytecode: EmpireSlasherDeploymentExtLibBytecode as Hex,
104
+ SlasherDeploymentExtLib: {
105
+ name: 'SlasherDeploymentExtLib',
106
+ contractAbi: SlasherDeploymentExtLibAbi,
107
+ contractBytecode: SlasherDeploymentExtLibBytecode as Hex,
119
108
  },
120
109
  },
121
110
  },
@@ -175,22 +164,10 @@ export const SlasherArtifact = {
175
164
  contractBytecode: SlasherBytecode as Hex,
176
165
  };
177
166
 
178
- export const EmpireSlashingProposerArtifact = {
179
- name: 'EmpireSlashingProposer',
180
- contractAbi: EmpireSlashingProposerAbi,
181
- contractBytecode: EmpireSlashingProposerBytecode as Hex,
182
- };
183
-
184
- export const TallySlashingProposerArtifact = {
185
- name: 'TallySlashingProposer',
186
- contractAbi: TallySlashingProposerAbi,
187
- contractBytecode: TallySlashingProposerBytecode as Hex,
188
- };
189
-
190
- export const SlashFactoryArtifact = {
191
- name: 'SlashFactory',
192
- contractAbi: SlashFactoryAbi,
193
- contractBytecode: SlashFactoryBytecode as Hex,
167
+ export const SlashingProposerArtifact = {
168
+ name: 'SlashingProposer',
169
+ contractAbi: SlashingProposerAbi,
170
+ contractBytecode: SlashingProposerBytecode as Hex,
194
171
  };
195
172
 
196
173
  export const RegisterNewRollupVersionPayloadArtifact = {
@@ -27,7 +27,6 @@ export const L1ContractsNames = [
27
27
  export type L1ContractAddresses = {
28
28
  [K in (typeof L1ContractsNames)[number]]: EthAddress;
29
29
  } & {
30
- slashFactoryAddress?: EthAddress | undefined;
31
30
  feeAssetHandlerAddress?: EthAddress | undefined;
32
31
  stakingAssetHandlerAddress?: EthAddress | undefined;
33
32
  zkPassportVerifierAddress?: EthAddress | undefined;
@@ -48,7 +47,6 @@ export const L1ContractAddressesSchema = zodFor<L1ContractAddresses>()(
48
47
  rewardDistributorAddress: schemas.EthAddress,
49
48
  governanceProposerAddress: schemas.EthAddress,
50
49
  governanceAddress: schemas.EthAddress,
51
- slashFactoryAddress: schemas.EthAddress.optional(),
52
50
  feeAssetHandlerAddress: schemas.EthAddress.optional(),
53
51
  stakingAssetHandlerAddress: schemas.EthAddress.optional(),
54
52
  zkPassportVerifierAddress: schemas.EthAddress.optional(),
@@ -67,11 +65,6 @@ export const l1ContractAddressesMapping: ConfigMappingsType<
67
65
  description: 'The deployed L1 registry contract address.',
68
66
  parseEnv,
69
67
  },
70
- slashFactoryAddress: {
71
- env: 'SLASH_FACTORY_CONTRACT_ADDRESS',
72
- description: 'The deployed L1 slashFactory contract address',
73
- parseEnv,
74
- },
75
68
  feeAssetHandlerAddress: {
76
69
  env: 'FEE_ASSET_HANDLER_CONTRACT_ADDRESS',
77
70
  description: 'The deployed L1 feeAssetHandler contract address',