@aztec/end-to-end 0.0.0-test.0 → 0.0.1-fake-c83136db25

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 (166) hide show
  1. package/dest/bench/client_flows/benchmark.d.ts +61 -0
  2. package/dest/bench/client_flows/benchmark.d.ts.map +1 -0
  3. package/dest/bench/client_flows/benchmark.js +261 -0
  4. package/dest/bench/client_flows/client_flows_benchmark.d.ts +73 -0
  5. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -0
  6. package/dest/bench/client_flows/client_flows_benchmark.js +311 -0
  7. package/dest/bench/client_flows/config.d.ts +14 -0
  8. package/dest/bench/client_flows/config.d.ts.map +1 -0
  9. package/dest/bench/client_flows/config.js +106 -0
  10. package/dest/bench/client_flows/data_extractor.d.ts +2 -0
  11. package/dest/bench/client_flows/data_extractor.d.ts.map +1 -0
  12. package/dest/bench/client_flows/data_extractor.js +99 -0
  13. package/dest/bench/utils.d.ts +10 -36
  14. package/dest/bench/utils.d.ts.map +1 -1
  15. package/dest/bench/utils.js +26 -66
  16. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +20 -12
  17. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  18. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +85 -57
  19. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +18 -24
  20. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  21. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +48 -69
  22. package/dest/e2e_deploy_contract/deploy_test.d.ts +14 -6
  23. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  24. package/dest/e2e_deploy_contract/deploy_test.js +13 -19
  25. package/dest/e2e_epochs/epochs_test.d.ts +58 -17
  26. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  27. package/dest/e2e_epochs/epochs_test.js +224 -43
  28. package/dest/e2e_fees/bridging_race.notest.d.ts +2 -0
  29. package/dest/e2e_fees/bridging_race.notest.d.ts.map +1 -0
  30. package/dest/e2e_fees/bridging_race.notest.js +63 -0
  31. package/dest/e2e_fees/fees_test.d.ts +20 -9
  32. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  33. package/dest/e2e_fees/fees_test.js +98 -107
  34. package/dest/e2e_l1_publisher/write_json.d.ts +10 -0
  35. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -0
  36. package/dest/e2e_l1_publisher/write_json.js +57 -0
  37. package/dest/e2e_multi_validator/utils.d.ts +12 -0
  38. package/dest/e2e_multi_validator/utils.d.ts.map +1 -0
  39. package/dest/e2e_multi_validator/utils.js +214 -0
  40. package/dest/e2e_nested_contract/nested_contract_test.d.ts +9 -6
  41. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  42. package/dest/e2e_nested_contract/nested_contract_test.js +22 -19
  43. package/dest/e2e_p2p/inactivity_slash_test.d.ts +31 -0
  44. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -0
  45. package/dest/e2e_p2p/inactivity_slash_test.js +135 -0
  46. package/dest/e2e_p2p/p2p_network.d.ts +69 -22
  47. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  48. package/dest/e2e_p2p/p2p_network.js +180 -129
  49. package/dest/e2e_p2p/shared.d.ts +41 -5
  50. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  51. package/dest/e2e_p2p/shared.js +163 -19
  52. package/dest/e2e_token_contract/token_contract_test.d.ts +11 -5
  53. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  54. package/dest/e2e_token_contract/token_contract_test.js +50 -26
  55. package/dest/{e2e_prover → fixtures}/e2e_prover_test.d.ts +14 -9
  56. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -0
  57. package/dest/{e2e_prover → fixtures}/e2e_prover_test.js +95 -100
  58. package/dest/fixtures/fixtures.d.ts +5 -6
  59. package/dest/fixtures/fixtures.d.ts.map +1 -1
  60. package/dest/fixtures/fixtures.js +4 -3
  61. package/dest/fixtures/get_acvm_config.d.ts +1 -1
  62. package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
  63. package/dest/fixtures/get_acvm_config.js +2 -14
  64. package/dest/fixtures/get_bb_config.d.ts +1 -1
  65. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  66. package/dest/fixtures/get_bb_config.js +10 -17
  67. package/dest/fixtures/l1_to_l2_messaging.d.ts +8 -5
  68. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  69. package/dest/fixtures/l1_to_l2_messaging.js +44 -18
  70. package/dest/fixtures/setup_l1_contracts.d.ts +3 -3
  71. package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
  72. package/dest/fixtures/setup_l1_contracts.js +4 -4
  73. package/dest/fixtures/setup_p2p_test.d.ts +14 -13
  74. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  75. package/dest/fixtures/setup_p2p_test.js +73 -21
  76. package/dest/fixtures/snapshot_manager.d.ts +15 -7
  77. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  78. package/dest/fixtures/snapshot_manager.js +147 -121
  79. package/dest/fixtures/token_utils.d.ts +6 -3
  80. package/dest/fixtures/token_utils.d.ts.map +1 -1
  81. package/dest/fixtures/token_utils.js +23 -10
  82. package/dest/fixtures/utils.d.ts +76 -37
  83. package/dest/fixtures/utils.d.ts.map +1 -1
  84. package/dest/fixtures/utils.js +464 -368
  85. package/dest/fixtures/web3signer.d.ts +5 -0
  86. package/dest/fixtures/web3signer.d.ts.map +1 -0
  87. package/dest/fixtures/web3signer.js +53 -0
  88. package/dest/quality_of_service/alert_checker.d.ts +1 -1
  89. package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
  90. package/dest/shared/cross_chain_test_harness.d.ts +41 -25
  91. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  92. package/dest/shared/cross_chain_test_harness.js +104 -50
  93. package/dest/shared/gas_portal_test_harness.d.ts +32 -24
  94. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  95. package/dest/shared/gas_portal_test_harness.js +50 -29
  96. package/dest/shared/jest_setup.js +1 -1
  97. package/dest/shared/submit-transactions.d.ts +5 -3
  98. package/dest/shared/submit-transactions.d.ts.map +1 -1
  99. package/dest/shared/submit-transactions.js +8 -7
  100. package/dest/shared/uniswap_l1_l2.d.ts +13 -11
  101. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  102. package/dest/shared/uniswap_l1_l2.js +138 -108
  103. package/dest/simulators/lending_simulator.d.ts +6 -6
  104. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  105. package/dest/simulators/lending_simulator.js +13 -16
  106. package/dest/simulators/token_simulator.d.ts +5 -2
  107. package/dest/simulators/token_simulator.d.ts.map +1 -1
  108. package/dest/simulators/token_simulator.js +16 -13
  109. package/dest/spartan/setup_test_wallets.d.ts +23 -10
  110. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  111. package/dest/spartan/setup_test_wallets.js +167 -58
  112. package/dest/spartan/utils.d.ts +100 -303
  113. package/dest/spartan/utils.d.ts.map +1 -1
  114. package/dest/spartan/utils.js +407 -130
  115. package/package.json +61 -56
  116. package/src/bench/client_flows/benchmark.ts +341 -0
  117. package/src/bench/client_flows/client_flows_benchmark.ts +402 -0
  118. package/src/bench/client_flows/config.ts +61 -0
  119. package/src/bench/client_flows/data_extractor.ts +111 -0
  120. package/src/bench/utils.ts +22 -76
  121. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +80 -77
  122. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +63 -105
  123. package/src/e2e_deploy_contract/deploy_test.ts +23 -38
  124. package/src/e2e_epochs/epochs_test.ts +274 -54
  125. package/src/e2e_fees/bridging_race.notest.ts +80 -0
  126. package/src/e2e_fees/fees_test.ts +137 -136
  127. package/src/e2e_l1_publisher/write_json.ts +76 -0
  128. package/src/e2e_multi_validator/utils.ts +258 -0
  129. package/src/e2e_nested_contract/nested_contract_test.ts +27 -18
  130. package/src/e2e_p2p/inactivity_slash_test.ts +178 -0
  131. package/src/e2e_p2p/p2p_network.ts +272 -166
  132. package/src/e2e_p2p/shared.ts +244 -29
  133. package/src/e2e_token_contract/token_contract_test.ts +43 -39
  134. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  135. package/src/{e2e_prover → fixtures}/e2e_prover_test.ts +101 -145
  136. package/src/fixtures/fixtures.ts +4 -3
  137. package/src/fixtures/get_acvm_config.ts +3 -11
  138. package/src/fixtures/get_bb_config.ts +18 -13
  139. package/src/fixtures/l1_to_l2_messaging.ts +53 -23
  140. package/src/fixtures/setup_l1_contracts.ts +6 -7
  141. package/src/fixtures/setup_p2p_test.ts +112 -38
  142. package/src/fixtures/snapshot_manager.ts +187 -139
  143. package/src/fixtures/token_utils.ts +29 -12
  144. package/src/fixtures/utils.ts +552 -425
  145. package/src/fixtures/web3signer.ts +63 -0
  146. package/src/guides/up_quick_start.sh +6 -14
  147. package/src/quality_of_service/alert_checker.ts +1 -1
  148. package/src/shared/cross_chain_test_harness.ts +108 -79
  149. package/src/shared/gas_portal_test_harness.ts +58 -49
  150. package/src/shared/jest_setup.ts +1 -1
  151. package/src/shared/submit-transactions.ts +12 -8
  152. package/src/shared/uniswap_l1_l2.ts +173 -176
  153. package/src/simulators/lending_simulator.ts +12 -15
  154. package/src/simulators/token_simulator.ts +21 -13
  155. package/src/spartan/DEVELOP.md +121 -0
  156. package/src/spartan/setup_test_wallets.ts +215 -93
  157. package/src/spartan/utils.ts +458 -130
  158. package/dest/e2e_prover/e2e_prover_test.d.ts.map +0 -1
  159. package/dest/sample-dapp/connect.js +0 -12
  160. package/dest/sample-dapp/contracts.js +0 -10
  161. package/dest/sample-dapp/deploy.js +0 -35
  162. package/dest/sample-dapp/index.js +0 -98
  163. package/src/sample-dapp/connect.mjs +0 -16
  164. package/src/sample-dapp/contracts.mjs +0 -14
  165. package/src/sample-dapp/deploy.mjs +0 -40
  166. package/src/sample-dapp/index.mjs +0 -128
