@aztec/end-to-end 0.0.1-commit.9593d84 → 0.0.1-commit.96bb3f7

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 (114) hide show
  1. package/dest/bench/client_flows/client_flows_benchmark.d.ts +3 -3
  2. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/client_flows_benchmark.js +6 -4
  4. package/dest/bench/client_flows/data_extractor.js +3 -1
  5. package/dest/bench/utils.d.ts +5 -5
  6. package/dest/bench/utils.d.ts.map +1 -1
  7. package/dest/bench/utils.js +18 -11
  8. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +14 -7
  9. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  10. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +36 -19
  11. package/dest/e2e_epochs/epochs_test.d.ts +11 -9
  12. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  13. package/dest/e2e_epochs/epochs_test.js +14 -12
  14. package/dest/e2e_fees/bridging_race.notest.js +1 -1
  15. package/dest/e2e_fees/fees_test.d.ts +8 -4
  16. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  17. package/dest/e2e_fees/fees_test.js +7 -4
  18. package/dest/e2e_l1_publisher/write_json.d.ts +1 -1
  19. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  20. package/dest/e2e_l1_publisher/write_json.js +2 -5
  21. package/dest/e2e_multi_validator/utils.js +1 -1
  22. package/dest/e2e_p2p/inactivity_slash_test.d.ts +2 -2
  23. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
  24. package/dest/e2e_p2p/inactivity_slash_test.js +3 -6
  25. package/dest/e2e_p2p/p2p_network.d.ts +7 -6
  26. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  27. package/dest/e2e_p2p/p2p_network.js +11 -9
  28. package/dest/e2e_p2p/shared.d.ts +2 -2
  29. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  30. package/dest/e2e_p2p/shared.js +4 -4
  31. package/dest/fixtures/e2e_prover_test.d.ts +3 -5
  32. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  33. package/dest/fixtures/e2e_prover_test.js +6 -10
  34. package/dest/fixtures/fixtures.d.ts +2 -3
  35. package/dest/fixtures/fixtures.d.ts.map +1 -1
  36. package/dest/fixtures/fixtures.js +2 -3
  37. package/dest/fixtures/get_acvm_config.js +1 -1
  38. package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
  39. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  40. package/dest/fixtures/l1_to_l2_messaging.js +2 -2
  41. package/dest/fixtures/setup_p2p_test.js +3 -3
  42. package/dest/fixtures/snapshot_manager.d.ts +6 -8
  43. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  44. package/dest/fixtures/snapshot_manager.js +27 -44
  45. package/dest/fixtures/utils.d.ts +17 -463
  46. package/dest/fixtures/utils.d.ts.map +1 -1
  47. package/dest/fixtures/utils.js +45 -77
  48. package/dest/fixtures/web3signer.js +1 -1
  49. package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
  50. package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
  51. package/dest/fixtures/with_telemetry_utils.js +2 -2
  52. package/dest/quality_of_service/grafana_client.d.ts +41 -0
  53. package/dest/quality_of_service/grafana_client.d.ts.map +1 -0
  54. package/dest/quality_of_service/{alert_checker.js → grafana_client.js} +1 -1
  55. package/dest/shared/cross_chain_test_harness.d.ts +5 -3
  56. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  57. package/dest/shared/cross_chain_test_harness.js +3 -3
  58. package/dest/shared/gas_portal_test_harness.d.ts +2 -2
  59. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  60. package/dest/shared/index.d.ts +2 -2
  61. package/dest/shared/index.d.ts.map +1 -1
  62. package/dest/shared/uniswap_l1_l2.d.ts +3 -27
  63. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  64. package/dest/shared/uniswap_l1_l2.js +43 -23
  65. package/dest/simulators/lending_simulator.d.ts +2 -2
  66. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  67. package/dest/simulators/lending_simulator.js +1 -1
  68. package/dest/spartan/setup_test_wallets.d.ts +4 -3
  69. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  70. package/dest/spartan/setup_test_wallets.js +2 -1
  71. package/dest/spartan/tx_metrics.d.ts +39 -0
  72. package/dest/spartan/tx_metrics.d.ts.map +1 -0
  73. package/dest/spartan/tx_metrics.js +95 -0
  74. package/dest/spartan/utils.d.ts +45 -10
  75. package/dest/spartan/utils.d.ts.map +1 -1
  76. package/dest/spartan/utils.js +203 -60
  77. package/package.json +40 -40
  78. package/src/bench/client_flows/client_flows_benchmark.ts +8 -5
  79. package/src/bench/client_flows/data_extractor.ts +1 -1
  80. package/src/bench/utils.ts +22 -14
  81. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +53 -31
  82. package/src/e2e_epochs/epochs_test.ts +34 -21
  83. package/src/e2e_fees/bridging_race.notest.ts +1 -1
  84. package/src/e2e_fees/fees_test.ts +13 -9
  85. package/src/e2e_l1_publisher/write_json.ts +2 -5
  86. package/src/e2e_multi_validator/utils.ts +1 -1
  87. package/src/e2e_p2p/inactivity_slash_test.ts +4 -7
  88. package/src/e2e_p2p/p2p_network.ts +10 -17
  89. package/src/e2e_p2p/shared.ts +11 -6
  90. package/src/fixtures/e2e_prover_test.ts +7 -10
  91. package/src/fixtures/fixtures.ts +2 -5
  92. package/src/fixtures/get_acvm_config.ts +1 -1
  93. package/src/fixtures/l1_to_l2_messaging.ts +4 -2
  94. package/src/fixtures/setup_p2p_test.ts +3 -3
  95. package/src/fixtures/snapshot_manager.ts +44 -63
  96. package/src/fixtures/utils.ts +74 -139
  97. package/src/fixtures/web3signer.ts +1 -1
  98. package/src/fixtures/with_telemetry_utils.ts +2 -2
  99. package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +1 -1
  100. package/src/shared/cross_chain_test_harness.ts +6 -9
  101. package/src/shared/gas_portal_test_harness.ts +1 -1
  102. package/src/shared/index.ts +1 -1
  103. package/src/shared/uniswap_l1_l2.ts +53 -67
  104. package/src/simulators/lending_simulator.ts +2 -2
  105. package/src/spartan/DEVELOP.md +7 -0
  106. package/src/spartan/setup_test_wallets.ts +9 -2
  107. package/src/spartan/tx_metrics.ts +130 -0
  108. package/src/spartan/utils.ts +267 -51
  109. package/dest/fixtures/setup_l1_contracts.d.ts +0 -477
  110. package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
  111. package/dest/fixtures/setup_l1_contracts.js +0 -17
  112. package/dest/quality_of_service/alert_checker.d.ts +0 -41
  113. package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
  114. package/src/fixtures/setup_l1_contracts.ts +0 -26
