@aztec/end-to-end 0.0.1-commit.d431d1c → 0.0.1-commit.e2b2873ed

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 (174) hide show
  1. package/dest/bench/client_flows/client_flows_benchmark.d.ts +2 -2
  2. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/client_flows_benchmark.js +31 -16
  4. package/dest/bench/client_flows/config.d.ts +2 -2
  5. package/dest/bench/client_flows/config.d.ts.map +1 -1
  6. package/dest/bench/client_flows/config.js +18 -0
  7. package/dest/bench/utils.d.ts +5 -4
  8. package/dest/bench/utils.d.ts.map +1 -1
  9. package/dest/bench/utils.js +9 -7
  10. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +4 -2
  11. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  12. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +17 -8
  13. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +2 -2
  14. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  15. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +3 -2
  16. package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -2
  17. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  18. package/dest/e2e_epochs/epochs_test.d.ts +7 -1
  19. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  20. package/dest/e2e_epochs/epochs_test.js +38 -10
  21. package/dest/e2e_fees/bridging_race.notest.js +1 -1
  22. package/dest/e2e_fees/fees_test.d.ts +2 -2
  23. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  24. package/dest/e2e_fees/fees_test.js +11 -11
  25. package/dest/e2e_l1_publisher/write_json.d.ts +4 -3
  26. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  27. package/dest/e2e_l1_publisher/write_json.js +1 -7
  28. package/dest/e2e_nested_contract/nested_contract_test.d.ts +1 -1
  29. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  30. package/dest/e2e_nested_contract/nested_contract_test.js +2 -2
  31. package/dest/e2e_p2p/p2p_network.d.ts +2 -2
  32. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  33. package/dest/e2e_p2p/p2p_network.js +6 -2
  34. package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
  35. package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
  36. package/dest/e2e_p2p/reqresp/utils.js +153 -0
  37. package/dest/e2e_p2p/shared.d.ts +6 -6
  38. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  39. package/dest/e2e_p2p/shared.js +14 -17
  40. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +2 -0
  41. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +1 -0
  42. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.js +184 -0
  43. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts +18 -0
  44. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +1 -0
  45. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.js +120 -0
  46. package/dest/e2e_token_contract/token_contract_test.d.ts +4 -2
  47. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  48. package/dest/e2e_token_contract/token_contract_test.js +13 -3
  49. package/dest/fixtures/e2e_prover_test.d.ts +2 -2
  50. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  51. package/dest/fixtures/e2e_prover_test.js +8 -5
  52. package/dest/fixtures/ha_setup.d.ts +71 -0
  53. package/dest/fixtures/ha_setup.d.ts.map +1 -0
  54. package/dest/fixtures/ha_setup.js +114 -0
  55. package/dest/fixtures/index.d.ts +2 -1
  56. package/dest/fixtures/index.d.ts.map +1 -1
  57. package/dest/fixtures/index.js +1 -0
  58. package/dest/fixtures/setup.d.ts +19 -17
  59. package/dest/fixtures/setup.d.ts.map +1 -1
  60. package/dest/fixtures/setup.js +42 -95
  61. package/dest/fixtures/setup_p2p_test.d.ts +12 -8
  62. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  63. package/dest/fixtures/setup_p2p_test.js +29 -21
  64. package/dest/fixtures/token_utils.d.ts +1 -1
  65. package/dest/fixtures/token_utils.d.ts.map +1 -1
  66. package/dest/fixtures/token_utils.js +7 -4
  67. package/dest/shared/cross_chain_test_harness.d.ts +3 -4
  68. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  69. package/dest/shared/cross_chain_test_harness.js +11 -11
  70. package/dest/shared/gas_portal_test_harness.js +1 -1
  71. package/dest/shared/submit-transactions.d.ts +4 -4
  72. package/dest/shared/submit-transactions.d.ts.map +1 -1
  73. package/dest/shared/submit-transactions.js +9 -11
  74. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  75. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  76. package/dest/shared/uniswap_l1_l2.js +20 -18
  77. package/dest/simulators/lending_simulator.js +2 -2
  78. package/dest/simulators/token_simulator.d.ts +1 -1
  79. package/dest/simulators/token_simulator.d.ts.map +1 -1
  80. package/dest/simulators/token_simulator.js +2 -23
  81. package/dest/spartan/setup_test_wallets.d.ts +2 -2
  82. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  83. package/dest/spartan/setup_test_wallets.js +64 -35
  84. package/dest/spartan/tx_metrics.d.ts +38 -2
  85. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  86. package/dest/spartan/tx_metrics.js +178 -4
  87. package/dest/spartan/utils/bot.d.ts +27 -0
  88. package/dest/spartan/utils/bot.d.ts.map +1 -0
  89. package/dest/spartan/utils/bot.js +141 -0
  90. package/dest/spartan/utils/chaos.d.ts +79 -0
  91. package/dest/spartan/utils/chaos.d.ts.map +1 -0
  92. package/dest/spartan/utils/chaos.js +142 -0
  93. package/dest/spartan/utils/clients.d.ts +39 -0
  94. package/dest/spartan/utils/clients.d.ts.map +1 -0
  95. package/dest/spartan/utils/clients.js +90 -0
  96. package/dest/spartan/utils/config.d.ts +39 -0
  97. package/dest/spartan/utils/config.d.ts.map +1 -0
  98. package/dest/spartan/utils/config.js +21 -0
  99. package/dest/spartan/utils/health.d.ts +63 -0
  100. package/dest/spartan/utils/health.d.ts.map +1 -0
  101. package/dest/spartan/utils/health.js +202 -0
  102. package/dest/spartan/utils/helm.d.ts +15 -0
  103. package/dest/spartan/utils/helm.d.ts.map +1 -0
  104. package/dest/spartan/utils/helm.js +47 -0
  105. package/dest/spartan/utils/index.d.ts +9 -0
  106. package/dest/spartan/utils/index.d.ts.map +1 -0
  107. package/dest/spartan/utils/index.js +18 -0
  108. package/dest/spartan/utils/k8s.d.ts +126 -0
  109. package/dest/spartan/utils/k8s.d.ts.map +1 -0
  110. package/dest/spartan/utils/k8s.js +375 -0
  111. package/dest/spartan/utils/nodes.d.ts +41 -0
  112. package/dest/spartan/utils/nodes.d.ts.map +1 -0
  113. package/dest/spartan/utils/nodes.js +461 -0
  114. package/dest/spartan/utils/scripts.d.ts +30 -0
  115. package/dest/spartan/utils/scripts.d.ts.map +1 -0
  116. package/dest/spartan/utils/scripts.js +81 -0
  117. package/dest/spartan/utils.d.ts +2 -260
  118. package/dest/spartan/utils.d.ts.map +1 -1
  119. package/dest/spartan/utils.js +1 -942
  120. package/dest/test-wallet/test_wallet.d.ts +82 -0
  121. package/dest/test-wallet/test_wallet.d.ts.map +1 -0
  122. package/dest/test-wallet/test_wallet.js +214 -0
  123. package/dest/test-wallet/utils.d.ts +41 -0
  124. package/dest/test-wallet/utils.d.ts.map +1 -0
  125. package/dest/test-wallet/utils.js +71 -0
  126. package/package.json +43 -39
  127. package/src/bench/client_flows/client_flows_benchmark.ts +19 -36
  128. package/src/bench/client_flows/config.ts +9 -1
  129. package/src/bench/utils.ts +10 -8
  130. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +20 -14
  131. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +7 -8
  132. package/src/e2e_deploy_contract/deploy_test.ts +3 -3
  133. package/src/e2e_epochs/epochs_test.ts +71 -35
  134. package/src/e2e_fees/bridging_race.notest.ts +2 -5
  135. package/src/e2e_fees/fees_test.ts +21 -40
  136. package/src/e2e_l1_publisher/write_json.ts +3 -8
  137. package/src/e2e_nested_contract/nested_contract_test.ts +3 -5
  138. package/src/e2e_p2p/inactivity_slash_test.ts +4 -4
  139. package/src/e2e_p2p/p2p_network.ts +20 -14
  140. package/src/e2e_p2p/reqresp/utils.ts +207 -0
  141. package/src/e2e_p2p/shared.ts +22 -22
  142. package/src/e2e_storage_proof/fixtures/storage_proof.json +915 -0
  143. package/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts +190 -0
  144. package/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts +173 -0
  145. package/src/e2e_token_contract/token_contract_test.ts +14 -7
  146. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  147. package/src/fixtures/e2e_prover_test.ts +8 -13
  148. package/src/fixtures/ha_setup.ts +184 -0
  149. package/src/fixtures/index.ts +1 -0
  150. package/src/fixtures/setup.ts +50 -128
  151. package/src/fixtures/setup_p2p_test.ts +31 -27
  152. package/src/fixtures/token_utils.ts +6 -5
  153. package/src/guides/up_quick_start.sh +3 -3
  154. package/src/shared/cross_chain_test_harness.ts +13 -27
  155. package/src/shared/gas_portal_test_harness.ts +1 -1
  156. package/src/shared/submit-transactions.ts +11 -16
  157. package/src/shared/uniswap_l1_l2.ts +21 -30
  158. package/src/simulators/lending_simulator.ts +2 -2
  159. package/src/simulators/token_simulator.ts +1 -29
  160. package/src/spartan/setup_test_wallets.ts +75 -25
  161. package/src/spartan/tx_metrics.ts +152 -7
  162. package/src/spartan/utils/bot.ts +185 -0
  163. package/src/spartan/utils/chaos.ts +253 -0
  164. package/src/spartan/utils/clients.ts +100 -0
  165. package/src/spartan/utils/config.ts +27 -0
  166. package/src/spartan/utils/health.ts +255 -0
  167. package/src/spartan/utils/helm.ts +84 -0
  168. package/src/spartan/utils/index.ts +64 -0
  169. package/src/spartan/utils/k8s.ts +527 -0
  170. package/src/spartan/utils/nodes.ts +538 -0
  171. package/src/spartan/utils/scripts.ts +99 -0
  172. package/src/spartan/utils.ts +1 -1246
  173. package/src/test-wallet/test_wallet.ts +305 -0
  174. package/src/test-wallet/utils.ts +112 -0