@@ -1,51 +1,46 @@
1
- import {
2
- SchnorrAccountContractArtifact,
3
- getSchnorrAccount,
4
- getSchnorrWalletWithSecretKey,
5
- } from '@aztec/accounts/schnorr';
6
1
  import type { InitialAccountData } from '@aztec/accounts/testing';
7
2
  import { type Archiver, createArchiver } from '@aztec/archiver';
3
+ import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
4
+ import { type Logger, createLogger } from '@aztec/aztec.js/log';
5
+ import type { AztecNode } from '@aztec/aztec.js/node';
6
+ import { CheatCodes } from '@aztec/aztec/testing';
8
7
  import {
9
- type AccountWalletWithSecretKey,
10
- type AztecNode,
11
- type CheatCodes,
12
- type CompleteAddress,
13
- type DeployL1ContractsReturnType,
14
- EthAddress,
15
- type Logger,
16
- type PXE,
17
- createLogger,
18
- deployL1Contract,
19
- } from '@aztec/aztec.js';
20
- import { BBCircuitVerifier, type ClientProtocolCircuitVerifier, TestCircuitVerifier } from '@aztec/bb-prover';
8
+ BBCircuitVerifier,
9
+ type ClientProtocolCircuitVerifier,
10
+ QueuedIVCVerifier,
11
+ TestCircuitVerifier,
12
+ } from '@aztec/bb-prover';
21
13
  import { createBlobSinkClient } from '@aztec/blob-sink/client';
