@aztec/end-to-end 0.0.1-fake-c83136db25 → 0.0.1-fake-ceab37513c

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