@aztec/end-to-end 0.0.0-test.0 → 0.0.1-commit.21caa21

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/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 +80 -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 +334 -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 +77 -0
  13. package/dest/bench/utils.d.ts +12 -38
  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 +21 -13
  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 +19 -25
  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 +50 -70
  22. package/dest/e2e_deploy_contract/deploy_test.d.ts +16 -8
  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 +59 -18
  26. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  27. package/dest/e2e_epochs/epochs_test.js +226 -44
  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 +21 -10
  32. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  33. package/dest/e2e_fees/fees_test.js +103 -109
  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 +58 -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 +10 -7
  41. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  42. package/dest/e2e_nested_contract/nested_contract_test.js +24 -20
  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 +139 -0
  46. package/dest/e2e_p2p/p2p_network.d.ts +275 -23
  47. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  48. package/dest/e2e_p2p/p2p_network.js +184 -131
  49. package/dest/e2e_p2p/shared.d.ts +43 -7
  50. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  51. package/dest/e2e_p2p/shared.js +164 -19
  52. package/dest/e2e_token_contract/token_contract_test.d.ts +12 -6
  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/fixtures/e2e_prover_test.d.ts +63 -0
  56. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -0
  57. package/dest/{e2e_prover → fixtures}/e2e_prover_test.js +104 -105
  58. package/dest/fixtures/fixtures.d.ts +6 -7
  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 +2 -2
  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 +2 -2
  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/index.d.ts +1 -1
  68. package/dest/fixtures/l1_to_l2_messaging.d.ts +9 -6
  69. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  70. package/dest/fixtures/l1_to_l2_messaging.js +44 -18
  71. package/dest/fixtures/logging.d.ts +1 -1
  72. package/dest/fixtures/setup_l1_contracts.d.ts +476 -5
  73. package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
  74. package/dest/fixtures/setup_l1_contracts.js +4 -4
  75. package/dest/fixtures/setup_p2p_test.d.ts +15 -14
  76. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  77. package/dest/fixtures/setup_p2p_test.js +81 -21
  78. package/dest/fixtures/snapshot_manager.d.ts +17 -9
  79. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  80. package/dest/fixtures/snapshot_manager.js +147 -121
  81. package/dest/fixtures/token_utils.d.ts +10 -4
  82. package/dest/fixtures/token_utils.d.ts.map +1 -1
  83. package/dest/fixtures/token_utils.js +28 -12
  84. package/dest/fixtures/utils.d.ts +524 -40
  85. package/dest/fixtures/utils.d.ts.map +1 -1
  86. package/dest/fixtures/utils.js +464 -369
  87. package/dest/fixtures/web3signer.d.ts +5 -0
  88. package/dest/fixtures/web3signer.d.ts.map +1 -0
  89. package/dest/fixtures/web3signer.js +53 -0
  90. package/dest/fixtures/with_telemetry_utils.d.ts +1 -1
  91. package/dest/index.d.ts +1 -1
  92. package/dest/quality_of_service/alert_checker.d.ts +2 -2
  93. package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
  94. package/dest/shared/cross_chain_test_harness.d.ts +39 -34
  95. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  96. package/dest/shared/cross_chain_test_harness.js +104 -50
  97. package/dest/shared/gas_portal_test_harness.d.ts +29 -31
  98. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  99. package/dest/shared/gas_portal_test_harness.js +51 -30
  100. package/dest/shared/index.d.ts +1 -1
  101. package/dest/shared/jest_setup.d.ts +1 -1
  102. package/dest/shared/jest_setup.js +1 -1
  103. package/dest/shared/submit-transactions.d.ts +6 -4
  104. package/dest/shared/submit-transactions.d.ts.map +1 -1
  105. package/dest/shared/submit-transactions.js +8 -7
  106. package/dest/shared/uniswap_l1_l2.d.ts +14 -12
  107. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  108. package/dest/shared/uniswap_l1_l2.js +146 -116
  109. package/dest/simulators/index.d.ts +1 -1
  110. package/dest/simulators/lending_simulator.d.ts +7 -11
  111. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  112. package/dest/simulators/lending_simulator.js +15 -16
  113. package/dest/simulators/token_simulator.d.ts +6 -3
  114. package/dest/simulators/token_simulator.d.ts.map +1 -1
  115. package/dest/simulators/token_simulator.js +16 -13
  116. package/dest/spartan/setup_test_wallets.d.ts +26 -11
  117. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  118. package/dest/spartan/setup_test_wallets.js +201 -58
  119. package/dest/spartan/utils.d.ts +116 -313
  120. package/dest/spartan/utils.d.ts.map +1 -1
  121. package/dest/spartan/utils.js +434 -130
  122. package/package.json +65 -58
  123. package/src/bench/client_flows/benchmark.ts +341 -0
  124. package/src/bench/client_flows/client_flows_benchmark.ts +447 -0
  125. package/src/bench/client_flows/config.ts +61 -0
  126. package/src/bench/client_flows/data_extractor.ts +89 -0
  127. package/src/bench/utils.ts +22 -76
  128. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +80 -77
  129. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +65 -106
  130. package/src/e2e_deploy_contract/deploy_test.ts +24 -39
  131. package/src/e2e_epochs/epochs_test.ts +276 -55
  132. package/src/e2e_fees/bridging_race.notest.ts +80 -0
  133. package/src/e2e_fees/fees_test.ts +142 -138
  134. package/src/e2e_l1_publisher/write_json.ts +77 -0
  135. package/src/e2e_multi_validator/utils.ts +258 -0
  136. package/src/e2e_nested_contract/nested_contract_test.ts +29 -19
  137. package/src/e2e_p2p/inactivity_slash_test.ts +182 -0
  138. package/src/e2e_p2p/p2p_network.ts +279 -169
  139. package/src/e2e_p2p/shared.ts +247 -29
  140. package/src/e2e_token_contract/token_contract_test.ts +43 -39
  141. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  142. package/src/{e2e_prover → fixtures}/e2e_prover_test.ts +107 -152
  143. package/src/fixtures/fixtures.ts +4 -3
  144. package/src/fixtures/get_acvm_config.ts +3 -11
  145. package/src/fixtures/get_bb_config.ts +18 -13
  146. package/src/fixtures/l1_to_l2_messaging.ts +53 -23
  147. package/src/fixtures/setup_l1_contracts.ts +6 -7
  148. package/src/fixtures/setup_p2p_test.ts +126 -38
  149. package/src/fixtures/snapshot_manager.ts +187 -139
  150. package/src/fixtures/token_utils.ts +32 -15
  151. package/src/fixtures/utils.ts +580 -434
  152. package/src/fixtures/web3signer.ts +63 -0
  153. package/src/guides/up_quick_start.sh +7 -15
  154. package/src/quality_of_service/alert_checker.ts +1 -1
  155. package/src/shared/cross_chain_test_harness.ts +108 -79
  156. package/src/shared/gas_portal_test_harness.ts +59 -50
  157. package/src/shared/jest_setup.ts +1 -1
  158. package/src/shared/submit-transactions.ts +12 -8
  159. package/src/shared/uniswap_l1_l2.ts +181 -184
  160. package/src/simulators/lending_simulator.ts +14 -15
  161. package/src/simulators/token_simulator.ts +21 -13
  162. package/src/spartan/DEVELOP.md +121 -0
  163. package/src/spartan/setup_test_wallets.ts +251 -93
  164. package/src/spartan/utils.ts +490 -130
  165. package/dest/e2e_prover/e2e_prover_test.d.ts +0 -56
  166. package/dest/e2e_prover/e2e_prover_test.d.ts.map +0 -1
  167. package/dest/sample-dapp/connect.js +0 -12
  168. package/dest/sample-dapp/contracts.js +0 -10
  169. package/dest/sample-dapp/deploy.js +0 -35
  170. package/dest/sample-dapp/index.js +0 -98
  171. package/src/sample-dapp/connect.mjs +0 -16
  172. package/src/sample-dapp/contracts.mjs +0 -14
  173. package/src/sample-dapp/deploy.mjs +0 -40
  174. package/src/sample-dapp/index.mjs +0 -128
