@aztec/end-to-end 0.0.0-test.1 → 0.0.1-fake-ceab37513c

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 (156) hide show
  1. package/dest/bench/client_flows/benchmark.d.ts +60 -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 +69 -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 +315 -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 -27
  14. package/dest/bench/utils.d.ts.map +1 -1
  15. package/dest/bench/utils.js +27 -43
  16. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +15 -7
  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 +66 -38
  19. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +10 -18
  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 +34 -53
  22. package/dest/e2e_deploy_contract/deploy_test.d.ts +4 -2
  23. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  24. package/dest/e2e_deploy_contract/deploy_test.js +9 -6
  25. package/dest/e2e_epochs/epochs_test.d.ts +56 -17
  26. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  27. package/dest/e2e_epochs/epochs_test.js +222 -42
  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 +60 -0
  31. package/dest/e2e_fees/fees_test.d.ts +16 -5
  32. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  33. package/dest/e2e_fees/fees_test.js +87 -88
  34. package/dest/e2e_l1_publisher/write_json.d.ts +8 -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 +5 -5
  41. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  42. package/dest/e2e_nested_contract/nested_contract_test.js +19 -14
  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 +132 -0
  46. package/dest/e2e_p2p/p2p_network.d.ts +56 -21
  47. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  48. package/dest/e2e_p2p/p2p_network.js +154 -125
  49. package/dest/e2e_p2p/shared.d.ts +41 -3
  50. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  51. package/dest/e2e_p2p/shared.js +146 -6
  52. package/dest/e2e_token_contract/token_contract_test.d.ts +10 -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 +51 -24
  55. package/dest/{e2e_prover → fixtures}/e2e_prover_test.d.ts +7 -4
  56. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -0
  57. package/dest/{e2e_prover → fixtures}/e2e_prover_test.js +67 -62
  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.map +1 -1
  62. package/dest/fixtures/get_acvm_config.js +2 -14
  63. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  64. package/dest/fixtures/get_bb_config.js +8 -15
  65. package/dest/fixtures/l1_to_l2_messaging.d.ts +8 -5
  66. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  67. package/dest/fixtures/l1_to_l2_messaging.js +44 -18
  68. package/dest/fixtures/setup_l1_contracts.d.ts +3 -3
  69. package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
  70. package/dest/fixtures/setup_l1_contracts.js +3 -3
  71. package/dest/fixtures/setup_p2p_test.d.ts +14 -6
  72. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  73. package/dest/fixtures/setup_p2p_test.js +73 -21
  74. package/dest/fixtures/snapshot_manager.d.ts +8 -3
  75. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  76. package/dest/fixtures/snapshot_manager.js +120 -104
  77. package/dest/fixtures/token_utils.d.ts +4 -3
  78. package/dest/fixtures/token_utils.d.ts.map +1 -1
  79. package/dest/fixtures/token_utils.js +24 -7
  80. package/dest/fixtures/utils.d.ts +65 -22
  81. package/dest/fixtures/utils.d.ts.map +1 -1
  82. package/dest/fixtures/utils.js +439 -318
  83. package/dest/fixtures/web3signer.d.ts +5 -0
  84. package/dest/fixtures/web3signer.d.ts.map +1 -0
  85. package/dest/fixtures/web3signer.js +42 -0
  86. package/dest/shared/cross_chain_test_harness.d.ts +28 -18
  87. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  88. package/dest/shared/cross_chain_test_harness.js +97 -41
  89. package/dest/shared/gas_portal_test_harness.d.ts +23 -18
  90. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  91. package/dest/shared/gas_portal_test_harness.js +43 -25
  92. package/dest/shared/submit-transactions.d.ts.map +1 -1
  93. package/dest/shared/uniswap_l1_l2.d.ts +5 -6
  94. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  95. package/dest/shared/uniswap_l1_l2.js +136 -90
  96. package/dest/simulators/lending_simulator.d.ts +5 -6
  97. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  98. package/dest/simulators/lending_simulator.js +11 -15
  99. package/dest/simulators/token_simulator.d.ts +2 -1
  100. package/dest/simulators/token_simulator.d.ts.map +1 -1
  101. package/dest/simulators/token_simulator.js +16 -13
  102. package/dest/spartan/setup_test_wallets.d.ts +8 -1
  103. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  104. package/dest/spartan/setup_test_wallets.js +108 -22
  105. package/dest/spartan/utils.d.ts +60 -307
  106. package/dest/spartan/utils.d.ts.map +1 -1
  107. package/dest/spartan/utils.js +200 -115
  108. package/package.json +60 -56
  109. package/src/bench/client_flows/benchmark.ts +341 -0
  110. package/src/bench/client_flows/client_flows_benchmark.ts +422 -0
  111. package/src/bench/client_flows/config.ts +61 -0
  112. package/src/bench/client_flows/data_extractor.ts +111 -0
  113. package/src/bench/utils.ts +26 -52
  114. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +60 -40
  115. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +47 -75
  116. package/src/e2e_deploy_contract/deploy_test.ts +11 -8
  117. package/src/e2e_epochs/epochs_test.ts +276 -54
  118. package/src/e2e_fees/bridging_race.notest.ts +75 -0
  119. package/src/e2e_fees/fees_test.ts +121 -108
  120. package/src/e2e_l1_publisher/write_json.ts +74 -0
  121. package/src/e2e_multi_validator/utils.ts +258 -0
  122. package/src/e2e_nested_contract/nested_contract_test.ts +22 -14
  123. package/src/e2e_p2p/inactivity_slash_test.ts +174 -0
  124. package/src/e2e_p2p/p2p_network.ts +212 -144
  125. package/src/e2e_p2p/shared.ts +234 -14
  126. package/src/e2e_token_contract/token_contract_test.ts +42 -38
  127. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  128. package/src/{e2e_prover → fixtures}/e2e_prover_test.ts +62 -69
  129. package/src/fixtures/fixtures.ts +4 -3
  130. package/src/fixtures/get_acvm_config.ts +2 -10
  131. package/src/fixtures/get_bb_config.ts +15 -11
  132. package/src/fixtures/l1_to_l2_messaging.ts +53 -23
  133. package/src/fixtures/setup_l1_contracts.ts +5 -6
  134. package/src/fixtures/setup_p2p_test.ts +112 -30
  135. package/src/fixtures/snapshot_manager.ts +150 -102
  136. package/src/fixtures/token_utils.ts +33 -8
  137. package/src/fixtures/utils.ts +530 -352
  138. package/src/fixtures/web3signer.ts +46 -0
  139. package/src/guides/up_quick_start.sh +4 -4
  140. package/src/shared/cross_chain_test_harness.ts +92 -52
  141. package/src/shared/gas_portal_test_harness.ts +47 -31
  142. package/src/shared/uniswap_l1_l2.ts +127 -124
  143. package/src/simulators/lending_simulator.ts +11 -15
  144. package/src/simulators/token_simulator.ts +17 -12
  145. package/src/spartan/DEVELOP.md +116 -0
  146. package/src/spartan/setup_test_wallets.ts +144 -29
  147. package/src/spartan/utils.ts +194 -116
  148. package/dest/e2e_prover/e2e_prover_test.d.ts.map +0 -1
  149. package/dest/sample-dapp/connect.js +0 -12
  150. package/dest/sample-dapp/contracts.js +0 -10
  151. package/dest/sample-dapp/deploy.js +0 -35
  152. package/dest/sample-dapp/index.js +0 -98
  153. package/src/sample-dapp/connect.mjs +0 -16
  154. package/src/sample-dapp/contracts.mjs +0 -14
  155. package/src/sample-dapp/deploy.mjs +0 -40
  156. package/src/sample-dapp/index.mjs +0 -128
