@aztec/end-to-end 3.0.0-nightly.20251118 → 3.0.0-nightly.20251120

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 (44) hide show
  1. package/dest/bench/client_flows/client_flows_benchmark.d.ts +7 -0
  2. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/client_flows_benchmark.js +53 -30
  4. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +2 -2
  5. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  6. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +4 -3
  7. package/dest/e2e_deploy_contract/deploy_test.d.ts +1 -1
  8. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  9. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  10. package/dest/e2e_fees/fees_test.js +11 -8
  11. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  12. package/dest/e2e_nested_contract/nested_contract_test.js +4 -3
  13. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  14. package/dest/e2e_p2p/p2p_network.js +3 -2
  15. package/dest/e2e_p2p/shared.js +1 -1
  16. package/dest/e2e_token_contract/token_contract_test.js +2 -2
  17. package/dest/fixtures/e2e_prover_test.d.ts +2 -0
  18. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  19. package/dest/fixtures/e2e_prover_test.js +10 -7
  20. package/dest/fixtures/setup_p2p_test.d.ts +3 -3
  21. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  22. package/dest/fixtures/setup_p2p_test.js +15 -7
  23. package/dest/fixtures/token_utils.d.ts +4 -1
  24. package/dest/fixtures/token_utils.d.ts.map +1 -1
  25. package/dest/fixtures/token_utils.js +7 -4
  26. package/dest/fixtures/utils.js +2 -8
  27. package/dest/shared/gas_portal_test_harness.js +1 -1
  28. package/dest/spartan/setup_test_wallets.js +6 -6
  29. package/package.json +38 -38
  30. package/src/bench/client_flows/client_flows_benchmark.ts +75 -30
  31. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +2 -2
  32. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +4 -3
  33. package/src/e2e_deploy_contract/deploy_test.ts +1 -1
  34. package/src/e2e_fees/fees_test.ts +11 -8
  35. package/src/e2e_nested_contract/nested_contract_test.ts +4 -3
  36. package/src/e2e_p2p/p2p_network.ts +3 -2
  37. package/src/e2e_p2p/shared.ts +1 -1
  38. package/src/e2e_token_contract/token_contract_test.ts +2 -2
  39. package/src/fixtures/e2e_prover_test.ts +10 -7
  40. package/src/fixtures/setup_p2p_test.ts +20 -6
  41. package/src/fixtures/token_utils.ts +4 -4
  42. package/src/fixtures/utils.ts +2 -2
  43. package/src/shared/gas_portal_test_harness.ts +1 -1
  44. package/src/spartan/setup_test_wallets.ts +8 -8
@@ -19,6 +19,7 @@ import { SecretValue } from '@aztec/foundation/config';
19
19
  import { FeeAssetHandlerAbi } from '@aztec/l1-artifacts';
20
20
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
21
21
  import { type ProverNode, type ProverNodeConfig, createProverNode } from '@aztec/prover-node';
22
+ import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
22
23
  import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
23
24
  import { TestWallet } from '@aztec/test-wallet/server';
24
25
  import { getGenesisValues } from '@aztec/world-state/testing';
