@aztec/end-to-end 2.1.0-rc.9 → 3.0.0-devnet.2

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 (135) hide show
  1. package/dest/bench/client_flows/benchmark.d.ts +3 -2
  2. package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/client_flows_benchmark.d.ts +16 -12
  4. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  5. package/dest/bench/client_flows/client_flows_benchmark.js +54 -58
  6. package/dest/bench/utils.d.ts +2 -11
  7. package/dest/bench/utils.d.ts.map +1 -1
  8. package/dest/bench/utils.js +10 -34
  9. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +7 -7
  10. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  11. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +42 -42
  12. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +10 -8
  13. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  14. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +31 -33
  15. package/dest/e2e_deploy_contract/deploy_test.d.ts +10 -4
  16. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  17. package/dest/e2e_deploy_contract/deploy_test.js +9 -18
  18. package/dest/e2e_epochs/epochs_test.d.ts +3 -1
  19. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  20. package/dest/e2e_epochs/epochs_test.js +10 -9
  21. package/dest/e2e_fees/bridging_race.notest.js +12 -9
  22. package/dest/e2e_fees/fees_test.d.ts +5 -5
  23. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  24. package/dest/e2e_fees/fees_test.js +23 -31
  25. package/dest/e2e_l1_publisher/write_json.d.ts +3 -1
  26. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  27. package/dest/e2e_l1_publisher/write_json.js +5 -5
  28. package/dest/e2e_multi_validator/utils.d.ts +1 -1
  29. package/dest/e2e_multi_validator/utils.d.ts.map +1 -1
  30. package/dest/e2e_nested_contract/nested_contract_test.d.ts +6 -3
  31. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  32. package/dest/e2e_nested_contract/nested_contract_test.js +7 -9
  33. package/dest/e2e_p2p/inactivity_slash_test.d.ts +2 -2
  34. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
  35. package/dest/e2e_p2p/inactivity_slash_test.js +5 -2
  36. package/dest/e2e_p2p/p2p_network.d.ts +16 -4
  37. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  38. package/dest/e2e_p2p/p2p_network.js +32 -10
  39. package/dest/e2e_p2p/shared.d.ts +11 -13
  40. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  41. package/dest/e2e_p2p/shared.js +49 -45
  42. package/dest/e2e_token_contract/token_contract_test.d.ts +5 -4
  43. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  44. package/dest/e2e_token_contract/token_contract_test.js +14 -17
  45. package/dest/fixtures/e2e_prover_test.d.ts +8 -6
  46. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  47. package/dest/fixtures/e2e_prover_test.js +40 -50
  48. package/dest/fixtures/get_acvm_config.d.ts +1 -1
  49. package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
  50. package/dest/fixtures/get_bb_config.d.ts +1 -1
  51. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  52. package/dest/fixtures/get_bb_config.js +2 -2
  53. package/dest/fixtures/setup_l1_contracts.d.ts +1 -1
  54. package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
  55. package/dest/fixtures/setup_l1_contracts.js +2 -2
  56. package/dest/fixtures/setup_p2p_test.d.ts +0 -7
  57. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  58. package/dest/fixtures/snapshot_manager.d.ts +10 -7
  59. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  60. package/dest/fixtures/snapshot_manager.js +44 -34
  61. package/dest/fixtures/token_utils.d.ts +6 -4
  62. package/dest/fixtures/token_utils.d.ts.map +1 -1
  63. package/dest/fixtures/token_utils.js +11 -15
  64. package/dest/fixtures/utils.d.ts +23 -27
  65. package/dest/fixtures/utils.d.ts.map +1 -1
  66. package/dest/fixtures/utils.js +76 -101
  67. package/dest/fixtures/web3signer.d.ts +1 -1
  68. package/dest/fixtures/web3signer.d.ts.map +1 -1
  69. package/dest/fixtures/web3signer.js +16 -5
  70. package/dest/quality_of_service/alert_checker.d.ts +1 -1
  71. package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
  72. package/dest/shared/cross_chain_test_harness.d.ts +16 -10
  73. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  74. package/dest/shared/cross_chain_test_harness.js +13 -15
  75. package/dest/shared/gas_portal_test_harness.d.ts +9 -6
  76. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  77. package/dest/shared/gas_portal_test_harness.js +10 -7
  78. package/dest/shared/jest_setup.js +1 -1
  79. package/dest/shared/submit-transactions.d.ts +5 -3
  80. package/dest/shared/submit-transactions.d.ts.map +1 -1
  81. package/dest/shared/submit-transactions.js +8 -7
  82. package/dest/shared/uniswap_l1_l2.d.ts +9 -6
  83. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  84. package/dest/shared/uniswap_l1_l2.js +29 -45
  85. package/dest/simulators/lending_simulator.d.ts +2 -1
  86. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  87. package/dest/simulators/lending_simulator.js +3 -2
  88. package/dest/simulators/token_simulator.d.ts +3 -1
  89. package/dest/simulators/token_simulator.d.ts.map +1 -1
  90. package/dest/simulators/token_simulator.js +2 -2
  91. package/dest/spartan/setup_test_wallets.d.ts +19 -13
  92. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  93. package/dest/spartan/setup_test_wallets.js +108 -85
  94. package/dest/spartan/utils.d.ts +44 -0
  95. package/dest/spartan/utils.d.ts.map +1 -1
  96. package/dest/spartan/utils.js +212 -20
  97. package/package.json +38 -37
  98. package/src/bench/client_flows/benchmark.ts +6 -6
  99. package/src/bench/client_flows/client_flows_benchmark.ts +62 -82
  100. package/src/bench/client_flows/data_extractor.ts +1 -1
  101. package/src/bench/utils.ts +9 -37
  102. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +46 -63
  103. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +33 -47
  104. package/src/e2e_deploy_contract/deploy_test.ts +17 -35
  105. package/src/e2e_epochs/epochs_test.ts +12 -14
  106. package/src/e2e_fees/bridging_race.notest.ts +14 -9
  107. package/src/e2e_fees/fees_test.ts +26 -38
  108. package/src/e2e_l1_publisher/write_json.ts +8 -6
  109. package/src/e2e_multi_validator/utils.ts +1 -1
  110. package/src/e2e_nested_contract/nested_contract_test.ts +11 -10
  111. package/src/e2e_p2p/inactivity_slash_test.ts +7 -3
  112. package/src/e2e_p2p/p2p_network.ts +105 -67
  113. package/src/e2e_p2p/shared.ts +50 -55
  114. package/src/e2e_token_contract/token_contract_test.ts +17 -17
  115. package/src/fixtures/e2e_prover_test.ts +51 -88
  116. package/src/fixtures/get_acvm_config.ts +1 -1
  117. package/src/fixtures/get_bb_config.ts +3 -2
  118. package/src/fixtures/setup_l1_contracts.ts +3 -3
  119. package/src/fixtures/setup_p2p_test.ts +0 -8
  120. package/src/fixtures/snapshot_manager.ts +61 -61
  121. package/src/fixtures/token_utils.ts +13 -21
  122. package/src/fixtures/utils.ts +87 -138
  123. package/src/fixtures/web3signer.ts +22 -5
  124. package/src/guides/up_quick_start.sh +2 -10
  125. package/src/quality_of_service/alert_checker.ts +1 -1
  126. package/src/shared/cross_chain_test_harness.ts +18 -29
  127. package/src/shared/gas_portal_test_harness.ts +12 -19
  128. package/src/shared/jest_setup.ts +1 -1
  129. package/src/shared/submit-transactions.ts +12 -8
  130. package/src/shared/uniswap_l1_l2.ts +61 -67
  131. package/src/simulators/lending_simulator.ts +3 -2
  132. package/src/simulators/token_simulator.ts +5 -2
  133. package/src/spartan/DEVELOP.md +8 -3
  134. package/src/spartan/setup_test_wallets.ts +133 -126
  135. package/src/spartan/utils.ts +268 -18