@@ -0,0 +1,116 @@
1
+ The flow is as follows:
2
+
3
+ 1. Install/start KIND locally
4
+ 2. Bootstrap (to build an aztec image)
5
+ 3. Load image into kind
6
+ 4. Deploy networks
7
+ 5. Run tests in `yarn-project/end-to-end/src/spartan`
8
+
9
+ # Setup KIND
10
+
11
+ KIND is a kubernetes cluster that runs locally out of docker containers.
12
+
13
+ You can just
14
+
15
+ ```bash
16
+ spartan/bootstrap.sh kind
17
+ ```
18
+
19
+ You only need to do that once. If you do it again, it will destroy the cluster and recreate it (which you almost never need to do).
20
+
21
+ Now you’ll likely want some visibility into your cluster. You can
22
+
23
+ ```bash
24
+ spartan/scripts/create_k8s_dashboard.sh
25
+ ```
26
+
27
+ And after ~30 seconds or so you can
28
+
29
+ ```bash
30
+ spartan/scripts/forward_k8s_dashboard.sh
31
+ ```
32
+
33
+ That will run a port forward to your port `8443` . If you’re running in a remote environment (e.g. the mainframe), you’ll need to subsequently forward that back to your local machine. Cursor/VSCode have built in port forwarding (cmd/ctrl shift P, “forward”)
34
+
35
+ Open the forwarded page, and copy/paste the token that was generated when you forwarded the dashboard.
36
+
37
+ # Build an aztecprotocol:aztec image
38
+
39
+ ```bash
40
+ ./bootstrap.sh
41
+ export AZTEC_DOCKER_IMAGE="aztecprotocol/aztec:$(docker images "aztecprotocol/aztec" --format json | \
42
+ jq -r 'select(.Tag != "latest") | .Tag' | \
43
+ head -1)"
44
+ kind load docker-image $AZTEC_DOCKER_IMAGE
45
+ ```
46
+
47
+ If you just changed typescript, you can (after the initial bootstrap)
48
+
49
+ ```bash
50
+ ./yarn-project/bootstrap.sh
51
+ ./release-image/bootstrap.sh
52
+ export AZTEC_DOCKER_IMAGE="aztecprotocol/aztec:$(docker images "aztecprotocol/aztec" --format json | \
53
+ jq -r 'select(.Tag != "latest") | .Tag' | \
54
+ head -1)"
55
+ kind load docker-image $AZTEC_DOCKER_IMAGE
56
+ ```
57
+
58
+ The export is important there. The `AZTEC_DOCKER_IMAGE` env var is used as both:
59
+
60
+ - the container that runs the rollup contract deployment
61
+ - the containers for the aztec infrastructure (validators, provers, etc)
62
+
63
+ # Deploy stuff
64
+
65
+ ```bash
66
+ ./spartan/bootstrap.sh network_deploy scenario.local.env
67
+ ```
68
+
69
+ That will take 1-3 minutes. But at the end you should have everything you need.
70
+
71
+ You can (`k` is just an alias over `kubectl`)
72
+
73
+ ```bash
74
+ ❯ k get pods -n scenario
75
+ NAME READY STATUS RESTARTS AGE
76
+ deploy-rollup-contracts-2025-08-31-1511-w2dlb 0/1 Completed 0 2m34s
77
+ scenario-eth-beacon-0 1/1 Running 0 39m
78
+ scenario-eth-execution-0 1/1 Running 0 39m
79
+ scenario-eth-validator-0 1/1 Running 0 39m
80
+ scenario-p2p-bootstrap-node-5cbf9658b9-6vd9b 1/1 Running 0 20m
81
+ scenario-prover-agent-59bd96899d-46k5s 1/1 Running 0 116s
82
+ scenario-prover-agent-59bd96899d-vzvkd 1/1 Running 0 116s
83
+ scenario-prover-broker-0 1/1 Running 0 116s
84
+ scenario-prover-node-0 1/1 Running 0 116s
85
+ scenario-rpc-aztec-node-0 1/1 Running 0 116s
86
+ scenario-validator-0 1/1 Running 0 116s
87
+ scenario-validator-1 1/1 Running 0 116s
88
+ scenario-validator-2 1/1 Running 0 116s
89
+ scenario-validator-3 1/1 Running 0 116s
90
+ ```
91
+
92
+ For example, you can forward back the ethereum node with
93
+
94
+ ```bash
95
+ k port-forward -n scenario services/eth-devnet-eth-execution 8545:8545
96
+ ```
97
+
98
+ And then do whatever you like with it.
99
+
100
+ # Run tests
101
+
102
+ With the cluster running, you can now easily run tests.
103
+
104
+ ```bash
105
+ # run one
106
+ ./spartan/bootstrap.sh single_test scenario.local.env spartan/smoke.test.ts
107
+
108
+ # run all (serially)
109
+ ./spartan/bootstrap.sh network_tests scenario.local.env
110
+ ```
111
+
112
+ Right now, I recommend running the smoke test first, always, as it waits for the committee to exist.
113
+
114
+ # Teardown
115
+
116
+ You can just `k delete namespace scenario`. That will destroy everything in your kind cluster. To destroy the associated terraform state that was stored locally, just `./spartan/terraform/purge_local_state.sh`.
@@ -5,23 +5,33 @@ import {
5
5
  type AztecAddress,
6
6
  type AztecNode,
7
7
  FeeJuicePaymentMethodWithClaim,
8
+ type FeePaymentMethod,
8
9
  Fr,
9
10
  L1FeeJuicePortalManager,
10
11
  type PXE,
12
+ SponsoredFeePaymentMethod,
11
13
  createAztecNodeClient,
12
14
  createCompatibleClient,
13
15
  retryUntil,
14
16
  } from '@aztec/aztec.js';
