@aztec/end-to-end 0.0.1-commit.86469d5 → 0.0.1-commit.8655d4a

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 (226) hide show
  1. package/README.md +27 -0
  2. package/dest/bench/client_flows/benchmark.d.ts +15 -1
  3. package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
  4. package/dest/bench/client_flows/benchmark.js +17 -0
  5. package/dest/bench/client_flows/client_flows_benchmark.d.ts +3 -3
  6. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  7. package/dest/bench/client_flows/client_flows_benchmark.js +36 -39
  8. package/dest/bench/client_flows/config.d.ts +2 -2
  9. package/dest/bench/client_flows/config.d.ts.map +1 -1
  10. package/dest/bench/client_flows/config.js +18 -0
  11. package/dest/bench/utils.d.ts +1 -1
  12. package/dest/bench/utils.d.ts.map +1 -1
  13. package/dest/bench/utils.js +8 -3
  14. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +8 -5
  15. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  16. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +36 -17
  17. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +16 -5
  18. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  19. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +42 -9
  20. package/dest/e2e_deploy_contract/deploy_test.d.ts +4 -4
  21. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  22. package/dest/e2e_deploy_contract/deploy_test.js +2 -1
  23. package/dest/e2e_epochs/epochs_test.d.ts +33 -8
  24. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  25. package/dest/e2e_epochs/epochs_test.js +143 -44
  26. package/dest/e2e_fees/fees_test.d.ts +6 -3
  27. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  28. package/dest/e2e_fees/fees_test.js +50 -17
  29. package/dest/e2e_nested_contract/nested_contract_test.d.ts +3 -3
  30. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  31. package/dest/e2e_nested_contract/nested_contract_test.js +6 -7
  32. package/dest/e2e_p2p/inactivity_slash_test.d.ts +1 -1
  33. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
  34. package/dest/e2e_p2p/inactivity_slash_test.js +5 -3
  35. package/dest/e2e_p2p/p2p_network.d.ts +14 -12
  36. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  37. package/dest/e2e_p2p/p2p_network.js +70 -34
  38. package/dest/e2e_p2p/reqresp/utils.d.ts +3 -3
  39. package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -1
  40. package/dest/e2e_p2p/reqresp/utils.js +67 -14
  41. package/dest/e2e_p2p/shared.d.ts +26 -8
  42. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  43. package/dest/e2e_p2p/shared.js +78 -51
  44. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +2 -0
  45. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +1 -0
  46. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.js +184 -0
  47. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts +18 -0
  48. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +1 -0
  49. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.js +120 -0
  50. package/dest/e2e_token_contract/token_contract_test.d.ts +6 -4
  51. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  52. package/dest/e2e_token_contract/token_contract_test.js +23 -11
  53. package/dest/fixtures/authwit_proxy.d.ts +15 -0
  54. package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
  55. package/dest/fixtures/authwit_proxy.js +34 -0
  56. package/dest/fixtures/e2e_prover_test.d.ts +9 -8
  57. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  58. package/dest/fixtures/e2e_prover_test.js +39 -50
  59. package/dest/fixtures/elu_monitor.d.ts +21 -0
  60. package/dest/fixtures/elu_monitor.d.ts.map +1 -0
  61. package/dest/fixtures/elu_monitor.js +102 -0
  62. package/dest/fixtures/fixtures.d.ts +77 -1
  63. package/dest/fixtures/fixtures.d.ts.map +1 -1
  64. package/dest/fixtures/fixtures.js +74 -0
  65. package/dest/fixtures/get_bb_config.d.ts +1 -1
  66. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  67. package/dest/fixtures/get_bb_config.js +5 -5
  68. package/dest/fixtures/ha_setup.d.ts +2 -2
  69. package/dest/fixtures/ha_setup.d.ts.map +1 -1
  70. package/dest/fixtures/ha_setup.js +4 -2
  71. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
  72. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
  73. package/dest/fixtures/schnorr_hardcoded_account_contract.js +37 -0
  74. package/dest/fixtures/setup.d.ts +80 -32
  75. package/dest/fixtures/setup.d.ts.map +1 -1
  76. package/dest/fixtures/setup.js +186 -167
  77. package/dest/fixtures/setup_p2p_test.d.ts +22 -10
  78. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  79. package/dest/fixtures/setup_p2p_test.js +23 -17
  80. package/dest/fixtures/token_utils.d.ts +2 -2
  81. package/dest/fixtures/token_utils.d.ts.map +1 -1
  82. package/dest/fixtures/token_utils.js +5 -7
  83. package/dest/fixtures/utils.d.ts +2 -2
  84. package/dest/fixtures/utils.d.ts.map +1 -1
  85. package/dest/fixtures/utils.js +1 -1
  86. package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
  87. package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
  88. package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
  89. package/dest/forward-compatibility/wallet_service.d.ts +3 -0
  90. package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
  91. package/dest/forward-compatibility/wallet_service.js +109 -0
  92. package/dest/install_legacy_contracts.d.cts +10 -0
  93. package/dest/install_legacy_contracts.d.cts.map +1 -0
  94. package/dest/legacy-jest-resolver.d.cts +3 -0
  95. package/dest/legacy-jest-resolver.d.cts.map +1 -0
  96. package/dest/shared/cross_chain_test_harness.d.ts +4 -2
  97. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  98. package/dest/shared/cross_chain_test_harness.js +22 -18
  99. package/dest/shared/gas_portal_test_harness.d.ts +8 -5
  100. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  101. package/dest/shared/gas_portal_test_harness.js +19 -10
  102. package/dest/shared/index.d.ts +2 -1
  103. package/dest/shared/index.d.ts.map +1 -1
  104. package/dest/shared/index.js +1 -0
  105. package/dest/shared/jest_setup.js +41 -1
  106. package/dest/shared/mock_state_view.d.ts +86 -0
  107. package/dest/shared/mock_state_view.d.ts.map +1 -0
  108. package/dest/shared/mock_state_view.js +186 -0
  109. package/dest/shared/submit-transactions.d.ts +2 -2
  110. package/dest/shared/submit-transactions.d.ts.map +1 -1
  111. package/dest/shared/submit-transactions.js +1 -1
  112. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  113. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  114. package/dest/shared/uniswap_l1_l2.js +62 -39
  115. package/dest/shared/wait_for_l1_to_l2_message.d.ts +13 -0
  116. package/dest/shared/wait_for_l1_to_l2_message.d.ts.map +1 -0
  117. package/dest/shared/wait_for_l1_to_l2_message.js +10 -0
  118. package/dest/simulators/lending_simulator.d.ts +10 -3
  119. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  120. package/dest/simulators/lending_simulator.js +26 -14
  121. package/dest/simulators/token_simulator.d.ts +1 -1
  122. package/dest/simulators/token_simulator.d.ts.map +1 -1
  123. package/dest/simulators/token_simulator.js +3 -24
  124. package/dest/spartan/setup_test_wallets.d.ts +12 -3
  125. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  126. package/dest/spartan/setup_test_wallets.js +103 -40
  127. package/dest/spartan/tx_metrics.d.ts +18 -4
  128. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  129. package/dest/spartan/tx_metrics.js +74 -21
  130. package/dest/spartan/utils/bot.d.ts +3 -2
  131. package/dest/spartan/utils/bot.d.ts.map +1 -1
  132. package/dest/spartan/utils/bot.js +2 -1
  133. package/dest/spartan/utils/config.d.ts +11 -28
  134. package/dest/spartan/utils/config.d.ts.map +1 -1
  135. package/dest/spartan/utils/config.js +4 -1
  136. package/dest/spartan/utils/index.d.ts +5 -3
  137. package/dest/spartan/utils/index.d.ts.map +1 -1
  138. package/dest/spartan/utils/index.js +5 -1
  139. package/dest/spartan/utils/k8s.d.ts +3 -1
  140. package/dest/spartan/utils/k8s.d.ts.map +1 -1
  141. package/dest/spartan/utils/k8s.js +6 -0
  142. package/dest/spartan/utils/nodes.d.ts +4 -5
  143. package/dest/spartan/utils/nodes.d.ts.map +1 -1
  144. package/dest/spartan/utils/nodes.js +11 -11
  145. package/dest/spartan/utils/pod_logs.d.ts +25 -0
  146. package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
  147. package/dest/spartan/utils/pod_logs.js +74 -0
  148. package/dest/spartan/utils/scripts.d.ts +18 -4
  149. package/dest/spartan/utils/scripts.d.ts.map +1 -1
  150. package/dest/spartan/utils/scripts.js +19 -4
  151. package/dest/test-wallet/test_wallet.d.ts +85 -0
  152. package/dest/test-wallet/test_wallet.d.ts.map +1 -0
  153. package/dest/test-wallet/test_wallet.js +273 -0
  154. package/dest/test-wallet/utils.d.ts +41 -0
  155. package/dest/test-wallet/utils.d.ts.map +1 -0
  156. package/dest/test-wallet/utils.js +66 -0
  157. package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
  158. package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
  159. package/dest/test-wallet/wallet_worker_script.js +48 -0
  160. package/dest/test-wallet/worker_wallet.d.ts +53 -0
  161. package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
  162. package/dest/test-wallet/worker_wallet.js +155 -0
  163. package/dest/test-wallet/worker_wallet_schema.d.ts +160 -0
  164. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
  165. package/dest/test-wallet/worker_wallet_schema.js +22 -0
  166. package/package.json +49 -45
  167. package/src/bench/client_flows/benchmark.ts +19 -0
  168. package/src/bench/client_flows/client_flows_benchmark.ts +64 -49
  169. package/src/bench/client_flows/config.ts +9 -1
  170. package/src/bench/utils.ts +10 -4
  171. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +52 -25
  172. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +56 -19
  173. package/src/e2e_deploy_contract/deploy_test.ts +6 -5
  174. package/src/e2e_epochs/epochs_test.ts +166 -68
  175. package/src/e2e_fees/bridging_race.notest.ts +1 -1
  176. package/src/e2e_fees/fees_test.ts +57 -32
  177. package/src/e2e_nested_contract/nested_contract_test.ts +10 -6
  178. package/src/e2e_p2p/inactivity_slash_test.ts +9 -7
  179. package/src/e2e_p2p/p2p_network.ts +93 -49
  180. package/src/e2e_p2p/reqresp/utils.ts +84 -17
  181. package/src/e2e_p2p/shared.ts +95 -65
  182. package/src/e2e_storage_proof/fixtures/storage_proof.json +915 -0
  183. package/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts +190 -0
  184. package/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts +173 -0
  185. package/src/e2e_token_contract/token_contract_test.ts +38 -11
  186. package/src/fixtures/authwit_proxy.ts +54 -0
  187. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  188. package/src/fixtures/e2e_prover_test.ts +49 -56
  189. package/src/fixtures/elu_monitor.ts +126 -0
  190. package/src/fixtures/fixtures.ts +96 -0
  191. package/src/fixtures/get_bb_config.ts +7 -6
  192. package/src/fixtures/ha_setup.ts +7 -3
  193. package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
  194. package/src/fixtures/setup.ts +251 -231
  195. package/src/fixtures/setup_p2p_test.ts +37 -32
  196. package/src/fixtures/token_utils.ts +3 -3
  197. package/src/fixtures/utils.ts +2 -0
  198. package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
  199. package/src/forward-compatibility/wallet_service.ts +104 -0
  200. package/src/guides/up_quick_start.sh +3 -5
  201. package/src/install_legacy_contracts.cjs +75 -0
  202. package/src/legacy-jest-resolver.cjs +112 -0
  203. package/src/shared/cross_chain_test_harness.ts +27 -13
  204. package/src/shared/gas_portal_test_harness.ts +21 -11
  205. package/src/shared/index.ts +1 -0
  206. package/src/shared/jest_setup.ts +51 -1
  207. package/src/shared/mock_state_view.ts +188 -0
  208. package/src/shared/submit-transactions.ts +3 -2
  209. package/src/shared/uniswap_l1_l2.ts +80 -55
  210. package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
  211. package/src/simulators/lending_simulator.ts +32 -14
  212. package/src/simulators/token_simulator.ts +6 -30
  213. package/src/spartan/setup_test_wallets.ts +142 -34
  214. package/src/spartan/tx_metrics.ts +82 -24
  215. package/src/spartan/utils/bot.ts +4 -1
  216. package/src/spartan/utils/config.ts +3 -0
  217. package/src/spartan/utils/index.ts +8 -1
  218. package/src/spartan/utils/k8s.ts +8 -0
  219. package/src/spartan/utils/nodes.ts +17 -12
  220. package/src/spartan/utils/pod_logs.ts +99 -0
  221. package/src/spartan/utils/scripts.ts +43 -7
  222. package/src/test-wallet/test_wallet.ts +376 -0
  223. package/src/test-wallet/utils.ts +108 -0
  224. package/src/test-wallet/wallet_worker_script.ts +60 -0
  225. package/src/test-wallet/worker_wallet.ts +218 -0
  226. package/src/test-wallet/worker_wallet_schema.ts +13 -0