@@ -4,14 +4,13 @@
4
4
  import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
5
5
  import { range } from '@aztec/foundation/array';
6
6
  import { SecretValue } from '@aztec/foundation/config';
7
- import { addLogNameHandler, removeLogNameHandler } from '@aztec/foundation/log';
7
+ import { withLoggerBindings } from '@aztec/foundation/log/server';
8
8
  import { bufferToHex } from '@aztec/foundation/string';
9
9
  import type { DateProvider } from '@aztec/foundation/timer';
10
10
  import type { ProverNodeConfig, ProverNodeDeps } from '@aztec/prover-node';
11
11
  import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
12
12
 
13
13
  import getPort from 'get-port';
14
- import { AsyncLocalStorage } from 'node:async_hooks';
15
14
 
16
15
  import { TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
17
16
  import { createAndSyncProverNode, getPrivateKeyFromIndex } from './utils.js';
@@ -22,6 +21,11 @@ import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
22
21
  // to avoid running validators with the same key
23
22
  export const ATTESTER_PRIVATE_KEYS_START_INDEX = 3;
24
23
 
24
+ // Global counters for actor naming (start at 1)
25
+ let validatorCounter = 1;
26
+ let nodeCounter = 1;
27
+ let proverCounter = 1;
28
+
25
29
  export function generatePrivateKeys(startIndex: number, numberOfKeys: number): `0x${string}`[] {
26
30
  const privateKeys: `0x${string}`[] = [];
27
31
  // Do not start from 0 as it is used during setup
@@ -44,10 +48,6 @@ export async function createNodes(
44
48
  validatorsPerNode = 1,
45
49
  ): Promise<AztecNodeService[]> {
46
50
  const nodePromises: Promise<AztecNodeService>[] = [];
47
- const loggerIdStorage = new AsyncLocalStorage<string>();
48
- const logNameHandler = (module: string) =>
49
- loggerIdStorage.getStore() ? `${module}:${loggerIdStorage.getStore()}` : module;
50
- addLogNameHandler(logNameHandler);
51
51
 
52
52
  for (let i = 0; i < numNodes; i++) {
53
53
  const index = indexOffset + i;
@@ -69,7 +69,6 @@ export async function createNodes(
69
69
  prefilledPublicData,
70
70
  dataDir,
71
71
  metricsPort,
72
- loggerIdStorage,
73
72
  );
74
73
  nodePromises.push(nodePromise);
75
74
  }
@@ -81,13 +80,20 @@ export async function createNodes(
81
80
  throw new Error('Sequencer not found');
82
81
  }
83
82
 
84
- removeLogNameHandler(logNameHandler);
85
83
  return nodes;
86
84
  }
87
85
 
88
- /** Creates a P2P enabled instance of Aztec Node Service with a validator */
86
+ /** Extended config type for createNode with test-specific overrides. */
87
+ export type CreateNodeConfig = AztecNodeConfig & {
88
+ /** Whether to skip starting the sequencer. */
89
+ dontStartSequencer?: boolean;
90
+ /** Override the private key (instead of deriving from addressIndex). */
91
+ validatorPrivateKey?: `0x${string}`;
92
+ };
93
+
94
+ /** Creates a P2P enabled instance of Aztec Node Service with a validator. */
89
95
  export async function createNode(
90
- config: AztecNodeConfig & { dontStartSequencer?: boolean },
96
+ config: CreateNodeConfig,
91
97
  dateProvider: DateProvider,
92
98
  tcpPort: number,
93
99
  bootstrapNode: string | undefined,
@@ -95,9 +101,9 @@ export async function createNode(
95
101
  prefilledPublicData?: PublicDataTreeLeaf[],
96
102
  dataDirectory?: string,
97
103
  metricsPort?: number,
98
- loggerIdStorage?: AsyncLocalStorage<string>,
99
104
  ) {
100
- const createNode = async () => {
105
+ const actorIndex = validatorCounter++;
106
+ return await withLoggerBindings({ actor: `validator-${actorIndex}` }, async () => {
101
107
  const validatorConfig = await createValidatorConfig(config, bootstrapNode, tcpPort, addressIndex, dataDirectory);
102
108
  const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
103
109
  return await AztecNodeService.createAndSync(
@@ -105,8 +111,7 @@ export async function createNode(
105
111
  { telemetry, dateProvider },
106
112
  { prefilledPublicData, dontStartSequencer: config.dontStartSequencer },
107
113
  );
108
- };
109
- return loggerIdStorage ? await loggerIdStorage.run(tcpPort.toString(), createNode) : createNode();
114
+ });
110
115
  }
111
116
 
112
117
  /** Creates a P2P enabled instance of Aztec Node Service without a validator */
@@ -118,9 +123,9 @@ export async function createNonValidatorNode(
118
123
  prefilledPublicData?: PublicDataTreeLeaf[],
119
124
  dataDirectory?: string,
120
125
  metricsPort?: number,
121
- loggerIdStorage?: AsyncLocalStorage<string>,
122
126
  ) {
123
- const createNode = async () => {
127
+ const actorIndex = nodeCounter++;
128
+ return await withLoggerBindings({ actor: `node-${actorIndex}` }, async () => {
124
129
  const p2pConfig = await createP2PConfig(baseConfig, bootstrapNode, tcpPort, dataDirectory);
125
130
  const config: AztecNodeConfig = {
126
131
  ...p2pConfig,
@@ -130,8 +135,7 @@ export async function createNonValidatorNode(
130
135
  };
131
136
  const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
132
137
  return await AztecNodeService.createAndSync(config, { telemetry, dateProvider }, { prefilledPublicData });
133
- };
134
- return loggerIdStorage ? await loggerIdStorage.run(tcpPort.toString(), createNode) : createNode();
138
+ });
135
139
  }
136
140
 
137
141
  export async function createProverNode(
@@ -143,9 +147,9 @@ export async function createProverNode(
143
147
  prefilledPublicData?: PublicDataTreeLeaf[],
144
148
  dataDirectory?: string,
145
149
  metricsPort?: number,
146
- loggerIdStorage?: AsyncLocalStorage<string>,
147
150
  ) {
148
- const createProverNode = async () => {
151
+ const actorIndex = proverCounter++;
152
+ return await withLoggerBindings({ actor: `prover-${actorIndex}` }, async () => {
149
153
  const proverNodePrivateKey = getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + addressIndex)!;
150
154
  const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
151
155
 
@@ -165,8 +169,7 @@ export async function createProverNode(
165
169
  prefilledPublicData,
166
170
  { ...proverNodeDeps, telemetry },
167
171
  );
168
- };
169
- return loggerIdStorage ? await loggerIdStorage.run(tcpPort.toString(), createProverNode) : createProverNode();
172
+ });
170
173
  }
171
174
 
172
175
  export async function createP2PConfig(
@@ -192,20 +195,21 @@ export async function createP2PConfig(
192
195
  }
193
196
 
194
197
  export async function createValidatorConfig(
195
- config: AztecNodeConfig,
198
+ config: CreateNodeConfig,
196
199
  bootstrapNodeEnr?: string,
197
200
  port?: number,
198
201
  addressIndex: number | number[] = 1,
199
202
  dataDirectory?: string,
200
203
  ) {
201
204
  const addressIndices = Array.isArray(addressIndex) ? addressIndex : [addressIndex];
202
- if (addressIndices.length === 0) {
205
+ if (addressIndices.length === 0 && !config.validatorPrivateKey) {
203
206
  throw new Error('At least one address index must be provided to create a validator config');
204
207
  }
205
208
 
206
- const attesterPrivateKeys = addressIndices.map(index =>
207
- bufferToHex(getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + index)!),
208
- );
209
+ // Use override private key if provided, otherwise derive from address indices
210
+ const attesterPrivateKeys = config.validatorPrivateKey
211
+ ? [config.validatorPrivateKey]
212
+ : addressIndices.map(index => bufferToHex(getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + index)!));
209
213
  const p2pConfig = await createP2PConfig(config, bootstrapNodeEnr, port, dataDirectory);
210
214
  const nodeConfig: AztecNodeConfig = {
211
215
  ...config,
@@ -6,9 +6,10 @@ 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, instance } = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18)
10
- .send({ from: admin })
11
- .wait();
9
+ const { contract, instance } = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18).send({
10
+ from: admin,
11
+ wait: { returnReceipt: true },
12
+ });
12
13
 
13
14
  if (initialAdminBalance > 0n) {
14
15
  await mintTokensToPrivate(contract, admin, admin, initialAdminBalance);
@@ -25,7 +26,7 @@ export async function mintTokensToPrivate(
25
26
  recipient: AztecAddress,
26
27
  amount: bigint,
27
28
  ) {
28
- await token.methods.mint_to_private(recipient, amount).send({ from: minter }).wait();
29
+ await token.methods.mint_to_private(recipient, amount).send({ from: minter });
29
30
  }
30
31
 
31
32
  export async function expectTokenBalance(
@@ -55,7 +56,7 @@ export async function mintNotes(
55
56
  for (let mintedNotes = 0; mintedNotes < noteAmounts.length; mintedNotes += notesPerIteration) {
56
57
  const toMint = noteAmounts.slice(mintedNotes, mintedNotes + notesPerIteration);
57
58
  const actions = toMint.map(amt => asset.methods.mint_to_private(recipient, amt));
58
- await new BatchCall(wallet, actions).send({ from: minter }).wait();
59
+ await new BatchCall(wallet, actions).send({ from: minter });
59
60
  }
60
61
 
61
62
  return noteAmounts.reduce((prev, curr) => prev + curr, 0n);
@@ -23,6 +23,8 @@ aztec-wallet create-account -a alice -f test0
23
23
  aztec-wallet create-account -a bob -f test0
24
24
  # docs:end:declare-accounts
25
25
 
26
+ aztec-wallet bridge-fee-juice 1000000000000000000000 accounts:alice --mint --no-wait
27
+
26
28
  DEPLOY_OUTPUT=$(aztec-wallet deploy ../noir-contracts.js/artifacts/token_contract-Token.json --args accounts:test0 Test TST 18 -f test0)
27
29
  TOKEN_ADDRESS=$(echo "$DEPLOY_OUTPUT" | grep -oE 'Contract deployed at 0x[0-9a-fA-F]+' | cut -d ' ' -f4)
28
30
  echo "Deployed contract at $TOKEN_ADDRESS"
@@ -38,9 +40,7 @@ fi
38
40
 
39
41
  TRANSFER_AMOUNT=42
40
42
 
41
- aztec-wallet create-authwit transfer_in_private accounts:test0 -ca last --args accounts:alice accounts:bob $TRANSFER_AMOUNT 1 -f alice
42
-
43
- aztec-wallet send transfer_in_private -ca last --args accounts:alice accounts:bob $TRANSFER_AMOUNT 1 -aw authwits:last -f test0
43
+ aztec-wallet send transfer_in_private -ca last --args accounts:alice accounts:bob $TRANSFER_AMOUNT 0 -f alice --payment method=fee_juice,claim
44
44
 
45
45
  # Test end result
46
46
  ALICE_BALANCE=$(aztec-wallet simulate balance_of_private -ca last --args accounts:alice -f alice)
@@ -18,7 +18,6 @@ import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses'
18
18
  import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
19
19
  import { EpochNumber } from '@aztec/foundation/branded-types';
20
20
  import { retryUntil } from '@aztec/foundation/retry';
21
- import type { FieldsOf } from '@aztec/foundation/types';
22
21
  import { TestERC20Abi, TokenPortalAbi, TokenPortalBytecode } from '@aztec/l1-artifacts';
23
22
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
24
23
  import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge';
@@ -74,14 +73,10 @@ export async function deployAndInitializeTokenAndBridgeContracts(
74
73
  });
75
74
 
76
75
  // deploy l2 token
77
- const token = await TokenContract.deploy(wallet, owner, 'TokenName', 'TokenSymbol', 18)
78
- .send({ from: owner })
79
- .deployed();
76
+ const token = await TokenContract.deploy(wallet, owner, 'TokenName', 'TokenSymbol', 18).send({ from: owner });
80
77
 
81
78
  // deploy l2 token bridge and attach to the portal
82
- const bridge = await TokenBridgeContract.deploy(wallet, token.address, tokenPortalAddress)
83
- .send({ from: owner })
84
- .deployed();
79
+ const bridge = await TokenBridgeContract.deploy(wallet, token.address, tokenPortalAddress).send({ from: owner });
85
80
 
86
81
  if ((await token.methods.get_admin().simulate({ from: owner })) !== owner.toBigInt()) {
87
82
  throw new Error(`Token admin is not ${owner}`);
@@ -92,7 +87,7 @@ export async function deployAndInitializeTokenAndBridgeContracts(
92
87
  }
93
88
 
94
89
  // make the bridge a minter on the token:
95
- await token.methods.set_minter(bridge.address, true).send({ from: owner }).wait();
90
+ await token.methods.set_minter(bridge.address, true).send({ from: owner });
96
91
  if ((await token.methods.is_minter(bridge.address).simulate({ from: owner })) === 1n) {
97
92
  throw new Error(`Bridge is not a minter`);
98
93
  }
@@ -235,7 +230,7 @@ export class CrossChainTestHarness {
235
230
 
236
231
  async mintTokensPublicOnL2(amount: bigint) {
237
232
  this.logger.info('Minting tokens on L2 publicly');
238
- await this.l2Token.methods.mint_to_public(this.ownerAddress, amount).send({ from: this.ownerAddress }).wait();
233
+ await this.l2Token.methods.mint_to_public(this.ownerAddress, amount).send({ from: this.ownerAddress });
239
234
  }
240
235
 
241
236
  async mintTokensPrivateOnL2(amount: bigint) {
@@ -246,8 +241,7 @@ export class CrossChainTestHarness {
246
241
  // send a transfer tx to force through rollup with the message included
247
242
  await this.l2Token.methods
248
243
  .transfer_in_public(this.ownerAddress, receiverAddress, transferAmount, 0)
249
- .send({ from: this.ownerAddress })
250
- .wait();
244
+ .send({ from: this.ownerAddress });
251
245
  }
252
246
 
253
247
  async consumeMessageOnAztecAndMintPrivately(
@@ -257,8 +251,7 @@ export class CrossChainTestHarness {
257
251
  const { recipient, claimAmount, claimSecret: secretForL2MessageConsumption, messageLeafIndex } = claim;
258
252
  await this.l2Bridge.methods
259
253
  .claim_private(recipient, claimAmount, secretForL2MessageConsumption, messageLeafIndex)
260
- .send({ from: this.ownerAddress })
261
- .wait();
254
+ .send({ from: this.ownerAddress });
262
255
  }
263
256
 
264
257
  async consumeMessageOnAztecAndMintPublicly(
@@ -268,28 +261,25 @@ export class CrossChainTestHarness {
268
261
  const { claimAmount, claimSecret, messageLeafIndex } = claim;
269
262
  await this.l2Bridge.methods
270
263
  .claim_public(this.ownerAddress, claimAmount, claimSecret, messageLeafIndex)
271
- .send({ from: this.ownerAddress })
272
- .wait();
264
+ .send({ from: this.ownerAddress });
273
265
  }
274
266
 
275
267
  async withdrawPrivateFromAztecToL1(
276
268
  withdrawAmount: bigint,
277
269
  authwitNonce: Fr = Fr.ZERO,
278
270
  authWitness: AuthWitness,
279
- ): Promise<FieldsOf<TxReceipt>> {
271
+ ): Promise<TxReceipt> {
280
272
  const withdrawReceipt = await this.l2Bridge.methods
281
273
  .exit_to_l1_private(this.l2Token.address, this.ethAccount, withdrawAmount, EthAddress.ZERO, authwitNonce)
282
- .send({ authWitnesses: [authWitness], from: this.ownerAddress })
283
- .wait();
274
+ .send({ authWitnesses: [authWitness], from: this.ownerAddress });
284
275
 
285
276
  return withdrawReceipt;
286
277
  }
287
278
 
288
- async withdrawPublicFromAztecToL1(withdrawAmount: bigint, authwitNonce: Fr = Fr.ZERO): Promise<FieldsOf<TxReceipt>> {
279
+ async withdrawPublicFromAztecToL1(withdrawAmount: bigint, authwitNonce: Fr = Fr.ZERO): Promise<TxReceipt> {
289
280
  const withdrawReceipt = await this.l2Bridge.methods
290
281
  .exit_to_l1_public(this.ethAccount, withdrawAmount, EthAddress.ZERO, authwitNonce)
291
- .send({ from: this.ownerAddress })
292
- .wait();
282
+ .send({ from: this.ownerAddress });
293
283
 
294
284
  return withdrawReceipt;
295
285
  }
@@ -333,18 +323,14 @@ export class CrossChainTestHarness {
333
323
 
334
324
  async transferToPrivateOnL2(shieldAmount: bigint) {
335
325
  this.logger.info('Transferring to private on L2');
336
- await this.l2Token.methods
337
- .transfer_to_private(this.ownerAddress, shieldAmount)
338
- .send({ from: this.ownerAddress })
339
- .wait();
326
+ await this.l2Token.methods.transfer_to_private(this.ownerAddress, shieldAmount).send({ from: this.ownerAddress });
340
327
  }
341
328
 
342
329
  async transferToPublicOnL2(amount: bigint, authwitNonce = Fr.ZERO) {
343
330
  this.logger.info('Transferring tokens to public');
344
331
  await this.l2Token.methods
345
332
  .transfer_to_public(this.ownerAddress, this.ownerAddress, amount, authwitNonce)
346
- .send({ from: this.ownerAddress })
347
- .wait();
333
+ .send({ from: this.ownerAddress });
348
334
  }
349
335
 
350
336
  /**
@@ -127,7 +127,7 @@ export class GasBridgingTestHarness implements IGasBridgingTestHarness {
127
127
  async consumeMessageOnAztecAndClaimPrivately(owner: AztecAddress, claimer: AztecAddress, claim: L2AmountClaim) {
128
128
  this.logger.info('Consuming messages on L2 Privately');
129
129
  const { claimAmount, claimSecret, messageLeafIndex } = claim;
130
- await this.feeJuice.methods.claim(owner, claimAmount, claimSecret, messageLeafIndex).send({ from: claimer }).wait();
130
+ await this.feeJuice.methods.claim(owner, claimAmount, claimSecret, messageLeafIndex).send({ from: claimer });
131
131
  }
132
132
 
133
133
  async getL2PublicBalanceOf(owner: AztecAddress) {
@@ -1,10 +1,11 @@
1
1
  import { AztecAddress } from '@aztec/aztec.js/addresses';
2
- import type { SentTx } from '@aztec/aztec.js/contracts';
2
+ import { NO_WAIT } from '@aztec/aztec.js/contracts';
3
3
  import { Fr, GrumpkinScalar } from '@aztec/aztec.js/fields';
4
4
  import type { Logger } from '@aztec/aztec.js/log';
5
- import { TxStatus } from '@aztec/aztec.js/tx';
5
+ import { TxHash, type TxReceipt, TxStatus } from '@aztec/aztec.js/tx';
6
6
  import { times } from '@aztec/foundation/collection';
7
- import type { TestWallet } from '@aztec/test-wallet/server';
7
+
8
+ import type { TestWallet } from '../test-wallet/test_wallet.js';
8
9
 
9
10
  // submits a set of transactions to the provided Wallet
10
11
  export const submitTxsTo = async (
@@ -12,26 +13,20 @@ export const submitTxsTo = async (
12
13
  submitter: AztecAddress,
13
14
  numTxs: number,
14
15
  logger: Logger,
15
- ): Promise<SentTx[]> => {
16
- const txs: SentTx[] = [];
16
+ ): Promise<TxHash[]> => {
17
+ const txHashes: TxHash[] = [];
17
18
  await Promise.all(
18
19
  times(numTxs, async () => {
19
20
  const accountManager = await wallet.createSchnorrAccount(Fr.random(), Fr.random(), GrumpkinScalar.random());
20
21
  const deployMethod = await accountManager.getDeployMethod();
21
- const tx = deployMethod.send({ from: submitter });
22
- const txHash = await tx.getTxHash();
22
+ const txHash = await deployMethod.send({ from: submitter, wait: NO_WAIT });
23
23
 
24
24
  logger.info(`Tx sent with hash ${txHash}`);
25
- const receipt = await tx.getReceipt();
26
- expect(receipt).toEqual(
27
- expect.objectContaining({
28
- status: TxStatus.PENDING,
29
- error: '',
30
- }),
31
- );
25
+ const receipt: TxReceipt = await wallet.getTxReceipt(txHash);
26
+ expect(receipt.status).toBe(TxStatus.PENDING);
32
27
  logger.info(`Receipt received for ${txHash}`);
33
- txs.push(tx);
28
+ txHashes.push(txHash);
34
29
  }),
35
30
  );
36
- return txs;
31
+ return txHashes;
37
32
  };
@@ -11,18 +11,18 @@ import type { DeployAztecL1ContractsReturnType } from '@aztec/ethereum/deploy-az
11
11
  import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contract';
12
12
  import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
13
13
  import { extractEvent } from '@aztec/ethereum/utils';
14
- import { CheckpointNumber, EpochNumber } from '@aztec/foundation/branded-types';
14
+ import { EpochNumber } from '@aztec/foundation/branded-types';
15
15
  import { sha256ToField } from '@aztec/foundation/crypto/sha256';
16
16
  import { InboxAbi, UniswapPortalAbi, UniswapPortalBytecode } from '@aztec/l1-artifacts';
17
17
  import { UniswapContract } from '@aztec/noir-contracts.js/Uniswap';
18
18
  import { computeL2ToL1MessageHash } from '@aztec/stdlib/hash';
19
19
  import { computeL2ToL1MembershipWitness } from '@aztec/stdlib/messaging';
20
- import type { TestWallet } from '@aztec/test-wallet/server';
21
20
 
22
21
  import { jest } from '@jest/globals';
23
22
  import { type GetContractReturnType, getContract, parseEther, toFunctionSelector } from 'viem';
24
23
 
25
24
  import { type EndToEndContext, ensureAccountContractsPublished } from '../fixtures/utils.js';
25
+ import type { TestWallet } from '../test-wallet/test_wallet.js';
26
26
  import { CrossChainTestHarness } from './cross_chain_test_harness.js';
27
27
 
28
28
  // PSA: This tests works on forked mainnet. There is a dump of the data in `dumpedState` such that we
@@ -84,7 +84,7 @@ export const uniswapL1L2TestSuite = (
84
84
 
85
85
  l1Client = deployL1ContractsValues.l1Client;
86
86
 
87
- t.watcher?.setIsMarkingAsProven(false);
87
+ t.watcher.setIsMarkingAsProven(false);
88
88
 
89
89
  if (Number(await l1Client.getBlockNumber()) < expectedForkBlockNumber) {
90
90
  throw new Error('This test must be run on a fork of mainnet with the expected fork block');
@@ -130,9 +130,7 @@ export const uniswapL1L2TestSuite = (
130
130
  client: l1Client,
131
131
  });
132
132
  // deploy l2 uniswap contract and attach to portal
133
- uniswapL2Contract = await UniswapContract.deploy(wallet, uniswapPortalAddress)
134
- .send({ from: ownerAddress })
135
- .deployed();
133
+ uniswapL2Contract = await UniswapContract.deploy(wallet, uniswapPortalAddress).send({ from: ownerAddress });
136
134
 
137
135
  const registryAddress = (await aztecNode.getNodeInfo()).l1ContractAddresses.registryAddress;
138
136
 
@@ -209,8 +207,7 @@ export const uniswapL1L2TestSuite = (
209
207
  secretHashForDepositingSwappedDai,
210
208
  ownerEthAddress,
211
209
  )
212
- .send({ from: ownerAddress, authWitnesses: [transferToPublicAuhtwit] })
213
- .wait();
210
+ .send({ from: ownerAddress, authWitnesses: [transferToPublicAuhtwit] });
214
211
 
215
212
  const swapPrivateFunction = 'swap_private(address,uint256,uint24,address,uint256,bytes32,address)';
216
213
  const swapPrivateContent = sha256ToField([
@@ -253,8 +250,8 @@ export const uniswapL1L2TestSuite = (
253
250
  await wethCrossChainHarness.expectPublicBalanceOnL2(uniswapL2Contract.address, 0n);
254
251
 
255
252
  // Since the outbox is only consumable when the epoch is proven, we need to advance to the next epoch.
256
- const checkpointNumber = CheckpointNumber.fromBlockNumber(l2UniswapInteractionReceipt.blockNumber!);
257
- const epoch = await rollup.getEpochNumberForCheckpoint(checkpointNumber);
253
+ const block = await aztecNode.getBlock(l2UniswapInteractionReceipt.blockNumber!);
254
+ const epoch = await rollup.getEpochNumberForCheckpoint(block!.checkpointNumber);
258
255
  await cheatCodes.rollup.advanceToEpoch(EpochNumber(epoch + 1));
259
256
  await waitForProven(aztecNode, l2UniswapInteractionReceipt, { provenTimeout: 300 });
260
257
 
@@ -428,10 +425,10 @@ export const uniswapL1L2TestSuite = (
428
425
  // ownerEthAddress,
429
426
  // nonceForSwap,
430
427
  // );
431
- // await ownerWallet.setPublicAuthWit({ caller: sponsorAddress, action }, true).send().wait();
428
+ // await ownerWallet.setPublicAuthWit({ caller: sponsorAddress, action }, true).send();
432
429
 
433
430
  // // 4.2 Call swap_public from user2 on behalf of owner
434
- // const uniswapL2Interaction = await action.send().wait();
431
+ // const uniswapL2Interaction = await action.send();
435
432
 
436
433
  // const swapPublicContent = sha256ToField([
437
434
  // Buffer.from(
@@ -649,8 +646,7 @@ export const uniswapL1L2TestSuite = (
649
646
  Fr.random(),
650
647
  ownerEthAddress,
651
648
  )
652
- .send({ from: ownerAddress, authWitnesses: [transferToPublicAuthwith] })
653
- .wait(),
649
+ .send({ from: ownerAddress, authWitnesses: [transferToPublicAuthwith] }),
654
650
  ).rejects.toThrow('Assertion failed: input_asset address is not the same as seen in the bridge contract');
655
651
  });
656
652
 
@@ -675,7 +671,7 @@ export const uniswapL1L2TestSuite = (
675
671
  },
676
672
  true,
677
673
  );
678
- await validateActionInteraction.send().wait();
674
+ await validateActionInteraction.send();
679
675
 
680
676
  // No approval to call `swap` but should work even without it:
681
677
  const [_, secretHashForDepositingSwappedDai] = await generateClaimSecret();
@@ -694,8 +690,7 @@ export const uniswapL1L2TestSuite = (
694
690
  ownerEthAddress,
695
691
  Fr.ZERO, // nonce for swap -> doesn't matter
696
692
  )
697
- .send({ from: ownerAddress })
698
- .wait();
693
+ .send({ from: ownerAddress });
699
694
  // check weth balance of owner on L2 (we first bridged `wethAmountToBridge` into L2 and now withdrew it!)
700
695
  await wethCrossChainHarness.expectPublicBalanceOnL2(ownerAddress, 0n);
701
696
  });
@@ -725,7 +720,7 @@ export const uniswapL1L2TestSuite = (
725
720
  { caller: approvedUser, action },
726
721
  true,
727
722
  );
728
- await validateActionInteraction.send().wait();
723
+ await validateActionInteraction.send();
729
724
 
730
725
  await expect(action.simulate({ from: sponsorAddress })).rejects.toThrow(/unauthorized/);
731
726
  });
@@ -747,7 +742,7 @@ export const uniswapL1L2TestSuite = (
747
742
  },
748
743
  true,
749
744
  );
750
- await validateActionInteraction.send().wait();
745
+ await validateActionInteraction.send();
751
746
 
752
747
  await expect(
753
748
  uniswapL2Contract.methods
@@ -804,8 +799,7 @@ export const uniswapL1L2TestSuite = (
804
799
  secretHashForDepositingSwappedDai,
805
800
  ownerEthAddress,
806
801
  )
807
- .send({ from: ownerAddress, authWitnesses: [transferToPublicAuhtwit] })
808
- .wait();
802
+ .send({ from: ownerAddress, authWitnesses: [transferToPublicAuhtwit] });
809
803
 
810
804
  const swapPrivateContent = sha256ToField([
811
805
  Buffer.from(
@@ -844,9 +838,8 @@ export const uniswapL1L2TestSuite = (
844
838
  chainId: new Fr(l1Client.chain.id),
845
839
  });
846
840
 
847
- const epoch = await rollup.getEpochNumberForCheckpoint(
848
- CheckpointNumber.fromBlockNumber(withdrawReceipt.blockNumber!),
849
- );
841
+ const block = await aztecNode.getBlock(withdrawReceipt.blockNumber!);
842
+ const epoch = await rollup.getEpochNumberForCheckpoint(block!.checkpointNumber);
850
843
  const swapResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, swapPrivateLeaf);
851
844
  const withdrawResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, withdrawLeaf);
852
845
 
@@ -918,7 +911,7 @@ export const uniswapL1L2TestSuite = (
918
911
  },
919
912
  true,
920
913
  );
921
- await validateActionInteraction.send().wait();
914
+ await validateActionInteraction.send();
922
915
 
923
916
  // Call swap_public on L2
924
917
  const secretHashForDepositingSwappedDai = Fr.random();
@@ -936,8 +929,7 @@ export const uniswapL1L2TestSuite = (
936
929
  ownerEthAddress,
937
930
  Fr.ZERO,
938
931
  )
939
- .send({ from: ownerAddress })
940
- .wait();
932
+ .send({ from: ownerAddress });
941
933
 
942
934
  const swapPublicContent = sha256ToField([
943
935
  Buffer.from(
@@ -979,9 +971,8 @@ export const uniswapL1L2TestSuite = (
979
971
  chainId: new Fr(l1Client.chain.id),
980
972
  });
981
973
 
982
- const epoch = await rollup.getEpochNumberForCheckpoint(
983
- CheckpointNumber.fromBlockNumber(withdrawReceipt.blockNumber!),
984
- );
974
+ const block = await aztecNode.getBlock(withdrawReceipt.blockNumber!);
975
+ const epoch = await rollup.getEpochNumberForCheckpoint(block!.checkpointNumber);
985
976
  const swapResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, swapPublicLeaf);
986
977
  const withdrawResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, withdrawLeaf);
987
978
 
@@ -4,7 +4,7 @@ import { Fr } from '@aztec/aztec.js/fields';
4
4
  import { CheatCodes } from '@aztec/aztec/testing';
5
5
  import type { RollupContract } from '@aztec/ethereum/contracts';
6
6
  import { SlotNumber } from '@aztec/foundation/branded-types';
7
- import { pedersenHash } from '@aztec/foundation/crypto/pedersen';
7
+ import { poseidon2Hash } from '@aztec/foundation/crypto/poseidon';
8
8
  import type { TestDateProvider } from '@aztec/foundation/timer';
9
9
  import type { LendingContract } from '@aztec/noir-contracts.js/Lending';
10
10
 
@@ -29,7 +29,7 @@ export class LendingAccount {
29
29
  * @returns Key in public space
30
30
  */
31
31
  public key() {
32
- return pedersenHash([this.address, this.secret]);
32
+ return poseidon2Hash([this.address, this.secret]);
33
33
  }
34
34
  }
35
35
 
@@ -119,39 +119,11 @@ export class TokenSimulator {
119
119
  }
120
120
 
121
121
  async checkPrivate() {
122
- // Private calls
123
- const defaultLookups = [];
124
- const nonDefaultLookups = [];
125
-
126
122
  for (const address of this.accounts) {
127
- if (this.lookupProvider.has(address.toString())) {
128
- nonDefaultLookups.push(address);
129
- } else {
130
- defaultLookups.push(address);
131
- }
132
- }
133
-
134
- const defaultCalls = defaultLookups.map(address => this.token.methods.balance_of_private(address));
135
- const results = (
136
- await Promise.all(
137
- chunk(defaultCalls, 4).map(batch =>
138
- new BatchCall(this.defaultWallet, batch).simulate({ from: this.defaultAddress }),
139
- ),
140
- )
141
- ).flat();
142
- for (let i = 0; i < defaultLookups.length; i++) {
143
- expect(results[i]).toEqual(this.balanceOfPrivate(defaultLookups[i]));
144
- }
145
-
146
- // We are just running individual calls for the non-default lookups
147
- // @todo We should also batch these
148
- for (const address of nonDefaultLookups) {
149
123
  const wallet = this.lookupProvider.get(address.toString());
150
124
  const asset = wallet ? this.token.withWallet(wallet) : this.token;
151
125
 
152
- const actualPrivateBalance = await asset.methods
153
- .balance_of_private({ address })
154
- .simulate({ from: this.defaultAddress });
126
+ const actualPrivateBalance = await asset.methods.balance_of_private(address).simulate({ from: address });
155
127
  expect(actualPrivateBalance).toEqual(this.balanceOfPrivate(address));
156
128
  }
157
129
  }