15
- import { createEthereumChain, createL1Clients } from '@aztec/ethereum';
17
+ import { createEthereumChain, createExtendedL1Client } from '@aztec/ethereum';
16
18
  import type { Logger } from '@aztec/foundation/log';
17
19
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
20
+ import { createPXEService } from '@aztec/pxe/server';
21
+ import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
22
+
23
+ import { getACVMConfig } from '../fixtures/get_acvm_config.js';
24
+ import { getBBConfig } from '../fixtures/get_bb_config.js';
25
+ import { getSponsoredFPCAddress, registerSponsoredFPC } from '../fixtures/utils.js';
18
26
 
19
27
  export interface TestWallets {
20
28
  pxe: PXE;
21
29
  wallets: AccountWalletWithSecretKey[];
22
30
  tokenAdminWallet: TokenContract;
31
+ tokenAdminAddress: AztecAddress;
23
32
  tokenName: string;
24
33
  recipientWallet: AccountWalletWithSecretKey;
34
+ recipientAddress: AztecAddress;
25
35
  tokenAddress: AztecAddress;
26
36
  }
27
37
 
@@ -41,21 +51,78 @@ export async function setupTestWalletsWithTokens(
41
51
  const [recipientWallet, ...wallets] = (await getDeployedTestAccountsWallets(pxe)).slice(0, WALLET_COUNT + 1);
42
52
 
43
53
  const tokenAdmin = wallets[0];
44
- const tokenAddress = await deployTokenAndMint(wallets, tokenAdmin.getAddress(), mintAmount, logger);
54
+ const tokenAddress = await deployTokenAndMint(wallets, tokenAdmin.getAddress(), mintAmount, undefined, logger);
45
55
  const tokenAdminWallet = await TokenContract.at(tokenAddress, tokenAdmin);
46
56
 
47
- return { pxe, wallets, tokenAdminWallet, tokenName: TOKEN_NAME, tokenAddress, recipientWallet };
57
+ return {
58
+ pxe,
59
+ wallets,
60
+ tokenAdminWallet,
61
+ tokenAdminAddress: tokenAdmin.getAddress(),
62
+ tokenName: TOKEN_NAME,
63
+ tokenAddress,
64
+ recipientAddress: recipientWallet.getAddress(),
65
+ recipientWallet,
66
+ };
67
+ }
68
+
69
+ export async function deploySponsoredTestWallets(
70
+ pxe: PXE,
71
+ mintAmount: bigint,
72
+ logger: Logger,
73
+ numberOfFundedWallets = 1,
74
+ ): Promise<TestWallets> {
75
+ const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
76
+ const recipientWallet = await getSchnorrWalletWithSecretKey(
77
+ pxe,
78
+ recipient.secret,
79
+ recipient.signingKey,
80
+ recipient.salt,
81
+ );
82
+ const fundedAccounts = await Promise.all(funded.map(a => getSchnorrAccount(pxe, a.secret, a.signingKey, a.salt)));
83
+
84
+ await registerSponsoredFPC(pxe);
85
+
86
+ const wallets = await Promise.all(
87
+ fundedAccounts.map(async a => {
88
+ const wallet = await a.getWallet();
89
+ const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
90
+ await a.deploy({ fee: { paymentMethod } }).wait({ timeout: 2400 }); // increase timeout on purpose in order to account for two empty epochs
91
+ logger.info(`Account deployed at ${a.getAddress()}`);
92
+ return wallet;
93
+ }),
94
+ );
95
+
96
+ const tokenAdmin = wallets[0];
97
+ const tokenAddress = await deployTokenAndMint(
98
+ wallets,
99
+ tokenAdmin.getAddress(),
100
+ mintAmount,
101
+ new SponsoredFeePaymentMethod(await getSponsoredFPCAddress()),
102
+ logger,
103
+ );
104
+ const tokenAdminWallet = await TokenContract.at(tokenAddress, tokenAdmin);
105
+
106
+ return {
107
+ pxe,
108
+ wallets,
109
+ tokenAdminAddress: tokenAdmin.getAddress(),
110
+ tokenAdminWallet,
111
+ tokenName: TOKEN_NAME,
112
+ tokenAddress,
113
+ recipientWallet,
114
+ recipientAddress: recipientWallet.getAddress(),
115
+ };
48
116
  }