@@ -63,6 +64,7 @@ export class FullProverTest {
63
64
  accounts: AztecAddress[] = [];
64
65
  deployedAccounts!: InitialAccountData[];
65
66
  fakeProofsAsset!: TokenContract;
67
+ fakeProofsAssetInstance!: ContractInstanceWithAddress;
66
68
  tokenSim!: TokenSimulator;
67
69
  aztecNode!: AztecNode;
68
70
  aztecNodeAdmin!: AztecNodeAdmin;
@@ -122,7 +124,7 @@ export class FullProverTest {
122
124
  await publicDeployAccounts(this.wallet, this.accounts.slice(0, 2));
123
125
 
124
126
  this.logger.verbose(`Deploying TokenContract...`);
125
- const asset = await TokenContract.deploy(
127
+ const { contract: asset, instance } = await TokenContract.deploy(
126
128
  this.wallet,
127
129
  this.accounts[0],
128
130
  FullProverTest.TOKEN_NAME,
@@ -130,14 +132,15 @@ export class FullProverTest {
130
132
  FullProverTest.TOKEN_DECIMALS,
131
133
  )
132
134
  .send({ from: this.accounts[0] })
133
- .deployed();
135
+ .wait();
134
136
  this.logger.verbose(`Token deployed to ${asset.address}`);
135
137
 
136
- return { tokenContractAddress: asset.address };
138
+ return { tokenContractAddress: asset.address, tokenContractInstance: instance };
137
139
  },
138
- async ({ tokenContractAddress }) => {
140
+ async ({ tokenContractAddress, tokenContractInstance }) => {
139
141
  // Restore the token contract state.
140
- this.fakeProofsAsset = await TokenContract.at(tokenContractAddress, this.wallet);
142
+ this.fakeProofsAsset = TokenContract.at(tokenContractAddress, this.wallet);
143
+ this.fakeProofsAssetInstance = tokenContractInstance;
141
144
  this.logger.verbose(`Token contract address: ${this.fakeProofsAsset.address}`);
142
145
 
143
146
  this.tokenSim = new TokenSimulator(
@@ -216,14 +219,14 @@ export class FullProverTest {
216
219
  true,
217
220
  );
218
221
  this.logger.debug(`Contract address ${this.fakeProofsAsset.address}`);
219
- await provenWallet.registerContract(this.fakeProofsAsset);
222
+ await provenWallet.registerContract(this.fakeProofsAssetInstance, TokenContract.artifact);
220
223
 
221
224
  for (let i = 0; i < 2; i++) {
222
225
  await provenWallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
223
226
  await this.wallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
224
227
  }
225
228
 
226
- const asset = await TokenContract.at(this.fakeProofsAsset.address, provenWallet);
229
+ const asset = TokenContract.at(this.fakeProofsAsset.address, provenWallet);
227
230
  this.provenComponents.push({
228
231
  wallet: provenWallet,
229
232
  teardown: provenTeardown,
@@ -2,6 +2,7 @@
2
2
  * Test fixtures and utilities to set up and run a test using multiple validators
3
3
  */
4
4
  import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
5
+ import { range } from '@aztec/foundation/array';
5
6
  import { SecretValue } from '@aztec/foundation/config';
6
7
  import { addLogNameHandler, removeLogNameHandler } from '@aztec/foundation/log';
7
8
  import { bufferToHex } from '@aztec/foundation/string';
@@ -40,6 +41,7 @@ export async function createNodes(
40
41
  dataDirectory?: string,
41
42
  metricsPort?: number,
42
43
  indexOffset = 0,
44
+ validatorsPerNode = 1,
43
45
  ): Promise<AztecNodeService[]> {
44
46
  const nodePromises: Promise<AztecNodeService>[] = [];
45
47
  const loggerIdStorage = new AsyncLocalStorage<string>();
@@ -52,13 +54,18 @@ export async function createNodes(
52
54
  // We run on ports from the bootnode upwards
53
55
  const port = bootNodePort + 1 + index;
54
56
 
57
+ // Determine validator indices for this node
58
+ const validatorIndices = validatorsPerNode === 1 ? index : range(validatorsPerNode, validatorsPerNode * index);
59
+
60
+ // Assign data directory
55
61
  const dataDir = dataDirectory ? `${dataDirectory}-${index}` : undefined;
62
+
56
63
  const nodePromise = createNode(
57
64
  config,
58
65
  dateProvider,
59
66
  port,
60
67
  bootstrapNodeEnr,
61
- index,
68
+ validatorIndices,
62
69
  prefilledPublicData,
63
70
  dataDir,
64
71
  metricsPort,
@@ -84,7 +91,7 @@ export async function createNode(
84
91
  dateProvider: DateProvider,
85
92
  tcpPort: number,
86
93
  bootstrapNode: string | undefined,
87
- addressIndex: number,
94
+ addressIndex: number | number[],
88
95
  prefilledPublicData?: PublicDataTreeLeaf[],
89
96
  dataDirectory?: string,
90
97
  metricsPort?: number,
@@ -188,16 +195,23 @@ export async function createValidatorConfig(
188
195
  config: AztecNodeConfig,
189
196
  bootstrapNodeEnr?: string,
190
197
  port?: number,
191
- addressIndex: number = 1,
198
+ addressIndex: number | number[] = 1,
192
199
  dataDirectory?: string,
193
200
  ) {
194
- const attesterPrivateKey = bufferToHex(getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + addressIndex)!);
201
+ const addressIndices = Array.isArray(addressIndex) ? addressIndex : [addressIndex];
202
+ if (addressIndices.length === 0) {
203
+ throw new Error('At least one address index must be provided to create a validator config');
204
+ }
205
+
206
+ const attesterPrivateKeys = addressIndices.map(index =>
207
+ bufferToHex(getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + index)!),
208
+ );
195
209
  const p2pConfig = await createP2PConfig(config, bootstrapNodeEnr, port, dataDirectory);
196
210
  const nodeConfig: AztecNodeConfig = {
197
211
  ...config,
198
212
  ...p2pConfig,
199
- validatorPrivateKeys: new SecretValue([attesterPrivateKey]),
200
- publisherPrivateKeys: [new SecretValue(attesterPrivateKey)],
213
+ validatorPrivateKeys: new SecretValue(attesterPrivateKeys),
214
+ publisherPrivateKeys: [new SecretValue(attesterPrivateKeys[0])],
201
215
  };
202
216
 
203
217
  return nodeConfig;
@@ -6,9 +6,9 @@ import { TokenContract } from '@aztec/noir-contracts.js/Token';
6
6
 
7
7
  export async function deployToken(wallet: Wallet, admin: AztecAddress, initialAdminBalance: bigint, logger: Logger) {
8
8
  logger.info(`Deploying Token contract...`);
9
- const contract = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18)
9
+ const { contract, instance } = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18)
10
10
  .send({ from: admin })
11
- .deployed();
11
+ .wait();
12
12
 
13
13
  if (initialAdminBalance > 0n) {
14
14
  await mintTokensToPrivate(contract, admin, admin, initialAdminBalance);
@@ -16,7 +16,7 @@ export async function deployToken(wallet: Wallet, admin: AztecAddress, initialAd
16
16
 
17
17
  logger.info('L2 contract deployed');
18
18
 
19
- return contract;
19
+ return { contract, instance };
20
20
  }
21
21
 
22
22
  export async function mintTokensToPrivate(
@@ -36,7 +36,7 @@ export async function expectTokenBalance(
36
36
  logger: Logger,
37
37
  ) {
38
38
  // Then check the balance
39
- const contractWithWallet = await TokenContract.at(token.address, wallet);
39
+ const contractWithWallet = TokenContract.at(token.address, wallet);
40
40
  const balance = await contractWithWallet.methods.balance_of_private(owner).simulate({ from: owner });
41
41
  logger.info(`Account ${owner} balance: ${balance}`);
42
42
  expect(balance).toBe(expectedBalance);
@@ -858,7 +858,7 @@ export async function setupSponsoredFPC(wallet: Wallet) {
858
858
  salt: new Fr(SPONSORED_FPC_SALT),
859
859
  });
860
860
 
861
- await wallet.registerContract({ instance, artifact: SponsoredFPCContract.artifact });
861
+ await wallet.registerContract(instance, SponsoredFPCContract.artifact);
862
862
  getLogger().info(`SponsoredFPC: ${instance.address}`);
863
863
  return instance;
864
864
  }
@@ -868,7 +868,7 @@ export async function setupSponsoredFPC(wallet: Wallet) {
868
868
  * @param wallet - The wallet
869
869
  */
870
870
  export async function registerSponsoredFPC(wallet: Wallet): Promise<void> {
871
- await wallet.registerContract({ instance: await getSponsoredFPCInstance(), artifact: SponsoredFPCContract.artifact });
871
+ await wallet.registerContract(await getSponsoredFPCInstance(), SponsoredFPCContract.artifact);
872
872
  }
873
873
 
874
874
  export async function waitForProvenChain(node: AztecNode, targetBlock?: number, timeoutSec = 60, intervalSec = 1) {
@@ -43,7 +43,7 @@ export class FeeJuicePortalTestingHarnessFactory {
43
43
  throw new Error('Fee Juice portal not deployed on L1');
44
44
  }
45
45
 
46
- const gasL2 = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, wallet);
46
+ const gasL2 = FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, wallet);
47
47
 
48
48
  return new GasBridgingTestHarness(
49
49
  aztecNode,
@@ -49,7 +49,7 @@ export async function setupTestAccountsWithTokens(
49
49
 
50
50
  const tokenAdmin = accounts[0];
51
51
  const tokenAddress = await deployTokenAndMint(wallet, accounts, tokenAdmin, mintAmount, undefined, logger);
52
- const tokenContract = await TokenContract.at(tokenAddress, wallet);
52
+ const tokenContract = TokenContract.at(tokenAddress, wallet);
53
53
 
54
54
  return {
55
55
  aztecNode,
@@ -96,7 +96,7 @@ export async function deploySponsoredTestAccounts(
96
96
  new SponsoredFeePaymentMethod(await getSponsoredFPCAddress()),
97
97
  logger,
98
98
  );
99
- const tokenContract = await TokenContract.at(tokenAddress, wallet);
99
+ const tokenContract = TokenContract.at(tokenAddress, wallet);
100
100
 
101
101
  return {
102
102
  aztecNode,
@@ -152,7 +152,7 @@ export async function deployTestAccountsWithTokens(
152
152
  undefined,
153
153
  logger,
154
154
  );
155
- const tokenContract = await TokenContract.at(tokenAddress, wallet);
155
+ const tokenContract = TokenContract.at(tokenAddress, wallet);
156
156
 
157
157
  return {
158
158
  aztecNode,
@@ -228,9 +228,9 @@ async function deployTokenAndMint(
228
228
  logger.verbose(`Minting ${mintAmount} public assets to the ${accounts.length} accounts...`);
229
229
 
230
230
  await Promise.all(
231
- accounts.map(async acc =>
232
- (await TokenContract.at(tokenAddress, wallet)).methods
233
- .mint_to_public(acc, mintAmount)
231
+ accounts.map(acc =>
232
+ TokenContract.at(tokenAddress, wallet)
233
+ .methods.mint_to_public(acc, mintAmount)
234
234
  .send({ from: admin, fee: { paymentMethod } })
235
235
  .wait({ timeout: 600 }),
236
236
  ),
@@ -260,8 +260,8 @@ export async function performTransfers({
260
260
  // Default to sponsored fee payment if no fee method is provided
261
261
  const defaultFeePaymentMethod = feePaymentMethod || new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
262
262
  for (let i = 0; i < rounds; i++) {
263
- const txs = testAccounts.accounts.map(async acc => {
264
- const token = await TokenContract.at(testAccounts.tokenAddress, testAccounts.wallet);
263
+ const txs = testAccounts.accounts.map(acc => {
264
+ const token = TokenContract.at(testAccounts.tokenAddress, testAccounts.wallet);
265
265
  return proveInteraction(wallet, token.methods.transfer_in_public(acc, recipient, transferAmount, 0), {
266
266
  from: acc,
267
267
  fee: {