22
14
  import type { BlobSinkServer } from '@aztec/blob-sink/server';
15
+ import type { DeployL1ContractsReturnType } from '@aztec/ethereum';
23
16
  import { Buffer32 } from '@aztec/foundation/buffer';
24
- import { HonkVerifierAbi, HonkVerifierBytecode, RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
17
+ import { SecretValue } from '@aztec/foundation/config';
18
+ import { FeeAssetHandlerAbi } from '@aztec/l1-artifacts';
25
19
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
26
20
  import { type ProverNode, type ProverNodeConfig, createProverNode } from '@aztec/prover-node';
27
- import type { PXEService } from '@aztec/pxe/server';
21
+ import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
22
+ import { TestWallet } from '@aztec/test-wallet/server';
28
23
  import { getGenesisValues } from '@aztec/world-state/testing';
29
24
 
30
25
  import { type Hex, getContract } from 'viem';
31
26
  import { privateKeyToAddress } from 'viem/accounts';
32
27
 
33
- import { getACVMConfig } from '../fixtures/get_acvm_config.js';
34
- import { getBBConfig } from '../fixtures/get_bb_config.js';
28
+ import { TokenSimulator } from '../simulators/token_simulator.js';
29
+ import { getACVMConfig } from './get_acvm_config.js';
30
+ import { getBBConfig } from './get_bb_config.js';
35
31
  import {
36
32
  type ISnapshotManager,
37
33
  type SubsystemsContext,
38
34
  createSnapshotManager,
39
35
  deployAccounts,
40
36
  publicDeployAccounts,
41
- } from '../fixtures/snapshot_manager.js';
42
- import { getPrivateKeyFromIndex, setupPXEService } from '../fixtures/utils.js';
43
- import { TokenSimulator } from '../simulators/token_simulator.js';
37
+ } from './snapshot_manager.js';
38
+ import { getPrivateKeyFromIndex, getSponsoredFPCAddress, setupPXEAndGetWallet } from './utils.js';
44
39
 
45
40
  const { E2E_DATA_PATH: dataPath } = process.env;
46
41
 
47
42
  type ProvenSetup = {
48
- pxe: PXE;
43
+ wallet: TestWallet;
49
44
  teardown: () => Promise<void>;
50
45
  };
51
46
 
@@ -62,20 +57,21 @@ export class FullProverTest {
62
57
  static TOKEN_DECIMALS = 18n;
63
58
  private snapshotManager: ISnapshotManager;
64
59
  logger: Logger;
65
- deployedAccounts: InitialAccountData[] = [];
66
- wallets: AccountWalletWithSecretKey[] = [];
67
- accounts: CompleteAddress[] = [];
60
+ wallet!: TestWallet;
61
+ provenWallet!: TestWallet;
62
+ accounts: AztecAddress[] = [];
63
+ deployedAccounts!: InitialAccountData[];
68
64
  fakeProofsAsset!: TokenContract;
69
65
  tokenSim!: TokenSimulator;
70
66
  aztecNode!: AztecNode;
71
- pxe!: PXEService;
67
+ aztecNodeAdmin!: AztecNodeAdmin;
72
68
  cheatCodes!: CheatCodes;
73
69
  blobSink!: BlobSinkServer;
74
70
  private provenComponents: ProvenSetup[] = [];
75
71
  private bbConfigCleanup?: () => Promise<void>;
76
72
  private acvmConfigCleanup?: () => Promise<void>;
77
73
  circuitProofVerifier?: ClientProtocolCircuitVerifier;
78
- provenAssets: TokenContract[] = [];
74
+ provenAsset!: TokenContract;
79
75
  private context!: SubsystemsContext;
80
76
  private proverNode!: ProverNode;
81
77
  private simulatedProverNode!: ProverNode;
@@ -93,7 +89,9 @@ export class FullProverTest {
93
89
  `full_prover_integration/${testName}`,
94
90
  dataPath,
95
91
  { startProverNode: true, fundRewardDistributor: true, coinbase },
96
- {},
92
+ {
93
+ realVerifier: realProofs,
94
+ },
97
95
  );
98
96
  }
99
97
 