49
117
 
50
118
  export async function deployTestWalletWithTokens(
51
119
  pxeUrl: string,
52
120
  nodeUrl: string,
53
- l1RpcUrl: string,
121
+ l1RpcUrls: string[],
54
122
  mnemonicOrPrivateKey: string,
55
123
  mintAmount: bigint,
56
124
  logger: Logger,
57
125
  numberOfFundedWallets = 1,
58
- initialFeeJuice = 10n ** 22n,
59
126
  ): Promise<TestWallets> {
60
127
  const pxe = await createCompatibleClient(pxeUrl, logger);
61
128
  const node = createAztecNodeClient(nodeUrl);
@@ -70,12 +137,11 @@ export async function deployTestWalletWithTokens(
70
137
  const fundedAccounts = await Promise.all(funded.map(a => getSchnorrAccount(pxe, a.secret, a.signingKey, a.salt)));
71
138
 
72
139
  const claims = await Promise.all(
73
- fundedAccounts.map(a =>
74
- bridgeL1FeeJuice(l1RpcUrl, mnemonicOrPrivateKey, pxe, a.getAddress(), initialFeeJuice, logger),
75
- ),
140
+ fundedAccounts.map(a => bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, a.getAddress(), undefined, logger)),
76
141
  );
77
142
 
78
- // Progress by 2 L2 blocks so that the l1ToL2Message added above will be available to use on L2.
143
+ // Progress by 3 L2 blocks so that the l1ToL2Message added above will be available to use on L2.
144
+ await advanceL2Block(node);
79
145
  await advanceL2Block(node);
80
146
  await advanceL2Block(node);
81
147
 
@@ -90,26 +156,37 @@ export async function deployTestWalletWithTokens(
90
156
  );
91
157
 
92
158
  const tokenAdmin = wallets[0];
93
- const tokenAddress = await deployTokenAndMint(wallets, tokenAdmin.getAddress(), mintAmount, logger);
159
+ const tokenAddress = await deployTokenAndMint(wallets, tokenAdmin.getAddress(), mintAmount, undefined, logger);
94
160
  const tokenAdminWallet = await TokenContract.at(tokenAddress, tokenAdmin);
95
161
 
96
- return { pxe, wallets, tokenAdminWallet, tokenName: TOKEN_NAME, tokenAddress, recipientWallet };
162
+ return {
163
+ pxe,
164
+ wallets,
165
+ tokenAdminAddress: tokenAdmin.getAddress(),
166
+ tokenAdminWallet,
167
+ tokenName: TOKEN_NAME,
168
+ tokenAddress,
169
+ recipientWallet,
170
+ recipientAddress: recipientWallet.getAddress(),
171
+ };
97
172
  }
