@aztec/ethereum 0.0.1-commit.3469e52 → 0.0.1-commit.54489865

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 (37) hide show
  1. package/dest/config.d.ts +3 -1
  2. package/dest/config.d.ts.map +1 -1
  3. package/dest/config.js +5 -0
  4. package/dest/contracts/governance.d.ts +3 -1
  5. package/dest/contracts/governance.d.ts.map +1 -1
  6. package/dest/contracts/governance.js +9 -1
  7. package/dest/contracts/rollup.d.ts +3 -3
  8. package/dest/contracts/rollup.d.ts.map +1 -1
  9. package/dest/contracts/rollup.js +3 -3
  10. package/dest/deploy_aztec_l1_contracts.d.ts +3 -1
  11. package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -1
  12. package/dest/deploy_aztec_l1_contracts.js +1 -0
  13. package/dest/generated/l1-contracts-defaults.d.ts +2 -1
  14. package/dest/generated/l1-contracts-defaults.d.ts.map +1 -1
  15. package/dest/generated/l1-contracts-defaults.js +1 -0
  16. package/dest/l1_artifacts.d.ts +846 -50
  17. package/dest/l1_artifacts.d.ts.map +1 -1
  18. package/dest/publisher_manager.d.ts +3 -2
  19. package/dest/publisher_manager.d.ts.map +1 -1
  20. package/dest/publisher_manager.js +2 -2
  21. package/dest/queries.d.ts +1 -1
  22. package/dest/queries.d.ts.map +1 -1
  23. package/dest/queries.js +2 -1
  24. package/dest/test/rollup_cheat_codes.d.ts +4 -2
  25. package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
  26. package/dest/test/rollup_cheat_codes.js +10 -1
  27. package/dest/test/start_anvil.js +1 -1
  28. package/package.json +5 -5
  29. package/src/config.ts +7 -0
  30. package/src/contracts/governance.ts +8 -1
  31. package/src/contracts/rollup.ts +4 -4
  32. package/src/deploy_aztec_l1_contracts.ts +1 -0
  33. package/src/generated/l1-contracts-defaults.ts +1 -0
  34. package/src/publisher_manager.ts +4 -2
  35. package/src/queries.ts +1 -0
  36. package/src/test/rollup_cheat_codes.ts +11 -2
  37. package/src/test/start_anvil.ts +1 -1
@@ -108,7 +108,7 @@ export enum AttesterStatus {
108
108
  export type FeeHeader = {
109
109
  excessMana: bigint;
110
110
  manaUsed: bigint;
111
- feeAssetPriceNumerator: bigint;
111
+ ethPerFeeAsset: bigint;
112
112
  congestionCost: bigint;
113
113
  proverCost: bigint;
114
114
  };
@@ -515,8 +515,8 @@ export class RollupContract {
515
515
  };
516
516
  }
517
517
 