@@ -1,17 +1,10 @@
1
- import { getSchnorrWallet } from '@aztec/accounts/schnorr';
2
1
  import type { AztecNodeConfig } from '@aztec/aztec-node';
3
- import {
4
- type AccountWallet,
5
- AztecAddress,
6
- type AztecNode,
7
- type CompleteAddress,
8
- EthAddress,
9
- type Logger,
10
- type PXE,
11
- createLogger,
12
- } from '@aztec/aztec.js';
2
+ import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
3
+ import { type Logger, createLogger } from '@aztec/aztec.js/log';
4
+ import type { AztecNode } from '@aztec/aztec.js/node';
13
5
  import { CheatCodes } from '@aztec/aztec/testing';
14
6
  import {
7
+ type DeployL1ContractsArgs,
15
8
  type DeployL1ContractsReturnType,
16
9
  type ExtendedViemWalletClient,
17
10
  createExtendedL1Client,
@@ -21,6 +14,7 @@ import { InboxAbi, OutboxAbi, TestERC20Abi, TestERC20Bytecode } from '@aztec/l1-
21
14
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
22
15
  import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge';
23
16
  import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
17
+ import type { TestWallet } from '@aztec/test-wallet/server';
24
18
 
25
19
  import { getContract } from 'viem';
26
20
 
@@ -32,6 +26,7 @@ import {
32
26
  deployAccounts,
33
27
  publicDeployAccounts,
34
28
  } from '../fixtures/snapshot_manager.js';
29
+ import type { SetupOptions } from '../fixtures/utils.js';
35
30
  import { CrossChainTestHarness } from '../shared/cross_chain_test_harness.js';
36
31
 
37
32
  const { E2E_DATA_PATH: dataPath } = process.env;
@@ -39,21 +34,19 @@ const { E2E_DATA_PATH: dataPath } = process.env;
39
34
  export class CrossChainMessagingTest {
40
35
  private snapshotManager: ISnapshotManager;
41
36
  logger: Logger;
42
- accounts: CompleteAddress[] = [];
43
37
  aztecNode!: AztecNode;
44
- pxe!: PXE;
45
38
  aztecNodeConfig!: AztecNodeConfig;
46
39
  aztecNodeAdmin!: AztecNodeAdmin;
40
+ ctx!: SubsystemsContext;
47
41
 
48
42
  l1Client!: ExtendedViemWalletClient | undefined;
49
43
 
50
- user1Wallet!: AccountWallet;
44
+ wallet!: TestWallet;
45
+ ownerAddress!: AztecAddress;
51
46
  user1Address!: AztecAddress;
52
- user2Wallet!: AccountWallet;
53
47
  user2Address!: AztecAddress;
54
48
  crossChainTestHarness!: CrossChainTestHarness;
55
49
  ethAccount!: EthAddress;
56
- ownerAddress!: AztecAddress;
57
50
  l2Token!: TokenContract;
58
51
  l2Bridge!: TokenBridgeContract;
59
52
 
@@ -63,9 +56,12 @@ export class CrossChainMessagingTest {
63
56
 
64
57
  deployL1ContractsValues!: DeployL1ContractsReturnType;
65
58
 
66
- constructor(testName: string) {
59
+ constructor(testName: string, opts: SetupOptions = {}, deployL1ContractsArgs: Partial<DeployL1ContractsArgs> = {}) {
67
60
  this.logger = createLogger(`e2e:e2e_cross_chain_messaging:${testName}`);
68
- this.snapshotManager = createSnapshotManager(`e2e_cross_chain_messaging/${testName}`, dataPath);
61
+ this.snapshotManager = createSnapshotManager(`e2e_cross_chain_messaging/${testName}`, dataPath, opts, {
62
+ initialValidators: [],
63
+ ...deployL1ContractsArgs,
64
+ });
69
65
  }
70
66
 
71
67
  async assumeProven() {
@@ -73,13 +69,13 @@ export class CrossChainMessagingTest {
73
69
  }
74
70
 
75
71
  async setup() {
76
- const { aztecNode, pxe, aztecNodeConfig, deployL1ContractsValues } = await this.snapshotManager.setup();
77
- this.aztecNode = aztecNode;
78
- this.pxe = pxe;
79
- this.aztecNodeConfig = aztecNodeConfig;
80
- this.cheatCodes = await CheatCodes.create(this.aztecNodeConfig.l1RpcUrls, this.pxe);
81
- this.deployL1ContractsValues = deployL1ContractsValues;
82
- this.aztecNodeAdmin = aztecNode;
72
+ this.ctx = await this.snapshotManager.setup();
73
+ this.aztecNode = this.ctx.aztecNode;
74
+ this.wallet = this.ctx.wallet;
75
+ this.aztecNodeConfig = this.ctx.aztecNodeConfig;
76
+ this.cheatCodes = this.ctx.cheatCodes;
77
+ this.deployL1ContractsValues = this.ctx.deployL1ContractsValues;
78
+ this.aztecNodeAdmin = this.ctx.aztecNode;
83
79
  }
84
80
 
85
81
  snapshot = <T>(
@@ -93,25 +89,18 @@ export class CrossChainMessagingTest {
93
89
  }
94
90
 
95
91
  async applyBaseSnapshots() {
96
- // Note that we are using the same `pxe`, `aztecNodeConfig` and `aztecNode` across all snapshots.
92
+ // Note that we are using the same `wallet`, `aztecNodeConfig` and `aztecNode` across all snapshots.
97
93
  // This is to not have issues with different networks.
98
94
 
99
95
  await this.snapshotManager.snapshot(
100
96
  '3_accounts',
101
97
  deployAccounts(3, this.logger),
102
- async ({ deployedAccounts }, { pxe, aztecNodeConfig, aztecNode }) => {
103
- const wallets = await Promise.all(deployedAccounts.map(a => getSchnorrWallet(pxe, a.address, a.signingKey)));
104
- this.accounts = wallets.map(w => w.getCompleteAddress());
105
- wallets.forEach((w, i) => this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
106
-
107
- this.user1Wallet = wallets[0];
108
- this.user1Address = this.user1Wallet.getAddress();
109
- this.user2Wallet = wallets[1];
110
- this.user2Address = this.user2Wallet.getAddress();
111
-
112
- this.pxe = pxe;
98
+ ({ deployedAccounts }, { wallet, aztecNodeConfig, aztecNode }) => {
99
+ [this.ownerAddress, this.user1Address, this.user2Address] = deployedAccounts.map(a => a.address);
100
+ this.wallet = wallet;
113
101
  this.aztecNode = aztecNode;
114
102
  this.aztecNodeConfig = aztecNodeConfig;
103
+ return Promise.resolve();
115
104
  },
116
105
  );
117
106
 
@@ -121,7 +110,7 @@ export class CrossChainMessagingTest {
121
110
  // Create the token contract state.
122
111
  // Move this account thing to addAccounts above?
123
112
  this.logger.verbose(`Public deploy accounts...`);
124
- await publicDeployAccounts(this.user1Wallet, this.accounts.slice(0, 3));
113
+ await publicDeployAccounts(this.wallet, [this.ownerAddress, this.user1Address, this.user2Address]);
125
114
 
126
115
  this.l1Client = createExtendedL1Client(this.aztecNodeConfig.l1RpcUrls, MNEMONIC);
127
116
 
@@ -134,10 +123,9 @@ export class CrossChainMessagingTest {
134
123
  this.logger.verbose(`Setting up cross chain harness...`);
135
124
  this.crossChainTestHarness = await CrossChainTestHarness.new(
136
125
  this.aztecNode,
137
- this.pxe,
138
126
  this.l1Client,
139
- this.user1Wallet,
140
- this.user1Address,
127
+ this.wallet,
128
+ this.ownerAddress,
141
129
  this.logger,
142
130
  underlyingERC20Address,
143
131
  );
@@ -147,12 +135,11 @@ export class CrossChainMessagingTest {
147
135
  return this.crossChainTestHarness.toCrossChainContext();
148
136
  },
149
137
  async crossChainContext => {
150
- this.l2Token = await TokenContract.at(crossChainContext.l2Token, this.user1Wallet);
151
- this.l2Bridge = await TokenBridgeContract.at(crossChainContext.l2Bridge, this.user1Wallet);
138
+ this.l2Token = await TokenContract.at(crossChainContext.l2Token, this.wallet);
139
+ this.l2Bridge = await TokenBridgeContract.at(crossChainContext.l2Bridge, this.wallet);
152
140
 
153
141
  // There is an issue with the reviver so we are getting strings sometimes. Working around it here.
154
142
  this.ethAccount = EthAddress.fromString(crossChainContext.ethAccount.toString());
155
- this.ownerAddress = AztecAddress.fromString(crossChainContext.ownerAddress.toString());
156
143
  const tokenPortalAddress = EthAddress.fromString(crossChainContext.tokenPortal.toString());
157
144
 
158
145
  const l1Client = createExtendedL1Client(this.aztecNodeConfig.l1RpcUrls, MNEMONIC);
@@ -170,7 +157,6 @@ export class CrossChainMessagingTest {
170
157
 
171
158
  this.crossChainTestHarness = new CrossChainTestHarness(
172
159
  this.aztecNode,
173
- this.pxe,
174
160
  this.logger,
175
161
  this.l2Token,
176
162
  this.l2Bridge,
@@ -179,8 +165,8 @@ export class CrossChainMessagingTest {
179
165
  crossChainContext.underlying,
180
166
  l1Client,
181
167
  this.aztecNodeConfig.l1Contracts,
182
- this.user1Wallet,
183
- this.user1Address,
168
+ this.wallet,
169
+ this.ownerAddress,
184
170
  );
185
171
 
186
172
  this.l1Client = l1Client;
@@ -1,20 +1,14 @@
1
- import { getSchnorrWallet } from '@aztec/accounts/schnorr';
2
- import {
3
- type AccountWallet,
4
- type AztecAddress,
5
- type AztecNode,
6
- type ContractArtifact,
7
- type ContractBase,
8
- Fr,
9
- type Logger,
10
- type PXE,
11
- type PublicKeys,
12
- type Wallet,
13
- createLogger,
14
- getContractInstanceFromInstantiationParams,
15
- } from '@aztec/aztec.js';
1
+ import type { ContractArtifact } from '@aztec/aztec.js/abi';
2
+ import type { AztecAddress } from '@aztec/aztec.js/addresses';
3
+ import { type ContractBase, getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
4
+ import { Fr } from '@aztec/aztec.js/fields';
5
+ import type { PublicKeys } from '@aztec/aztec.js/keys';
6
+ import { type Logger, createLogger } from '@aztec/aztec.js/log';
7
+ import type { AztecNode } from '@aztec/aztec.js/node';
8
+ import type { Wallet } from '@aztec/aztec.js/wallet';
16
9
  import type { StatefulTestContract } from '@aztec/noir-test-contracts.js/StatefulTest';
17
10
  import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
11
+ import type { TestWallet } from '@aztec/test-wallet/server';
18
12
 
19
13
  import { type ISnapshotManager, createSnapshotManager, deployAccounts } from '../fixtures/snapshot_manager.js';
20
14
 
@@ -23,8 +17,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
23
17
  export class DeployTest {
24
18
  private snapshotManager: ISnapshotManager;
25
19
  public logger: Logger;
26
- public pxe!: PXE;
27
- public wallet!: AccountWallet;
20
+ public wallet!: TestWallet;
28
21
  public defaultAccountAddress!: AztecAddress;
29
22
  public aztecNode!: AztecNode;
30
23
  public aztecNodeAdmin!: AztecNodeAdmin;
@@ -37,7 +30,7 @@ export class DeployTest {
37
30
  async setup() {
38
31
  await this.applyInitialAccountSnapshot();
39
32
  const context = await this.snapshotManager.setup();
40
- ({ pxe: this.pxe, aztecNode: this.aztecNode } = context);
33
+ ({ aztecNode: this.aztecNode, wallet: this.wallet } = context);
41
34
  this.aztecNodeAdmin = context.aztecNode;
42
35
  return this;
43
36
  }
@@ -47,16 +40,10 @@ export class DeployTest {
47
40
  }
48
41
 
49
42
  private async applyInitialAccountSnapshot() {
50
- await this.snapshotManager.snapshot(
51
- 'initial_account',
52
- deployAccounts(1, this.logger),
53
- async ({ deployedAccounts }, { pxe }) => {
54
- const wallets = await Promise.all(deployedAccounts.map(a => getSchnorrWallet(pxe, a.address, a.signingKey)));
55
- wallets.forEach((w, i) => this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
56
- this.wallet = wallets[0];
57
- this.defaultAccountAddress = this.wallet.getAddress();
58
- },
59
- );
43
+ await this.snapshotManager.snapshot('initial_account', deployAccounts(1, this.logger), ({ deployedAccounts }) => {
44
+ this.defaultAccountAddress = deployedAccounts[0].address;
45
+ return Promise.resolve();
46
+ });
60
47
  }
61
48
 
62
49
  async registerContract<T extends ContractBase>(
@@ -74,18 +61,13 @@ export class DeployTest {
74
61
  const instance = await getContractInstanceFromInstantiationParams(contractArtifact.artifact, {
75
62
  constructorArgs: initArgs ?? [],
76
63
  constructorArtifact: constructorName,
77
- salt,
64
+ salt: salt ?? Fr.random(),
78
65
  publicKeys,
79
66
  deployer,
80
67
  });
81
- await wallet.registerContract({ artifact: contractArtifact.artifact, instance });
68
+ await wallet.registerContract(instance, contractArtifact.artifact);
82
69
  return contractArtifact.at(instance.address, wallet);
83
70
  }
84
-
85
- async registerRandomAccount(): Promise<AztecAddress> {
86
- const completeAddress = await this.pxe.registerAccount(Fr.random(), Fr.random());
87
- return completeAddress.address;
88
- }
89
71
  }
90
72
 
91
73
  export type StatefulContractCtorArgs = Parameters<StatefulTestContract['methods']['constructor']>;
@@ -1,14 +1,10 @@
1
1
  import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
2
- import {
3
- Fr,
4
- type Logger,
5
- MerkleTreeId,
6
- type Wallet,
7
- getContractInstanceFromInstantiationParams,
8
- getTimestampRangeForEpoch,
9
- retryUntil,
10
- sleep,
11
- } from '@aztec/aztec.js';
2
+ import { getTimestampRangeForEpoch } from '@aztec/aztec.js/block';
3
+ import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
4
+ import { Fr } from '@aztec/aztec.js/fields';
5
+ import type { Logger } from '@aztec/aztec.js/log';
6
+ import { MerkleTreeId } from '@aztec/aztec.js/trees';
7
+ import type { Wallet } from '@aztec/aztec.js/wallet';
12
8
  import { EpochCache } from '@aztec/epoch-cache';
13
9
  import { DefaultL1ContractsConfig, type ExtendedViemWalletClient, createExtendedL1Client } from '@aztec/ethereum';
14
10
  import { RollupContract } from '@aztec/ethereum/contracts';
@@ -16,6 +12,8 @@ import { ChainMonitor, DelayedTxUtils, type Delayer, waitUntilL1Timestamp, withD
16
12
  import { SecretValue } from '@aztec/foundation/config';
17
13
  import { randomBytes } from '@aztec/foundation/crypto';
18
14
  import { withLogNameSuffix } from '@aztec/foundation/log';
15
+ import { retryUntil } from '@aztec/foundation/retry';
16
+ import { sleep } from '@aztec/foundation/sleep';
19
17
  import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
20
18
  import { getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
21
19
  import { ProverNode, type ProverNodeConfig, ProverNodePublisher } from '@aztec/prover-node';
@@ -188,14 +186,14 @@ export class EpochsTestContext {
188
186
  this.logger.warn('Creating and syncing a simulated prover node...');
189
187
  const proverNodePrivateKey = this.getNextPrivateKey();
190
188
  const suffix = (this.proverNodes.length + 1).toString();
191
- const proverId = EthAddress.fromNumber(parseInt(suffix, 10));
192
189
  const proverNode = await withLogNameSuffix(suffix, () =>
193
190
  createAndSyncProverNode(
194
191
  proverNodePrivateKey,
195
- { ...this.context.config, proverId },
192
+ { ...this.context.config },
196
193
  {
197
194
  dataDirectory: join(this.context.config.dataDirectory!, randomBytes(8).toString('hex')),
198
- proverId,
195
+ proverId: EthAddress.fromNumber(parseInt(suffix, 10)),
196
+ dontStart: opts.dontStart,
199
197
  ...opts,
200
198
  },
201
199
  this.context.aztecNode,
@@ -354,7 +352,7 @@ export class EpochsTestContext {
354
352
  publicKeys: undefined,
355
353
  deployer: undefined,
356
354
  });
357
- await wallet.registerContract({ artifact: SpamContract.artifact, instance });
355
+ await wallet.registerContract(instance, SpamContract.artifact);
358
356
  return SpamContract.at(instance.address, wallet);
359
357
  }
360
358
 
@@ -1,7 +1,10 @@
1
- import { getSchnorrAccount } from '@aztec/accounts/schnorr';
2
- import { Fr, type Logger, type PXE, sleep } from '@aztec/aztec.js';
1
+ import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
2
+ import { Fr } from '@aztec/aztec.js/fields';
3
+ import type { Logger } from '@aztec/aztec.js/log';
3
4
  import { Fq } from '@aztec/foundation/fields';
5
+ import { sleep } from '@aztec/foundation/sleep';
4
6
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
7
+ import type { TestWallet } from '@aztec/test-wallet/server';
5
8
 
6
9
  import { jest } from '@jest/globals';
7
10
  import type { Hex } from 'viem';
@@ -27,7 +30,7 @@ describe('e2e_fees bridging_race', () => {
27
30
  await t.applyPublicDeployAccountsSnapshot();
28
31
  await t.applySetupFeeJuiceSnapshot();
29
32
 
30
- ({ pxe, logger } = await t.setup());
33
+ ({ wallet, logger } = await t.setup());
31
34
  });
32
35
 
33
36
  afterAll(async () => {
@@ -35,17 +38,19 @@ describe('e2e_fees bridging_race', () => {
35
38
  });
36
39
 
37
40
  let logger: Logger;
38
- let pxe: PXE;
39
41
  let bobsAddress: AztecAddress;
42
+ let wallet: TestWallet;
40
43
 
41
44
  beforeEach(async () => {
42
45
  const bobsSecretKey = Fr.random();
43
46
  const bobsPrivateSigningKey = Fq.random();
44
- const bobsAccountManager = await getSchnorrAccount(pxe, bobsSecretKey, bobsPrivateSigningKey, Fr.random());
45
- const bobsCompleteAddress = await bobsAccountManager.getCompleteAddress();
46
- bobsAddress = bobsCompleteAddress.address;
47
- await bobsAccountManager.getWallet();
48
- await bobsAccountManager.register();
47
+ const bobsSalt = Fr.random();
48
+ const bobsAccountManager = await wallet.createAccount({
49
+ secret: bobsSecretKey,
50
+ salt: bobsSalt,
51
+ contract: new SchnorrAccountContract(bobsPrivateSigningKey),
52
+ });
53
+ bobsAddress = bobsAccountManager.address;
49
54
  });
50
55
 
51
56
  it('Alice bridges funds to Bob', async () => {
@@ -1,17 +1,11 @@
1
- import { getSchnorrWallet } from '@aztec/accounts/schnorr';
2
- import {
3
- type AccountWallet,
4
- type AztecAddress,
5
- type AztecNode,
6
- type Logger,
7
- type PXE,
8
- createLogger,
9
- sleep,
10
- } from '@aztec/aztec.js';
1
+ import type { AztecAddress } from '@aztec/aztec.js/addresses';
2
+ import { type Logger, createLogger } from '@aztec/aztec.js/log';
3
+ import type { AztecNode } from '@aztec/aztec.js/node';
11
4
  import { CheatCodes } from '@aztec/aztec/testing';
12
5
  import { type DeployL1ContractsArgs, RollupContract, createExtendedL1Client } from '@aztec/ethereum';
13
6
  import { ChainMonitor } from '@aztec/ethereum/test';
14
7
  import { EthAddress } from '@aztec/foundation/eth-address';
8
+ import { sleep } from '@aztec/foundation/sleep';
15
9
  import { TestERC20Abi } from '@aztec/l1-artifacts';
16
10
  import { AppSubscriptionContract } from '@aztec/noir-contracts.js/AppSubscription';
17
11
  import { FPCContract } from '@aztec/noir-contracts.js/FPC';
@@ -22,6 +16,7 @@ import { CounterContract } from '@aztec/noir-test-contracts.js/Counter';
22
16
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
23
17
  import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
24
18
  import { GasSettings } from '@aztec/stdlib/gas';
19
+ import { TestWallet } from '@aztec/test-wallet/server';
25
20
 
26
21
  import { getContract } from 'viem';
27
22
 
@@ -56,17 +51,14 @@ const { E2E_DATA_PATH: dataPath } = process.env;
56
51
  */
57
52
  export class FeesTest {
58
53
  private snapshotManager: ISnapshotManager;
59
- private wallets: AccountWallet[] = [];
60
54
  private accounts: AztecAddress[] = [];
61
55
 
62
56
  public logger: Logger;
63
- public pxe!: PXE;
64
57
  public aztecNode!: AztecNode;
65
58
  public cheatCodes!: CheatCodes;
66
59
 
67
- public aliceWallet!: AccountWallet;
60
+ public wallet!: TestWallet;
68
61
  public aliceAddress!: AztecAddress;
69
- public bobWallet!: AccountWallet;
70
62
  public bobAddress!: AztecAddress;
71
63
  public sequencerAddress!: AztecAddress;
72
64
  public coinbase!: EthAddress;
@@ -173,7 +165,7 @@ export class FeesTest {
173
165
  .balance_of_private(address)
174
166
  .simulate({ from: this.aliceAddress });
175
167
 
176
- await mintTokensToPrivate(this.bananaCoin, this.aliceAddress, this.aliceWallet, address, amount);
168
+ await mintTokensToPrivate(this.bananaCoin, this.aliceAddress, address, amount);
177
169
 
178
170
  const balanceAfter = await this.bananaCoin.methods
179
171
  .balance_of_private(address)
@@ -192,30 +184,27 @@ export class FeesTest {
192
184
  await this.snapshotManager.snapshot(
193
185
  'initial_accounts',
194
186
  deployAccounts(this.numberOfAccounts, this.logger),
195
- async ({ deployedAccounts }, { pxe, aztecNode, aztecNodeConfig }) => {
196
- this.pxe = pxe;
197
-
187
+ async ({ deployedAccounts }, { wallet, aztecNode, cheatCodes }) => {
188
+ this.wallet = wallet;
198
189
  this.aztecNode = aztecNode;
199
190
  this.gasSettings = GasSettings.default({ maxFeesPerGas: (await this.aztecNode.getCurrentBaseFees()).mul(2) });
200
- this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
201
- this.wallets = await Promise.all(deployedAccounts.map(a => getSchnorrWallet(pxe, a.address, a.signingKey)));
202
- this.wallets.forEach((w, i) => this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
203
- this.accounts = this.wallets.map(w => w.getAddress());
204
- [this.aliceWallet, this.bobWallet] = this.wallets.slice(0, 2);
205
- [this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.accounts;
191
+ this.cheatCodes = cheatCodes;
192
+ this.accounts = deployedAccounts.map(a => a.address);
193
+ this.accounts.forEach((a, i) => this.logger.verbose(`Account ${i} address: ${a}`));
194
+ [this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.accounts.slice(0, 3);
206
195
 
207
196
  // We set Alice as the FPC admin to avoid the need for deployment of another account.
208
197
  this.fpcAdmin = this.aliceAddress;
209
198
 
210
199
  const canonicalFeeJuice = await getCanonicalFeeJuice();
211
- this.feeJuiceContract = await FeeJuiceContract.at(canonicalFeeJuice.address, this.aliceWallet);
200
+ this.feeJuiceContract = await FeeJuiceContract.at(canonicalFeeJuice.address, this.wallet);
212
201
  },
213
202
  );
214
203
  }
215
204
 
216
205
  async applyPublicDeployAccountsSnapshot() {
217
206
  await this.snapshotManager.snapshot('public_deploy_accounts', () =>
218
- ensureAccountContractsPublished(this.aliceWallet, this.wallets),
207
+ ensureAccountContractsPublished(this.wallet, this.accounts),
219
208
  );
220
209
  }
221
210
 
@@ -226,7 +215,7 @@ export class FeesTest {
226
215
  async (_data, context) => {
227
216
  this.context = context;
228
217
 
229
- this.feeJuiceContract = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.aliceWallet);
218
+ this.feeJuiceContract = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.wallet);
230
219
 
231
220
  this.getGasBalanceFn = getBalancesFn(
232
221
  '⛽',
@@ -238,9 +227,8 @@ export class FeesTest {
238
227
  this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
239
228
  aztecNode: context.aztecNode,
240
229
  aztecNodeAdmin: context.aztecNode,
241
- pxeService: context.pxe,
242
230
  l1Client: context.deployL1ContractsValues.l1Client,
243
- wallet: this.aliceWallet,
231
+ wallet: this.wallet,
244
232
  logger: this.logger,
245
233
  });
246
234
  },
@@ -251,14 +239,14 @@ export class FeesTest {
251
239
  await this.snapshotManager.snapshot(
252
240
  'deploy_banana_token',
253
241
  async () => {
254
- const bananaCoin = await BananaCoin.deploy(this.aliceWallet, this.aliceAddress, 'BC', 'BC', 18n)
242
+ const bananaCoin = await BananaCoin.deploy(this.wallet, this.aliceAddress, 'BC', 'BC', 18n)
255
243
  .send({ from: this.aliceAddress })
256
244
  .deployed();
257
245
  this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
258
246
  return { bananaCoinAddress: bananaCoin.address };
259
247
  },
260
248
  async ({ bananaCoinAddress }) => {
261
- this.bananaCoin = await BananaCoin.at(bananaCoinAddress, this.aliceWallet);
249
+ this.bananaCoin = await BananaCoin.at(bananaCoinAddress, this.wallet);
262
250
  const logger = this.logger;
263
251
  this.getBananaPublicBalanceFn = getBalancesFn(
264
252
  '🍌.public',
@@ -281,10 +269,10 @@ export class FeesTest {
281
269
  'fpc_setup',
282
270
  async context => {
283
271
  const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
284
- expect((await context.pxe.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
272
+ expect((await context.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
285
273
 
286
274
  const bananaCoin = this.bananaCoin;
287
- const bananaFPC = await FPCContract.deploy(this.aliceWallet, bananaCoin.address, this.fpcAdmin)
275
+ const bananaFPC = await FPCContract.deploy(this.wallet, bananaCoin.address, this.fpcAdmin)
288
276
  .send({ from: this.aliceAddress })
289
277
  .deployed();
290
278
 
@@ -300,7 +288,7 @@ export class FeesTest {
300
288
  };
301
289
  },
302
290
  async (data, context) => {
303
- const bananaFPC = await FPCContract.at(data.bananaFPCAddress, this.aliceWallet);
291
+ const bananaFPC = await FPCContract.at(data.bananaFPCAddress, this.wallet);
304
292
  this.bananaFPC = bananaFPC;
305
293
 
306
294
  this.getCoinbaseBalance = async () => {
@@ -318,7 +306,7 @@ export class FeesTest {
318
306
  };
319
307
 
320
308
  this.getProverFee = async (blockNumber: number) => {
321
- const block = await this.pxe.getBlock(blockNumber);
309
+ const block = await this.aztecNode.getBlock(blockNumber);
322
310
 
323
311
  // @todo @lherskind As we deal with #13601
324
312
  // Right now the value is from `FeeLib.sol`
@@ -349,9 +337,9 @@ export class FeesTest {
349
337
  'sponsored_fpc_setup',
350
338
  async context => {
351
339
  const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
352
- expect((await context.pxe.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
340
+ expect((await context.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
353
341
 
354
- const sponsoredFPC = await setupSponsoredFPC(context.pxe);
342
+ const sponsoredFPC = await setupSponsoredFPC(this.wallet);
355
343
  this.logger.info(`SponsoredFPC at ${sponsoredFPC.address}`);
356
344
 
357
345
  return {
@@ -359,7 +347,7 @@ export class FeesTest {
359
347
  };
360
348
  },
361
349
  async data => {
362
- this.sponsoredFPC = await SponsoredFPCContract.at(data.sponsoredFPCAddress, this.aliceWallet);
350
+ this.sponsoredFPC = await SponsoredFPCContract.at(data.sponsoredFPCAddress, this.wallet);
363
351
  },
364
352
  );
365
353
  }
@@ -1,5 +1,7 @@
1
- import { AztecAddress, Fr, type L2Block } from '@aztec/aztec.js';
2
- import { BatchedBlob, Blob } from '@aztec/blob-lib';
1
+ import { AztecAddress } from '@aztec/aztec.js/addresses';
2
+ import type { L2Block } from '@aztec/aztec.js/block';
3
+ import { Fr } from '@aztec/aztec.js/fields';
4
+ import { BatchedBlob, Blob, getPrefixedEthBlobCommitments } from '@aztec/blob-lib';
3
5
  import { EthAddress } from '@aztec/foundation/eth-address';
4
6
 
5
7
  import { writeFile } from 'fs/promises';
@@ -32,18 +34,18 @@ export async function writeJson(
32
34
 
33
35
  const jsonObject = {
34
36
  populate: {
35
- l1ToL2Content: l1ToL2Content.map(asHex),
37
+ l1ToL2Content: l1ToL2Content.map(value => asHex(value)),
36
38
  recipient: asHex(recipientAddress.toField()),
37
39
  sender: deployerAddress,
38
40
  },
39
41
  messages: {
40
- l2ToL1Messages: block.body.txEffects.flatMap(txEffect => txEffect.l2ToL1Msgs).map(asHex),
42
+ l2ToL1Messages: block.body.txEffects.flatMap(txEffect => txEffect.l2ToL1Msgs).map(value => asHex(value)),
41
43
  },
42
44
  block: {
43
45
  // The json formatting in forge is a bit brittle, so we convert Fr to a number in the few values below.
44
46
  // This should not be a problem for testing as long as the values are not larger than u32.
45
47
  archive: asHex(block.archive.root),
46
- blobCommitments: Blob.getPrefixedEthBlobCommitments(blobs),
48
+ blobCommitments: getPrefixedEthBlobCommitments(blobs),
47
49
  batchedBlobInputs: batchedBlob.getEthBlobEvaluationInputs(),
48
50
  blockNumber: block.number,
49
51
  body: `0x${block.body.toBuffer().toString('hex')}`,
@@ -64,7 +66,7 @@ export async function writeJson(
64
66
  },
65
67
  totalManaUsed: block.header.totalManaUsed.toNumber(),
66
68
  },
67
- headerHash: asHex(block.header.toPropose().hash()),
69
+ headerHash: asHex(block.getCheckpointHeader().hash()),
68
70
  numTxs: block.body.txEffects.length,
69
71
  },
70
72
  };
@@ -1,4 +1,4 @@
1
- import type { AztecAddress } from '@aztec/aztec.js';
1
+ import { AztecAddress } from '@aztec/aztec.js/addresses';
2
2
  import { getAddressFromPrivateKey } from '@aztec/ethereum';
3
3
  import { EthAddress } from '@aztec/foundation/eth-address';
4
4
  import type { EthPrivateKey } from '@aztec/node-keystore';
@@ -1,5 +1,7 @@
1
- import { getSchnorrWallet } from '@aztec/accounts/schnorr';
2
- import { type AccountWallet, AztecAddress, type Logger, type PXE, createLogger } from '@aztec/aztec.js';
1
+ import { AztecAddress } from '@aztec/aztec.js/addresses';
2
+ import { type Logger, createLogger } from '@aztec/aztec.js/log';
3
+ import type { AztecNode } from '@aztec/aztec.js/node';
4
+ import type { Wallet } from '@aztec/aztec.js/wallet';
3
5
  import { ChildContract } from '@aztec/noir-test-contracts.js/Child';
4
6
  import { ParentContract } from '@aztec/noir-test-contracts.js/Parent';
5
7
 
@@ -16,9 +18,9 @@ const { E2E_DATA_PATH: dataPath } = process.env;
16
18
  export class NestedContractTest {
17
19
  private snapshotManager: ISnapshotManager;
18
20
  logger: Logger;
19
- wallet!: AccountWallet;
21
+ wallet!: Wallet;
20
22
  defaultAccountAddress!: AztecAddress;
21
- pxe!: PXE;
23
+ aztecNode!: AztecNode;
22
24
 
23
25
  parentContract!: ParentContract;
24
26
  childContract!: ChildContract;
@@ -40,12 +42,11 @@ export class NestedContractTest {
40
42
  await this.snapshotManager.snapshot(
41
43
  'accounts',
42
44
  deployAccounts(this.numberOfAccounts, this.logger),
43
- async ({ deployedAccounts }, { pxe }) => {
44
- const wallets = await Promise.all(deployedAccounts.map(a => getSchnorrWallet(pxe, a.address, a.signingKey)));
45
- wallets.forEach((w, i) => this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
46
- [this.wallet] = wallets;
47
- this.defaultAccountAddress = this.wallet.getAddress();
48
- this.pxe = pxe;
45
+ ({ deployedAccounts }, { wallet, aztecNode }) => {
46
+ this.wallet = wallet;
47
+ [{ address: this.defaultAccountAddress }] = deployedAccounts;
48
+ this.aztecNode = aztecNode;
49
+ return Promise.resolve();
49
50
  },
50
51
  );
51
52