98
173
 
99
174
  async function bridgeL1FeeJuice(
100
- l1RpcUrl: string,
175
+ l1RpcUrls: string[],
101
176
  mnemonicOrPrivateKey: string,
102
177
  pxe: PXE,
103
178
  recipient: AztecAddress,
104
- amount: bigint,
179
+ amount: bigint | undefined,
105
180
  log: Logger,
106
181
  ) {
107
182
  const { l1ChainId } = await pxe.getNodeInfo();
108
- const chain = createEthereumChain([l1RpcUrl], l1ChainId);
109
- const { publicClient, walletClient } = createL1Clients(chain.rpcUrls, mnemonicOrPrivateKey, chain.chainInfo);
183
+ const chain = createEthereumChain(l1RpcUrls, l1ChainId);
184
+ const l1Client = createExtendedL1Client(chain.rpcUrls, mnemonicOrPrivateKey, chain.chainInfo);
110
185
 
111
- const portal = await L1FeeJuicePortalManager.new(pxe, publicClient, walletClient, log);
186
+ // docs:start:bridge_fee_juice
187
+ const portal = await L1FeeJuicePortalManager.new(pxe, l1Client, log);
112
188
  const claim = await portal.bridgeTokensPublic(recipient, amount, true /* mint */);
189
+ // docs:end:bridge_fee_juice
113
190
 
114
191
  const isSynced = async () => await pxe.isL1ToL2MessageSynced(Fr.fromHexString(claim.messageHash));
115
192
  await retryUntil(isSynced, `message ${claim.messageHash} sync`, 24, 0.5);
@@ -118,21 +195,37 @@ async function bridgeL1FeeJuice(
118
195
  return claim;
119
196
  }
120
197
 
121
- async function advanceL2Block(node: AztecNode) {
198
+ async function advanceL2Block(node: AztecNode, nodeAdmin?: AztecNodeAdmin) {
122
199
  const initialBlockNumber = await node.getBlockNumber();
123
- await node!.flushTxs();
200
+
201
+ let minTxsPerBlock = undefined;
202
+ if (nodeAdmin) {
203
+ ({ minTxsPerBlock } = await nodeAdmin.getConfig());
204
+ await nodeAdmin.setConfig({ minTxsPerBlock: 0 }); // Set to 0 to ensure we can advance the block
205
+ }
206
+
124
207
  await retryUntil(async () => (await node.getBlockNumber()) >= initialBlockNumber + 1);
208
+
209
+ if (nodeAdmin && minTxsPerBlock !== undefined) {
210
+ await nodeAdmin.setConfig({ minTxsPerBlock });
211
+ }
125
212
  }
126
213
 
127
214
  async function deployTokenAndMint(
128
215
  wallets: AccountWalletWithSecretKey[],
129
216
  admin: AztecAddress,
130
217
  mintAmount: bigint,
218
+ paymentMethod: FeePaymentMethod | undefined,
131
219
  logger: Logger,
132
220
  ) {
133
221
  logger.verbose(`Deploying TokenContract...`);
134
222
  const tokenContract = await TokenContract.deploy(wallets[0], admin, TOKEN_NAME, TOKEN_SYMBOL, TOKEN_DECIMALS)
135
- .send()
223
+ .send({
224
+ from: admin,
225
+ fee: {
226
+ paymentMethod,
227
+ },
228
+ })
136
229
  .deployed({ timeout: 600 });
137
230
 
138
231
  const tokenAddress = tokenContract.address;
@@ -143,7 +236,7 @@ async function deployTokenAndMint(
143
236
  wallets.map(async w =>
144
237
  (await TokenContract.at(tokenAddress, w)).methods
145
238
  .mint_to_public(w.getAddress(), mintAmount)
146
- .send()
239
+ .send({ from: admin, fee: { paymentMethod } })
147
240
  .wait({ timeout: 600 }),
148
241
  ),
149
242
  );
@@ -165,20 +258,42 @@ export async function performTransfers({
165
258
  logger: Logger;
166
259
  }) {
167
260
  const recipient = testWallets.recipientWallet.getAddress();
168
-
169
261
  for (let i = 0; i < rounds; i++) {
170
- const interactions = await Promise.all(
171
- testWallets.wallets.map(async w =>
172
- (
173
- await TokenContract.at(testWallets.tokenAddress, w)
174
- ).methods.transfer_in_public(w.getAddress(), recipient, transferAmount, 0),
175
- ),
262
+ const txs = testWallets.wallets.map(async w =>
263
+ (await TokenContract.at(testWallets.tokenAddress, w)).methods
264
+ .transfer_in_public(w.getAddress(), recipient, transferAmount, 0)
265
+ .prove({ from: w.getAddress() }),
176
266
  );
177
267
 
178
- const txs = await Promise.all(interactions.map(async i => await i.prove()));
268
+ const provenTxs = await Promise.all(txs);
179
269
 
180
- await Promise.all(txs.map(t => t.send().wait({ timeout: 600 })));
270
+ await Promise.all(provenTxs.map(t => t.send().wait({ timeout: 600 })));
181
271
 
182
272
  logger.info(`Completed round ${i + 1} / ${rounds}`);
183
273
  }
184
274
  }
275
+
276
+ export async function startCompatiblePXE(
277
+ nodeUrl: string,
278
+ proverEnabled: boolean,
279
+ logger: Logger,
280
+ ): Promise<{ pxe: PXE; cleanup: () => Promise<void> }> {
281
+ const node = createAztecNodeClient(nodeUrl);
282
+ const [bbConfig, acvmConfig] = await Promise.all([getBBConfig(logger), getACVMConfig(logger)]);
283
+ const pxe = await createPXEService(node, {
284
+ dataDirectory: undefined,
285
+ dataStoreMapSizeKb: 1024 * 1024,
286
+ ...bbConfig,
287
+ ...acvmConfig,
288
+ proverEnabled,
289
+ });
290
+
291
+ return {
292
+ pxe,
293
+ async cleanup() {
294
+ await pxe.stop();
295
+ await bbConfig?.cleanup();
296
+ await acvmConfig?.cleanup();
297
+ },
298
+ };
299
+ }