@@ -1,51 +1,48 @@
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';
13
+ import { BackendType, Barretenberg } from '@aztec/bb.js';
21
14
  import { createBlobSinkClient } from '@aztec/blob-sink/client';
22
15
  import type { BlobSinkServer } from '@aztec/blob-sink/server';
16
+ import type { DeployL1ContractsReturnType } from '@aztec/ethereum';
23
17
  import { Buffer32 } from '@aztec/foundation/buffer';
24
- import { HonkVerifierAbi, HonkVerifierBytecode, RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
18
+ import { SecretValue } from '@aztec/foundation/config';
19
+ import { FeeAssetHandlerAbi } from '@aztec/l1-artifacts';
25
20
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
26
21
  import { type ProverNode, type ProverNodeConfig, createProverNode } from '@aztec/prover-node';
27
- import type { PXEService } from '@aztec/pxe/server';
22
+ import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
23
+ import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
24
+ import { TestWallet } from '@aztec/test-wallet/server';
28
25
  import { getGenesisValues } from '@aztec/world-state/testing';
29
26
 
30
27
  import { type Hex, getContract } from 'viem';
31
28
  import { privateKeyToAddress } from 'viem/accounts';
32
29
 
33
- import { getACVMConfig } from '../fixtures/get_acvm_config.js';
34
- import { getBBConfig } from '../fixtures/get_bb_config.js';
30
+ import { TokenSimulator } from '../simulators/token_simulator.js';
31
+ import { getACVMConfig } from './get_acvm_config.js';
32
+ import { getBBConfig } from './get_bb_config.js';
35
33
  import {
36
34
  type ISnapshotManager,
37
35
  type SubsystemsContext,
38
36
  createSnapshotManager,
39
37
  deployAccounts,
40
38
  publicDeployAccounts,
41
- } from '../fixtures/snapshot_manager.js';
42
- import { getPrivateKeyFromIndex, setupPXEService } from '../fixtures/utils.js';
43
- import { TokenSimulator } from '../simulators/token_simulator.js';
39
+ } from './snapshot_manager.js';
40
+ import { getPrivateKeyFromIndex, getSponsoredFPCAddress, setupPXEAndGetWallet } from './utils.js';
44
41
 
