@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,20 +1,21 @@
1
- import { SchnorrAccountContractArtifact, getSchnorrAccount, getSchnorrWalletWithSecretKey } from '@aztec/accounts/schnorr';
2
1
  import { createArchiver } from '@aztec/archiver';
3
- import { EthAddress, createLogger, deployL1Contract } from '@aztec/aztec.js';
4
- import { BBCircuitVerifier, TestCircuitVerifier } from '@aztec/bb-prover';
2
+ import { EthAddress } from '@aztec/aztec.js/addresses';
3
+ import { createLogger } from '@aztec/aztec.js/log';
4
+ import { BBCircuitVerifier, QueuedIVCVerifier, TestCircuitVerifier } from '@aztec/bb-prover';
5
5
  import { createBlobSinkClient } from '@aztec/blob-sink/client';
6
6
  import { Buffer32 } from '@aztec/foundation/buffer';
7
- import { HonkVerifierAbi, HonkVerifierBytecode, RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
7
+ import { SecretValue } from '@aztec/foundation/config';
8
+ import { FeeAssetHandlerAbi } from '@aztec/l1-artifacts';
8
9
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
9
10
  import { createProverNode } from '@aztec/prover-node';
10
11
  import { getGenesisValues } from '@aztec/world-state/testing';
11
12
  import { getContract } from 'viem';
12
13
  import { privateKeyToAddress } from 'viem/accounts';
13
- import { getACVMConfig } from '../fixtures/get_acvm_config.js';
14
- import { getBBConfig } from '../fixtures/get_bb_config.js';
15
- import { createSnapshotManager, deployAccounts, publicDeployAccounts } from '../fixtures/snapshot_manager.js';
16
- import { getPrivateKeyFromIndex, setupPXEService } from '../fixtures/utils.js';
17
14
  import { TokenSimulator } from '../simulators/token_simulator.js';
15
+ import { getACVMConfig } from './get_acvm_config.js';
16
+ import { getBBConfig } from './get_bb_config.js';
17
+ import { createSnapshotManager, deployAccounts, publicDeployAccounts } from './snapshot_manager.js';
18
+ import { getPrivateKeyFromIndex, getSponsoredFPCAddress, setupPXEAndGetWallet } from './utils.js';
18
19
  const { E2E_DATA_PATH: dataPath } = process.env;
19
20
  /**
20
21
  * Largely taken from the e2e_token_contract test file. We deploy 2 accounts and a token contract.
@@ -29,20 +30,21 @@ const { E2E_DATA_PATH: dataPath } = process.env;
29
30
  static TOKEN_DECIMALS = 18n;
30
31
  snapshotManager;
31
32
  logger;
32
- deployedAccounts;
33
- wallets;
33
+ wallet;
34
+ provenWallet;
34
35
  accounts;
36
+ deployedAccounts;
35
37
  fakeProofsAsset;
36
38
  tokenSim;
37
39
  aztecNode;
38
- pxe;
40
+ aztecNodeAdmin;
39
41
  cheatCodes;
40
42
  blobSink;
41
43
  provenComponents;
42
44
  bbConfigCleanup;
43
45
  acvmConfigCleanup;
44
46
  circuitProofVerifier;
45
- provenAssets;
47
+ provenAsset;
46
48
  context;
47
49
  proverNode;
48
50
  simulatedProverNode;
@@ -51,47 +53,50 @@ const { E2E_DATA_PATH: dataPath } = process.env;
51
53
  constructor(testName, minNumberOfTxsPerBlock, coinbase, realProofs = true){
52
54
  this.minNumberOfTxsPerBlock = minNumberOfTxsPerBlock;
53
55
  this.realProofs = realProofs;
54
- this.deployedAccounts = [];
55
- this.wallets = [];
56
56
  this.accounts = [];
57
57
  this.provenComponents = [];
58
- this.provenAssets = [];
59
58
  this.snapshot = (name, apply, restore = ()=>Promise.resolve())=>this.snapshotManager.snapshot(name, apply, restore);
60
59
  this.logger = createLogger(`e2e:full_prover_test:${testName}`);
61
60
  this.snapshotManager = createSnapshotManager(`full_prover_integration/${testName}`, dataPath, {
62
61
  startProverNode: true,
63
62
  fundRewardDistributor: true,
64
63
  coinbase
65
- }, {});
64
+ }, {
65
+ realVerifier: realProofs
66
+ });
66
67
  }
67
68
  /**
68
69
  * Adds two state shifts to snapshot manager.
69
70
  * 1. Add 2 accounts.
70
71
  * 2. Publicly deploy accounts, deploy token contract
71
72
  */ async applyBaseSnapshots() {
72
- await this.snapshotManager.snapshot('2_accounts', deployAccounts(2, this.logger), async ({ deployedAccounts }, { pxe })=>{
73
+ await this.snapshotManager.snapshot('2_accounts', deployAccounts(2, this.logger), ({ deployedAccounts }, { wallet })=>{
73
74
  this.deployedAccounts = deployedAccounts;
74
- this.wallets = await Promise.all(deployedAccounts.map((a)=>getSchnorrWalletWithSecretKey(pxe, a.secret, a.signingKey, a.salt)));
75
- this.accounts = this.wallets.map((w)=>w.getCompleteAddress());
76
- this.wallets.forEach((w, i)=>this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
75
+ this.accounts = deployedAccounts.map((a)=>a.address);
76
+ this.wallet = wallet;
77
+ return Promise.resolve();
77
78
  });
78
79
  await this.snapshotManager.snapshot('client_prover_integration', async ()=>{
79
80
  // Create the token contract state.
80
81
  // Move this account thing to addAccounts above?
81
82
  this.logger.verbose(`Public deploy accounts...`);
82
- await publicDeployAccounts(this.wallets[0], this.accounts.slice(0, 2), false);
83
+ await publicDeployAccounts(this.wallet, this.accounts.slice(0, 2));
83
84
  this.logger.verbose(`Deploying TokenContract...`);
84
- const asset = await TokenContract.deploy(this.wallets[0], this.accounts[0], FullProverTest.TOKEN_NAME, FullProverTest.TOKEN_SYMBOL, FullProverTest.TOKEN_DECIMALS).send().deployed();
85
+ const asset = await TokenContract.deploy(this.wallet, this.accounts[0], FullProverTest.TOKEN_NAME, FullProverTest.TOKEN_SYMBOL, FullProverTest.TOKEN_DECIMALS).send({
86
+ from: this.accounts[0]
87
+ }).deployed();
85
88
  this.logger.verbose(`Token deployed to ${asset.address}`);
86
89
  return {
87
90
  tokenContractAddress: asset.address
88
91
  };
89
92
  }, async ({ tokenContractAddress })=>{
90
93
  // Restore the token contract state.
91
- this.fakeProofsAsset = await TokenContract.at(tokenContractAddress, this.wallets[0]);
94
+ this.fakeProofsAsset = await TokenContract.at(tokenContractAddress, this.wallet);
92
95
  this.logger.verbose(`Token contract address: ${this.fakeProofsAsset.address}`);
93
- this.tokenSim = new TokenSimulator(this.fakeProofsAsset, this.wallets[0], this.logger, this.accounts.map((a)=>a.address));
94
- expect(await this.fakeProofsAsset.methods.get_admin().simulate()).toBe(this.accounts[0].address.toBigInt());
96
+ this.tokenSim = new TokenSimulator(this.fakeProofsAsset, this.wallet, this.accounts[0], this.logger, this.accounts);
97
+ expect(await this.fakeProofsAsset.methods.get_admin().simulate({
98
+ from: this.accounts[0]
99
+ })).toBe(this.accounts[0].toBigInt());
95
100
  });
96
101
  }
97
102
  async setup() {
@@ -99,7 +104,8 @@ const { E2E_DATA_PATH: dataPath } = process.env;
99
104
  // We don't wish to mark as proven automatically, so we set the flag to false
100
105
  this.context.watcher.setIsMarkingAsProven(false);
101
106
  this.simulatedProverNode = this.context.proverNode;
102
- ({ pxe: this.pxe, aztecNode: this.aztecNode, deployL1ContractsValues: this.l1Contracts, cheatCodes: this.cheatCodes, blobSink: this.blobSink } = this.context);
107
+ ({ aztecNode: this.aztecNode, deployL1ContractsValues: this.l1Contracts, cheatCodes: this.cheatCodes, blobSink: this.blobSink } = this.context);
108
+ this.aztecNodeAdmin = this.context.aztecNode;
103
109
  const blobSinkClient = createBlobSinkClient({
104
110
  blobSinkUrl: `http://localhost:${this.blobSink.port}`
105
111
  });
@@ -119,16 +125,17 @@ const { E2E_DATA_PATH: dataPath } = process.env;
119
125
  if (!bbConfig?.bbWorkingDirectory || !bbConfig?.bbBinaryPath) {
120
126
  throw new Error(`Test must be run with BB native configuration`);
121
127
  }
122
- this.circuitProofVerifier = await BBCircuitVerifier.new(bbConfig);
128
+ const verifier = await BBCircuitVerifier.new(bbConfig);
129
+ this.circuitProofVerifier = new QueuedIVCVerifier(bbConfig, verifier);
123
130
  this.logger.debug(`Configuring the node for real proofs...`);
124
- await this.aztecNode.setConfig({
131
+ await this.aztecNodeAdmin.setConfig({
125
132
  realProofs: true,
126
133
  minTxsPerBlock: this.minNumberOfTxsPerBlock
127
134
  });
128
135
  } else {
129
136
  this.logger.debug(`Configuring the node min txs per block ${this.minNumberOfTxsPerBlock}...`);
130
137
  this.circuitProofVerifier = new TestCircuitVerifier();
131
- await this.aztecNode.setConfig({
138
+ await this.aztecNodeAdmin.setConfig({
132
139
  minTxsPerBlock: this.minNumberOfTxsPerBlock
133
140
  });
134
141
  }
@@ -137,31 +144,24 @@ const { E2E_DATA_PATH: dataPath } = process.env;
137
144
  this.logger.verbose(`Marking current block as proven`);
138
145
  await this.context.cheatCodes.rollup.markAsProven();
139
146
  this.logger.verbose(`Main setup completed, initializing full prover PXE, Node, and Prover Node`);
147
+ const { wallet: provenWallet, teardown: provenTeardown } = await setupPXEAndGetWallet(this.aztecNode, {
148
+ proverEnabled: this.realProofs,
149
+ bbBinaryPath: bbConfig?.bbBinaryPath,
150
+ bbWorkingDirectory: bbConfig?.bbWorkingDirectory
151
+ }, undefined, true);
152
+ this.logger.debug(`Contract address ${this.fakeProofsAsset.address}`);
153
+ await provenWallet.registerContract(this.fakeProofsAsset);
140
154
  for(let i = 0; i < 2; i++){
141
- const result = await setupPXEService(this.aztecNode, {
142
- proverEnabled: this.realProofs,
143
- bbBinaryPath: bbConfig?.bbBinaryPath,
144
- bbWorkingDirectory: bbConfig?.bbWorkingDirectory
145
- }, undefined, true);
146
- this.logger.debug(`Contract address ${this.fakeProofsAsset.address}`);
147
- await result.pxe.registerContract(this.fakeProofsAsset);
148
- for(let i = 0; i < 2; i++){
149
- await result.pxe.registerAccount(this.deployedAccounts[i].secret, this.wallets[i].getCompleteAddress().partialAddress);
150
- await this.pxe.registerAccount(this.deployedAccounts[i].secret, this.wallets[i].getCompleteAddress().partialAddress);
151
- }
152
- const account = await getSchnorrAccount(result.pxe, this.deployedAccounts[0].secret, this.deployedAccounts[0].signingKey, this.deployedAccounts[0].salt);
153
- await result.pxe.registerContract({
154
- instance: account.getInstance(),
155
- artifact: SchnorrAccountContractArtifact
156
- });
157
- const provenWallet = await account.getWallet();
158
- const asset = await TokenContract.at(this.fakeProofsAsset.address, provenWallet);
159
- this.provenComponents.push({
160
- pxe: result.pxe,
161
- teardown: result.teardown
162
- });
163
- this.provenAssets.push(asset);
155
+ await provenWallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
156
+ await this.wallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
164
157
  }
158
+ const asset = await TokenContract.at(this.fakeProofsAsset.address, provenWallet);
159
+ this.provenComponents.push({
160
+ wallet: provenWallet,
161
+ teardown: provenTeardown
162
+ });
163
+ this.provenAsset = asset;
164
+ this.provenWallet = provenWallet;
165
165
  this.logger.info(`Full prover PXE started`);
166
166
  // Shutdown the current, simulated prover node
167
167
  this.logger.verbose('Shutting down simulated prover node');
@@ -171,7 +171,9 @@ const { E2E_DATA_PATH: dataPath } = process.env;
171
171
  const archiver = await createArchiver({
172
172
  ...this.context.aztecNodeConfig,
173
173
  dataDirectory: undefined
174
- }, blobSinkClient, {
174
+ }, {
175
+ blobSinkClient
176
+ }, {
175
177
  blockUntilSync: true
176
178
  });
177
179
  // The simulated prover node (now shutdown) used private key index 2
@@ -179,24 +181,30 @@ const { E2E_DATA_PATH: dataPath } = process.env;
179
181
  const proverNodeSenderAddress = privateKeyToAddress(new Buffer32(proverNodePrivateKey).toString());
180
182
  this.proverAddress = EthAddress.fromString(proverNodeSenderAddress);
181
183
  this.logger.verbose(`Funding prover node at ${proverNodeSenderAddress}`);
182
- await this.mintL1ERC20(proverNodeSenderAddress, 100_000_000n);
184
+ await this.mintFeeJuice(proverNodeSenderAddress);
183
185
  this.logger.verbose('Starting prover node');
184
186
  const proverConfig = {
185
187
  ...this.context.aztecNodeConfig,
186
- proverCoordinationNodeUrl: undefined,
188
+ txCollectionNodeRpcUrls: [],
187
189
  dataDirectory: undefined,
188
- proverId: this.proverAddress.toField(),
190
+ proverId: this.proverAddress,
189
191
  realProofs: this.realProofs,
190
192
  proverAgentCount: 2,
191
- publisherPrivateKey: `0x${proverNodePrivateKey.toString('hex')}`,
193
+ publisherPrivateKeys: [
194
+ new SecretValue(`0x${proverNodePrivateKey.toString('hex')}`)
195
+ ],
192
196
  proverNodeMaxPendingJobs: 100,
193
197
  proverNodeMaxParallelBlocksPerEpoch: 32,
194
198
  proverNodePollingIntervalMs: 100,
195
- txGatheringTimeoutMs: 60000,
196
199
  txGatheringIntervalMs: 1000,
197
- txGatheringMaxParallelRequests: 100
200
+ txGatheringBatchSize: 10,
201
+ txGatheringMaxParallelRequestsPerNode: 100,
202
+ txGatheringTimeoutMs: 24_000,
203
+ proverNodeFailedEpochStore: undefined,
204
+ proverNodeEpochProvingDelayMs: undefined
198
205
  };
199
- const { prefilledPublicData } = await getGenesisValues(this.context.initialFundedAccounts.map((a)=>a.address));
206
+ const sponsoredFPCAddress = await getSponsoredFPCAddress();
207
+ const { prefilledPublicData } = await getGenesisValues(this.context.initialFundedAccounts.map((a)=>a.address).concat(sponsoredFPCAddress));
200
208
  this.proverNode = await createProverNode(proverConfig, {
201
209
  aztecNodeTxProvider: this.aztecNode,
202
210
  archiver: archiver,
@@ -204,23 +212,23 @@ const { E2E_DATA_PATH: dataPath } = process.env;
204
212
  }, {
205
213
  prefilledPublicData
206
214
  });
207
- this.proverNode.start();
215
+ await this.proverNode.start();
208
216
  this.logger.warn(`Proofs are now enabled`);
209
217
  return this;
210
218
  }
211
- async mintL1ERC20(recipient, amount) {
212
- const erc20Address = this.context.deployL1ContractsValues.l1ContractAddresses.feeJuiceAddress;
213
- const client = this.context.deployL1ContractsValues.walletClient;
214
- const erc20 = getContract({
215
- abi: TestERC20Abi,
216
- address: erc20Address.toString(),
219
+ async mintFeeJuice(recipient) {
220
+ const handlerAddress = this.context.deployL1ContractsValues.l1ContractAddresses.feeAssetHandlerAddress;
221
+ this.logger.verbose(`Minting fee juice to ${recipient} using handler at ${handlerAddress}`);
222
+ const client = this.context.deployL1ContractsValues.l1Client;
223
+ const handler = getContract({
224
+ abi: FeeAssetHandlerAbi,
225
+ address: handlerAddress.toString(),
217
226
  client
218
227
  });
219
- const hash = await erc20.write.mint([
220
- recipient,
221
- amount
228
+ const hash = await handler.write.mint([
229
+ recipient
222
230
  ]);
223
- await this.context.deployL1ContractsValues.publicClient.waitForTransactionReceipt({
231
+ await this.context.deployL1ContractsValues.l1Client.waitForTransactionReceipt({
224
232
  hash
225
233
  });
226
234
  }
@@ -241,51 +249,38 @@ const { E2E_DATA_PATH: dataPath } = process.env;
241
249
  const { fakeProofsAsset: asset, accounts } = this;
242
250
  const privateAmount = 10000n;
243
251
  const publicAmount = 10000n;
244
- const waitOpts = {
245
- proven: false
246
- };
247
252
  this.logger.verbose(`Minting ${privateAmount + publicAmount} publicly...`);
248
- await asset.methods.mint_to_public(accounts[0].address, privateAmount + publicAmount).send().wait(waitOpts);
253
+ await asset.methods.mint_to_public(accounts[0], privateAmount + publicAmount).send({
254
+ from: accounts[0]
255
+ }).wait();
249
256
  this.logger.verbose(`Transferring ${privateAmount} to private...`);
250
- await asset.methods.transfer_to_private(accounts[0].address, privateAmount).send().wait(waitOpts);
257
+ await asset.methods.transfer_to_private(accounts[0], privateAmount).send({
258
+ from: accounts[0]
259
+ }).wait();
251
260
  this.logger.verbose(`Minting complete.`);
252
261
  return {
253
262
  amount: publicAmount
254
263
  };
255
264
  }, async ({ amount })=>{
256
- const { fakeProofsAsset: asset, accounts: [{ address }], tokenSim } = this;
265
+ const { fakeProofsAsset: asset, accounts: [address], tokenSim } = this;
257
266
  tokenSim.mintPublic(address, amount);
258
- const publicBalance = await asset.methods.balance_of_public(address).simulate();
267
+ const publicBalance = await asset.methods.balance_of_public(address).simulate({
268
+ from: address
269
+ });
259
270
  this.logger.verbose(`Public balance of wallet 0: ${publicBalance}`);
260
271
  expect(publicBalance).toEqual(this.tokenSim.balanceOfPublic(address));
261
272
  tokenSim.mintPrivate(address, amount);
262
- const privateBalance = await asset.methods.balance_of_private(address).simulate();
273
+ const privateBalance = await asset.methods.balance_of_private(address).simulate({
274
+ from: address
275
+ });
263
276
  this.logger.verbose(`Private balance of wallet 0: ${privateBalance}`);
264
277
  expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(address));
265
- const totalSupply = await asset.methods.total_supply().simulate();
278
+ const totalSupply = await asset.methods.total_supply().simulate({
279
+ from: address
280
+ });
266
281
  this.logger.verbose(`Total supply: ${totalSupply}`);
267
282
  expect(totalSupply).toEqual(tokenSim.totalSupply);
268
283
  return Promise.resolve();
269
284
  });
270
285
  }
271
- async deployVerifier() {
272
- if (!this.realProofs) {
273
- return;
274
- }
275
- if (!this.circuitProofVerifier) {
276
- throw new Error('No verifier');
277
- }
278
- const { walletClient, publicClient, l1ContractAddresses } = this.context.deployL1ContractsValues;
279
- const rollup = getContract({
280
- abi: RollupAbi,
281
- address: l1ContractAddresses.rollupAddress.toString(),
282
- client: walletClient
283
- });
284
- const { address: verifierAddress } = await deployL1Contract(walletClient, publicClient, HonkVerifierAbi, HonkVerifierBytecode);
285
- this.logger.info(`Deployed honk verifier at ${verifierAddress}`);
286
- await rollup.write.setEpochVerifier([
287
- verifierAddress.toString()
288
- ]);
289
- this.logger.info('Rollup only accepts valid proofs now');
290
- }
291
286
  }
@@ -1,13 +1,12 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /// <reference types="node" resolution-mode="require"/>
3
1
  export declare const METRICS_PORT = 4318;
4
2
  export declare const shouldCollectMetrics: () => 4318 | undefined;
5
3
  export declare const TEST_PEER_CHECK_INTERVAL_MS = 1000;
4
+ export declare const TEST_MAX_TX_POOL_SIZE: number;
6
5
  export declare const MNEMONIC = "test test test test test test test test test test test junk";
7
- export declare const privateKey: Buffer;
8
- export declare const privateKey2: Buffer;
9
- export declare const U128_UNDERFLOW_ERROR = "Assertion failed: attempt to subtract with overflow 'self - other'";
10
- export declare const U128_OVERFLOW_ERROR = "Assertion failed: attempt to add with overflow 'self + other'";
6
+ export declare const privateKey: Buffer<ArrayBuffer>;
7
+ export declare const privateKey2: Buffer<ArrayBuffer>;
8
+ export declare const U128_UNDERFLOW_ERROR = "Assertion failed: attempt to subtract with overflow";
9
+ export declare const U128_OVERFLOW_ERROR = "Assertion failed: attempt to add with overflow";
11
10
  export declare const BITSIZE_TOO_BIG_ERROR = "Assertion failed: call to assert_max_bit_size 'self.__assert_max_bit_size'";
12
11
  export declare const DUPLICATE_NULLIFIER_ERROR: RegExp;
13
12
  export declare const NO_L1_TO_L2_MSG_ERROR: RegExp;
@@ -1 +1 @@
1
- {"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../src/fixtures/fixtures.ts"],"names":[],"mappings":";;AAAA,eAAO,MAAM,YAAY,OAAO,CAAC;AAEjC,eAAO,MAAM,oBAAoB,wBAKhC,CAAC;AAEF,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAEhD,eAAO,MAAM,QAAQ,gEAAgE,CAAC;AACtF,eAAO,MAAM,UAAU,QAAyF,CAAC;AACjH,eAAO,MAAM,WAAW,QAAyF,CAAC;AAGlH,eAAO,MAAM,oBAAoB,uEAAuE,CAAC;AACzG,eAAO,MAAM,mBAAmB,kEAAkE,CAAC;AACnG,eAAO,MAAM,qBAAqB,+EAA+E,CAAC;AAElH,eAAO,MAAM,yBAAyB,QAA6D,CAAC;AACpG,eAAO,MAAM,qBAAqB,QACwE,CAAC;AAC3G,eAAO,MAAM,oCAAoC,QAC+B,CAAC;AACjF,eAAO,MAAM,8BAA8B,QAAkE,CAAC;AAE9G,eAAO,MAAM,sBAAsB,SAAS,CAAC"}
1
+ {"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../src/fixtures/fixtures.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,OAAO,CAAC;AAEjC,eAAO,MAAM,oBAAoB,wBAKhC,CAAC;AAEF,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAChD,eAAO,MAAM,qBAAqB,QAAyB,CAAC;AAE5D,eAAO,MAAM,QAAQ,gEAAgE,CAAC;AACtF,eAAO,MAAM,UAAU,qBAAyF,CAAC;AACjH,eAAO,MAAM,WAAW,qBAAyF,CAAC;AAGlH,eAAO,MAAM,oBAAoB,wDAAwD,CAAC;AAC1F,eAAO,MAAM,mBAAmB,mDAAmD,CAAC;AACpF,eAAO,MAAM,qBAAqB,+EAA+E,CAAC;AAElH,eAAO,MAAM,yBAAyB,QAAgC,CAAC;AACvE,eAAO,MAAM,qBAAqB,QACwE,CAAC;AAC3G,eAAO,MAAM,oCAAoC,QAC+B,CAAC;AACjF,eAAO,MAAM,8BAA8B,QAAkE,CAAC;AAE9G,eAAO,MAAM,sBAAsB,SAAS,CAAC"}
@@ -6,15 +6,16 @@ export const shouldCollectMetrics = ()=>{
6
6
  return undefined;
7
7
  };
8
8
  export const TEST_PEER_CHECK_INTERVAL_MS = 1000;
9
+ export const TEST_MAX_TX_POOL_SIZE = 2 * 1024 * 1024 * 1024; // 2GB
9
10
  export const MNEMONIC = 'test test test test test test test test test test test junk';
10
11
  export const privateKey = Buffer.from('ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80', 'hex');
11
12
  export const privateKey2 = Buffer.from('59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d', 'hex');
12
13
  /// Common errors
13
- export const U128_UNDERFLOW_ERROR = "Assertion failed: attempt to subtract with overflow 'self - other'";
14
- export const U128_OVERFLOW_ERROR = "Assertion failed: attempt to add with overflow 'self + other'";
14
+ export const U128_UNDERFLOW_ERROR = 'Assertion failed: attempt to subtract with overflow';
15
+ export const U128_OVERFLOW_ERROR = 'Assertion failed: attempt to add with overflow';
15
16
  export const BITSIZE_TOO_BIG_ERROR = "Assertion failed: call to assert_max_bit_size 'self.__assert_max_bit_size'";
16
17
  // TODO(https://github.com/AztecProtocol/aztec-packages/issues/5818): Make these a fixed error after transition.
17
- export const DUPLICATE_NULLIFIER_ERROR = /dropped|duplicate nullifier|reverted|Nullifier collision/;
18
+ export const DUPLICATE_NULLIFIER_ERROR = /dropped|nullifier|reverted/i;
18
19
  export const NO_L1_TO_L2_MSG_ERROR = /No non-nullified L1 to L2 message found for message hash|Tried to consume nonexistent L1-to-L2 message/;
19
20
  export const STATIC_CALL_STATE_MODIFICATION_ERROR = /Static call cannot update the state, emit L2->L1 messages or generate logs.*/;
20
21
  export const STATIC_CONTEXT_ASSERTION_ERROR = /Assertion failed: Function .* can only be called statically.*/;
@@ -1,4 +1,4 @@
1
- import type { Logger } from '@aztec/aztec.js';
1
+ import type { Logger } from '@aztec/aztec.js/log';
2
2
  export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chain_test_harness.js';
3
3
  export declare function getACVMConfig(logger: Logger): Promise<{
4
4
  acvmWorkingDirectory: string;
@@ -1 +1 @@
1
- {"version":3,"file":"get_acvm_config.d.ts","sourceRoot":"","sources":["../../src/fixtures/get_acvm_config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAM9C,OAAO,EAAE,0CAA0C,EAAE,MAAM,uCAAuC,CAAC;AAWnG,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CACxD;IACE,oBAAoB,EAAE,MAAM,CAAC;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,GACD,SAAS,CACZ,CAkCA"}
1
+ {"version":3,"file":"get_acvm_config.d.ts","sourceRoot":"","sources":["../../src/fixtures/get_acvm_config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAOlD,OAAO,EAAE,0CAA0C,EAAE,MAAM,uCAAuC,CAAC;AAWnG,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CACxD;IACE,oBAAoB,EAAE,MAAM,CAAC;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,GACD,SAAS,CACZ,CAyBA"}
@@ -1,5 +1,6 @@
1
1
  import { parseBooleanEnv } from '@aztec/foundation/config';
2
2
  import { randomBytes } from '@aztec/foundation/crypto';
3
+ import { tryRmDir } from '@aztec/foundation/fs';
3
4
  import { promises as fs } from 'fs';
4
5
  export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chain_test_harness.js';
5
6
  const { NOIR_RELEASE_DIR = 'noir-repo/target/release', TEMP_DIR = '/tmp', ACVM_BINARY_PATH = '', ACVM_WORKING_DIRECTORY = '', ACVM_FORCE_WASM = '' } = process.env;
@@ -18,20 +19,7 @@ export async function getACVMConfig(logger) {
18
19
  });
19
20
  logger.verbose(`Using native ACVM binary at ${acvmBinaryPath} with working directory ${acvmWorkingDirectory}`);
20
21
  const directoryToCleanup = ACVM_WORKING_DIRECTORY ? undefined : tempWorkingDirectory;
21
- const cleanup = async ()=>{
22
- if (directoryToCleanup) {
23
- try {
24
- logger.info(`Cleaning up ACVM temp directory ${directoryToCleanup}`);
25
- await fs.rm(directoryToCleanup, {
26
- recursive: true,
27
- force: true,
28
- maxRetries: 3
29
- });
30
- } catch (err) {
31
- logger.warn(`Failed to delete ACVM temp directory at ${directoryToCleanup}: ${err}`);
32
- }
33
- }
34
- };
22
+ const cleanup = ()=>tryRmDir(directoryToCleanup, logger);
35
23
  return {
36
24
  acvmWorkingDirectory,
37
25
  acvmBinaryPath,
@@ -1,4 +1,4 @@
1
- import { type Logger } from '@aztec/aztec.js';
1
+ import type { Logger } from '@aztec/aztec.js/log';
2
2
  import type { BBConfig } from '@aztec/bb-prover';
3
3
  export declare const getBBConfig: (logger: Logger) => Promise<(BBConfig & {
4
4
  cleanup: () => Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"get_bb_config.d.ts","sourceRoot":"","sources":["../../src/fixtures/get_bb_config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAiB,MAAM,iBAAiB,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAcjD,eAAO,MAAM,WAAW,WACd,MAAM,KACb,QAAQ,CAAC,QAAQ,GAAG;IAAE,OAAO,EAAE,MAAM,QAAQ,IAAI,CAAC,CAAA;CAAE,CAAC,GAAG,SAAS,CAoCnE,CAAC"}
1
+ {"version":3,"file":"get_bb_config.d.ts","sourceRoot":"","sources":["../../src/fixtures/get_bb_config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAkBjD,eAAO,MAAM,WAAW,GACtB,QAAQ,MAAM,KACb,OAAO,CAAC,CAAC,QAAQ,GAAG;IAAE,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC,GAAG,SAAS,CAqCnE,CAAC"}
@@ -1,11 +1,12 @@
1
- import { fileURLToPath } from '@aztec/aztec.js';
1
+ import { tryRmDir } from '@aztec/foundation/fs';
2
2
  import fs from 'node:fs/promises';
3
3
  import { tmpdir } from 'node:os';
4
4
  import path from 'path';
5
- const { BB_RELEASE_DIR = 'barretenberg/cpp/build/bin', BB_BINARY_PATH, BB_SKIP_CLEANUP = '', TEMP_DIR = tmpdir(), BB_WORKING_DIRECTORY = '' } = process.env;
5
+ import { fileURLToPath } from 'url';
6
+ const { BB_RELEASE_DIR = 'barretenberg/cpp/build/bin', BB_BINARY_PATH, BB_SKIP_CLEANUP = '', TEMP_DIR = tmpdir(), BB_WORKING_DIRECTORY = '', BB_NUM_IVC_VERIFIERS = '1', BB_IVC_CONCURRENCY = '1' } = process.env;
6
7
  export const getBBConfig = async (logger)=>{
7
8
  try {
8
- const bbBinaryPath = BB_BINARY_PATH ?? path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../', BB_RELEASE_DIR, 'bb');
9
+ const bbBinaryPath = BB_BINARY_PATH ?? path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../', BB_RELEASE_DIR, 'bb-avm');
9
10
  await fs.access(bbBinaryPath, fs.constants.R_OK);
10
11
  let bbWorkingDirectory;
11
12
  let directoryToCleanup;
@@ -22,24 +23,16 @@ export const getBBConfig = async (logger)=>{
22
23
  '1',
23
24
  'true'
24
25
  ].includes(BB_SKIP_CLEANUP);
25
- const cleanup = async ()=>{
26
- if (directoryToCleanup && !bbSkipCleanup) {
27
- try {
28
- await fs.rm(directoryToCleanup, {
29
- recursive: true,
30
- force: true,
31
- maxRetries: 3
32
- });
33
- } catch (err) {
34
- logger.warn(`Failed to delete bb working directory at ${directoryToCleanup}: ${err}`);
35
- }
36
- }
37
- };
26
+ const cleanup = bbSkipCleanup ? ()=>Promise.resolve() : ()=>tryRmDir(directoryToCleanup);
27
+ const numIvcVerifiers = Number(BB_NUM_IVC_VERIFIERS);
28
+ const ivcConcurrency = Number(BB_IVC_CONCURRENCY);
38
29
  return {
39
30
  bbSkipCleanup,
40
31
  bbBinaryPath,
41
32
  bbWorkingDirectory,
42
- cleanup
33
+ cleanup,
34
+ numConcurrentIVCVerifiers: numIvcVerifiers,
35
+ bbIVCConcurrency: ivcConcurrency
43
36
  };
44
37
  } catch (err) {
45
38
  logger.error(`Native BB not available, error: ${err}`);
@@ -1,4 +1,4 @@
1
- import type { L1ContractAddresses, ViemPublicClient, ViemWalletClient } from '@aztec/ethereum';
1
+ import { type ExtendedViemWalletClient, type L1ContractAddresses } from '@aztec/ethereum';
2
2
  import { Fr } from '@aztec/foundation/fields';
3
3
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
4
  export declare function sendL1ToL2Message(message: {
@@ -6,8 +6,11 @@ export declare function sendL1ToL2Message(message: {
6
6
  content: Fr;
7
7
  secretHash: Fr;
8
8
  }, ctx: {
9
- walletClient: ViemWalletClient;
10
- publicClient: ViemPublicClient;
11
- l1ContractAddresses: Pick<L1ContractAddresses, 'inboxAddress'>;
12
- }): Promise<Fr[]>;
9
+ l1Client: ExtendedViemWalletClient;
10
+ l1ContractAddresses: Pick<L1ContractAddresses, 'inboxAddress' | 'rollupAddress'>;
11
+ }): Promise<{
12
+ msgHash: Fr;
13
+ globalLeafIndex: Fr;
14
+ txReceipt: import("viem").TransactionReceipt;
15
+ }>;
13
16
  //# sourceMappingURL=l1_to_l2_messaging.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"l1_to_l2_messaging.d.ts","sourceRoot":"","sources":["../../src/fixtures/l1_to_l2_messaging.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC/F,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAKhE,wBAAsB,iBAAiB,CACrC,OAAO,EAAE;IAAE,SAAS,EAAE,YAAY,CAAC;IAAC,OAAO,EAAE,EAAE,CAAC;IAAC,UAAU,EAAE,EAAE,CAAA;CAAE,EACjE,GAAG,EAAE;IACH,YAAY,EAAE,gBAAgB,CAAC;IAC/B,YAAY,EAAE,gBAAgB,CAAC;IAC/B,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAAE,cAAc,CAAC,CAAC;CAChE,iBAmCF"}
1
+ {"version":3,"file":"l1_to_l2_messaging.d.ts","sourceRoot":"","sources":["../../src/fixtures/l1_to_l2_messaging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,wBAAwB,EAAE,KAAK,mBAAmB,EAAkB,MAAM,iBAAiB,CAAC;AAC1G,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAMhE,wBAAsB,iBAAiB,CACrC,OAAO,EAAE;IAAE,SAAS,EAAE,YAAY,CAAC;IAAC,OAAO,EAAE,EAAE,CAAC;IAAC,UAAU,EAAE,EAAE,CAAA;CAAE,EACjE,GAAG,EAAE;IACH,QAAQ,EAAE,wBAAwB,CAAC;IACnC,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAAE,cAAc,GAAG,eAAe,CAAC,CAAC;CAClF;;;;GAgEF"}
@@ -1,15 +1,18 @@
1
+ import { RollupContract } from '@aztec/ethereum';
1
2
  import { Fr } from '@aztec/foundation/fields';
3
+ import { tryJsonStringify } from '@aztec/foundation/json-rpc';
2
4
  import { InboxAbi } from '@aztec/l1-artifacts';
3
- import { expect } from '@jest/globals';
4
5
  import { decodeEventLog, getContract } from 'viem';
6
+ import { getLogger } from './utils.js';
5
7
  export async function sendL1ToL2Message(message, ctx) {
8
+ const logger = getLogger();
6
9
  const inbox = getContract({
7
10
  address: ctx.l1ContractAddresses.inboxAddress.toString(),
8
11
  abi: InboxAbi,
9
- client: ctx.walletClient
12
+ client: ctx.l1Client
10
13
  });
11
14
  const { recipient, content, secretHash } = message;
12
- const version = 1;
15
+ const version = await new RollupContract(ctx.l1Client, ctx.l1ContractAddresses.rollupAddress.toString()).getVersion();
13
16
  // We inject the message to Inbox
14
17
  const txHash = await inbox.write.sendL2Message([
15
18
  {
@@ -18,24 +21,47 @@ export async function sendL1ToL2Message(message, ctx) {
18
21
  },
19
22
  content.toString(),
20
23
  secretHash.toString()
21
- ]);
24
+ ], {
25
+ gas: 1_000_000n
26
+ });
27
+ logger.info(`L1 to L2 message sent in tx ${txHash}`);
22
28
  // We check that the message was correctly injected by checking the emitted event
23
- const txReceipt = await ctx.publicClient.waitForTransactionReceipt({
29
+ const txReceipt = await ctx.l1Client.waitForTransactionReceipt({
24
30
  hash: txHash
25
31
  });
26
- // Exactly 1 event should be emitted in the transaction
27
- expect(txReceipt.logs.length).toBe(1);
28
- // We decode the event and get leaf out of it
29
- const messageSentLog = txReceipt.logs[0];
30
- const topics = decodeEventLog({
31
- abi: InboxAbi,
32
- data: messageSentLog.data,
33
- topics: messageSentLog.topics
34
- });
32
+ if (txReceipt.status !== 'success') {
33
+ throw new Error(`L1 to L2 message failed to be sent in tx ${txHash}. Status: ${txReceipt.status}`);
34
+ }
35
+ logger.info(`L1 to L2 message receipt retrieved for tx ${txReceipt.transactionHash}`, txReceipt);
36
+ if (txReceipt.transactionHash !== txHash) {
37
+ throw new Error(`Receipt transaction hash mismatch: ${txReceipt.transactionHash} !== ${txHash}`);
38
+ }
39
+ // Filter for MessageSent events from the Inbox contract by trying to decode each log
40
+ const messageSentLogs = txReceipt.logs.filter((log)=>log.address.toLowerCase() === ctx.l1ContractAddresses.inboxAddress.toString().toLowerCase()).map((log)=>{
41
+ try {
42
+ const decoded = decodeEventLog({
43
+ abi: InboxAbi,
44
+ data: log.data,
45
+ topics: log.topics
46
+ });
47
+ return {
48
+ log,
49
+ decoded
50
+ };
51
+ } catch {
52
+ return null; // Not a decodable event from this ABI
53
+ }
54
+ }).filter((item)=>item !== null && item.decoded.eventName === 'MessageSent');
55
+ if (messageSentLogs.length !== 1) {
56
+ throw new Error(`Wrong number of MessageSent logs found in ${txHash} transaction (got ${messageSentLogs.length} expected 1)\n${tryJsonStringify(messageSentLogs.map((item)=>item.log))}`);
57
+ }
58
+ // We already have the decoded event
59
+ const topics = messageSentLogs[0].decoded;
35
60
  const receivedMsgHash = topics.args.hash;
36
61
  const receivedGlobalLeafIndex = topics.args.index;
37
- return [
38
- Fr.fromHexString(receivedMsgHash),
39
- new Fr(receivedGlobalLeafIndex)
40
- ];
62
+ return {
63
+ msgHash: Fr.fromHexString(receivedMsgHash),
64
+ globalLeafIndex: new Fr(receivedGlobalLeafIndex),
65
+ txReceipt
66
+ };
41
67
  }
@@ -1,6 +1,6 @@
1
- import { type Logger } from '@aztec/aztec.js';
2
- import type { DeployL1ContractsArgs, L1ContractsConfig } from '@aztec/ethereum';
1
+ import type { Logger } from '@aztec/aztec.js/log';
2
+ import { type DeployL1ContractsArgs, type L1ContractsConfig } from '@aztec/ethereum';
3
3
  import type { HDAccount, PrivateKeyAccount } from 'viem';
4
4
  export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chain_test_harness.js';
5
- export declare const setupL1Contracts: (l1RpcUrl: string, account: HDAccount | PrivateKeyAccount, logger: Logger, args: Pick<DeployL1ContractsArgs, 'genesisArchiveRoot' | 'genesisBlockHash' | 'initialValidators'> & L1ContractsConfig) => Promise<import("@aztec/aztec.js").DeployL1ContractsReturnType>;
5
+ export declare const setupL1Contracts: (l1RpcUrl: string, account: HDAccount | PrivateKeyAccount, logger: Logger, args: Pick<DeployL1ContractsArgs, "genesisArchiveRoot" | "initialValidators"> & L1ContractsConfig) => Promise<import("@aztec/ethereum").DeployL1ContractsReturnType>;
6
6
  //# sourceMappingURL=setup_l1_contracts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"setup_l1_contracts.d.ts","sourceRoot":"","sources":["../../src/fixtures/setup_l1_contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAqB,MAAM,iBAAiB,CAAC;AACjE,OAAO,KAAK,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAIhF,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAGzD,OAAO,EAAE,0CAA0C,EAAE,MAAM,uCAAuC,CAAC;AAEnG,eAAO,MAAM,gBAAgB,aACjB,MAAM,WACP,SAAS,GAAG,iBAAiB,UAC9B,MAAM,QACR,KAAK,qBAAqB,EAAE,oBAAoB,GAAG,kBAAkB,GAAG,mBAAmB,CAAC,GAChG,iBAAiB,mEAWpB,CAAC"}
1
+ {"version":3,"file":"setup_l1_contracts.d.ts","sourceRoot":"","sources":["../../src/fixtures/setup_l1_contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,iBAAiB,EAAqB,MAAM,iBAAiB,CAAC;AAIxG,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAGzD,OAAO,EAAE,0CAA0C,EAAE,MAAM,uCAAuC,CAAC;AAEnG,eAAO,MAAM,gBAAgB,GAC3B,UAAU,MAAM,EAChB,SAAS,SAAS,GAAG,iBAAiB,EACtC,QAAQ,MAAM,EACd,MAAM,IAAI,CAAC,qBAAqB,EAAE,oBAAoB,GAAG,mBAAmB,CAAC,GAAG,iBAAiB,mEAWlG,CAAC"}