@aztec/end-to-end 0.0.0-test.1 → 0.0.1-commit.023c3e5

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 (240) hide show
  1. package/dest/bench/client_flows/benchmark.d.ts +62 -0
  2. package/dest/bench/client_flows/benchmark.d.ts.map +1 -0
  3. package/dest/bench/client_flows/benchmark.js +281 -0
  4. package/dest/bench/client_flows/client_flows_benchmark.d.ts +79 -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 +321 -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 +79 -0
  13. package/dest/bench/utils.d.ts +16 -41
  14. package/dest/bench/utils.d.ts.map +1 -1
  15. package/dest/bench/utils.js +41 -72
  16. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +26 -19
  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 +114 -102
  19. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +32 -32
  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 +104 -104
  22. package/dest/e2e_deploy_contract/deploy_test.d.ts +19 -10
  23. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  24. package/dest/e2e_deploy_contract/deploy_test.js +26 -27
  25. package/dest/e2e_epochs/epochs_test.d.ts +71 -22
  26. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  27. package/dest/e2e_epochs/epochs_test.js +260 -54
  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 +61 -0
  31. package/dest/e2e_fees/fees_test.d.ts +38 -23
  32. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  33. package/dest/e2e_fees/fees_test.js +162 -183
  34. package/dest/e2e_l1_publisher/write_json.d.ts +11 -0
  35. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -0
  36. package/dest/e2e_l1_publisher/write_json.js +56 -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 +15 -15
  41. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  42. package/dest/e2e_nested_contract/nested_contract_test.js +37 -41
  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 +136 -0
  46. package/dest/e2e_p2p/p2p_network.d.ts +281 -27
  47. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  48. package/dest/e2e_p2p/p2p_network.js +237 -175
  49. package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
  50. package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
  51. package/dest/e2e_p2p/reqresp/utils.js +153 -0
  52. package/dest/e2e_p2p/shared.d.ts +44 -8
  53. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  54. package/dest/e2e_p2p/shared.js +165 -27
  55. package/dest/e2e_token_contract/token_contract_test.d.ts +27 -14
  56. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  57. package/dest/e2e_token_contract/token_contract_test.js +96 -74
  58. package/dest/fixtures/e2e_prover_test.d.ts +55 -0
  59. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -0
  60. package/dest/fixtures/e2e_prover_test.js +278 -0
  61. package/dest/fixtures/fixtures.d.ts +6 -8
  62. package/dest/fixtures/fixtures.d.ts.map +1 -1
  63. package/dest/fixtures/fixtures.js +5 -5
  64. package/dest/fixtures/get_acvm_config.d.ts +2 -2
  65. package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
  66. package/dest/fixtures/get_acvm_config.js +3 -15
  67. package/dest/fixtures/get_bb_config.d.ts +2 -2
  68. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  69. package/dest/fixtures/get_bb_config.js +10 -17
  70. package/dest/fixtures/index.d.ts +1 -1
  71. package/dest/fixtures/l1_to_l2_messaging.d.ts +11 -7
  72. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  73. package/dest/fixtures/l1_to_l2_messaging.js +45 -19
  74. package/dest/fixtures/logging.d.ts +1 -1
  75. package/dest/fixtures/setup.d.ts +218 -0
  76. package/dest/fixtures/setup.d.ts.map +1 -0
  77. package/dest/fixtures/setup.js +695 -0
  78. package/dest/fixtures/setup_p2p_test.d.ts +15 -15
  79. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  80. package/dest/fixtures/setup_p2p_test.js +96 -31
  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 +31 -12
  84. package/dest/fixtures/utils.d.ts +5 -153
  85. package/dest/fixtures/utils.d.ts.map +1 -1
  86. package/dest/fixtures/utils.js +4 -552
  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 +2 -2
  91. package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
  92. package/dest/fixtures/with_telemetry_utils.js +2 -2
  93. package/dest/index.d.ts +1 -1
  94. package/dest/quality_of_service/grafana_client.d.ts +41 -0
  95. package/dest/quality_of_service/grafana_client.d.ts.map +1 -0
  96. package/dest/quality_of_service/{alert_checker.js → grafana_client.js} +1 -1
  97. package/dest/quality_of_service/prometheus_client.d.ts +38 -0
  98. package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
  99. package/dest/quality_of_service/prometheus_client.js +67 -0
  100. package/dest/shared/cross_chain_test_harness.d.ts +44 -27
  101. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  102. package/dest/shared/cross_chain_test_harness.js +105 -51
  103. package/dest/shared/gas_portal_test_harness.d.ts +33 -25
  104. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  105. package/dest/shared/gas_portal_test_harness.js +51 -30
  106. package/dest/shared/index.d.ts +2 -2
  107. package/dest/shared/index.d.ts.map +1 -1
  108. package/dest/shared/jest_setup.d.ts +1 -1
  109. package/dest/shared/jest_setup.js +1 -1
  110. package/dest/shared/submit-transactions.d.ts +6 -4
  111. package/dest/shared/submit-transactions.d.ts.map +1 -1
  112. package/dest/shared/submit-transactions.js +15 -16
  113. package/dest/shared/uniswap_l1_l2.d.ts +3 -25
  114. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  115. package/dest/shared/uniswap_l1_l2.js +176 -126
  116. package/dest/simulators/index.d.ts +1 -1
  117. package/dest/simulators/lending_simulator.d.ts +7 -7
  118. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  119. package/dest/simulators/lending_simulator.js +17 -18
  120. package/dest/simulators/token_simulator.d.ts +6 -3
  121. package/dest/simulators/token_simulator.d.ts.map +1 -1
  122. package/dest/simulators/token_simulator.js +16 -13
  123. package/dest/spartan/setup_test_wallets.d.ts +27 -11
  124. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  125. package/dest/spartan/setup_test_wallets.js +233 -62
  126. package/dest/spartan/tx_metrics.d.ts +88 -0
  127. package/dest/spartan/tx_metrics.d.ts.map +1 -0
  128. package/dest/spartan/tx_metrics.js +422 -0
  129. package/dest/spartan/utils/bot.d.ts +27 -0
  130. package/dest/spartan/utils/bot.d.ts.map +1 -0
  131. package/dest/spartan/utils/bot.js +141 -0
  132. package/dest/spartan/utils/chaos.d.ts +79 -0
  133. package/dest/spartan/utils/chaos.d.ts.map +1 -0
  134. package/dest/spartan/utils/chaos.js +142 -0
  135. package/dest/spartan/utils/clients.d.ts +39 -0
  136. package/dest/spartan/utils/clients.d.ts.map +1 -0
  137. package/dest/spartan/utils/clients.js +90 -0
  138. package/dest/spartan/utils/config.d.ts +36 -0
  139. package/dest/spartan/utils/config.d.ts.map +1 -0
  140. package/dest/spartan/utils/config.js +20 -0
  141. package/dest/spartan/utils/health.d.ts +63 -0
  142. package/dest/spartan/utils/health.d.ts.map +1 -0
  143. package/dest/spartan/utils/health.js +202 -0
  144. package/dest/spartan/utils/helm.d.ts +15 -0
  145. package/dest/spartan/utils/helm.d.ts.map +1 -0
  146. package/dest/spartan/utils/helm.js +47 -0
  147. package/dest/spartan/utils/index.d.ts +9 -0
  148. package/dest/spartan/utils/index.d.ts.map +1 -0
  149. package/dest/spartan/utils/index.js +18 -0
  150. package/dest/spartan/utils/k8s.d.ts +126 -0
  151. package/dest/spartan/utils/k8s.d.ts.map +1 -0
  152. package/dest/spartan/utils/k8s.js +375 -0
  153. package/dest/spartan/utils/nodes.d.ts +41 -0
  154. package/dest/spartan/utils/nodes.d.ts.map +1 -0
  155. package/dest/spartan/utils/nodes.js +461 -0
  156. package/dest/spartan/utils/scripts.d.ts +16 -0
  157. package/dest/spartan/utils/scripts.d.ts.map +1 -0
  158. package/dest/spartan/utils/scripts.js +66 -0
  159. package/dest/spartan/utils.d.ts +2 -415
  160. package/dest/spartan/utils.d.ts.map +1 -1
  161. package/dest/spartan/utils.js +1 -445
  162. package/package.json +66 -58
  163. package/src/bench/client_flows/benchmark.ts +363 -0
  164. package/src/bench/client_flows/client_flows_benchmark.ts +384 -0
  165. package/src/bench/client_flows/config.ts +61 -0
  166. package/src/bench/client_flows/data_extractor.ts +89 -0
  167. package/src/bench/utils.ts +41 -85
  168. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +134 -169
  169. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +156 -182
  170. package/src/e2e_deploy_contract/deploy_test.ts +40 -48
  171. package/src/e2e_epochs/epochs_test.ts +341 -81
  172. package/src/e2e_fees/bridging_race.notest.ts +74 -0
  173. package/src/e2e_fees/fees_test.ts +220 -258
  174. package/src/e2e_l1_publisher/write_json.ts +77 -0
  175. package/src/e2e_multi_validator/utils.ts +258 -0
  176. package/src/e2e_nested_contract/nested_contract_test.ts +46 -59
  177. package/src/e2e_p2p/inactivity_slash_test.ts +179 -0
  178. package/src/e2e_p2p/p2p_network.ts +341 -234
  179. package/src/e2e_p2p/reqresp/utils.ts +207 -0
  180. package/src/e2e_p2p/shared.ts +260 -39
  181. package/src/e2e_token_contract/token_contract_test.ts +115 -126
  182. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  183. package/src/fixtures/e2e_prover_test.ts +336 -0
  184. package/src/fixtures/fixtures.ts +5 -7
  185. package/src/fixtures/get_acvm_config.ts +4 -12
  186. package/src/fixtures/get_bb_config.ts +18 -13
  187. package/src/fixtures/l1_to_l2_messaging.ts +56 -24
  188. package/src/fixtures/setup.ts +1017 -0
  189. package/src/fixtures/setup_p2p_test.ts +133 -50
  190. package/src/fixtures/token_utils.ts +33 -15
  191. package/src/fixtures/utils.ts +27 -820
  192. package/src/fixtures/web3signer.ts +63 -0
  193. package/src/fixtures/with_telemetry_utils.ts +2 -2
  194. package/src/guides/up_quick_start.sh +7 -15
  195. package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +2 -2
  196. package/src/quality_of_service/prometheus_client.ts +113 -0
  197. package/src/shared/cross_chain_test_harness.ts +103 -91
  198. package/src/shared/gas_portal_test_harness.ts +59 -50
  199. package/src/shared/index.ts +1 -1
  200. package/src/shared/jest_setup.ts +1 -1
  201. package/src/shared/submit-transactions.ts +18 -20
  202. package/src/shared/uniswap_l1_l2.ts +197 -221
  203. package/src/simulators/lending_simulator.ts +16 -17
  204. package/src/simulators/token_simulator.ts +21 -13
  205. package/src/spartan/DEVELOP.md +128 -0
  206. package/src/spartan/setup_test_wallets.ts +308 -95
  207. package/src/spartan/tx_metrics.ts +376 -0
  208. package/src/spartan/utils/bot.ts +185 -0
  209. package/src/spartan/utils/chaos.ts +253 -0
  210. package/src/spartan/utils/clients.ts +100 -0
  211. package/src/spartan/utils/config.ts +26 -0
  212. package/src/spartan/utils/health.ts +255 -0
  213. package/src/spartan/utils/helm.ts +84 -0
  214. package/src/spartan/utils/index.ts +64 -0
  215. package/src/spartan/utils/k8s.ts +527 -0
  216. package/src/spartan/utils/nodes.ts +538 -0
  217. package/src/spartan/utils/scripts.ts +63 -0
  218. package/src/spartan/utils.ts +1 -582
  219. package/dest/e2e_prover/e2e_prover_test.d.ts +0 -56
  220. package/dest/e2e_prover/e2e_prover_test.d.ts.map +0 -1
  221. package/dest/e2e_prover/e2e_prover_test.js +0 -291
  222. package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
  223. package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
  224. package/dest/fixtures/setup_l1_contracts.js +0 -17
  225. package/dest/fixtures/snapshot_manager.d.ts +0 -87
  226. package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
  227. package/dest/fixtures/snapshot_manager.js +0 -479
  228. package/dest/quality_of_service/alert_checker.d.ts +0 -41
  229. package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
  230. package/dest/sample-dapp/connect.js +0 -12
  231. package/dest/sample-dapp/contracts.js +0 -10
  232. package/dest/sample-dapp/deploy.js +0 -35
  233. package/dest/sample-dapp/index.js +0 -98
  234. package/src/e2e_prover/e2e_prover_test.ts +0 -418
  235. package/src/fixtures/setup_l1_contracts.ts +0 -27
  236. package/src/fixtures/snapshot_manager.ts +0 -617
  237. package/src/sample-dapp/connect.mjs +0 -16
  238. package/src/sample-dapp/contracts.mjs +0 -14
  239. package/src/sample-dapp/deploy.mjs +0 -40
  240. package/src/sample-dapp/index.mjs +0 -128