45
42
  const { E2E_DATA_PATH: dataPath } = process.env;
46
43
 
47
44
  type ProvenSetup = {
48
- pxe: PXE;
45
+ wallet: TestWallet;
49
46
  teardown: () => Promise<void>;
50
47
  };
51
48
 
@@ -62,20 +59,22 @@ export class FullProverTest {
62
59
  static TOKEN_DECIMALS = 18n;
63
60
  private snapshotManager: ISnapshotManager;
64
61
  logger: Logger;
65
- deployedAccounts: InitialAccountData[] = [];
66
- wallets: AccountWalletWithSecretKey[] = [];
67
- accounts: CompleteAddress[] = [];
62
+ wallet!: TestWallet;
63
+ provenWallet!: TestWallet;
64
+ accounts: AztecAddress[] = [];
65
+ deployedAccounts!: InitialAccountData[];
68
66
  fakeProofsAsset!: TokenContract;
67
+ fakeProofsAssetInstance!: ContractInstanceWithAddress;
69
68
  tokenSim!: TokenSimulator;
70
69
  aztecNode!: AztecNode;
71
- pxe!: PXEService;
70
+ aztecNodeAdmin!: AztecNodeAdmin;
72
71
  cheatCodes!: CheatCodes;
73
72
  blobSink!: BlobSinkServer;
74
73
  private provenComponents: ProvenSetup[] = [];
75
74
  private bbConfigCleanup?: () => Promise<void>;
76
75
  private acvmConfigCleanup?: () => Promise<void>;
77
76
  circuitProofVerifier?: ClientProtocolCircuitVerifier;
78
- provenAssets: TokenContract[] = [];
77
+ provenAsset!: TokenContract;
79
78
  private context!: SubsystemsContext;
80
79
  private proverNode!: ProverNode;
81
80
  private simulatedProverNode!: ProverNode;
@@ -93,7 +92,9 @@ export class FullProverTest {
93
92
  `full_prover_integration/${testName}`,
94
93
  dataPath,
95
94
  { startProverNode: true, fundRewardDistributor: true, coinbase },
96
- {},
95
+ {
96
+ realVerifier: realProofs,
97
+ },
97
98
  );
98
99
  }
99
100
 