@@ -1,5 +1,91 @@
1
+ import type { AztecNode } from '@aztec/aztec.js/node';
2
+ import type { GasFees } from '@aztec/stdlib/gas';
3
+
1
4
  export const METRICS_PORT = 4318;
2
5
 
6
+ /** Default fee padding applied to predicted min fees in e2e tests. */
7
+ export const DEFAULT_MIN_FEE_PADDING = 5;
8
+
9
+ /**
10
+ * Large fee padding for txs that may be mined significantly later than when they were created,
11
+ * such as cloned txs in throughput/capacity benchmarks, where fees may spike between creation and mining.
12
+ */
13
+ export const LARGE_MIN_FEE_PADDING = 15;
14
+
15
+ /**
16
+ * Fee padding used by tests running under proposer pipelining. Under pipelining the fee-asset
17
+ * price modifier evolves faster across the build/publish gap, so client-set maxFeesPerGas (sized
18
+ * for the default 5x padding) was getting bumped past by the time the tx mined a few slots later.
19
+ * Observed worst case in CI: fee evolved ~20x between PXE snapshot and inclusion, exceeding even
20
+ * LARGE_MIN_FEE_PADDING (15x).
21
+ */
22
+ export const PIPELINED_FEE_PADDING = 30;
23
+
24
+ /**
25
+ * Setup option preset that opts a test into proposer pipelining. Use with `setup()`:
26
+ *
27
+ * await setup(N, { ...PIPELINING_SETUP_OPTS, ...otherOpts });
28
+ *
29
+ * The preset sets:
30
+ * - `enableProposerPipelining: true` so the sequencer builds for `slot + 1`.
31
+ * - `inboxLag: 2` so the sequencer sources L1->L2 messages from checkpoint N-1 (already sealed),
32
+ * avoiding `L1ToL2MessagesNotReadyError` when building for slot N during slot N-1.
33
+ * - `minTxsPerBlock: 0` so empty checkpoints land even when a tx arrives late in the build window
34
+ * (otherwise the chain stalls on alternating slots).
35
+ * - `aztecSlotDuration: 12` / `ethereumSlotDuration: 4` so the pipelined cycle fits inside the
36
+ * default 300s Jest hook budget. Tests that depend on the env-default 72s/12s should override.
37
+ * - `walletMinFeePadding: PIPELINED_FEE_PADDING` (30x) to absorb the wider fee evolution window.
38
+ */
39
+ export const PIPELINING_SETUP_OPTS = {
40
+ enableProposerPipelining: true,
41
+ inboxLag: 2,
42
+ minTxsPerBlock: 0,
43
+ aztecSlotDuration: 12,
44
+ ethereumSlotDuration: 4,
45
+ walletMinFeePadding: PIPELINED_FEE_PADDING,
46
+ } as const;
47
+
48
+ /**
49
+ * Setup option preset that opts a test into the deterministic AutomineSequencer path.
50
+ * Use only for single-sequencer tests that don't exercise block-building or consensus
51
+ * (e.g. e2e_token, e2e_amm, e2e_authwit). Not compatible with `e2e_p2p/*`,
52
+ * `e2e_epochs/*`, `e2e_slashing/*`, `e2e_block_building`, or any multi-validator suite.
53
+ *
54
+ * await setup(N, { ...AUTOMINE_E2E_OPTS, ...otherOpts });
55
+ *
56
+ * The preset:
57
+ * - Swaps the production Sequencer for an AutomineSequencer that builds one block per
58
+ * submitted tx, publishes synchronously to L1, and owns all time control through a
59
+ * serial queue (see `sequencer-client/src/sequencer/automine/automine_sequencer.ts`).
60
+ * - Disables the validator client and AnvilTestWatcher (the AutomineSequencer needs
61
+ * neither).
62
+ * - Disables proposer pipelining and uses `inboxLag: 1` (synchronous, non-pipelined).
63
+ * - Switches anvil into automine mode at setup time (no interval mining); each L1 tx
64
+ * mines an L1 block immediately.
65
+ *
66
+ * Requires `aztecTargetCommitteeSize: 0`, which is the e2e default at `setup.ts:317`.
67
+ */
68
+ export const AUTOMINE_E2E_OPTS = {
69
+ useAutomineSequencer: true,
70
+ disableAnvilTestWatcher: true,
71
+ enableProposerPipelining: false,
72
+ inboxLag: 1,
73
+ minTxsPerBlock: 0,
74
+ aztecSlotDuration: 12,
75
+ ethereumSlotDuration: 4,
76
+ walletMinFeePadding: PIPELINED_FEE_PADDING,
77
+ } as const;
78
+
79
+ /** Returns worst-case predicted min fees with padding applied, mirroring the BaseWallet pattern. */
80
+ export async function getPaddedMaxFeesPerGas(node: AztecNode, padding = DEFAULT_MIN_FEE_PADDING): Promise<GasFees> {
81
+ const predicted = await node.getPredictedMinFees();
82
+ const worstCase =
83
+ predicted.length > 0
84
+ ? predicted.reduce((worst, fees) => (fees.feePerL2Gas > worst.feePerL2Gas ? fees : worst))
85
+ : await node.getCurrentMinFees();
86
+ return worstCase.mul(1 + padding);
87
+ }
88
+
3
89
  export const shouldCollectMetrics = () => {
4
90
  if (process.env.COLLECT_METRICS) {
5
91
  return METRICS_PORT;
@@ -7,6 +93,16 @@ export const shouldCollectMetrics = () => {
7
93
  return undefined;
8
94
  };
9
95
 
96
+ /** Returns the boot node UDP port from environment variable or default value. */
97
+ export function getBootNodeUdpPort(): number {
98
+ return process.env.BOOT_NODE_UDP_PORT ? parseInt(process.env.BOOT_NODE_UDP_PORT, 10) : 4500;
99
+ }
100
+
101
+ /** Returns the anvil port from environment variable or default value. */
102
+ export function getAnvilPort(): number {
103
+ return process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT, 10) : 8545;
104
+ }
105
+
10
106
  export const TEST_PEER_CHECK_INTERVAL_MS = 1000;
11
107
  export const TEST_MAX_PENDING_TX_POOL_COUNT = 10_000; // Number of max pending TXs ~ 1.56GB
12
108
 
@@ -13,8 +13,10 @@ const {
13
13
  BB_SKIP_CLEANUP = '',
14
14
  TEMP_DIR = tmpdir(),
15
15
  BB_WORKING_DIRECTORY = '',
16
- BB_NUM_IVC_VERIFIERS = '1',
16
+ BB_NUM_IVC_VERIFIERS = '8',
17
17
  BB_IVC_CONCURRENCY = '1',
18
+ BB_CHONK_VERIFY_MAX_BATCH = '16',
19
+ BB_CHONK_VERIFY_BATCH_CONCURRENCY = '6',
18
20
  } = process.env;
19
21
 
20
22
  export const getBBConfig = async (
@@ -41,16 +43,15 @@ export const getBBConfig = async (
41
43
  const bbSkipCleanup = ['1', 'true'].includes(BB_SKIP_CLEANUP);
42
44
  const cleanup = bbSkipCleanup ? () => Promise.resolve() : () => tryRmDir(directoryToCleanup);
43
45
 
44
- const numIvcVerifiers = Number(BB_NUM_IVC_VERIFIERS);
45
- const ivcConcurrency = Number(BB_IVC_CONCURRENCY);
46
-
47
46
  return {
48
47
  bbSkipCleanup,
49
48
  bbBinaryPath,
50
49
  bbWorkingDirectory,
51
50
  cleanup,
52
- numConcurrentIVCVerifiers: numIvcVerifiers,
53
- bbIVCConcurrency: ivcConcurrency,
51
+ numConcurrentIVCVerifiers: Number(BB_NUM_IVC_VERIFIERS),
52
+ bbIVCConcurrency: Number(BB_IVC_CONCURRENCY),
53
+ bbChonkVerifyMaxBatch: Number(BB_CHONK_VERIFY_MAX_BATCH),
54
+ bbChonkVerifyConcurrency: Number(BB_CHONK_VERIFY_BATCH_CONCURRENCY),
54
55
  };
55
56
  } catch (err) {
56
57
  logger.error(`Native BB not available, error: ${err}`);
@@ -11,7 +11,7 @@ import { privateKeyToAccount } from 'viem/accounts';
11
11
  */
12
12
  export interface HADatabaseConfig {
13
13
  /** PostgreSQL connection URL */
14
- databaseUrl: string;
14
+ databaseUrl: SecretValue<string>;
15
15
  /** Node ID for HA coordination */
16
16
  nodeId: string;
17
17
  /** Enable HA signing */
@@ -28,7 +28,9 @@ export interface HADatabaseConfig {
28
28
  * Get database configuration from environment variables
29
29
  */
30
30
  export function createHADatabaseConfig(nodeId: string): HADatabaseConfig {
31
- const databaseUrl = process.env.DATABASE_URL || 'postgresql://aztec:aztec@localhost:5432/aztec_ha_test';
31
+ const databaseUrl = new SecretValue(
32
+ process.env.DATABASE_URL || 'postgresql://aztec:aztec@localhost:5432/aztec_ha_test',
33
+ );
32
34
 
33
35
  return {
34
36
  databaseUrl,
@@ -69,8 +71,10 @@ export async function cleanupHADatabase(pool: Pool, logger?: Logger): Promise<vo
69
71
  try {
70
72
  // Drop all HA tables
71
73
  await pool.query('DROP TABLE IF EXISTS validator_duties CASCADE');
72
- await pool.query('DROP TABLE IF EXISTS slashing_protection CASCADE');
73
74
  await pool.query('DROP TABLE IF EXISTS schema_version CASCADE');
75
+ // Drop migration tracking table (node-pg-migrate uses 'pgmigrations' by default)
76
+ // This ensures migrations will run fresh on next startup
77
+ await pool.query('DROP TABLE IF EXISTS pgmigrations CASCADE');
74
78
 
75
79
  logger?.info('HA database cleaned up successfully');
76
80
  } catch (error) {
@@ -0,0 +1,49 @@
1
+ import { DefaultAccountContract } from '@aztec/accounts/defaults';
2
+ import type { ContractArtifact } from '@aztec/aztec.js/abi';
3
+ import type { AuthWitnessProvider } from '@aztec/aztec.js/account';
4
+ import type { CompleteAddress } from '@aztec/aztec.js/addresses';
5
+ import { AuthWitness } from '@aztec/aztec.js/authorization';
6
+ import type { Fr } from '@aztec/aztec.js/fields';
7
+ import { Schnorr } from '@aztec/foundation/crypto/schnorr';
8
+ import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
9
+ import { SchnorrHardcodedAccountContractArtifact } from '@aztec/noir-contracts.js/SchnorrHardcodedAccount';
10
+
11
+ /**
12
+ * The private key that matches the hardcoded public key in the SchnorrHardcodedAccountContract.
13
+ * The corresponding public key is baked into the Noir contract as a global constant.
14
+ */
15
+ export const SCHNORR_HARDCODED_PRIVATE_KEY = GrumpkinScalar.fromHexString(
16
+ '0xd35d743ac0dfe3d6dbe6be8c877cb524a00ab1e3d52d7bada095dfc8894ccfa',
17
+ );
18
+
19
+ /**
20
+ * Account contract backed by the SchnorrHardcodedAccount Noir contract.
21
+ * This contract verifies Schnorr signatures against a public key that is hardcoded
22
+ * in the contract artifact (not stored in a note), so it does not require on-chain
23
+ * deployment or initialization. Useful for tests that need a working account without
24
+ * mining any blocks.
25
+ */
26
+ export class SchnorrHardcodedKeyAccountContract extends DefaultAccountContract {
27
+ constructor(private privateKey: GrumpkinScalar = SCHNORR_HARDCODED_PRIVATE_KEY) {
28
+ super();
29
+ }
30
+
31
+ override getContractArtifact(): Promise<ContractArtifact> {
32
+ return Promise.resolve(SchnorrHardcodedAccountContractArtifact);
33
+ }
34
+
35
+ getInitializationFunctionAndArgs() {
36
+ return Promise.resolve(undefined);
37
+ }
38
+
39
+ getAuthWitnessProvider(_address: CompleteAddress): AuthWitnessProvider {
40
+ const privateKey = this.privateKey;
41
+ return {
42
+ async createAuthWit(messageHash: Fr): Promise<AuthWitness> {
43
+ const signer = new Schnorr();
44
+ const signature = await signer.constructSignature(messageHash, privateKey);
45
+ return new AuthWitness(messageHash, signature.toLimbFields());
46
+ },
47
+ };
48
+ }
49
+ }