@@ -1,445 +1 @@
1
- import { createAztecNodeClient, createLogger, sleep } from '@aztec/aztec.js';
2
- import { exec, execSync, spawn } from 'child_process';
3
- import path from 'path';
4
- import { promisify } from 'util';
5
- import { z } from 'zod';
6
- import { AlertChecker } from '../quality_of_service/alert_checker.js';
7
- const execAsync = promisify(exec);
8
- const logger = createLogger('e2e:k8s-utils');
9
- const ethereumHostsSchema = z.string().refine((str)=>str.split(',').every((url)=>{
10
- try {
11
- new URL(url.trim());
12
- return true;
13
- } catch {
14
- return false;
15
- }
16
- }), 'ETHEREUM_HOSTS must be a comma-separated list of valid URLs');
17
- const k8sLocalConfigSchema = z.object({
18
- ETHEREUM_SLOT_DURATION: z.coerce.number().min(1, 'ETHEREUM_SLOT_DURATION env variable must be set'),
19
- AZTEC_SLOT_DURATION: z.coerce.number().min(1, 'AZTEC_SLOT_DURATION env variable must be set'),
20
- AZTEC_EPOCH_DURATION: z.coerce.number().min(1, 'AZTEC_EPOCH_DURATION env variable must be set'),
21
- AZTEC_PROOF_SUBMISSION_WINDOW: z.coerce.number().min(1, 'AZTEC_PROOF_SUBMISSION_WINDOW env variable must be set'),
22
- INSTANCE_NAME: z.string().min(1, 'INSTANCE_NAME env variable must be set'),
23
- NAMESPACE: z.string().min(1, 'NAMESPACE env variable must be set'),
24
- CONTAINER_NODE_PORT: z.coerce.number().default(8080),
25
- CONTAINER_SEQUENCER_PORT: z.coerce.number().default(8080),
26
- CONTAINER_PROVER_NODE_PORT: z.coerce.number().default(8080),
27
- CONTAINER_PXE_PORT: z.coerce.number().default(8080),
28
- CONTAINER_ETHEREUM_PORT: z.coerce.number().default(8545),
29
- CONTAINER_METRICS_PORT: z.coerce.number().default(80),
30
- GRAFANA_PASSWORD: z.string().optional(),
31
- METRICS_API_PATH: z.string().default('/api/datasources/proxy/uid/spartan-metrics-prometheus/api/v1'),
32
- SPARTAN_DIR: z.string().min(1, 'SPARTAN_DIR env variable must be set'),
33
- ETHEREUM_HOSTS: ethereumHostsSchema.optional(),
34
- L1_ACCOUNT_MNEMONIC: z.string().default('test test test test test test test test test test test junk'),
35
- SEPOLIA_RUN: z.string().default('false'),
36
- K8S: z.literal('local')
37
- });
38
- const k8sGCloudConfigSchema = k8sLocalConfigSchema.extend({
39
- K8S: z.literal('gcloud'),
40
- CLUSTER_NAME: z.string().min(1, 'CLUSTER_NAME env variable must be set'),
41
- REGION: z.string().min(1, 'REGION env variable must be set')
42
- });
43
- const directConfigSchema = z.object({
44
- PXE_URL: z.string().url('PXE_URL must be a valid URL'),
45
- NODE_URL: z.string().url('NODE_URL must be a valid URL'),
46
- ETHEREUM_HOSTS: ethereumHostsSchema,
47
- K8S: z.literal('false')
48
- });
49
- const envSchema = z.discriminatedUnion('K8S', [
50
- k8sLocalConfigSchema,
51
- k8sGCloudConfigSchema,
52
- directConfigSchema
53
- ]);
54
- export function isK8sConfig(config) {
55
- return config.K8S === 'local' || config.K8S === 'gcloud';
56
- }
57
- export function isGCloudConfig(config) {
58
- return config.K8S === 'gcloud';
59
- }
60
- export function setupEnvironment(env) {
61
- const config = envSchema.parse(env);
62
- if (isGCloudConfig(config)) {
63
- const command = `gcloud container clusters get-credentials ${config.CLUSTER_NAME} --region=${config.REGION}`;
64
- execSync(command);
65
- }
66
- return config;
67
- }
68
- export async function startPortForward({ resource, namespace, containerPort, hostPort }) {
69
- const hostPortAsString = hostPort ? hostPort.toString() : '';
70
- logger.info(`kubectl port-forward -n ${namespace} ${resource} ${hostPortAsString}:${containerPort}`);
71
- const process = spawn('kubectl', [
72
- 'port-forward',
73
- '-n',
74
- namespace,
75
- resource,
76
- `${hostPortAsString}:${containerPort}`
77
- ], {
78
- detached: true,
79
- windowsHide: true,
80
- stdio: [
81
- 'ignore',
82
- 'pipe',
83
- 'pipe'
84
- ]
85
- });
86
- let isResolved = false;
87
- const connected = new Promise((resolve)=>{
88
- process.stdout?.on('data', (data)=>{
89
- const str = data.toString();
90
- if (!isResolved && str.includes('Forwarding from')) {
91
- isResolved = true;
92
- logger.info(str);
93
- const port = str.search(/:\d+/);
94
- if (port === -1) {
95
- throw new Error('Port not found in port forward output');
96
- }
97
- const portNumber = parseInt(str.slice(port + 1));
98
- logger.info(`Port forward connected: ${portNumber}`);
99
- logger.info(`Port forward connected: ${portNumber}`);
100
- resolve(portNumber);
101
- } else {
102
- logger.silent(str);
103
- }
104
- });
105
- process.stderr?.on('data', (data)=>{
106
- logger.info(data.toString());
107
- // It's a strange thing:
108
- // If we don't pipe stderr, then the port forwarding does not work.
109
- // Log to silent because this doesn't actually report errors,
110
- // just extremely verbose debug logs.
111
- logger.silent(data.toString());
112
- });
113
- process.on('close', ()=>{
114
- if (!isResolved) {
115
- isResolved = true;
116
- logger.warn('Port forward closed before connection established');
117
- resolve(0);
118
- }
119
- });
120
- process.on('error', (error)=>{
121
- logger.error(`Port forward error: ${error}`);
122
- resolve(0);
123
- });
124
- process.on('exit', (code)=>{
125
- logger.info(`Port forward exited with code ${code}`);
126
- resolve(0);
127
- });
128
- });
129
- const port = await connected;
130
- return {
131
- process,
132
- port
133
- };
134
- }
135
- export async function deleteResourceByName({ resource, namespace, name, force = false }) {
136
- const command = `kubectl delete ${resource} ${name} -n ${namespace} --ignore-not-found=true --wait=true ${force ? '--force' : ''}`;
137
- logger.info(`command: ${command}`);
138
- const { stdout } = await execAsync(command);
139
- return stdout;
140
- }
141
- export async function deleteResourceByLabel({ resource, namespace, label }) {
142
- const command = `kubectl delete ${resource} -l ${label} -n ${namespace} --ignore-not-found=true --wait=true`;
143
- logger.info(`command: ${command}`);
144
- const { stdout } = await execAsync(command);
145
- return stdout;
146
- }
147
- export async function waitForResourceByLabel({ resource, label, namespace, condition = 'Ready', timeout = '10m' }) {
148
- const command = `kubectl wait ${resource} -l ${label} --for=condition=${condition} -n ${namespace} --timeout=${timeout}`;
149
- logger.info(`command: ${command}`);
150
- const { stdout } = await execAsync(command);
151
- return stdout;
152
- }
153
- export function getChartDir(spartanDir, chartName) {
154
- return path.join(spartanDir.trim(), chartName);
155
- }
156
- function valuesToArgs(values) {
157
- return Object.entries(values).map(([key, value])=>`--set ${key}=${value}`).join(' ');
158
- }
159
- function createHelmCommand({ instanceName, helmChartDir, namespace, valuesFile, timeout, values, reuseValues = false }) {
160
- const valuesFileArgs = valuesFile ? `--values ${helmChartDir}/values/${valuesFile}` : '';
161
- const reuseValuesArgs = reuseValues ? '--reuse-values' : '';
162
- return `helm upgrade --install ${instanceName} ${helmChartDir} --namespace ${namespace} ${valuesFileArgs} ${reuseValuesArgs} --wait --timeout=${timeout} ${valuesToArgs(values)}`;
163
- }
164
- async function execHelmCommand(args) {
165
- const helmCommand = createHelmCommand(args);
166
- logger.info(`helm command: ${helmCommand}`);
167
- const { stdout } = await execAsync(helmCommand);
168
- return stdout;
169
- }
170
- /**
171
- * Installs a Helm chart with the given parameters.
172
- * @param instanceName - The name of the Helm chart instance.
173
- * @param targetNamespace - The namespace with the resources to be affected by the Helm chart.
174
- * @param valuesFile - The values file to use for the Helm chart.
175
- * @param chaosMeshNamespace - The namespace to install the Helm chart in.
176
- * @param timeout - The timeout for the Helm command.
177
- * @param clean - Whether to clean up the Helm chart before installing it.
178
- * @returns The stdout of the Helm command.
179
- * @throws If the Helm command fails.
180
- *
181
- * Example usage:
182
- * ```typescript
183
- * const stdout = await installChaosMeshChart({ instanceName: 'force-reorg', targetNamespace: 'smoke', valuesFile: 'prover-failure.yaml'});
184
- * console.log(stdout);
185
- * ```
186
- */ export async function installChaosMeshChart({ instanceName, targetNamespace, valuesFile, helmChartDir, chaosMeshNamespace = 'chaos-mesh', timeout = '5m', clean = true, values = {}, logger }) {
187
- if (clean) {
188
- // uninstall the helm chart if it exists
189
- logger.info(`Uninstalling helm chart ${instanceName}`);
190
- await execAsync(`helm uninstall ${instanceName} --namespace ${chaosMeshNamespace} --wait --ignore-not-found`);
191
- // and delete the podchaos resource
192
- const deleteArgs = {
193
- resource: 'podchaos',
194
- namespace: chaosMeshNamespace,
195
- name: `${targetNamespace}-${instanceName}`
196
- };
197
- logger.info(`Deleting podchaos resource`);
198
- await deleteResourceByName(deleteArgs).catch((e)=>{
199
- logger.error(`Error deleting podchaos resource: ${e}`);
200
- logger.info(`Force deleting podchaos resource`);
201
- return deleteResourceByName({
202
- ...deleteArgs,
203
- force: true
204
- });
205
- });
206
- }
207
- return execHelmCommand({
208
- instanceName,
209
- helmChartDir,
210
- namespace: chaosMeshNamespace,
211
- valuesFile,
212
- timeout,
213
- values: {
214
- ...values,
215
- 'global.targetNamespace': targetNamespace
216
- }
217
- });
218
- }
219
- export function applyProverFailure({ namespace, spartanDir, durationSeconds, logger }) {
220
- return installChaosMeshChart({
221
- instanceName: 'prover-failure',
222
- targetNamespace: namespace,
223
- valuesFile: 'prover-failure.yaml',
224
- helmChartDir: getChartDir(spartanDir, 'aztec-chaos-scenarios'),
225
- values: {
226
- 'proverFailure.duration': `${durationSeconds}s`
227
- },
228
- logger
229
- });
230
- }
231
- export function applyProverKill({ namespace, spartanDir, logger }) {
232
- return installChaosMeshChart({
233
- instanceName: 'prover-kill',
234
- targetNamespace: namespace,
235
- valuesFile: 'prover-kill.yaml',
236
- helmChartDir: getChartDir(spartanDir, 'aztec-chaos-scenarios'),
237
- clean: true,
238
- logger
239
- });
240
- }
241
- export function applyProverBrokerKill({ namespace, spartanDir, logger }) {
242
- return installChaosMeshChart({
243
- instanceName: 'prover-broker-kill',
244
- targetNamespace: namespace,
245
- valuesFile: 'prover-broker-kill.yaml',
246
- helmChartDir: getChartDir(spartanDir, 'aztec-chaos-scenarios'),
247
- clean: true,
248
- logger
249
- });
250
- }
251
- export function applyBootNodeFailure({ namespace, spartanDir, durationSeconds, logger }) {
252
- return installChaosMeshChart({
253
- instanceName: 'boot-node-failure',
254
- targetNamespace: namespace,
255
- valuesFile: 'boot-node-failure.yaml',
256
- helmChartDir: getChartDir(spartanDir, 'aztec-chaos-scenarios'),
257
- values: {
258
- 'bootNodeFailure.duration': `${durationSeconds}s`
259
- },
260
- logger
261
- });
262
- }
263
- export function applyValidatorKill({ namespace, spartanDir, logger }) {
264
- return installChaosMeshChart({
265
- instanceName: 'validator-kill',
266
- targetNamespace: namespace,
267
- valuesFile: 'validator-kill.yaml',
268
- helmChartDir: getChartDir(spartanDir, 'aztec-chaos-scenarios'),
269
- logger
270
- });
271
- }
272
- export function applyNetworkShaping({ valuesFile, namespace, spartanDir, logger }) {
273
- return installChaosMeshChart({
274
- instanceName: 'network-shaping',
275
- targetNamespace: namespace,
276
- valuesFile,
277
- helmChartDir: getChartDir(spartanDir, 'aztec-chaos-scenarios'),
278
- logger
279
- });
280
- }
281
- export async function awaitL2BlockNumber(rollupCheatCodes, blockNumber, timeoutSeconds, logger) {
282
- logger.info(`Waiting for L2 Block ${blockNumber}`);
283
- let tips = await rollupCheatCodes.getTips();
284
- const endTime = Date.now() + timeoutSeconds * 1000;
285
- while(tips.pending < blockNumber && Date.now() < endTime){
286
- logger.info(`At L2 Block ${tips.pending}`);
287
- await sleep(1000);
288
- tips = await rollupCheatCodes.getTips();
289
- }
290
- if (tips.pending < blockNumber) {
291
- throw new Error(`Timeout waiting for L2 Block ${blockNumber}, only reached ${tips.pending}`);
292
- } else {
293
- logger.info(`Reached L2 Block ${tips.pending}`);
294
- }
295
- }
296
- export async function restartBot(namespace, logger) {
297
- logger.info(`Restarting bot`);
298
- await deleteResourceByLabel({
299
- resource: 'pods',
300
- namespace,
301
- label: 'app=bot'
302
- });
303
- await sleep(10 * 1000);
304
- await waitForResourceByLabel({
305
- resource: 'pods',
306
- namespace,
307
- label: 'app=bot'
308
- });
309
- logger.info(`Bot restarted`);
310
- }
311
- export async function enableValidatorDynamicBootNode(instanceName, namespace, spartanDir, logger) {
312
- logger.info(`Enabling validator dynamic boot node`);
313
- await execHelmCommand({
314
- instanceName,
315
- namespace,
316
- helmChartDir: getChartDir(spartanDir, 'aztec-network'),
317
- values: {
318
- 'validator.dynamicBootNode': 'true'
319
- },
320
- valuesFile: undefined,
321
- timeout: '15m',
322
- reuseValues: true
323
- });
324
- logger.info(`Validator dynamic boot node enabled`);
325
- }
326
- export async function runAlertCheck(config, alerts, logger) {
327
- if (isK8sConfig(config)) {
328
- const { process, port } = await startPortForward({
329
- resource: `svc/metrics-grafana`,
330
- namespace: 'metrics',
331
- containerPort: config.CONTAINER_METRICS_PORT
332
- });
333
- const alertChecker = new AlertChecker(logger, {
334
- grafanaEndpoint: `http://localhost:${port}${config.METRICS_API_PATH}`,
335
- grafanaCredentials: `admin:${config.GRAFANA_PASSWORD}`
336
- });
337
- await alertChecker.runAlertCheck(alerts);
338
- process.kill();
339
- } else {
340
- logger.info('Not running alert check in non-k8s environment');
341
- }
342
- }
343
- export async function updateSequencerConfig(url, config) {
344
- const node = createAztecNodeClient(url);
345
- await node.setConfig(config);
346
- }
347
- export async function getSequencers(namespace) {
348
- const command = `kubectl get pods -l app=validator -n ${namespace} -o jsonpath='{.items[*].metadata.name}'`;
349
- const { stdout } = await execAsync(command);
350
- return stdout.split(' ');
351
- }
352
- export async function updateK8sSequencersConfig(args) {
353
- const { containerPort, namespace, config } = args;
354
- const sequencers = await getSequencers(namespace);
355
- for (const sequencer of sequencers){
356
- const { process, port } = await startPortForward({
357
- resource: `pod/${sequencer}`,
358
- namespace,
359
- containerPort
360
- });
361
- const url = `http://localhost:${port}`;
362
- await updateSequencerConfig(url, config);
363
- process.kill();
364
- }
365
- }
366
- export async function updateSequencersConfig(env, config) {
367
- if (isK8sConfig(env)) {
368
- await updateK8sSequencersConfig({
369
- containerPort: env.CONTAINER_NODE_PORT,
370
- namespace: env.NAMESPACE,
371
- config
372
- });
373
- } else {
374
- await updateSequencerConfig(env.NODE_URL, config);
375
- }
376
- }
377
- /**
378
- * Rolls the Aztec pods in the given namespace.
379
- * @param namespace - The namespace to roll the Aztec pods in.
380
- * @dev - IMPORTANT: This function DOES NOT delete the underlying PVCs.
381
- * This means that the pods will be restarted with the same persistent storage.
382
- * This is useful for testing, but you should be aware of the implications.
383
- */ export async function rollAztecPods(namespace) {
384
- await deleteResourceByLabel({
385
- resource: 'pods',
386
- namespace: namespace,
387
- label: 'app=boot-node'
388
- });
389
- await deleteResourceByLabel({
390
- resource: 'pods',
391
- namespace: namespace,
392
- label: 'app=prover-node'
393
- });
394
- await deleteResourceByLabel({
395
- resource: 'pods',
396
- namespace: namespace,
397
- label: 'app=prover-broker'
398
- });
399
- await deleteResourceByLabel({
400
- resource: 'pods',
401
- namespace: namespace,
402
- label: 'app=prover-agent'
403
- });
404
- await deleteResourceByLabel({
405
- resource: 'pods',
406
- namespace: namespace,
407
- label: 'app=validator'
408
- });
409
- await deleteResourceByLabel({
410
- resource: 'pods',
411
- namespace: namespace,
412
- label: 'app=pxe'
413
- });
414
- await sleep(10 * 1000);
415
- await waitForResourceByLabel({
416
- resource: 'pods',
417
- namespace: namespace,
418
- label: 'app=boot-node'
419
- });
420
- await waitForResourceByLabel({
421
- resource: 'pods',
422
- namespace: namespace,
423
- label: 'app=prover-node'
424
- });
425
- await waitForResourceByLabel({
426
- resource: 'pods',
427
- namespace: namespace,
428
- label: 'app=prover-broker'
429
- });
430
- await waitForResourceByLabel({
431
- resource: 'pods',
432
- namespace: namespace,
433
- label: 'app=prover-agent'
434
- });
435
- await waitForResourceByLabel({
436
- resource: 'pods',
437
- namespace: namespace,
438
- label: 'app=validator'
439
- });
440
- await waitForResourceByLabel({
441
- resource: 'pods',
442
- namespace: namespace,
443
- label: 'app=pxe'
444
- });
445
- }
1
+ export * from './utils/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/end-to-end",
3
- "version": "0.0.0-test.1",
3
+ "version": "0.0.1-commit.023c3e5",
4
4
  "type": "module",