@@ -106,13 +107,11 @@ export class FullProverTest {
106
107
  await this.snapshotManager.snapshot(
107
108
  '2_accounts',
108
109
  deployAccounts(2, this.logger),
109
- async ({ deployedAccounts }, { pxe }) => {
110
+ ({ deployedAccounts }, { wallet }) => {
110
111
  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()}`));
112
+ this.accounts = deployedAccounts.map(a => a.address);
113
+ this.wallet = wallet;
114
+ return Promise.resolve();
116
115
  },
117
116
  );
118
117
 
@@ -122,35 +121,39 @@ export class FullProverTest {
122
121
  // Create the token contract state.
123
122
  // Move this account thing to addAccounts above?
124
123
  this.logger.verbose(`Public deploy accounts...`);
125
- await publicDeployAccounts(this.wallets[0], this.accounts.slice(0, 2), false);
124
+ await publicDeployAccounts(this.wallet, this.accounts.slice(0, 2));
126
125
 
127
126
  this.logger.verbose(`Deploying TokenContract...`);
128
- const asset = await TokenContract.deploy(
129
- this.wallets[0],
127
+ const { contract: asset, instance } = await TokenContract.deploy(
128
+ this.wallet,
130
129
  this.accounts[0],
131
130
  FullProverTest.TOKEN_NAME,
132
131
  FullProverTest.TOKEN_SYMBOL,
133
132
  FullProverTest.TOKEN_DECIMALS,
134
133
  )
135
- .send()
136
- .deployed();
134
+ .send({ from: this.accounts[0] })
135
+ .wait();
137
136
  this.logger.verbose(`Token deployed to ${asset.address}`);
138
137
 
139
- return { tokenContractAddress: asset.address };
138
+ return { tokenContractAddress: asset.address, tokenContractInstance: instance };
140
139
  },
141
- async ({ tokenContractAddress }) => {
140
+ async ({ tokenContractAddress, tokenContractInstance }) => {
142
141
  // Restore the token contract state.
143
- this.fakeProofsAsset = await TokenContract.at(tokenContractAddress, this.wallets[0]);
142
+ this.fakeProofsAsset = TokenContract.at(tokenContractAddress, this.wallet);
143
+ this.fakeProofsAssetInstance = tokenContractInstance;
144
144
  this.logger.verbose(`Token contract address: ${this.fakeProofsAsset.address}`);
145
145
 
146
146
  this.tokenSim = new TokenSimulator(
147
147
  this.fakeProofsAsset,
148
- this.wallets[0],
148
+ this.wallet,
149
+ this.accounts[0],
149
150
  this.logger,
150
- this.accounts.map(a => a.address),
151
+ this.accounts,
151
152
  );
152
153
 
153
- expect(await this.fakeProofsAsset.methods.get_admin().simulate()).toBe(this.accounts[0].address.toBigInt());
154
+ expect(await this.fakeProofsAsset.methods.get_admin().simulate({ from: this.accounts[0] })).toBe(
155
+ this.accounts[0].toBigInt(),
156
+ );
154
157
  },
155
158
  );
156
159
  }
@@ -163,12 +166,12 @@ export class FullProverTest {
163
166
 
164
167
  this.simulatedProverNode = this.context.proverNode!;
165
168
  ({
166
- pxe: this.pxe,
167
169
  aztecNode: this.aztecNode,
168
170
  deployL1ContractsValues: this.l1Contracts,
169
171
  cheatCodes: this.cheatCodes,
170
172
  blobSink: this.blobSink,
171
173
  } = this.context);
174
+ this.aztecNodeAdmin = this.context.aztecNode;
172
175
 
173
176
  const blobSinkClient = createBlobSinkClient({ blobSinkUrl: `http://localhost:${this.blobSink.port}` });
174
177
 
@@ -184,21 +187,20 @@ export class FullProverTest {
184
187
  this.acvmConfigCleanup = acvmConfig.cleanup;
185
188
  this.bbConfigCleanup = bbConfig.cleanup;
186
189
 
187
- if (!bbConfig?.bbWorkingDirectory || !bbConfig?.bbBinaryPath) {
188
- throw new Error(`Test must be run with BB native configuration`);
189
- }
190
+ await Barretenberg.initSingleton({ backend: BackendType.NativeUnixSocket });
190
191
 
191
- this.circuitProofVerifier = await BBCircuitVerifier.new(bbConfig);
192
+ const verifier = await BBCircuitVerifier.new(bbConfig);
193
+ this.circuitProofVerifier = new QueuedIVCVerifier(bbConfig, verifier);
192
194
 
193
195
  this.logger.debug(`Configuring the node for real proofs...`);
194
- await this.aztecNode.setConfig({
196
+ await this.aztecNodeAdmin.setConfig({
195
197
  realProofs: true,
196
198
  minTxsPerBlock: this.minNumberOfTxsPerBlock,
197
199
  });
198
200
  } else {
199
201
  this.logger.debug(`Configuring the node min txs per block ${this.minNumberOfTxsPerBlock}...`);
200
202
  this.circuitProofVerifier = new TestCircuitVerifier();
201
- await this.aztecNode.setConfig({
203
+ await this.aztecNodeAdmin.setConfig({
202
204
  minTxsPerBlock: this.minNumberOfTxsPerBlock,
203
205
  });
204
206
  }
@@ -210,51 +212,27 @@ export class FullProverTest {
210
212
  await this.context.cheatCodes.rollup.markAsProven();
211
213
 
212
214
  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
- });
215
+ const { wallet: provenWallet, teardown: provenTeardown } = await setupPXEAndGetWallet(
216
+ this.aztecNode,
217
+ { proverEnabled: this.realProofs },
218
+ undefined,
219
+ true,
220
+ );
221
+ this.logger.debug(`Contract address ${this.fakeProofsAsset.address}`);
222
+ await provenWallet.registerContract(this.fakeProofsAssetInstance, TokenContract.artifact);
249
223
 
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);
224
+ for (let i = 0; i < 2; i++) {
225
+ await provenWallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
226
+ await this.wallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
257
227
  }
228
+
229
+ const asset = TokenContract.at(this.fakeProofsAsset.address, provenWallet);
230
+ this.provenComponents.push({
231
+ wallet: provenWallet,
232
+ teardown: provenTeardown,
233
+ });
234
+ this.provenAsset = asset;
235
+ this.provenWallet = provenWallet;
258
236
  this.logger.info(`Full prover PXE started`);
259
237
 
260
238
  // Shutdown the current, simulated prover node
@@ -265,7 +243,7 @@ export class FullProverTest {
265
243
  this.logger.verbose('Starting archiver for new prover node');
266
244
  const archiver = await createArchiver(
267
245
  { ...this.context.aztecNodeConfig, dataDirectory: undefined },
268
- blobSinkClient,
246
+ { blobSinkClient, dateProvider: this.context.dateProvider },
269
247
  { blockUntilSync: true },
270
248
  );
271
249
 
@@ -275,25 +253,31 @@ export class FullProverTest {
275
253
  this.proverAddress = EthAddress.fromString(proverNodeSenderAddress);
276
254
 
277
255
  this.logger.verbose(`Funding prover node at ${proverNodeSenderAddress}`);
278
- await this.mintL1ERC20(proverNodeSenderAddress, 100_000_000n);
256
+ await this.mintFeeJuice(proverNodeSenderAddress);
279
257
 
280
258
  this.logger.verbose('Starting prover node');
281
259
  const proverConfig: ProverNodeConfig = {
282
260
  ...this.context.aztecNodeConfig,
283
- proverCoordinationNodeUrl: undefined,
261
+ txCollectionNodeRpcUrls: [],
284
262
  dataDirectory: undefined,
285
- proverId: this.proverAddress.toField(),
263
+ proverId: this.proverAddress,
286
264
  realProofs: this.realProofs,
287
265
  proverAgentCount: 2,
288
- publisherPrivateKey: `0x${proverNodePrivateKey!.toString('hex')}`,
266
+ publisherPrivateKeys: [new SecretValue(`0x${proverNodePrivateKey!.toString('hex')}` as const)],
289
267
  proverNodeMaxPendingJobs: 100,
290
268
  proverNodeMaxParallelBlocksPerEpoch: 32,
291
269
  proverNodePollingIntervalMs: 100,
292
- txGatheringTimeoutMs: 60000,
293
270
  txGatheringIntervalMs: 1000,
294
- txGatheringMaxParallelRequests: 100,
271
+ txGatheringBatchSize: 10,
272
+ txGatheringMaxParallelRequestsPerNode: 100,
273
+ txGatheringTimeoutMs: 24_000,
274
+ proverNodeFailedEpochStore: undefined,
275
+ proverNodeEpochProvingDelayMs: undefined,
295
276
  };
296
- const { prefilledPublicData } = await getGenesisValues(this.context.initialFundedAccounts.map(a => a.address));
277
+ const sponsoredFPCAddress = await getSponsoredFPCAddress();
278
+ const { prefilledPublicData } = await getGenesisValues(
279
+ this.context.initialFundedAccounts.map(a => a.address).concat(sponsoredFPCAddress),
280
+ );
297
281
  this.proverNode = await createProverNode(
298
282
  proverConfig,
299
283
  {
@@ -303,18 +287,19 @@ export class FullProverTest {
303
287
  },
304
288
  { prefilledPublicData },
305
289
  );
306
- this.proverNode.start();
290
+ await this.proverNode.start();
307
291
 
308
292
  this.logger.warn(`Proofs are now enabled`);
309
293
  return this;
310
294
  }
311
295
 
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 });
296
+ private async mintFeeJuice(recipient: Hex) {
297
+ const handlerAddress = this.context.deployL1ContractsValues.l1ContractAddresses.feeAssetHandlerAddress!;
298
+ this.logger.verbose(`Minting fee juice to ${recipient} using handler at ${handlerAddress}`);
299
+ const client = this.context.deployL1ContractsValues.l1Client;
300
+ const handler = getContract({ abi: FeeAssetHandlerAbi, address: handlerAddress.toString(), client });
301
+ const hash = await handler.write.mint([recipient]);
302
+ await this.context.deployL1ContractsValues.l1Client.waitForTransactionReceipt({ hash });
318
303
  }
319
304
 
320
305
  snapshot = <T>(
@@ -334,6 +319,7 @@ export class FullProverTest {
334
319
  // clean up the full prover node
335
320
  await this.proverNode.stop();
336
321
 
322
+ await Barretenberg.destroySingleton();
337
323
  await this.bbConfigCleanup?.();
338
324
  await this.acvmConfigCleanup?.();
339
325
  }
@@ -346,16 +332,14 @@ export class FullProverTest {
346
332
  const privateAmount = 10000n;
347
333
  const publicAmount = 10000n;
348
334
 
349
- const waitOpts = { proven: false };
350
-
351
335
  this.logger.verbose(`Minting ${privateAmount + publicAmount} publicly...`);
352
336
  await asset.methods
353
- .mint_to_public(accounts[0].address, privateAmount + publicAmount)
354
- .send()
355
- .wait(waitOpts);
337
+ .mint_to_public(accounts[0], privateAmount + publicAmount)
338
+ .send({ from: accounts[0] })
339
+ .wait();
356
340
 
357
341
  this.logger.verbose(`Transferring ${privateAmount} to private...`);
358
- await asset.methods.transfer_to_private(accounts[0].address, privateAmount).send().wait(waitOpts);
342
+ await asset.methods.transfer_to_private(accounts[0], privateAmount).send({ from: accounts[0] }).wait();
359
343
 
360
344
  this.logger.verbose(`Minting complete.`);
361
345
 
@@ -364,21 +348,21 @@ export class FullProverTest {
364
348
  async ({ amount }) => {
365
349
  const {
366
350
  fakeProofsAsset: asset,
367
- accounts: [{ address }],
351
+ accounts: [address],
368
352
  tokenSim,
369
353
  } = this;
370
354
  tokenSim.mintPublic(address, amount);
371
355
 
372
- const publicBalance = await asset.methods.balance_of_public(address).simulate();
356
+ const publicBalance = await asset.methods.balance_of_public(address).simulate({ from: address });
373
357
  this.logger.verbose(`Public balance of wallet 0: ${publicBalance}`);
374
358
  expect(publicBalance).toEqual(this.tokenSim.balanceOfPublic(address));
375
359
 
376
360
  tokenSim.mintPrivate(address, amount);
377
- const privateBalance = await asset.methods.balance_of_private(address).simulate();
361
+ const privateBalance = await asset.methods.balance_of_private(address).simulate({ from: address });
378
362
  this.logger.verbose(`Private balance of wallet 0: ${privateBalance}`);
379
363
  expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(address));
380
364
 
381
- const totalSupply = await asset.methods.total_supply().simulate();
365
+ const totalSupply = await asset.methods.total_supply().simulate({ from: address });
382
366
  this.logger.verbose(`Total supply: ${totalSupply}`);
383
367
  expect(totalSupply).toEqual(tokenSim.totalSupply);
384
368
 
@@ -386,33 +370,4 @@ export class FullProverTest {
386
370
  },
387
371
  );
388
372
  }
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
373
  }
@@ -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
  }