@@ -1,8 +1,9 @@
1
1
  import type { AztecNodeService } from '@aztec/aztec-node';
2
+ import { AztecAddress } from '@aztec/aztec.js/addresses';
2
3
  import { BatchCall, type SentTx, type WaitOpts } from '@aztec/aztec.js/contracts';
3
4
  import { mean, stdDev, times } from '@aztec/foundation/collection';
4
5
  import { BenchmarkingContract } from '@aztec/noir-test-contracts.js/Benchmarking';
5
- import type { MetricsType } from '@aztec/telemetry-client';
6
+ import type { MetricDefinition } from '@aztec/telemetry-client';
6
7
  import type { BenchmarkDataPoint, BenchmarkMetricsType, BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
7
8
 
8
9
  import { mkdirSync, writeFileSync } from 'fs';
@@ -15,7 +16,7 @@ import { type EndToEndContext, type SetupOptions, setup } from '../fixtures/util
15
16
  */
16
17
  export async function benchmarkSetup(
17
18
  opts: Partial<SetupOptions> & {
18
- /** What metrics to export */ metrics: (MetricsType | MetricFilter)[];
19
+ /** What metrics to export */ metrics: (MetricDefinition | MetricFilter)[];
19
20
  /** Where to output the benchmark data (defaults to BENCH_OUTPUT or bench.json) */
20
21
  benchOutput?: string;
21
22
  },
@@ -46,7 +47,7 @@ export async function benchmarkSetup(
46
47
  }
47
48
 
48
49
  type MetricFilter = {
49
- source: MetricsType;
50
+ source: MetricDefinition;
50
51
  transform: (value: number) => number;
51
52
  name: string;
52
53
  unit?: string;
@@ -61,17 +62,21 @@ export type GithubActionBenchmarkResult = {
61
62
  extra?: string;
62
63
  };
63
64
 
65
+ function isMetricDefinition(f: MetricDefinition | MetricFilter): f is MetricDefinition {
66
+ return 'description' in f;
67
+ }
68
+
64
69
  function formatMetricsForGithubBenchmarkAction(
65
70
  data: BenchmarkMetricsType,
66
- filter: (MetricsType | MetricFilter)[],
71
+ filter: (MetricDefinition | MetricFilter)[],
67
72
  ): GithubActionBenchmarkResult[] {
68
73
  const allFilters: MetricFilter[] = filter.map(f =>
69
- typeof f === 'string' ? { name: f, source: f, transform: (x: number) => x, unit: undefined } : f,
74
+ isMetricDefinition(f) ? { name: f.name, source: f, transform: (x: number) => x, unit: f.unit } : f,
70
75
  );
71
76
  return data.flatMap(meter => {
72
77
  return meter.metrics
73
- .filter(metric => allFilters.map(f => f.source).includes(metric.name as MetricsType))
74
- .map(metric => [metric, allFilters.find(f => f.source === metric.name)!] as const)
78
+ .filter(metric => allFilters.map(f => f.source.name).includes(metric.name))
79
+ .map(metric => [metric, allFilters.find(f => f.source.name === metric.name)!] as const)
75
80
  .map(([metric, filter]) => ({
76
81
  name: `${meter.name}/${filter.name}`,
77
82
  unit: filter.unit ?? metric.unit ?? 'unknown',
@@ -103,19 +108,22 @@ function getMetricValues(points: BenchmarkDataPoint[]) {
103
108
  * @param heavyPublicCompute - Whether the transactions include heavy public compute (like a big sha256).
104
109
  * @returns A BatchCall instance.
105
110
  */
106
- function makeCall(
111
+ async function makeCall(
107
112
  index: number,
108
113
  context: EndToEndContext,
109
114
  contract: BenchmarkingContract,
110
115
  heavyPublicCompute: boolean,
111
116
  ) {
112
- const [owner] = context.accounts;
113
117
  if (heavyPublicCompute) {
114
118
  return new BatchCall(context.wallet, [contract.methods.sha256_hash_1024(randomBytesAsBigInts(1024))]);
115
119
  } else {
120
+ // We use random address for the new note owner because we can emit at most UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN
121
+ // logs for a given sender-recipient-contract tuple.
122
+ const ownerOfNewNote = await AztecAddress.random();
123
+ const [ownerOfBalance] = context.accounts;
116
124
  return new BatchCall(context.wallet, [
117
- contract.methods.create_note(owner, index + 1),
118
- contract.methods.increment_balance(owner, index + 1),
125
+ contract.methods.create_note(ownerOfNewNote, index + 1),
126
+ contract.methods.increment_balance(ownerOfBalance, index + 1),
119
127
  ]);
120
128
  }
121
129
  }
@@ -129,13 +137,13 @@ function makeCall(
129
137
  * @param heavyPublicCompute - Whether the transactions include heavy public compute (like a big sha256).
130
138
  * @returns Array of sent txs.
131
139
  */
132
- export function sendTxs(
140
+ export async function sendTxs(
133
141
  txCount: number,
134
142
  context: EndToEndContext,
135
143
  contract: BenchmarkingContract,
136
144
  heavyPublicCompute: boolean = false,
137
- ): SentTx[] {
138
- const calls = times(txCount, index => makeCall(index, context, contract, heavyPublicCompute));
145
+ ): Promise<SentTx[]> {
146
+ const calls = await Promise.all(times(txCount, index => makeCall(index, context, contract, heavyPublicCompute)));
139
147
  context.logger.info(`Creating ${txCount} txs`);
140
148
  const [from] = context.accounts;
141
149
  context.logger.info(`Sending ${txCount} txs`);
@@ -1,23 +1,26 @@
1
1
  import type { AztecNodeConfig } from '@aztec/aztec-node';
2
2
  import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
3
+ import { waitForProven } from '@aztec/aztec.js/contracts';
3
4
  import { type Logger, createLogger } from '@aztec/aztec.js/log';
4
5
  import type { AztecNode } from '@aztec/aztec.js/node';
6
+ import type { TxReceipt } from '@aztec/aztec.js/tx';
5
7
  import { CheatCodes } from '@aztec/aztec/testing';
6
- import {
7
- type DeployL1ContractsArgs,
8
- type DeployL1ContractsReturnType,
9
- type ExtendedViemWalletClient,
10
- createExtendedL1Client,
11
- deployL1Contract,
12
- } from '@aztec/ethereum';
13
- import { InboxAbi, OutboxAbi, TestERC20Abi, TestERC20Bytecode } from '@aztec/l1-artifacts';
8
+ import { createExtendedL1Client } from '@aztec/ethereum/client';
9
+ import { InboxContract, OutboxContract, RollupContract } from '@aztec/ethereum/contracts';
10
+ import type {
11
+ DeployAztecL1ContractsArgs,
12
+ DeployAztecL1ContractsReturnType,
13
+ } from '@aztec/ethereum/deploy-aztec-l1-contracts';
14
+ import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contract';
15
+ import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
16
+ import { CheckpointNumber, EpochNumber } from '@aztec/foundation/branded-types';
17
+ import { sleep } from '@aztec/foundation/sleep';
18
+ import { TestERC20Abi, TestERC20Bytecode } from '@aztec/l1-artifacts';
14
19
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
15
20
  import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge';
16
21
  import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
17
22
  import type { TestWallet } from '@aztec/test-wallet/server';
18
23
 
19
- import { getContract } from 'viem';
20
-
21
24
  import { MNEMONIC } from '../fixtures/fixtures.js';
22
25
  import {
23
26
  type ISnapshotManager,
@@ -33,6 +36,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
33
36
 
34
37
  export class CrossChainMessagingTest {
35
38
  private snapshotManager: ISnapshotManager;
39
+ private requireEpochProven: boolean;
36
40
  logger: Logger;
37
41
  aztecNode!: AztecNode;
38
42
  aztecNodeConfig!: AztecNodeConfig;
@@ -50,22 +54,24 @@ export class CrossChainMessagingTest {
50
54
  l2Token!: TokenContract;
51
55
  l2Bridge!: TokenBridgeContract;
52
56
 
53
- inbox!: any; // GetContractReturnType<typeof InboxAbi> | undefined;
54
- outbox!: any; // GetContractReturnType<typeof OutboxAbi> | undefined;
57
+ rollup!: RollupContract;
58
+ inbox!: InboxContract;
59
+ outbox!: OutboxContract;
55
60
  cheatCodes!: CheatCodes;
56
61
 
57
- deployL1ContractsValues!: DeployL1ContractsReturnType;
62
+ deployL1ContractsValues!: DeployAztecL1ContractsReturnType;
58
63
 
59
- constructor(testName: string, opts: SetupOptions = {}, deployL1ContractsArgs: Partial<DeployL1ContractsArgs> = {}) {
64
+ constructor(
65
+ testName: string,
66
+ opts: SetupOptions = {},
67
+ deployL1ContractsArgs: Partial<DeployAztecL1ContractsArgs> = {},
68
+ ) {
60
69
  this.logger = createLogger(`e2e:e2e_cross_chain_messaging:${testName}`);
61
70
  this.snapshotManager = createSnapshotManager(`e2e_cross_chain_messaging/${testName}`, dataPath, opts, {
62
71
  initialValidators: [],
63
72
  ...deployL1ContractsArgs,
64
73
  });
65
- }
66
-
67
- async assumeProven() {
68
- await this.cheatCodes.rollup.markAsProven();
74
+ this.requireEpochProven = opts.startProverNode ?? false;
69
75
  }
70
76
 
71
77
  async setup() {
@@ -76,6 +82,30 @@ export class CrossChainMessagingTest {
76
82
  this.cheatCodes = this.ctx.cheatCodes;
77
83
  this.deployL1ContractsValues = this.ctx.deployL1ContractsValues;
78
84
  this.aztecNodeAdmin = this.ctx.aztecNode;
85
+
86
+ if (this.requireEpochProven) {
87
+ // Turn off the watcher to prevent it from keep marking blocks as proven.
88
+ this.ctx.watcher.setIsMarkingAsProven(false);
89
+ }
90
+ }
91
+
92
+ async advanceToEpochProven(l2TxReceipt: TxReceipt): Promise<EpochNumber> {
93
+ const epoch = await this.rollup.getEpochNumberForCheckpoint(
94
+ CheckpointNumber.fromBlockNumber(l2TxReceipt.blockNumber!),
95
+ );
96
+ // Warp to the next epoch.
97
+ await this.cheatCodes.rollup.advanceToEpoch(EpochNumber(epoch + 1));
98
+ // Wait for the tx to be proven.
99
+ await waitForProven(this.aztecNode, l2TxReceipt, { provenTimeout: 300 });
100
+ // Return the epoch the tx is in.
101
+ return epoch;
102
+ }
103
+
104
+ async catchUpProvenChain() {
105
+ const bn = await this.aztecNode.getBlockNumber();
106
+ while ((await this.aztecNode.getProvenBlockNumber()) < bn) {
107
+ await sleep(1000);
108
+ }
79
109
  }
80
110
 
81
111
  snapshot = <T>(
@@ -143,17 +173,12 @@ export class CrossChainMessagingTest {
143
173
  const tokenPortalAddress = EthAddress.fromString(crossChainContext.tokenPortal.toString());
144
174
 
145
175
  const l1Client = createExtendedL1Client(this.aztecNodeConfig.l1RpcUrls, MNEMONIC);
176
+ this.l1Client = l1Client;
146
177
 
147
- const inbox = getContract({
148
- address: this.aztecNodeConfig.l1Contracts.inboxAddress.toString(),
149
- abi: InboxAbi,
150
- client: l1Client,
151
- });
152
- const outbox = getContract({
153
- address: this.aztecNodeConfig.l1Contracts.outboxAddress.toString(),
154
- abi: OutboxAbi,
155
- client: l1Client,
156
- });
178
+ const l1Contracts = this.aztecNodeConfig.l1Contracts;
179
+ this.rollup = new RollupContract(l1Client, l1Contracts.rollupAddress.toString());
180
+ this.inbox = new InboxContract(l1Client, l1Contracts.inboxAddress.toString());
181
+ this.outbox = new OutboxContract(l1Client, l1Contracts.outboxAddress.toString());
157
182
 
158
183
  this.crossChainTestHarness = new CrossChainTestHarness(
159
184
  this.aztecNode,
@@ -169,9 +194,6 @@ export class CrossChainMessagingTest {
169
194
  this.ownerAddress,
170
195
  );
171
196
 
172
- this.l1Client = l1Client;
173
- this.inbox = inbox;
174
- this.outbox = outbox;
175
197
  return Promise.resolve();
176
198
  },
177
199
  );
@@ -6,12 +6,14 @@ import type { Logger } from '@aztec/aztec.js/log';
6
6
  import { MerkleTreeId } from '@aztec/aztec.js/trees';
7
7
  import type { Wallet } from '@aztec/aztec.js/wallet';
8
8
  import { EpochCache } from '@aztec/epoch-cache';
9
- import { DefaultL1ContractsConfig, type ExtendedViemWalletClient, createExtendedL1Client } from '@aztec/ethereum';
9
+ import { createExtendedL1Client } from '@aztec/ethereum/client';
10
+ import { DefaultL1ContractsConfig } from '@aztec/ethereum/config';
10
11
  import { RollupContract } from '@aztec/ethereum/contracts';
11
12
  import { ChainMonitor, DelayedTxUtils, type Delayer, waitUntilL1Timestamp, withDelayer } from '@aztec/ethereum/test';
12
- import { EpochNumber } from '@aztec/foundation/branded-types';
13
+ import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
14
+ import { BlockNumber, CheckpointNumber, EpochNumber } from '@aztec/foundation/branded-types';
13
15
  import { SecretValue } from '@aztec/foundation/config';
14
- import { randomBytes } from '@aztec/foundation/crypto';
16
+ import { randomBytes } from '@aztec/foundation/crypto/random';
15
17
  import { withLogNameSuffix } from '@aztec/foundation/log';
16
18
  import { retryUntil } from '@aztec/foundation/retry';
17
19
  import { sleep } from '@aztec/foundation/sleep';
@@ -26,7 +28,7 @@ import {
26
28
  SequencerState,
27
29
  } from '@aztec/sequencer-client';
28
30
  import type { TestSequencerClient } from '@aztec/sequencer-client/test';
29
- import { EthAddress, type L2BlockNumber } from '@aztec/stdlib/block';
31
+ import { type BlockParameter, EthAddress } from '@aztec/stdlib/block';
30
32
  import { type L1RollupConstants, getProofSubmissionDeadlineTimestamp } from '@aztec/stdlib/epoch-helpers';
31
33
  import { tryStop } from '@aztec/stdlib/interfaces/server';
32
34
 
@@ -95,12 +97,24 @@ export class EpochsTestContext {
95
97
  const aztecSlotDuration = opts.aztecSlotDuration ?? ethereumSlotDuration * 2;
96
98
  const aztecEpochDuration = opts.aztecEpochDuration ?? 6;
97
99
  const aztecProofSubmissionEpochs = opts.aztecProofSubmissionEpochs ?? 1;
98
- return { ethereumSlotDuration, aztecSlotDuration, aztecEpochDuration, aztecProofSubmissionEpochs };
100
+ const l1PublishingTime = opts.l1PublishingTime ?? 1;
101
+ return {
102
+ l1PublishingTime,
103
+ ethereumSlotDuration,
104
+ aztecSlotDuration,
105
+ aztecEpochDuration,
106
+ aztecProofSubmissionEpochs,
107
+ };
99
108
  }
100
109
 
101
110
  public async setup(opts: EpochsTestOpts = {}) {
102
- const { ethereumSlotDuration, aztecSlotDuration, aztecEpochDuration, aztecProofSubmissionEpochs } =
103
- EpochsTestContext.getSlotDurations(opts);
111
+ const {
112
+ ethereumSlotDuration,
113
+ aztecSlotDuration,
114
+ aztecEpochDuration,
115
+ aztecProofSubmissionEpochs,
116
+ l1PublishingTime,
117
+ } = EpochsTestContext.getSlotDurations(opts);
104
118
 
105
119
  this.L1_BLOCK_TIME_IN_S = ethereumSlotDuration;
106
120
  this.L2_SLOT_DURATION_IN_S = aztecSlotDuration;
@@ -112,8 +126,6 @@ export class EpochsTestContext {
112
126
  checkIntervalMs: 50,
113
127
  archiverPollingIntervalMS: ARCHIVER_POLL_INTERVAL,
114
128
  worldStateBlockCheckIntervalMS: WORLD_STATE_BLOCK_CHECK_INTERVAL,
115
- skipProtocolContracts: true,
116
- salt: 1,
117
129
  aztecEpochDuration,
118
130
  aztecSlotDuration,
119
131
  ethereumSlotDuration,
@@ -130,6 +142,7 @@ export class EpochsTestContext {
130
142
  worldStateBlockHistory: WORLD_STATE_BLOCK_HISTORY,
131
143
  exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
132
144
  slasherFlavor: 'none',
145
+ l1PublishingTime,
133
146
  ...opts,
134
147
  });
135
148
 
@@ -291,21 +304,21 @@ export class EpochsTestContext {
291
304
  return start;
292
305
  }
293
306
 
294
- /** Waits until the given L2 block number is mined. */
295
- public async waitUntilL2BlockNumber(target: number, timeout = 60) {
307
+ /** Waits until the given checkpoint number is mined. */
308
+ public async waitUntilCheckpointNumber(target: CheckpointNumber, timeout = 120) {
296
309
  await retryUntil(
297
310
  () => Promise.resolve(target <= this.monitor.checkpointNumber),
298
- `Wait until L2 block ${target}`,
311
+ `Wait until checkpoint ${target}`,
299
312
  timeout,
300
313
  0.1,
301
314
  );
302
315
  }
303
316
 
304
- /** Waits until the given L2 block number is marked as proven. */
305
- public async waitUntilProvenL2BlockNumber(t: number, timeout = 60) {
317
+ /** Waits until the given checkpoint number is marked as proven. */
318
+ public async waitUntilProvenCheckpointNumber(target: CheckpointNumber, timeout = 120) {
306
319
  await retryUntil(
307
- () => Promise.resolve(t <= this.monitor.provenCheckpointNumber),
308
- `Wait proven L2 block ${t}`,
320
+ () => Promise.resolve(target <= this.monitor.provenCheckpointNumber),
321
+ `Wait proven checkpoint ${target}`,
309
322
  timeout,
310
323
  0.1,
311
324
  );
@@ -324,7 +337,7 @@ export class EpochsTestContext {
324
337
  }
325
338
 
326
339
  /** Waits for the aztec node to sync to the target block number. */
327
- public async waitForNodeToSync(blockNumber: number, type: 'proven' | 'finalized' | 'historic') {
340
+ public async waitForNodeToSync(blockNumber: BlockNumber, type: 'proven' | 'finalized' | 'historic') {
328
341
  const waitTime = ARCHIVER_POLL_INTERVAL + WORLD_STATE_BLOCK_CHECK_INTERVAL;
329
342
  let synched = false;
330
343
  while (!synched) {
@@ -335,7 +348,7 @@ export class EpochsTestContext {
335
348
  ]);
336
349
  this.logger.info(`Wait for node synch ${blockNumber} ${type}`, { blockNumber, type, syncState, tips });
337
350
  if (type === 'proven') {
338
- synched = tips.proven.number >= blockNumber && syncState.latestBlockNumber >= blockNumber;
351
+ synched = tips.proven.block.number >= blockNumber && syncState.latestBlockNumber >= blockNumber;
339
352
  } else if (type === 'finalized') {
340
353
  synched = syncState.finalizedBlockNumber >= blockNumber;
341
354
  } else {
@@ -373,7 +386,7 @@ export class EpochsTestContext {
373
386
  }
374
387
 
375
388
  /** Verifies whether the given block number is found on the aztec node. */
376
- public async verifyHistoricBlock(blockNumber: L2BlockNumber, expectedSuccess: boolean) {
389
+ public async verifyHistoricBlock(blockNumber: BlockParameter, expectedSuccess: boolean) {
377
390
  // We use `findLeavesIndexes` here, but could use any function that queries the world-state
378
391
  // at a particular block, so we know whether that historic block is available or has been
379
392
  // pruned. Note that `getBlock` would not work here, since it only hits the archiver.
@@ -391,11 +404,11 @@ export class EpochsTestContext {
391
404
  const stateChanges: TrackedSequencerEvent[] = [];
392
405
  const failEvents: TrackedSequencerEvent[] = [];
393
406
 
394
- // Note we do not include the 'tx-count-check-failed' event here, since it is fine if we dont build
407
+ // Note we do not include the 'block-tx-count-check-failed' event here, since it is fine if we dont build
395
408
  // due to lack of txs available.
396
409
  const failEventsKeys: (keyof SequencerEvents)[] = [
397
410
  'block-build-failed',
398
- 'block-publish-failed',
411
+ 'checkpoint-publish-failed',
399
412
  'proposer-rollup-check-failed',
400
413
  ];
401
414
 
@@ -1,7 +1,7 @@
1
1
  import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
2
2
  import { Fr } from '@aztec/aztec.js/fields';
3
3
  import type { Logger } from '@aztec/aztec.js/log';
4
- import { Fq } from '@aztec/foundation/fields';
4
+ import { Fq } from '@aztec/foundation/curves/bn254';
5
5
  import { sleep } from '@aztec/foundation/sleep';
6
6
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
7
7
  import type { TestWallet } from '@aztec/test-wallet/server';
@@ -2,8 +2,11 @@ import type { AztecAddress } from '@aztec/aztec.js/addresses';
2
2
  import { type Logger, createLogger } from '@aztec/aztec.js/log';
3
3
  import type { AztecNode } from '@aztec/aztec.js/node';
4
4
  import { CheatCodes } from '@aztec/aztec/testing';
5
- import { type DeployL1ContractsArgs, RollupContract, createExtendedL1Client } from '@aztec/ethereum';
5
+ import { createExtendedL1Client } from '@aztec/ethereum/client';
6
+ import { RollupContract } from '@aztec/ethereum/contracts';
7
+ import type { DeployAztecL1ContractsArgs } from '@aztec/ethereum/deploy-aztec-l1-contracts';
6
8
  import { ChainMonitor } from '@aztec/ethereum/test';
9
+ import { BlockNumber } from '@aztec/foundation/branded-types';
7
10
  import { EthAddress } from '@aztec/foundation/eth-address';
8
11
  import { sleep } from '@aztec/foundation/sleep';
9
12
  import { TestERC20Abi } from '@aztec/l1-artifacts';
@@ -16,6 +19,7 @@ import { CounterContract } from '@aztec/noir-test-contracts.js/Counter';
16
19
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
17
20
  import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
18
21
  import { GasSettings } from '@aztec/stdlib/gas';
22
+ import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
19
23
  import { TestWallet } from '@aztec/test-wallet/server';
20
24
 
21
25
  import { getContract } from 'viem';
@@ -55,6 +59,7 @@ export class FeesTest {
55
59
 
56
60
  public logger: Logger;
57
61
  public aztecNode!: AztecNode;
62
+ public aztecNodeAdmin!: AztecNodeAdmin;
58
63
  public cheatCodes!: CheatCodes;
59
64
 
60
65
  public wallet!: TestWallet;
@@ -85,7 +90,7 @@ export class FeesTest {
85
90
  public getGasBalanceFn!: BalancesFn;
86
91
  public getBananaPublicBalanceFn!: BalancesFn;
87
92
  public getBananaPrivateBalanceFn!: BalancesFn;
88
- public getProverFee!: (blockNumber: number) => Promise<bigint>;
93
+ public getProverFee!: (blockNumber: BlockNumber) => Promise<bigint>;
89
94
 
90
95
  public readonly ALICE_INITIAL_BANANAS = BigInt(1e22);
91
96
  public readonly SUBSCRIPTION_AMOUNT = BigInt(1e19);
@@ -94,7 +99,7 @@ export class FeesTest {
94
99
  constructor(
95
100
  testName: string,
96
101
  private numberOfAccounts = 3,
97
- setupOptions: Partial<SetupOptions & DeployL1ContractsArgs> = {},
102
+ setupOptions: Partial<SetupOptions & DeployAztecL1ContractsArgs> = {},
98
103
  ) {
99
104
  if (!numberOfAccounts) {
100
105
  throw new Error('There must be at least 1 initial account.');
@@ -139,9 +144,7 @@ export class FeesTest {
139
144
  const blockReward = await this.rollupContract.getCheckpointReward();
140
145
  const rewardConfig = await this.rollupContract.getRewardConfig();
141
146
 
142
- const balance = await this.feeJuiceBridgeTestHarness.getL1FeeJuiceBalance(
143
- EthAddress.fromString(rewardConfig.rewardDistributor),
144
- );
147
+ const balance = await this.feeJuiceBridgeTestHarness.getL1FeeJuiceBalance(rewardConfig.rewardDistributor);
145
148
 
146
149
  const toDistribute = balance > blockReward ? blockReward : balance;
147
150
  const sequencerBlockRewards = (toDistribute * BigInt(rewardConfig.sequencerBps)) / 10000n;
@@ -187,7 +190,8 @@ export class FeesTest {
187
190
  async ({ deployedAccounts }, { wallet, aztecNode, cheatCodes }) => {
188
191
  this.wallet = wallet;
189
192
  this.aztecNode = aztecNode;
190
- this.gasSettings = GasSettings.default({ maxFeesPerGas: (await this.aztecNode.getCurrentBaseFees()).mul(2) });
193
+ this.aztecNodeAdmin = aztecNode;
194
+ this.gasSettings = GasSettings.default({ maxFeesPerGas: (await this.aztecNode.getCurrentMinFees()).mul(2) });
191
195
  this.cheatCodes = cheatCodes;
192
196
  this.accounts = deployedAccounts.map(a => a.address);
193
197
  this.accounts.forEach((a, i) => this.logger.verbose(`Account ${i} address: ${a}`));
@@ -306,7 +310,7 @@ export class FeesTest {
306
310
  return await this.rollupContract.getSequencerRewards(this.coinbase);
307
311
  };
308
312
 
309
- this.getProverFee = async (blockNumber: number) => {
313
+ this.getProverFee = async (blockNumber: BlockNumber) => {
310
314
  const block = await this.aztecNode.getBlock(blockNumber);
311
315
 
312
316
  // @todo @lherskind As we deal with #13601
@@ -319,7 +323,7 @@ export class FeesTest {
319
323
  const { baseFee } = await this.rollupContract.getL1FeesAt(block!.header.globalVariables.timestamp);
320
324
  const proverCost =
321
325
  mulDiv(
322
- mulDiv(L1_GAS_PER_EPOCH_VERIFIED, baseFee, await this.rollupContract.getEpochDuration()),
326
+ mulDiv(L1_GAS_PER_EPOCH_VERIFIED, baseFee, BigInt(await this.rollupContract.getEpochDuration())),
323
327
  1n,
324
328
  await this.rollupContract.getManaTarget(),
325
329
  ) + (await this.rollupContract.getProvingCostPerMana());
@@ -52,11 +52,8 @@ export async function writeJson(
52
52
  header: {
53
53
  lastArchiveRoot: asHex(block.header.lastArchive.root),
54
54
  blockHeadersHash: asHex(block.header.blockHeadersHash),
55
- contentCommitment: {
56
- blobsHash: asHex(block.header.contentCommitment.blobsHash),
57
- inHash: asHex(block.header.contentCommitment.inHash),
58
- outHash: asHex(block.header.contentCommitment.outHash),
59
- },
55
+ blobsHash: asHex(block.header.blobsHash),
56
+ inHash: asHex(block.header.inHash),
60
57
  slotNumber: Number(block.header.globalVariables.slotNumber),
61
58
  timestamp: Number(block.header.globalVariables.timestamp),
62
59
  coinbase: asHex(block.header.globalVariables.coinbase, 40),
@@ -1,5 +1,5 @@
1
1
  import { AztecAddress } from '@aztec/aztec.js/addresses';
2
- import { getAddressFromPrivateKey } from '@aztec/ethereum';
2
+ import { getAddressFromPrivateKey } from '@aztec/ethereum/account';
3
3
  import { EthAddress } from '@aztec/foundation/eth-address';
4
4
  import type { EthPrivateKey } from '@aztec/node-keystore';
5
5
 
@@ -1,6 +1,6 @@
1
1
  import type { AztecNodeService } from '@aztec/aztec-node';
2
2
  import { EthAddress } from '@aztec/aztec.js/addresses';
3
- import { RollupContract } from '@aztec/ethereum';
3
+ import { RollupContract } from '@aztec/ethereum/contracts';
4
4
  import { EpochNumber } from '@aztec/foundation/branded-types';
5
5
 
6
6
  import fs from 'fs';
@@ -24,7 +24,7 @@ const SLASHING_UNIT = BigInt(1e18);
24
24
  const SLASHING_AMOUNT = SLASHING_UNIT * 3n;
25
25
 
26
26
  // How many epochs it may take to set everything up, so we dont slash during this period
27
- const SETUP_EPOCH_DURATION = 5;
27
+ const SETUP_EPOCH_DURATION = 8;
28
28
 
29
29
  export class P2PInactivityTest {
30
30
  public nodes!: AztecNodeService[];
@@ -151,11 +151,8 @@ export class P2PInactivityTest {
151
151
  // This prevents race conditions where validators propose blocks before the network is ready
152
152
  await this.test.waitForP2PMeshConnectivity(this.nodes, NUM_NODES);
153
153
 
154
- const ethereumSlotDuration = this.test.ctx.aztecNodeConfig.ethereumSlotDuration!;
155
- this.test.logger.warn(`Advancing to the L1 slot before epoch ${SETUP_EPOCH_DURATION + 1} to start slashing`);
156
- await this.test.ctx.cheatCodes.rollup.advanceToEpoch(EpochNumber(SETUP_EPOCH_DURATION + 1), {
157
- offset: -ethereumSlotDuration,
158
- });
154
+ this.test.logger.warn(`Advancing to epoch ${SETUP_EPOCH_DURATION - 1} (slashing will start after it is completed)`);
155
+ await this.test.ctx.cheatCodes.rollup.advanceToEpoch(EpochNumber(SETUP_EPOCH_DURATION - 1));
159
156
 
160
157
  return this;
161
158
  }
@@ -2,20 +2,19 @@ import type { InitialAccountData } from '@aztec/accounts/testing';
2
2
  import type { AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
3
3
  import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
4
4
  import { Fr } from '@aztec/aztec.js/fields';
5
+ import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
5
6
  import {
6
7
  type EmpireSlashingProposerContract,
7
- type ExtendedViemWalletClient,
8
8
  GSEContract,
9
- MultiAdderArtifact,
10
- type Operator,
11
9
  RollupContract,
12
10
  type TallySlashingProposerContract,
13
- type ViemClient,
14
- createL1TxUtilsFromViemWallet,
15
- deployL1Contract,
16
- getL1ContractsConfigEnvVars,
17
- } from '@aztec/ethereum';
11
+ } from '@aztec/ethereum/contracts';
12
+ import type { Operator } from '@aztec/ethereum/deploy-aztec-l1-contracts';
13
+ import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contract';
14
+ import { MultiAdderArtifact } from '@aztec/ethereum/l1-artifacts';
15
+ import { createL1TxUtilsFromViemWallet } from '@aztec/ethereum/l1-tx-utils';
18
16
  import { ChainMonitor } from '@aztec/ethereum/test';
17
+ import type { ExtendedViemWalletClient, ViemClient } from '@aztec/ethereum/types';
19
18
  import { EpochNumber } from '@aztec/foundation/branded-types';
20
19
  import { SecretValue } from '@aztec/foundation/config';
21
20
  import { type Logger, createLogger } from '@aztec/foundation/log';
@@ -94,7 +93,6 @@ export class P2PNetworkTest {
94
93
  // If set enable metrics collection
95
94
  private metricsPort?: number,
96
95
  startProverNode?: boolean,
97
- mockZkPassportVerifier?: boolean,
98
96
  ) {
99
97
  this.logger = createLogger(`e2e:e2e_p2p:${testName}`);
100
98
 
@@ -123,7 +121,6 @@ export class P2PNetworkTest {
123
121
  initialValidatorConfig.slashingRoundSizeInEpochs ?? l1ContractsConfig.slashingRoundSizeInEpochs,
124
122
  slasherFlavor: initialValidatorConfig.slasherFlavor ?? 'tally',
125
123
  aztecTargetCommitteeSize: numberOfValidators,
126
- salt: 420,
127
124
  metricsPort: metricsPort,
128
125
  numberOfInitialFundedAccounts: 2,
129
126
  startProverNode,
@@ -142,7 +139,6 @@ export class P2PNetworkTest {
142
139
  aztecTargetCommitteeSize: numberOfValidators,
143
140
  initialValidators: [],
144
141
  zkPassportArgs: {
145
- mockZkPassportVerifier,
146
142
  zkPassportDomain: zkPassportParams.domain,
147
143
  zkPassportScope: zkPassportParams.scope,
148
144
  },
@@ -158,7 +154,6 @@ export class P2PNetworkTest {
158
154
  metricsPort,
159
155
  initialConfig,
160
156
  startProverNode,
161
- mockZkPassportVerifier,
162
157
  }: {
163
158
  testName: string;
164
159
  numberOfNodes: number;
@@ -167,7 +162,6 @@ export class P2PNetworkTest {
167
162
  metricsPort?: number;
168
163
  initialConfig?: SetupOptions;
169
164
  startProverNode?: boolean;
170
- mockZkPassportVerifier?: boolean;
171
165
  }) {
172
166
  const port = basePort || (await getPort());
173
167
 
@@ -188,7 +182,6 @@ export class P2PNetworkTest {
188
182
  numberOfNodes,
189
183
  metricsPort,
190
184
  startProverNode,
191
- mockZkPassportVerifier,
192
185
  );
193
186
  }
194
187
 
@@ -201,7 +194,7 @@ export class P2PNetworkTest {
201
194
 
202
195
  async addBootstrapNode() {
203
196
  await this.snapshotManager.snapshot('add-bootstrap-node', async ({ aztecNodeConfig }) => {
204
- const telemetry = getEndToEndTestTelemetryClient(this.metricsPort);
197
+ const telemetry = await getEndToEndTestTelemetryClient(this.metricsPort);
205
198
  this.bootstrapNode = await createBootstrapNodeFromPrivateKey(
206
199
  BOOTSTRAP_NODE_PRIVATE_KEY,
207
200
  this.bootNodePort,
@@ -449,7 +442,7 @@ export class P2PNetworkTest {
449
442
  slashFactory: SlashFactoryContract;
450
443
  }> {
451
444
  if (!this.ctx.deployL1ContractsValues) {
452
- throw new Error('DeployL1ContractsValues not set');
445
+ throw new Error('DeployAztecL1ContractsValues not set');
453
446
  }
454
447
 
455
448
  const rollup = new RollupContract(
@@ -458,7 +451,7 @@ export class P2PNetworkTest {
458
451
  );
459
452
 
460
453
  const slasherContract = getContract({
461
- address: getAddress(await rollup.getSlasherAddress()),
454
+ address: getAddress((await rollup.getSlasherAddress()).toString()),
462
455
  abi: SlasherAbi,
463
456
  client: this.ctx.deployL1ContractsValues.l1Client,
464
457
  });