5
5
  "exports": "./dest/index.js",
6
6
  "inherits": [
@@ -8,10 +8,9 @@
8
8
  "./package.local.json"
9
9
  ],
10
10
  "scripts": {
11
- "build": "yarn clean && tsc -b",
12
- "build:dev": "tsc -b --watch",
11
+ "build": "yarn clean && ../scripts/tsc.sh",
12
+ "build:dev": "../scripts/tsc.sh --watch",
13
13
  "clean": "rm -rf ./dest .tsbuildinfo",
14
- "formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src",
15
14
  "test:with-alerts": "./scripts/test-with-alerts.sh",
16
15
  "test:e2e": "LOG_LEVEL=${LOG_LEVEL:-verbose} NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=300000 --forceExit",
17
16
  "test:e2e-docker": "./scripts/run_test.sh simple",
@@ -26,89 +25,96 @@
26
25
  "formatting": "run -T prettier --check ./src && run -T eslint ./src"
27
26
  },
28
27
  "dependencies": {
29
- "@aztec/accounts": "0.0.0-test.1",
30
- "@aztec/archiver": "0.0.0-test.1",
31
- "@aztec/aztec": "0.0.0-test.1",
32
- "@aztec/aztec-node": "0.0.0-test.1",
33
- "@aztec/aztec.js": "0.0.0-test.1",
34
- "@aztec/bb-prover": "0.0.0-test.1",
35
- "@aztec/blob-lib": "0.0.0-test.1",
36
- "@aztec/blob-sink": "0.0.0-test.1",
37
- "@aztec/bot": "0.0.0-test.1",
38
- "@aztec/constants": "0.0.0-test.1",
39
- "@aztec/entrypoints": "0.0.0-test.1",
40
- "@aztec/epoch-cache": "0.0.0-test.1",
41
- "@aztec/ethereum": "0.0.0-test.1",
42
- "@aztec/foundation": "0.0.0-test.1",
43
- "@aztec/kv-store": "0.0.0-test.1",
44
- "@aztec/l1-artifacts": "0.0.0-test.1",
45
- "@aztec/merkle-tree": "0.0.0-test.1",
46
- "@aztec/noir-contracts.js": "0.0.0-test.1",
47
- "@aztec/noir-protocol-circuits-types": "0.0.0-test.1",
48
- "@aztec/p2p": "0.0.0-test.1",
49
- "@aztec/protocol-contracts": "0.0.0-test.1",
50
- "@aztec/prover-client": "0.0.0-test.1",
51
- "@aztec/prover-node": "0.0.0-test.1",
52
- "@aztec/pxe": "0.0.0-test.1",
53
- "@aztec/sequencer-client": "0.0.0-test.1",
54
- "@aztec/simulator": "0.0.0-test.1",
55
- "@aztec/stdlib": "0.0.0-test.1",
56
- "@aztec/telemetry-client": "0.0.0-test.1",
57
- "@aztec/validator-client": "0.0.0-test.1",
58
- "@aztec/world-state": "0.0.0-test.1",
28
+ "@aztec/accounts": "0.0.1-commit.023c3e5",
29
+ "@aztec/archiver": "0.0.1-commit.023c3e5",
30
+ "@aztec/aztec": "0.0.1-commit.023c3e5",
31
+ "@aztec/aztec-node": "0.0.1-commit.023c3e5",
32
+ "@aztec/aztec.js": "0.0.1-commit.023c3e5",
33
+ "@aztec/bb-prover": "0.0.1-commit.023c3e5",
34
+ "@aztec/bb.js": "0.0.1-commit.023c3e5",
35
+ "@aztec/blob-client": "0.0.1-commit.023c3e5",
36
+ "@aztec/blob-lib": "0.0.1-commit.023c3e5",
37
+ "@aztec/bot": "0.0.1-commit.023c3e5",
38
+ "@aztec/cli": "0.0.1-commit.023c3e5",
39
+ "@aztec/constants": "0.0.1-commit.023c3e5",
40
+ "@aztec/entrypoints": "0.0.1-commit.023c3e5",
41
+ "@aztec/epoch-cache": "0.0.1-commit.023c3e5",
42
+ "@aztec/ethereum": "0.0.1-commit.023c3e5",
43
+ "@aztec/foundation": "0.0.1-commit.023c3e5",
44
+ "@aztec/kv-store": "0.0.1-commit.023c3e5",
45
+ "@aztec/l1-artifacts": "0.0.1-commit.023c3e5",
46
+ "@aztec/merkle-tree": "0.0.1-commit.023c3e5",
47
+ "@aztec/node-keystore": "0.0.1-commit.023c3e5",
48
+ "@aztec/noir-contracts.js": "0.0.1-commit.023c3e5",
49
+ "@aztec/noir-noirc_abi": "0.0.1-commit.023c3e5",
50
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.023c3e5",
51
+ "@aztec/noir-test-contracts.js": "0.0.1-commit.023c3e5",
52
+ "@aztec/p2p": "0.0.1-commit.023c3e5",
53
+ "@aztec/protocol-contracts": "0.0.1-commit.023c3e5",
54
+ "@aztec/prover-client": "0.0.1-commit.023c3e5",
55
+ "@aztec/prover-node": "0.0.1-commit.023c3e5",
56
+ "@aztec/pxe": "0.0.1-commit.023c3e5",
57
+ "@aztec/sequencer-client": "0.0.1-commit.023c3e5",
58
+ "@aztec/simulator": "0.0.1-commit.023c3e5",
59
+ "@aztec/slasher": "0.0.1-commit.023c3e5",
60
+ "@aztec/stdlib": "0.0.1-commit.023c3e5",
61
+ "@aztec/telemetry-client": "0.0.1-commit.023c3e5",
62
+ "@aztec/test-wallet": "0.0.1-commit.023c3e5",
63
+ "@aztec/validator-client": "0.0.1-commit.023c3e5",
64
+ "@aztec/validator-ha-signer": "0.0.1-commit.023c3e5",
65
+ "@aztec/world-state": "0.0.1-commit.023c3e5",
59
66
  "@iarna/toml": "^2.2.5",
60
- "@jest/globals": "^29.5.0",
61
- "@noble/curves": "^1.0.0",
67
+ "@jest/globals": "^30.0.0",
68
+ "@noble/curves": "=1.0.0",
62
69
  "@swc/core": "^1.4.11",
63
70
  "@swc/jest": "^0.2.36",
64
71
  "@types/fs-extra": "^11.0.2",
65
- "@types/jest": "^29.5.0",
66
- "@types/koa": "^2.13.9",
72
+ "@types/jest": "^30.0.0",
73
+ "@types/koa": "^2.15.0",
67
74
  "@types/koa-static": "^4.0.2",
68
- "@types/levelup": "^5.1.2",
69
75
  "@types/lodash.every": "^4.6.7",
70
- "@types/memdown": "^3.0.3",
71
- "@types/node": "^18.7.23",
76
+ "@types/node": "^22.15.17",
72
77
  "@viem/anvil": "^0.0.9",
73
78
  "buffer": "^6.0.3",
74
- "crypto-browserify": "^3.12.0",
79
+ "crypto-browserify": "^3.12.1",
75
80
  "fs-extra": "^11.2.0",
76
81
  "get-port": "^7.1.0",
77
82
  "glob": "^10.3.10",
78
- "jest": "^29.5.0",
79
- "jest-extended": "^4.0.2",
80
- "jest-mock-extended": "^3.0.5",
81
- "koa": "^2.14.2",
83
+ "jest": "^30.0.0",
84
+ "jest-extended": "^6.0.0",
85
+ "jest-mock-extended": "^4.0.0",
86
+ "koa": "^2.16.1",
82
87
  "koa-static": "^5.0.0",
83
- "levelup": "^5.1.1",
84
88
  "lodash.chunk": "^4.2.0",
85
89
  "lodash.compact": "^3.0.1",
86
90
  "lodash.every": "^4.6.0",
87
91
  "lodash.omit": "^4.5.0",
88
- "memdown": "^6.1.1",
92
+ "msgpackr": "^1.11.2",
89
93
  "process": "^0.11.10",
94
+ "snappy": "^7.2.2",
90
95
  "stream-browserify": "^3.0.0",
91
96
  "string-argv": "^0.3.2",
92
- "ts-loader": "^9.4.4",
97
+ "ts-loader": "^9.5.4",
93
98
  "ts-node": "^10.9.1",
94
99
  "tslib": "^2.4.0",
95
- "typescript": "^5.0.4",
100
+ "typescript": "^5.3.3",
96
101
  "util": "^0.12.5",
97
- "viem": "2.22.8",
102
+ "viem": "npm:@aztec/viem@2.38.2",
98
103
  "zod": "^3.23.8"
99
104
  },
