@aztec/ethereum 3.0.0-nightly.20251125 → 3.0.0-nightly.20251127

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/src/config.ts CHANGED
@@ -29,7 +29,9 @@ export type L1ContractsConfig = {
29
29
  /** The target validator committee size. */
30
30
  aztecTargetCommitteeSize: number;
31
31
  /** The number of epochs to lag behind the current epoch for validator selection. */
32
- lagInEpochs: number;
32
+ lagInEpochsForValidatorSet: number;
33
+ /** The number of epochs to lag behind the current epoch for randao selection. */
34
+ lagInEpochsForRandao: number;
33
35
  /** The number of epochs after an epoch ends that proofs are still accepted. */
34
36
  aztecProofSubmissionEpochs: number;
35
37
  /** The deposit amount for a validator */
@@ -77,7 +79,8 @@ export const DefaultL1ContractsConfig = {
77
79
  aztecSlotDuration: 36,
78
80
  aztecEpochDuration: 32,
79
81
  aztecTargetCommitteeSize: 48,
80
- lagInEpochs: 2,
82
+ lagInEpochsForValidatorSet: 2,
83
+ lagInEpochsForRandao: 2, // For PROD, this value should be > lagInEpochsForValidatorSet
81
84
  aztecProofSubmissionEpochs: 1, // you have a full epoch to submit a proof after the epoch to prove ends
82
85
  activationThreshold: 100n * 10n ** 18n,
83
86
  ejectionThreshold: 50n * 10n ** 18n,
@@ -321,10 +324,15 @@ export const l1ContractsConfigMappings: ConfigMappingsType<L1ContractsConfig> =
321
324
  description: 'The target validator committee size.',
322
325
  ...numberConfigHelper(DefaultL1ContractsConfig.aztecTargetCommitteeSize),
323
326
  },
324
- lagInEpochs: {
325
- env: 'AZTEC_LAG_IN_EPOCHS',
327
+ lagInEpochsForValidatorSet: {
328
+ env: 'AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET',
326
329
  description: 'The number of epochs to lag behind the current epoch for validator selection.',
327
- ...numberConfigHelper(DefaultL1ContractsConfig.lagInEpochs),
330
+ ...numberConfigHelper(DefaultL1ContractsConfig.lagInEpochsForValidatorSet),
331
+ },
332
+ lagInEpochsForRandao: {
333
+ env: 'AZTEC_LAG_IN_EPOCHS_FOR_RANDAO',
334
+ description: 'The number of epochs to lag behind the current epoch for randao selection.',
335
+ ...numberConfigHelper(DefaultL1ContractsConfig.lagInEpochsForRandao),
328
336
  },
329
337
  aztecProofSubmissionEpochs: {
330
338
  env: 'AZTEC_PROOF_SUBMISSION_EPOCHS',
@@ -228,8 +228,13 @@ export class RollupContract {
228
228
  }
229
229
 
230
230
  @memoize
231
- getLagInEpochs() {
232
- return this.rollup.read.getLagInEpochs();
231
+ getLagInEpochsForValidatorSet() {
232
+ return this.rollup.read.getLagInEpochsForValidatorSet();
233
+ }
234
+
235
+ @memoize
236
+ getLagInEpochsForRandao() {
237
+ return this.rollup.read.getLagInEpochsForRandao();
233
238
  }
234
239
 
235
240
  @memoize
@@ -863,7 +863,8 @@ export const deployRollup = async (
863
863
  aztecSlotDuration: BigInt(args.aztecSlotDuration),
864
864
  aztecEpochDuration: BigInt(args.aztecEpochDuration),
865
865
  targetCommitteeSize: BigInt(args.aztecTargetCommitteeSize),
866
- lagInEpochs: BigInt(args.lagInEpochs),
866
+ lagInEpochsForValidatorSet: BigInt(args.lagInEpochsForValidatorSet),
867
+ lagInEpochsForRandao: BigInt(args.lagInEpochsForRandao),
867
868
  aztecProofSubmissionEpochs: BigInt(args.aztecProofSubmissionEpochs),
868
869
  slashingQuorum: BigInt(args.slashingQuorum ?? (args.slashingRoundSizeInEpochs * args.aztecEpochDuration) / 2 + 1),
869
870
  slashingRoundSize: BigInt(args.slashingRoundSizeInEpochs * args.aztecEpochDuration),
@@ -248,8 +248,7 @@ export class ReadOnlyL1TxUtils {
248
248
  this.logger?.debug('Using fixed priority fee per L1 gas', {
249
249
  fixedPriorityFeePerGas: gasConfig.fixedPriorityFeePerGas,
250
250
  });
251
- // try to maintain precision up to 1000000 wei
252
- priorityFee = BigInt(gasConfig.fixedPriorityFeePerGas * 1_000_000) * (WEI_CONST / 1_000_000n);
251
+ priorityFee = BigInt(Math.trunc(gasConfig.fixedPriorityFeePerGas * Number(WEI_CONST)));
253
252
  } else {
254
253
  // Get competitive priority fee (includes network estimate + analysis)
255
254
  priorityFee = this.getCompetitivePriorityFee(networkEstimateResult, pendingBlockResult, feeHistoryResult);
package/src/queries.ts CHANGED
@@ -33,7 +33,8 @@ export async function getL1ContractsConfig(
33
33
  aztecSlotDuration,
34
34
  aztecProofSubmissionEpochs,
35
35
  aztecTargetCommitteeSize,
36
- lagInEpochs,
36
+ lagInEpochsForValidatorSet,
37
+ lagInEpochsForRandao,
37
38
  activationThreshold,
38
39
  ejectionThreshold,
39
40
  localEjectionThreshold,
@@ -59,7 +60,8 @@ export async function getL1ContractsConfig(
59
60
  rollup.getSlotDuration(),
60
61
  rollup.getProofSubmissionEpochs(),
61
62
  rollup.getTargetCommitteeSize(),
62
- rollup.getLagInEpochs(),
63
+ rollup.getLagInEpochsForValidatorSet(),
64
+ rollup.getLagInEpochsForRandao(),
63
65
  rollup.getActivationThreshold(),
64
66
  rollup.getEjectionThreshold(),
65
67
  rollup.getLocalEjectionThreshold(),
@@ -87,7 +89,8 @@ export async function getL1ContractsConfig(
87
89
  aztecSlotDuration: Number(aztecSlotDuration),
88
90
  aztecProofSubmissionEpochs: Number(aztecProofSubmissionEpochs),
89
91
  aztecTargetCommitteeSize: Number(aztecTargetCommitteeSize),
90
- lagInEpochs: Number(lagInEpochs),
92
+ lagInEpochsForValidatorSet: Number(lagInEpochsForValidatorSet),
93
+ lagInEpochsForRandao: Number(lagInEpochsForRandao),
91
94
  governanceProposerQuorum: Number(governanceProposerQuorum),
92
95
  governanceProposerRoundSize: Number(governanceProposerRoundSize),
93
96
  activationThreshold,
@@ -6,7 +6,8 @@ import { createLogger } from '@aztec/foundation/log';
6
6
  import { pluralize } from '@aztec/foundation/string';
7
7
  import type { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
8
8
 
9
- import { type Hex, type Transaction, createPublicClient, fallback, hexToNumber, http } from 'viem';
9
+ import { type Chain, type Hex, type Transaction, createPublicClient, fallback, hexToNumber, http } from 'viem';
10
+ import { foundry } from 'viem/chains';
10
11
 
11
12
  import type { ViemPublicClient } from '../types.js';
12
13
 
@@ -28,9 +29,14 @@ export class EthCheatCodes {
28
29
  * The logger to use for the eth cheatcodes
29
30
  */
30
31
  public logger = createLogger('ethereum:cheat_codes'),
32
+ /**
33
+ * The chain configuration provided to Anvil
34
+ */
35
+ public chain: Chain = foundry,
31
36
  ) {
32
37
  this.publicClient = createPublicClient({
33
38
  transport: fallback(this.rpcUrls.map(url => http(url))),
39
+ chain: chain,
34
40
  });
35
41
  }
36
42
 
@@ -14,7 +14,6 @@ import {
14
14
  hexToBigInt,
15
15
  http,
16
16
  } from 'viem';
17
- import { foundry } from 'viem/chains';
18
17
 
19
18
  import { EthCheatCodes } from './eth_cheat_codes.js';
20
19
 
@@ -30,7 +29,7 @@ export class RollupCheatCodes {
30
29
  addresses: Pick<L1ContractAddresses, 'rollupAddress'>,
31
30
  ) {
32
31
  this.client = createPublicClient({
33
- chain: foundry,
32
+ chain: ethCheatCodes.chain,
34
33
  transport: fallback(ethCheatCodes.rpcUrls.map(url => http(url))),
35
34
  });
36
35
  this.rollup = getContract({
@@ -15,6 +15,7 @@ export async function startAnvil(
15
15
  log?: boolean;
16
16
  captureMethodCalls?: boolean;
17
17
  accounts?: number;
18
+ chainId?: number;
18
19
  } = {},
19
20
  ): Promise<{ anvil: Anvil; methodCalls?: string[]; rpcUrl: string; stop: () => Promise<void> }> {
20
21
  const anvilBinary = resolve(dirname(fileURLToPath(import.meta.url)), '../../', 'scripts/anvil_kill_wrapper.sh');
@@ -35,6 +36,7 @@ export async function startAnvil(
35
36
  stopTimeout: 1000,
36
37
  accounts: opts.accounts ?? 20,
37
38
  gasLimit: 45_000_000n,
39
+ chainId: opts.chainId ?? 31337,
38
40
  });
39
41
 
40
42
  // Listen to the anvil output to get the port.