@@ -106,13 +104,11 @@ export class FullProverTest {
106
104
  await this.snapshotManager.snapshot(
107
105
  '2_accounts',
108
106
  deployAccounts(2, this.logger),
109
- async ({ deployedAccounts }, { pxe }) => {
107
+ ({ deployedAccounts }, { wallet }) => {
110
108
  this.deployedAccounts = deployedAccounts;
111
- this.wallets = await Promise.all(
112
- deployedAccounts.map(a => getSchnorrWalletWithSecretKey(pxe, a.secret, a.signingKey, a.salt)),
113
- );
114
- this.accounts = this.wallets.map(w => w.getCompleteAddress());
115
- this.wallets.forEach((w, i) => this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
109
+ this.accounts = deployedAccounts.map(a => a.address);
110
+ this.wallet = wallet;
111
+ return Promise.resolve();
116
112
  },
117
113
  );
118
114
 
@@ -122,17 +118,17 @@ export class FullProverTest {
122
118
  // Create the token contract state.
123
119
  // Move this account thing to addAccounts above?
124
120
  this.logger.verbose(`Public deploy accounts...`);
125
- await publicDeployAccounts(this.wallets[0], this.accounts.slice(0, 2), false);
121
+ await publicDeployAccounts(this.wallet, this.accounts.slice(0, 2));
126
122
 
127
123
  this.logger.verbose(`Deploying TokenContract...`);
128
124
  const asset = await TokenContract.deploy(
129
- this.wallets[0],
125
+ this.wallet,
130
126
  this.accounts[0],
131
127
  FullProverTest.TOKEN_NAME,
132
128
  FullProverTest.TOKEN_SYMBOL,
133
129
  FullProverTest.TOKEN_DECIMALS,
134
130
  )
135
- .send()
131
+ .send({ from: this.accounts[0] })
136
132
  .deployed();
137
133
  this.logger.verbose(`Token deployed to ${asset.address}`);
138
134
 
@@ -140,17 +136,20 @@ export class FullProverTest {
140
136
  },
141
137
  async ({ tokenContractAddress }) => {
142
138
  // Restore the token contract state.
143
- this.fakeProofsAsset = await TokenContract.at(tokenContractAddress, this.wallets[0]);
139
+ this.fakeProofsAsset = await TokenContract.at(tokenContractAddress, this.wallet);
144
140
  this.logger.verbose(`Token contract address: ${this.fakeProofsAsset.address}`);
145
141
 
146
142
  this.tokenSim = new TokenSimulator(
147
143
  this.fakeProofsAsset,
148
- this.wallets[0],
144
+ this.wallet,
145
+ this.accounts[0],
149
146
  this.logger,
150
- this.accounts.map(a => a.address),
147
+ this.accounts,
151
148
  );
152
149
 
153
- expect(await this.fakeProofsAsset.methods.get_admin().simulate()).toBe(this.accounts[0].address.toBigInt());
150
+ expect(await this.fakeProofsAsset.methods.get_admin().simulate({ from: this.accounts[0] })).toBe(
151
+ this.accounts[0].toBigInt(),
152
+ );
154
153
  },
155
154
  );
156
155
  }
@@ -163,12 +162,12 @@ export class FullProverTest {
163
162
 
164
163
  this.simulatedProverNode = this.context.proverNode!;
165
164
  ({
166
- pxe: this.pxe,
167
165
  aztecNode: this.aztecNode,
168
166
  deployL1ContractsValues: this.l1Contracts,
169
167
  cheatCodes: this.cheatCodes,
170
168
  blobSink: this.blobSink,
171
169
  } = this.context);
170
+ this.aztecNodeAdmin = this.context.aztecNode;
172
171
 
173
172
  const blobSinkClient = createBlobSinkClient({ blobSinkUrl: `http://localhost:${this.blobSink.port}` });
174
173
 
@@ -188,17 +187,18 @@ export class FullProverTest {
188
187
  throw new Error(`Test must be run with BB native configuration`);
189
188
  }
190
189
 
191
- this.circuitProofVerifier = await BBCircuitVerifier.new(bbConfig);
190
+ const verifier = await BBCircuitVerifier.new(bbConfig);
191
+ this.circuitProofVerifier = new QueuedIVCVerifier(bbConfig, verifier);
192
192
 
193
193
  this.logger.debug(`Configuring the node for real proofs...`);
194
- await this.aztecNode.setConfig({
194
+ await this.aztecNodeAdmin.setConfig({
195
195
  realProofs: true,
196
196
  minTxsPerBlock: this.minNumberOfTxsPerBlock,
197
197
  });
198
198
  } else {
199
199
  this.logger.debug(`Configuring the node min txs per block ${this.minNumberOfTxsPerBlock}...`);
200
200
  this.circuitProofVerifier = new TestCircuitVerifier();
201
- await this.aztecNode.setConfig({
201
+ await this.aztecNodeAdmin.setConfig({
202
202
  minTxsPerBlock: this.minNumberOfTxsPerBlock,
203
203
  });
204
204
  }
@@ -210,51 +210,31 @@ export class FullProverTest {
210
210
  await this.context.cheatCodes.rollup.markAsProven();
211
211
 
212
212
  this.logger.verbose(`Main setup completed, initializing full prover PXE, Node, and Prover Node`);
213
- for (let i = 0; i < 2; i++) {
214
- const result = await setupPXEService(
215
- this.aztecNode,
216
- {
217
- proverEnabled: this.realProofs,
218
- bbBinaryPath: bbConfig?.bbBinaryPath,
219
- bbWorkingDirectory: bbConfig?.bbWorkingDirectory,
220
- },
221
- undefined,
222
- true,
223
- );
224
- this.logger.debug(`Contract address ${this.fakeProofsAsset.address}`);
225
- await result.pxe.registerContract(this.fakeProofsAsset);
226
-
227
- for (let i = 0; i < 2; i++) {
228
- await result.pxe.registerAccount(
229
- this.deployedAccounts[i].secret,
230
- this.wallets[i].getCompleteAddress().partialAddress,
231
- );
232
- await this.pxe.registerAccount(
233
- this.deployedAccounts[i].secret,
234
- this.wallets[i].getCompleteAddress().partialAddress,
235
- );
236
- }
237
-
238
- const account = await getSchnorrAccount(
239
- result.pxe,
240
- this.deployedAccounts[0].secret,
241
- this.deployedAccounts[0].signingKey,
242
- this.deployedAccounts[0].salt,
243
- );
244
-
245
- await result.pxe.registerContract({
246
- instance: account.getInstance(),
247
- artifact: SchnorrAccountContractArtifact,
248
- });
213
+ const { wallet: provenWallet, teardown: provenTeardown } = await setupPXEAndGetWallet(
214
+ this.aztecNode,
215
+ {
216
+ proverEnabled: this.realProofs,
217
+ bbBinaryPath: bbConfig?.bbBinaryPath,
218
+ bbWorkingDirectory: bbConfig?.bbWorkingDirectory,
219
+ },
220
+ undefined,
221
+ true,
222
+ );
223
+ this.logger.debug(`Contract address ${this.fakeProofsAsset.address}`);
224
+ await provenWallet.registerContract(this.fakeProofsAsset);
249
225
 
250
- const provenWallet = await account.getWallet();
251
- const asset = await TokenContract.at(this.fakeProofsAsset.address, provenWallet);
252
- this.provenComponents.push({
253
- pxe: result.pxe,
254
- teardown: result.teardown,
255
- });
256
- this.provenAssets.push(asset);
226
+ for (let i = 0; i < 2; i++) {
227
+ await provenWallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
228
+ await this.wallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
257
229
  }
230
+
231
+ const asset = await TokenContract.at(this.fakeProofsAsset.address, provenWallet);
232
+ this.provenComponents.push({
233
+ wallet: provenWallet,
234
+ teardown: provenTeardown,
235
+ });
236
+ this.provenAsset = asset;
237
+ this.provenWallet = provenWallet;
258
238
  this.logger.info(`Full prover PXE started`);
259
239
 
260
240
  // Shutdown the current, simulated prover node
@@ -265,7 +245,7 @@ export class FullProverTest {
265
245
  this.logger.verbose('Starting archiver for new prover node');
266
246
  const archiver = await createArchiver(
267
247
  { ...this.context.aztecNodeConfig, dataDirectory: undefined },
268
- blobSinkClient,
248
+ { blobSinkClient },
269
249
  { blockUntilSync: true },
270
250
  );
271
251
 
@@ -275,25 +255,31 @@ export class FullProverTest {
275
255
  this.proverAddress = EthAddress.fromString(proverNodeSenderAddress);
276
256
 
277
257
  this.logger.verbose(`Funding prover node at ${proverNodeSenderAddress}`);
278
- await this.mintL1ERC20(proverNodeSenderAddress, 100_000_000n);
258
+ await this.mintFeeJuice(proverNodeSenderAddress);
279
259
 
280
260
  this.logger.verbose('Starting prover node');
281
261
  const proverConfig: ProverNodeConfig = {
282
262
  ...this.context.aztecNodeConfig,
283
- proverCoordinationNodeUrl: undefined,
263
+ txCollectionNodeRpcUrls: [],
284
264
  dataDirectory: undefined,
285
- proverId: this.proverAddress.toField(),
265
+ proverId: this.proverAddress,
286
266
  realProofs: this.realProofs,
287
267
  proverAgentCount: 2,
288
- publisherPrivateKey: `0x${proverNodePrivateKey!.toString('hex')}`,
268
+ publisherPrivateKeys: [new SecretValue(`0x${proverNodePrivateKey!.toString('hex')}` as const)],
289
269
  proverNodeMaxPendingJobs: 100,
290
270
  proverNodeMaxParallelBlocksPerEpoch: 32,
291
271
  proverNodePollingIntervalMs: 100,
292
- txGatheringTimeoutMs: 60000,
293
272
  txGatheringIntervalMs: 1000,
294
- txGatheringMaxParallelRequests: 100,
273
+ txGatheringBatchSize: 10,
274
+ txGatheringMaxParallelRequestsPerNode: 100,
275
+ txGatheringTimeoutMs: 24_000,
276
+ proverNodeFailedEpochStore: undefined,
277
+ proverNodeEpochProvingDelayMs: undefined,
295
278
  };
296
- const { prefilledPublicData } = await getGenesisValues(this.context.initialFundedAccounts.map(a => a.address));
279
+ const sponsoredFPCAddress = await getSponsoredFPCAddress();
280
+ const { prefilledPublicData } = await getGenesisValues(
281
+ this.context.initialFundedAccounts.map(a => a.address).concat(sponsoredFPCAddress),
282
+ );
297
283
  this.proverNode = await createProverNode(
298
284
  proverConfig,
299
285
  {
@@ -303,18 +289,19 @@ export class FullProverTest {
303
289
  },
304
290
  { prefilledPublicData },
305
291
  );
306
- this.proverNode.start();
292
+ await this.proverNode.start();
307
293
 
308
294
  this.logger.warn(`Proofs are now enabled`);
309
295
  return this;
310
296
  }
311
297
 
312
- private async mintL1ERC20(recipient: Hex, amount: bigint) {
313
- const erc20Address = this.context.deployL1ContractsValues.l1ContractAddresses.feeJuiceAddress;
314
- const client = this.context.deployL1ContractsValues.walletClient;
315
- const erc20 = getContract({ abi: TestERC20Abi, address: erc20Address.toString(), client });
316
- const hash = await erc20.write.mint([recipient, amount]);
317
- await this.context.deployL1ContractsValues.publicClient.waitForTransactionReceipt({ hash });
298
+ private async mintFeeJuice(recipient: Hex) {
299
+ const handlerAddress = this.context.deployL1ContractsValues.l1ContractAddresses.feeAssetHandlerAddress!;
300
+ this.logger.verbose(`Minting fee juice to ${recipient} using handler at ${handlerAddress}`);
301
+ const client = this.context.deployL1ContractsValues.l1Client;
302
+ const handler = getContract({ abi: FeeAssetHandlerAbi, address: handlerAddress.toString(), client });
303
+ const hash = await handler.write.mint([recipient]);
304
+ await this.context.deployL1ContractsValues.l1Client.waitForTransactionReceipt({ hash });
318
305
  }
319
306
 
320
307
  snapshot = <T>(
@@ -346,16 +333,14 @@ export class FullProverTest {
346
333
  const privateAmount = 10000n;
347
334
  const publicAmount = 10000n;
348
335
 
349
- const waitOpts = { proven: false };
350
-
351
336
  this.logger.verbose(`Minting ${privateAmount + publicAmount} publicly...`);
352
337
  await asset.methods
353
- .mint_to_public(accounts[0].address, privateAmount + publicAmount)
354
- .send()
355
- .wait(waitOpts);
338
+ .mint_to_public(accounts[0], privateAmount + publicAmount)
339
+ .send({ from: accounts[0] })
340
+ .wait();
356
341
 
357
342
  this.logger.verbose(`Transferring ${privateAmount} to private...`);
358
- await asset.methods.transfer_to_private(accounts[0].address, privateAmount).send().wait(waitOpts);
343
+ await asset.methods.transfer_to_private(accounts[0], privateAmount).send({ from: accounts[0] }).wait();
359
344
 
360
345
  this.logger.verbose(`Minting complete.`);
361
346
 
@@ -364,21 +349,21 @@ export class FullProverTest {
364
349
  async ({ amount }) => {
365
350
  const {
366
351
  fakeProofsAsset: asset,
367
- accounts: [{ address }],
352
+ accounts: [address],
368
353
  tokenSim,
369
354
  } = this;
370
355
  tokenSim.mintPublic(address, amount);
371
356
 
372
- const publicBalance = await asset.methods.balance_of_public(address).simulate();
357
+ const publicBalance = await asset.methods.balance_of_public(address).simulate({ from: address });
373
358
  this.logger.verbose(`Public balance of wallet 0: ${publicBalance}`);
374
359
  expect(publicBalance).toEqual(this.tokenSim.balanceOfPublic(address));
375
360
 
376
361
  tokenSim.mintPrivate(address, amount);
377
- const privateBalance = await asset.methods.balance_of_private(address).simulate();
362
+ const privateBalance = await asset.methods.balance_of_private(address).simulate({ from: address });
378
363
  this.logger.verbose(`Private balance of wallet 0: ${privateBalance}`);
379
364
  expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(address));
380
365
 
381
- const totalSupply = await asset.methods.total_supply().simulate();
366
+ const totalSupply = await asset.methods.total_supply().simulate({ from: address });
382
367
  this.logger.verbose(`Total supply: ${totalSupply}`);
383
368
  expect(totalSupply).toEqual(tokenSim.totalSupply);
384
369
 
@@ -386,33 +371,4 @@ export class FullProverTest {
386
371
  },
387
372
  );
388
373
  }
389
-
390
- async deployVerifier() {
391
- if (!this.realProofs) {
392
- return;
393
- }
394
-
395
- if (!this.circuitProofVerifier) {
396
- throw new Error('No verifier');
397
- }
398
-
399
- const { walletClient, publicClient, l1ContractAddresses } = this.context.deployL1ContractsValues;
400
- const rollup = getContract({
401
- abi: RollupAbi,
402
- address: l1ContractAddresses.rollupAddress.toString(),
403
- client: walletClient,
404
- });
405
-
406
- const { address: verifierAddress } = await deployL1Contract(
407
- walletClient,
408
- publicClient,
409
- HonkVerifierAbi,
410
- HonkVerifierBytecode,
411
- );
412
- this.logger.info(`Deployed honk verifier at ${verifierAddress}`);
413
-
414
- await rollup.write.setEpochVerifier([verifierAddress.toString()]);
415
-
416
- this.logger.info('Rollup only accepts valid proofs now');
417
- }
418
374
  }
@@ -8,17 +8,18 @@ export const shouldCollectMetrics = () => {
8
8
  };
9
9
 
10
10
  export const TEST_PEER_CHECK_INTERVAL_MS = 1000;
11
+ export const TEST_MAX_TX_POOL_SIZE = 2 * 1024 * 1024 * 1024; // 2GB
11
12
 
12
13
  export const MNEMONIC = 'test test test test test test test test test test test junk';
13
14
  export const privateKey = Buffer.from('ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80', 'hex');
14
15
  export const privateKey2 = Buffer.from('59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d', 'hex');
15
16
 
16
17
  /// Common errors
17
- export const U128_UNDERFLOW_ERROR = "Assertion failed: attempt to subtract with overflow 'self - other'";
18
- export const U128_OVERFLOW_ERROR = "Assertion failed: attempt to add with overflow 'self + other'";
18
+ export const U128_UNDERFLOW_ERROR = 'Assertion failed: attempt to subtract with overflow';
19
+ export const U128_OVERFLOW_ERROR = 'Assertion failed: attempt to add with overflow';
19
20
  export const BITSIZE_TOO_BIG_ERROR = "Assertion failed: call to assert_max_bit_size 'self.__assert_max_bit_size'";
20
21
  // TODO(https://github.com/AztecProtocol/aztec-packages/issues/5818): Make these a fixed error after transition.
21
- export const DUPLICATE_NULLIFIER_ERROR = /dropped|duplicate nullifier|reverted|Nullifier collision/;
22
+ export const DUPLICATE_NULLIFIER_ERROR = /dropped|nullifier|reverted/i;
22
23
  export const NO_L1_TO_L2_MSG_ERROR =
23
24
  /No non-nullified L1 to L2 message found for message hash|Tried to consume nonexistent L1-to-L2 message/;
24
25
  export const STATIC_CALL_STATE_MODIFICATION_ERROR =
@@ -1,6 +1,7 @@
1
- import type { Logger } from '@aztec/aztec.js';
1
+ import type { Logger } from '@aztec/aztec.js/log';
2
2
  import { parseBooleanEnv } from '@aztec/foundation/config';
3
3
  import { randomBytes } from '@aztec/foundation/crypto';
4
+ import { tryRmDir } from '@aztec/foundation/fs';
4
5
 
5
6
  import { promises as fs } from 'fs';
6
7
 
@@ -36,16 +37,7 @@ export async function getACVMConfig(logger: Logger): Promise<
36
37
 
37
38
  const directoryToCleanup = ACVM_WORKING_DIRECTORY ? undefined : tempWorkingDirectory;
38
39
 
39
- const cleanup = async () => {
40
- if (directoryToCleanup) {
41
- try {
42
- logger.info(`Cleaning up ACVM temp directory ${directoryToCleanup}`);
43
- await fs.rm(directoryToCleanup, { recursive: true, force: true, maxRetries: 3 });
44
- } catch (err) {
45
- logger.warn(`Failed to delete ACVM temp directory at ${directoryToCleanup}: ${err}`);
46
- }
47
- }
48
- };
40
+ const cleanup = () => tryRmDir(directoryToCleanup, logger);
49
41
 
50
42
  return {
51
43
  acvmWorkingDirectory,
@@ -1,9 +1,11 @@
1
- import { type Logger, fileURLToPath } from '@aztec/aztec.js';
1
+ import type { Logger } from '@aztec/aztec.js/log';
2
2
  import type { BBConfig } from '@aztec/bb-prover';
3
+ import { tryRmDir } from '@aztec/foundation/fs';
3
4
 
4
5
  import fs from 'node:fs/promises';
5
6
  import { tmpdir } from 'node:os';
6
7
  import path from 'path';
8
+ import { fileURLToPath } from 'url';
7
9
 
8
10
  const {
9
11
  BB_RELEASE_DIR = 'barretenberg/cpp/build/bin',
@@ -11,6 +13,8 @@ const {
11
13
  BB_SKIP_CLEANUP = '',
12
14
  TEMP_DIR = tmpdir(),
13
15
  BB_WORKING_DIRECTORY = '',
16
+ BB_NUM_IVC_VERIFIERS = '1',
17
+ BB_IVC_CONCURRENCY = '1',
14
18
  } = process.env;
15
19
 
16
20
  export const getBBConfig = async (
@@ -19,7 +23,7 @@ export const getBBConfig = async (
19
23
  try {
20
24
  const bbBinaryPath =
21
25
  BB_BINARY_PATH ??
22
- path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../', BB_RELEASE_DIR, 'bb');
26
+ path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../', BB_RELEASE_DIR, 'bb-avm');
23
27
  await fs.access(bbBinaryPath, fs.constants.R_OK);
24
28
 
25
29
  let bbWorkingDirectory: string;
@@ -35,18 +39,19 @@ export const getBBConfig = async (
35
39
  await fs.mkdir(bbWorkingDirectory, { recursive: true });
36
40
 
37
41
  const bbSkipCleanup = ['1', 'true'].includes(BB_SKIP_CLEANUP);
38
-
39
- const cleanup = async () => {
40
- if (directoryToCleanup && !bbSkipCleanup) {
41
- try {
42
- await fs.rm(directoryToCleanup, { recursive: true, force: true, maxRetries: 3 });
43
- } catch (err) {
44
- logger.warn(`Failed to delete bb working directory at ${directoryToCleanup}: ${err}`);
45
- }
46
- }
42
+ const cleanup = bbSkipCleanup ? () => Promise.resolve() : () => tryRmDir(directoryToCleanup);
43
+
44
+ const numIvcVerifiers = Number(BB_NUM_IVC_VERIFIERS);
45
+ const ivcConcurrency = Number(BB_IVC_CONCURRENCY);
46
+
47
+ return {
48
+ bbSkipCleanup,
49
+ bbBinaryPath,
50
+ bbWorkingDirectory,
51
+ cleanup,
52
+ numConcurrentIVCVerifiers: numIvcVerifiers,
53
+ bbIVCConcurrency: ivcConcurrency,
47
54
  };
48
-
49
- return { bbSkipCleanup, bbBinaryPath, bbWorkingDirectory, cleanup };
50
55
  } catch (err) {
51
56
  logger.error(`Native BB not available, error: ${err}`);
52
57
  return undefined;
@@ -1,50 +1,80 @@
1
- import type { L1ContractAddresses, ViemPublicClient, ViemWalletClient } from '@aztec/ethereum';
1
+ import { type ExtendedViemWalletClient, type L1ContractAddresses, RollupContract } from '@aztec/ethereum';
2
2
  import { Fr } from '@aztec/foundation/fields';
3
+ import { tryJsonStringify } from '@aztec/foundation/json-rpc';
3
4
  import { InboxAbi } from '@aztec/l1-artifacts';
4
5
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
5
6
 
6
- import { expect } from '@jest/globals';
7
7
  import { decodeEventLog, getContract } from 'viem';
8
8
 
9
+ import { getLogger } from './utils.js';
10
+
9
11
  export async function sendL1ToL2Message(
10
12
  message: { recipient: AztecAddress; content: Fr; secretHash: Fr },
11
13
  ctx: {
12
- walletClient: ViemWalletClient;
13
- publicClient: ViemPublicClient;
14
- l1ContractAddresses: Pick<L1ContractAddresses, 'inboxAddress'>;
14
+ l1Client: ExtendedViemWalletClient;
15
+ l1ContractAddresses: Pick<L1ContractAddresses, 'inboxAddress' | 'rollupAddress'>;
15
16
  },
16
17
  ) {
18
+ const logger = getLogger();
17
19
  const inbox = getContract({
18
20
  address: ctx.l1ContractAddresses.inboxAddress.toString(),
19
21
  abi: InboxAbi,
20
- client: ctx.walletClient,
22
+ client: ctx.l1Client,
21
23
  });
22
24
 
23
25
  const { recipient, content, secretHash } = message;
24
- const version = 1;
26
+
27
+ const version = await new RollupContract(ctx.l1Client, ctx.l1ContractAddresses.rollupAddress.toString()).getVersion();
25
28
 
26
29
  // We inject the message to Inbox
27
- const txHash = await inbox.write.sendL2Message([
28
- { actor: recipient.toString(), version: BigInt(version) },
29
- content.toString(),
30
- secretHash.toString(),
31
- ]);
30
+ const txHash = await inbox.write.sendL2Message(
31
+ [{ actor: recipient.toString(), version: BigInt(version) }, content.toString(), secretHash.toString()],
32
+ {
33
+ gas: 1_000_000n,
34
+ },
35
+ );
36
+ logger.info(`L1 to L2 message sent in tx ${txHash}`);
32
37
 
33
38
  // We check that the message was correctly injected by checking the emitted event
34
- const txReceipt = await ctx.publicClient.waitForTransactionReceipt({ hash: txHash });
39
+ const txReceipt = await ctx.l1Client.waitForTransactionReceipt({ hash: txHash });
35
40
 
36
- // Exactly 1 event should be emitted in the transaction
37
- expect(txReceipt.logs.length).toBe(1);
41
+ if (txReceipt.status !== 'success') {
42
+ throw new Error(`L1 to L2 message failed to be sent in tx ${txHash}. Status: ${txReceipt.status}`);
43
+ }
38
44
 
39
- // We decode the event and get leaf out of it
40
- const messageSentLog = txReceipt.logs[0];
41
- const topics = decodeEventLog({
42
- abi: InboxAbi,
43
- data: messageSentLog.data,
44
- topics: messageSentLog.topics,
45
- });
45
+ logger.info(`L1 to L2 message receipt retrieved for tx ${txReceipt.transactionHash}`, txReceipt);
46
+
47
+ if (txReceipt.transactionHash !== txHash) {
48
+ throw new Error(`Receipt transaction hash mismatch: ${txReceipt.transactionHash} !== ${txHash}`);
49
+ }
50
+
51
+ // Filter for MessageSent events from the Inbox contract by trying to decode each log
52
+ const messageSentLogs = txReceipt.logs
53
+ .filter(log => log.address.toLowerCase() === ctx.l1ContractAddresses.inboxAddress.toString().toLowerCase())
54
+ .map(log => {
55
+ try {
56
+ const decoded = decodeEventLog({
57
+ abi: InboxAbi,
58
+ data: log.data,
59
+ topics: log.topics,
60
+ });
61
+ return { log, decoded };
62
+ } catch {
63
+ return null; // Not a decodable event from this ABI
64
+ }
65
+ })
66
+ .filter((item): item is { log: any; decoded: any } => item !== null && item.decoded.eventName === 'MessageSent');
67
+
68
+ if (messageSentLogs.length !== 1) {
69
+ throw new Error(
70
+ `Wrong number of MessageSent logs found in ${txHash} transaction (got ${messageSentLogs.length} expected 1)\n${tryJsonStringify(messageSentLogs.map(item => item.log))}`,
71
+ );
72
+ }
73
+
74
+ // We already have the decoded event
75
+ const topics = messageSentLogs[0].decoded;
46
76
  const receivedMsgHash = topics.args.hash;
47
77
  const receivedGlobalLeafIndex = topics.args.index;
48
78
 
49
- return [Fr.fromHexString(receivedMsgHash), new Fr(receivedGlobalLeafIndex)];
79
+ return { msgHash: Fr.fromHexString(receivedMsgHash), globalLeafIndex: new Fr(receivedGlobalLeafIndex), txReceipt };
50
80
  }