100
105
  "devDependencies": {
101
106
  "0x": "^5.7.0",
102
- "@jest/globals": "^29.5.0",
103
- "@types/jest": "^29.5.0",
107
+ "@jest/globals": "^30.0.0",
108
+ "@types/jest": "^30.0.0",
104
109
  "@types/js-yaml": "^4.0.9",
105
110
  "@types/lodash.chunk": "^4.2.9",
111
+ "@typescript/native-preview": "7.0.0-dev.20260113.1",
106
112
  "concurrently": "^7.6.0",
107
- "jest": "^29.5.0",
108
- "jest-extended": "^4.0.2",
113
+ "jest": "^30.0.0",
114
+ "jest-extended": "^6.0.0",
109
115
  "js-yaml": "^4.1.0",
110
116
  "ts-node": "^10.9.1",
111
- "typescript": "^5.0.4"
117
+ "typescript": "^5.3.3"
112
118
  },
113
119
  "files": [
114
120
  "dest",
@@ -117,11 +123,12 @@
117
123
  ],
118
124
  "types": "./dest/index.d.ts",
119
125
  "engines": {
120
- "node": ">=18"
126
+ "node": ">=20.10"
121
127
  },
122
128
  "jest": {
123
129
  "slowTestThreshold": 300,
124
130
  "setupFilesAfterEnv": [
131
+ "../../foundation/src/jest/setupAfterEnv.mjs",
125
132
  "jest-extended/all",
126
133
  "./shared/jest_setup.ts"
127
134
  ],
@@ -155,6 +162,7 @@
155
162
  "testTimeout": 120000,
156
163
  "setupFiles": [
157
164
  "../../foundation/src/jest/setup.mjs"
158
- ]
165
+ ],
166
+ "testEnvironment": "../../foundation/src/jest/env.mjs"
159
167
  }
160
168
  }