518
- getFeeAssetPerEth(): Promise<bigint> {
519
- return this.rollup.read.getFeeAssetPerEth();
518
+ getEthPerFeeAsset(): Promise<bigint> {
519
+ return this.rollup.read.getEthPerFeeAsset();
520
520
  }
521
521
 
522
522
  async getCommitteeAt(timestamp: bigint): Promise<EthAddress[] | undefined> {
@@ -601,7 +601,7 @@ export class RollupContract {
601
601
  feeHeader: {
602
602
  excessMana: result.feeHeader.excessMana,
603
603
  manaUsed: result.feeHeader.manaUsed,
604
- feeAssetPriceNumerator: result.feeHeader.feeAssetPriceNumerator,
604
+ ethPerFeeAsset: result.feeHeader.ethPerFeeAsset,
605
605
  congestionCost: result.feeHeader.congestionCost,
606
606
  proverCost: result.feeHeader.proverCost,
607
607
  },
@@ -549,6 +549,7 @@ export function getDeployRollupForUpgradeEnvVars(
549
549
  AZTEC_MANA_TARGET: args.manaTarget.toString(),
550
550
  AZTEC_EXIT_DELAY_SECONDS: args.exitDelaySeconds.toString(),
551
551
  AZTEC_PROVING_COST_PER_MANA: args.provingCostPerMana.toString(),
552
+ AZTEC_INITIAL_ETH_PER_FEE_ASSET: args.initialEthPerFeeAsset.toString(),
552
553
  AZTEC_SLASHER_FLAVOR: args.slasherFlavor,
553
554
  AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS: args.slashingRoundSizeInEpochs.toString(),
554
555
  AZTEC_SLASHING_QUORUM: args.slashingQuorum?.toString(),
@@ -17,6 +17,7 @@ export const l1ContractsDefaultEnv = {
17
17
  AZTEC_PROOF_SUBMISSION_EPOCHS: 1,
18
18
  AZTEC_MANA_TARGET: 100000000,
19
19
  AZTEC_PROVING_COST_PER_MANA: 100,
20
+ AZTEC_INITIAL_ETH_PER_FEE_ASSET: 10000000,
20
21
  AZTEC_SLASHER_FLAVOR: 'tally',
21
22
  AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS: 4,
22
23
  AZTEC_SLASHING_LIFETIME_IN_ROUNDS: 5,
@@ -1,5 +1,5 @@
1
1
  import { pick } from '@aztec/foundation/collection';
2
- import { createLogger } from '@aztec/foundation/log';
2
+ import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
3
3
 
4
4
  import { L1TxUtils, TxUtilsState } from './l1_tx_utils/index.js';
5
5
 
@@ -28,13 +28,15 @@ const busyStates: TxUtilsState[] = [
28
28
  export type PublisherFilter<UtilsType extends L1TxUtils> = (utils: UtilsType) => boolean;
29
29
 
30
30
  export class PublisherManager<UtilsType extends L1TxUtils = L1TxUtils> {
31
- private log = createLogger('publisher:manager');
31
+ private log: Logger;
32
32
  private config: { publisherAllowInvalidStates?: boolean };
33
33
 
34
34
  constructor(
35
35
  private publishers: UtilsType[],
36
36
  config: { publisherAllowInvalidStates?: boolean },
37
+ bindings?: LoggerBindings,
37
38
  ) {
39
+ this.log = createLogger('publisher:manager', bindings);
38
40
  this.log.info(`PublisherManager initialized with ${publishers.length} publishers.`);
39
41
  this.publishers = publishers;
40
42
  this.config = pick(config, 'publisherAllowInvalidStates');
package/src/queries.ts CHANGED
@@ -119,5 +119,6 @@ export async function getL1ContractsConfig(
119
119
  slashAmountSmall: slashingAmounts[0],
120
120
  slashAmountMedium: slashingAmounts[1],
121
121
  slashAmountLarge: slashingAmounts[2],
122
+ initialEthPerFeeAsset: DefaultL1ContractsConfig.initialEthPerFeeAsset,
122
123
  };
123
124
  }
@@ -56,6 +56,15 @@ export class RollupCheatCodes {
56
56
  return SlotNumber.fromBigInt(await this.rollup.read.getSlotAt([ts]));
57
57
  }
58
58
 
59
+ /** Returns the number of seconds until the start of the given slot based on L1 block timestamp. */
60
+ public async getSecondsUntilSlot(slot: SlotNumber): Promise<number> {
61
+ const [currentTimestamp, targetTimestamp] = await Promise.all([
62
+ this.client.getBlock().then(b => BigInt(b.timestamp)),
63
+ this.rollup.read.getTimestampForSlot([BigInt(slot)]),
64
+ ]);
65
+ return Math.max(0, Number(targetTimestamp - currentTimestamp));
66
+ }
67
+
59
68
  /** Returns the current epoch */
60
69
  public async getEpoch(): Promise<EpochNumber> {
61
70
  const slotNumber = await this.getSlot();
@@ -124,7 +133,7 @@ export class RollupCheatCodes {
124
133
  } = {},
125
134
  ) {
126
135
  const { epochDuration: slotsInEpoch } = await this.getConfig();
127
- const slotNumber = SlotNumber(epoch * Number(slotsInEpoch));
136
+ const slotNumber = SlotNumber(Number(epoch) * Number(slotsInEpoch));
128
137
  const timestamp = (await this.rollup.read.getTimestampForSlot([BigInt(slotNumber)])) + BigInt(opts.offset ?? 0);
129
138
  try {
130
139
  await this.ethCheatCodes.warp(Number(timestamp), { ...opts, silent: true, resetBlockInterval: true });
@@ -176,7 +185,7 @@ export class RollupCheatCodes {
176
185
  * Marks the specified checkpoint (or latest if none) as proven
177
186
  * @param maybeCheckpointNumber - The checkpoint number to mark as proven (defaults to latest pending)
178
187
  */
179
- public markAsProven(maybeCheckpointNumber?: number | bigint) {
188
+ public markAsProven(maybeCheckpointNumber?: CheckpointNumber) {
180
189
  return this.ethCheatCodes.execWithPausedAnvil(async () => {
181
190
  const tipsBefore = await this.getTips();
182
191
  const { pending, proven } = tipsBefore;
@@ -33,7 +33,7 @@ export async function startAnvil(
33
33
  const anvil = createAnvil({
34
34
  anvilBinary,
35
35
  host: '127.0.0.1',
36
- port: opts.port ?? 8545,
36
+ port: opts.port ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : 8545),
37
37
  blockTime: opts.l1BlockTime,
38
38
  stopTimeout: 1000,
39
39
  accounts: opts.accounts ?? 20,