@aztec/end-to-end 0.0.0-test.1 → 0.0.1-commit.0b941701

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 (236) 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 +65 -22
  26. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  27. package/dest/e2e_epochs/epochs_test.js +236 -49
  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 +10 -0
  35. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -0
  36. package/dest/e2e_l1_publisher/write_json.js +62 -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/shared.d.ts +44 -8
  50. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  51. package/dest/e2e_p2p/shared.js +165 -27
  52. package/dest/e2e_token_contract/token_contract_test.d.ts +27 -14
  53. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  54. package/dest/e2e_token_contract/token_contract_test.js +96 -74
  55. package/dest/fixtures/e2e_prover_test.d.ts +55 -0
  56. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -0
  57. package/dest/fixtures/e2e_prover_test.js +278 -0
  58. package/dest/fixtures/fixtures.d.ts +6 -8
  59. package/dest/fixtures/fixtures.d.ts.map +1 -1
  60. package/dest/fixtures/fixtures.js +5 -5
  61. package/dest/fixtures/get_acvm_config.d.ts +2 -2
  62. package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
  63. package/dest/fixtures/get_acvm_config.js +3 -15
  64. package/dest/fixtures/get_bb_config.d.ts +2 -2
  65. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  66. package/dest/fixtures/get_bb_config.js +10 -17
  67. package/dest/fixtures/index.d.ts +1 -1
  68. package/dest/fixtures/l1_to_l2_messaging.d.ts +11 -7
  69. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  70. package/dest/fixtures/l1_to_l2_messaging.js +45 -19
  71. package/dest/fixtures/logging.d.ts +1 -1
  72. package/dest/fixtures/setup.d.ts +218 -0
  73. package/dest/fixtures/setup.d.ts.map +1 -0
  74. package/dest/fixtures/setup.js +690 -0
  75. package/dest/fixtures/setup_p2p_test.d.ts +15 -14
  76. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  77. package/dest/fixtures/setup_p2p_test.js +82 -22
  78. package/dest/fixtures/token_utils.d.ts +10 -4
  79. package/dest/fixtures/token_utils.d.ts.map +1 -1
  80. package/dest/fixtures/token_utils.js +31 -12
  81. package/dest/fixtures/utils.d.ts +5 -153
  82. package/dest/fixtures/utils.d.ts.map +1 -1
  83. package/dest/fixtures/utils.js +4 -552
  84. package/dest/fixtures/web3signer.d.ts +5 -0
  85. package/dest/fixtures/web3signer.d.ts.map +1 -0
  86. package/dest/fixtures/web3signer.js +53 -0
  87. package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
  88. package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
  89. package/dest/fixtures/with_telemetry_utils.js +2 -2
  90. package/dest/index.d.ts +1 -1
  91. package/dest/quality_of_service/grafana_client.d.ts +41 -0
  92. package/dest/quality_of_service/grafana_client.d.ts.map +1 -0
  93. package/dest/quality_of_service/{alert_checker.js → grafana_client.js} +1 -1
  94. package/dest/quality_of_service/prometheus_client.d.ts +38 -0
  95. package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
  96. package/dest/quality_of_service/prometheus_client.js +67 -0
  97. package/dest/shared/cross_chain_test_harness.d.ts +44 -27
  98. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  99. package/dest/shared/cross_chain_test_harness.js +105 -51
  100. package/dest/shared/gas_portal_test_harness.d.ts +33 -25
  101. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  102. package/dest/shared/gas_portal_test_harness.js +51 -30
  103. package/dest/shared/index.d.ts +2 -2
  104. package/dest/shared/index.d.ts.map +1 -1
  105. package/dest/shared/jest_setup.d.ts +1 -1
  106. package/dest/shared/jest_setup.js +1 -1
  107. package/dest/shared/submit-transactions.d.ts +6 -4
  108. package/dest/shared/submit-transactions.d.ts.map +1 -1
  109. package/dest/shared/submit-transactions.js +15 -16
  110. package/dest/shared/uniswap_l1_l2.d.ts +3 -25
  111. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  112. package/dest/shared/uniswap_l1_l2.js +176 -126
  113. package/dest/simulators/index.d.ts +1 -1
  114. package/dest/simulators/lending_simulator.d.ts +7 -7
  115. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  116. package/dest/simulators/lending_simulator.js +17 -18
  117. package/dest/simulators/token_simulator.d.ts +6 -3
  118. package/dest/simulators/token_simulator.d.ts.map +1 -1
  119. package/dest/simulators/token_simulator.js +16 -13
  120. package/dest/spartan/setup_test_wallets.d.ts +27 -11
  121. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  122. package/dest/spartan/setup_test_wallets.js +233 -62
  123. package/dest/spartan/tx_metrics.d.ts +54 -0
  124. package/dest/spartan/tx_metrics.d.ts.map +1 -0
  125. package/dest/spartan/tx_metrics.js +272 -0
  126. package/dest/spartan/utils/bot.d.ts +27 -0
  127. package/dest/spartan/utils/bot.d.ts.map +1 -0
  128. package/dest/spartan/utils/bot.js +141 -0
  129. package/dest/spartan/utils/chaos.d.ts +79 -0
  130. package/dest/spartan/utils/chaos.d.ts.map +1 -0
  131. package/dest/spartan/utils/chaos.js +142 -0
  132. package/dest/spartan/utils/clients.d.ts +39 -0
  133. package/dest/spartan/utils/clients.d.ts.map +1 -0
  134. package/dest/spartan/utils/clients.js +90 -0
  135. package/dest/spartan/utils/config.d.ts +36 -0
  136. package/dest/spartan/utils/config.d.ts.map +1 -0
  137. package/dest/spartan/utils/config.js +20 -0
  138. package/dest/spartan/utils/health.d.ts +63 -0
  139. package/dest/spartan/utils/health.d.ts.map +1 -0
  140. package/dest/spartan/utils/health.js +202 -0
  141. package/dest/spartan/utils/helm.d.ts +15 -0
  142. package/dest/spartan/utils/helm.d.ts.map +1 -0
  143. package/dest/spartan/utils/helm.js +47 -0
  144. package/dest/spartan/utils/index.d.ts +9 -0
  145. package/dest/spartan/utils/index.d.ts.map +1 -0
  146. package/dest/spartan/utils/index.js +18 -0
  147. package/dest/spartan/utils/k8s.d.ts +98 -0
  148. package/dest/spartan/utils/k8s.d.ts.map +1 -0
  149. package/dest/spartan/utils/k8s.js +257 -0
  150. package/dest/spartan/utils/nodes.d.ts +31 -0
  151. package/dest/spartan/utils/nodes.d.ts.map +1 -0
  152. package/dest/spartan/utils/nodes.js +290 -0
  153. package/dest/spartan/utils/scripts.d.ts +16 -0
  154. package/dest/spartan/utils/scripts.d.ts.map +1 -0
  155. package/dest/spartan/utils/scripts.js +66 -0
  156. package/dest/spartan/utils.d.ts +2 -415
  157. package/dest/spartan/utils.d.ts.map +1 -1
  158. package/dest/spartan/utils.js +1 -445
  159. package/package.json +66 -58
  160. package/src/bench/client_flows/benchmark.ts +363 -0
  161. package/src/bench/client_flows/client_flows_benchmark.ts +384 -0
  162. package/src/bench/client_flows/config.ts +61 -0
  163. package/src/bench/client_flows/data_extractor.ts +89 -0
  164. package/src/bench/utils.ts +41 -85
  165. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +134 -169
  166. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +156 -182
  167. package/src/e2e_deploy_contract/deploy_test.ts +40 -48
  168. package/src/e2e_epochs/epochs_test.ts +315 -76
  169. package/src/e2e_fees/bridging_race.notest.ts +74 -0
  170. package/src/e2e_fees/fees_test.ts +220 -258
  171. package/src/e2e_l1_publisher/write_json.ts +82 -0
  172. package/src/e2e_multi_validator/utils.ts +258 -0
  173. package/src/e2e_nested_contract/nested_contract_test.ts +46 -59
  174. package/src/e2e_p2p/inactivity_slash_test.ts +179 -0
  175. package/src/e2e_p2p/p2p_network.ts +341 -234
  176. package/src/e2e_p2p/shared.ts +253 -40
  177. package/src/e2e_token_contract/token_contract_test.ts +115 -126
  178. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  179. package/src/fixtures/e2e_prover_test.ts +336 -0
  180. package/src/fixtures/fixtures.ts +5 -7
  181. package/src/fixtures/get_acvm_config.ts +4 -12
  182. package/src/fixtures/get_bb_config.ts +18 -13
  183. package/src/fixtures/l1_to_l2_messaging.ts +56 -24
  184. package/src/fixtures/setup.ts +1017 -0
  185. package/src/fixtures/setup_p2p_test.ts +127 -39
  186. package/src/fixtures/token_utils.ts +33 -15
  187. package/src/fixtures/utils.ts +27 -820
  188. package/src/fixtures/web3signer.ts +63 -0
  189. package/src/fixtures/with_telemetry_utils.ts +2 -2
  190. package/src/guides/up_quick_start.sh +7 -15
  191. package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +2 -2
  192. package/src/quality_of_service/prometheus_client.ts +113 -0
  193. package/src/shared/cross_chain_test_harness.ts +103 -91
  194. package/src/shared/gas_portal_test_harness.ts +59 -50
  195. package/src/shared/index.ts +1 -1
  196. package/src/shared/jest_setup.ts +1 -1
  197. package/src/shared/submit-transactions.ts +18 -20
  198. package/src/shared/uniswap_l1_l2.ts +197 -221
  199. package/src/simulators/lending_simulator.ts +16 -17
  200. package/src/simulators/token_simulator.ts +21 -13
  201. package/src/spartan/DEVELOP.md +128 -0
  202. package/src/spartan/setup_test_wallets.ts +308 -95
  203. package/src/spartan/tx_metrics.ts +250 -0
  204. package/src/spartan/utils/bot.ts +185 -0
  205. package/src/spartan/utils/chaos.ts +253 -0
  206. package/src/spartan/utils/clients.ts +100 -0
  207. package/src/spartan/utils/config.ts +26 -0
  208. package/src/spartan/utils/health.ts +255 -0
  209. package/src/spartan/utils/helm.ts +84 -0
  210. package/src/spartan/utils/index.ts +62 -0
  211. package/src/spartan/utils/k8s.ts +375 -0
  212. package/src/spartan/utils/nodes.ts +323 -0
  213. package/src/spartan/utils/scripts.ts +63 -0
  214. package/src/spartan/utils.ts +1 -582
  215. package/dest/e2e_prover/e2e_prover_test.d.ts +0 -56
  216. package/dest/e2e_prover/e2e_prover_test.d.ts.map +0 -1
  217. package/dest/e2e_prover/e2e_prover_test.js +0 -291
  218. package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
  219. package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
  220. package/dest/fixtures/setup_l1_contracts.js +0 -17
  221. package/dest/fixtures/snapshot_manager.d.ts +0 -87
  222. package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
  223. package/dest/fixtures/snapshot_manager.js +0 -479
  224. package/dest/quality_of_service/alert_checker.d.ts +0 -41
  225. package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
  226. package/dest/sample-dapp/connect.js +0 -12
  227. package/dest/sample-dapp/contracts.js +0 -10
  228. package/dest/sample-dapp/deploy.js +0 -35
  229. package/dest/sample-dapp/index.js +0 -98
  230. package/src/e2e_prover/e2e_prover_test.ts +0 -418
  231. package/src/fixtures/setup_l1_contracts.ts +0 -27
  232. package/src/fixtures/snapshot_manager.ts +0 -617
  233. package/src/sample-dapp/connect.mjs +0 -16
  234. package/src/sample-dapp/contracts.mjs +0 -14
  235. package/src/sample-dapp/deploy.mjs +0 -40
  236. package/src/sample-dapp/index.mjs +0 -128
@@ -1,20 +1,40 @@
1
- import { AztecNodeService } from '@aztec/aztec-node';
2
- import { Fr, type Logger, getTimestampRangeForEpoch, retryUntil, sleep } from '@aztec/aztec.js';
3
- import { ChainMonitor } from '@aztec/aztec.js/ethereum';
1
+ import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
2
+ import { getTimestampRangeForEpoch } from '@aztec/aztec.js/block';
3
+ import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
4
+ import { Fr } from '@aztec/aztec.js/fields';
5
+ import type { Logger } from '@aztec/aztec.js/log';
6
+ import { MerkleTreeId } from '@aztec/aztec.js/trees';
7
+ import type { Wallet } from '@aztec/aztec.js/wallet';
8
+ import { EpochCache } from '@aztec/epoch-cache';
9
+ import { createExtendedL1Client } from '@aztec/ethereum/client';
10
+ import { DefaultL1ContractsConfig } from '@aztec/ethereum/config';
4
11
  import { RollupContract } from '@aztec/ethereum/contracts';
5
- import { DelayedTxUtils, type Delayer, waitUntilL1Timestamp } from '@aztec/ethereum/test';
6
- import { randomBytes } from '@aztec/foundation/crypto';
12
+ import { ChainMonitor, DelayedTxUtils, type Delayer, waitUntilL1Timestamp, withDelayer } from '@aztec/ethereum/test';
13
+ import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
14
+ import { BlockNumber, CheckpointNumber, EpochNumber } from '@aztec/foundation/branded-types';
15
+ import { SecretValue } from '@aztec/foundation/config';
16
+ import { randomBytes } from '@aztec/foundation/crypto/random';
7
17
  import { withLogNameSuffix } from '@aztec/foundation/log';
8
- import { ProverNode, ProverNodePublisher } from '@aztec/prover-node';
18
+ import { retryUntil } from '@aztec/foundation/retry';
19
+ import { sleep } from '@aztec/foundation/sleep';
20
+ import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
21
+ import { getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
22
+ import { ProverNode, type ProverNodeConfig, ProverNodePublisher } from '@aztec/prover-node';
9
23
  import type { TestProverNode } from '@aztec/prover-node/test';
10
- import type { SequencerPublisher } from '@aztec/sequencer-client';
24
+ import {
25
+ type SequencerClient,
26
+ type SequencerEvents,
27
+ type SequencerPublisher,
28
+ SequencerState,
29
+ } from '@aztec/sequencer-client';
11
30
  import type { TestSequencerClient } from '@aztec/sequencer-client/test';
12
- import type { L2BlockNumber } from '@aztec/stdlib/block';
13
- import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
14
- import { MerkleTreeId } from '@aztec/stdlib/trees';
31
+ import { type BlockParameter, EthAddress } from '@aztec/stdlib/block';
32
+ import { type L1RollupConstants, getProofSubmissionDeadlineTimestamp } from '@aztec/stdlib/epoch-helpers';
33
+ import { tryStop } from '@aztec/stdlib/interfaces/server';
15
34
 
16
35
  import { join } from 'path';
17
- import type { Hex, PublicClient } from 'viem';
36
+ import type { Hex } from 'viem';
37
+ import { privateKeyToAccount } from 'viem/accounts';
18
38
 
19
39
  import {
20
40
  type EndToEndContext,
@@ -24,15 +44,20 @@ import {
24
44
  setup,
25
45
  } from '../fixtures/utils.js';
26
46
 
27
- // This can be lowered to as much as 2s in non-CI
28
- export const L1_BLOCK_TIME_IN_S = process.env.L1_BLOCK_TIME ? parseInt(process.env.L1_BLOCK_TIME) : 8;
29
- export const EPOCH_DURATION_IN_L2_SLOTS = 4;
30
- export const L2_SLOT_DURATION_IN_L1_SLOTS = 2;
31
47
  export const WORLD_STATE_BLOCK_HISTORY = 2;
32
48
  export const WORLD_STATE_BLOCK_CHECK_INTERVAL = 50;
33
49
  export const ARCHIVER_POLL_INTERVAL = 50;
50
+ export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
51
+
52
+ export type EpochsTestOpts = Partial<SetupOptions> & { numberOfAccounts?: number };
34
53
 
35
- export type EpochsTestOpts = Partial<Pick<SetupOptions, 'startProverNode'>>;
54
+ export type TrackedSequencerEvent = {
55
+ [K in keyof SequencerEvents]: Parameters<SequencerEvents[K]>[0] & {
56
+ type: K;
57
+ sequencerIndex: number;
58
+ validator: EthAddress;
59
+ };
60
+ }[keyof SequencerEvents];
36
61
 
37
62
  /**
38
63
  * Tests building of epochs using fast block times and short epochs.
@@ -41,79 +66,127 @@ export type EpochsTestOpts = Partial<Pick<SetupOptions, 'startProverNode'>>;
41
66
  */
42
67
  export class EpochsTestContext {
43
68
  public context!: EndToEndContext;
44
- public l1Client!: PublicClient;
69
+ public l1Client!: ExtendedViemWalletClient;
45
70
  public rollup!: RollupContract;
46
71
  public constants!: L1RollupConstants;
47
72
  public logger!: Logger;
48
73
  public monitor!: ChainMonitor;
74
+ public epochCache!: EpochCache;
49
75
  public proverDelayer!: Delayer;
50
76
  public sequencerDelayer!: Delayer;
51
77
 
52
78
  public proverNodes: ProverNode[] = [];
53
79
  public nodes: AztecNodeService[] = [];
54
80
 
81
+ public epochDuration!: number;
82
+
83
+ public L1_BLOCK_TIME_IN_S!: number;
84
+ public L2_SLOT_DURATION_IN_S!: number;
85
+
55
86
  public static async setup(opts: EpochsTestOpts = {}) {
56
87
  const test = new EpochsTestContext();
57
88
  await test.setup(opts);
58
89
  return test;
59
90
  }
60
91
 
92
+ public static getSlotDurations(opts: EpochsTestOpts = {}) {
93
+ const envEthereumSlotDuration = process.env.L1_BLOCK_TIME
94
+ ? parseInt(process.env.L1_BLOCK_TIME)
95
+ : DEFAULT_L1_BLOCK_TIME;
96
+ const ethereumSlotDuration = opts.ethereumSlotDuration ?? envEthereumSlotDuration;
97
+ const aztecSlotDuration = opts.aztecSlotDuration ?? ethereumSlotDuration * 2;
98
+ const aztecEpochDuration = opts.aztecEpochDuration ?? 6;
99
+ const aztecProofSubmissionEpochs = opts.aztecProofSubmissionEpochs ?? 1;
100
+ const l1PublishingTime = opts.l1PublishingTime ?? 1;
101
+ return {
102
+ l1PublishingTime,
103
+ ethereumSlotDuration,
104
+ aztecSlotDuration,
105
+ aztecEpochDuration,
106
+ aztecProofSubmissionEpochs,
107
+ };
108
+ }
109
+
61
110
  public async setup(opts: EpochsTestOpts = {}) {
111
+ const {
112
+ ethereumSlotDuration,
113
+ aztecSlotDuration,
114
+ aztecEpochDuration,
115
+ aztecProofSubmissionEpochs,
116
+ l1PublishingTime,
117
+ } = EpochsTestContext.getSlotDurations(opts);
118
+
119
+ this.L1_BLOCK_TIME_IN_S = ethereumSlotDuration;
120
+ this.L2_SLOT_DURATION_IN_S = aztecSlotDuration;
121
+
62
122
  // Set up system without any account nor protocol contracts
63
123
  // and with faster block times and shorter epochs.
64
- const context = await setup(0, {
65
- checkIntervalMs: 50,
66
- archiverPollingIntervalMS: ARCHIVER_POLL_INTERVAL,
67
- worldStateBlockCheckIntervalMS: WORLD_STATE_BLOCK_CHECK_INTERVAL,
68
- skipProtocolContracts: true,
69
- salt: 1,
70
- aztecEpochDuration: EPOCH_DURATION_IN_L2_SLOTS,
71
- aztecSlotDuration: L1_BLOCK_TIME_IN_S * L2_SLOT_DURATION_IN_L1_SLOTS,
72
- ethereumSlotDuration: L1_BLOCK_TIME_IN_S,
73
- aztecProofSubmissionWindow: EPOCH_DURATION_IN_L2_SLOTS * 2 - 1,
74
- minTxsPerBlock: 0,
75
- realProofs: false,
76
- startProverNode: true,
77
- // We use numeric incremental prover ids for simplicity, but we can switch to
78
- // using the prover's eth address if the proverId is used for something in the rollup contract
79
- proverId: Fr.fromString('1'),
80
- // This must be enough so that the tx from the prover is delayed properly,
81
- // but not so much to hang the sequencer and timeout the teardown
82
- txPropagationMaxQueryAttempts: 12,
83
- worldStateBlockHistory: WORLD_STATE_BLOCK_HISTORY,
84
- ...opts,
85
- });
124
+ const context = await setup(
125
+ opts.numberOfAccounts ?? 0,
126
+ {
127
+ automineL1Setup: true,
128
+ checkIntervalMs: 50,
129
+ archiverPollingIntervalMS: ARCHIVER_POLL_INTERVAL,
130
+ worldStateBlockCheckIntervalMS: WORLD_STATE_BLOCK_CHECK_INTERVAL,
131
+ aztecEpochDuration,
132
+ aztecSlotDuration,
133
+ ethereumSlotDuration,
134
+ aztecProofSubmissionEpochs,
135
+ aztecTargetCommitteeSize: opts.initialValidators?.length ?? 0,
136
+ minTxsPerBlock: 0,
137
+ realProofs: false,
138
+ startProverNode: true,
139
+ proverTestDelayMs: opts.proverTestDelayMs ?? 0,
140
+ // We use numeric incremental prover ids for simplicity, but we can switch to
141
+ // using the prover's eth address if the proverId is used for something in the rollup contract
142
+ // Use numeric EthAddress for deterministic prover id
143
+ proverId: EthAddress.fromNumber(1),
144
+ worldStateBlockHistory: WORLD_STATE_BLOCK_HISTORY,
145
+ exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
146
+ slasherFlavor: 'none',
147
+ l1PublishingTime,
148
+ ...opts,
149
+ },
150
+ // Use checkpointed chain tip for PXE to avoid issues with blocks being dropped due to pruned anchor blocks.
151
+ { syncChainTip: 'checkpointed' },
152
+ );
86
153
 
87
154
  this.context = context;
88
155
  this.proverNodes = context.proverNode ? [context.proverNode] : [];
89
156
  this.nodes = context.aztecNode ? [context.aztecNode as AztecNodeService] : [];
90
157
  this.logger = context.logger;
91
- this.l1Client = context.deployL1ContractsValues.publicClient;
158
+ this.l1Client = context.deployL1ContractsValues.l1Client;
92
159
  this.rollup = RollupContract.getFromConfig(context.config);
160
+ this.epochCache = await EpochCache.create(this.rollup, context.config, { dateProvider: context.dateProvider });
93
161
 
94
162
  // Loop that tracks L1 and L2 block numbers and logs whenever there's a new one.
95
- this.monitor = new ChainMonitor(this.rollup, this.logger).start();
163
+ this.monitor = new ChainMonitor(this.rollup, context.dateProvider, this.logger).start();
96
164
 
97
165
  // This is hideous.
98
166
  // We ought to have a definite reference to the l1TxUtils that we're using in both places, provided by the test context.
99
167
  this.proverDelayer = context.proverNode
100
168
  ? (((context.proverNode as TestProverNode).publisher as ProverNodePublisher).l1TxUtils as DelayedTxUtils).delayer!
101
169
  : undefined!;
102
- this.sequencerDelayer = (
103
- ((context.sequencer as TestSequencerClient).sequencer.publisher as SequencerPublisher).l1TxUtils as DelayedTxUtils
104
- ).delayer!;
170
+ this.sequencerDelayer = context.sequencer
171
+ ? (
172
+ ((context.sequencer as TestSequencerClient).sequencer.publisher as SequencerPublisher)
173
+ .l1TxUtils as DelayedTxUtils
174
+ ).delayer!
175
+ : undefined!;
105
176
 
106
- if ((context.proverNode && !this.proverDelayer) || !this.sequencerDelayer) {
177
+ if ((context.proverNode && !this.proverDelayer) || (context.sequencer && !this.sequencerDelayer)) {
107
178
  throw new Error(`Could not find prover or sequencer delayer`);
108
179
  }
109
180
 
110
181
  // Constants used for time calculation
182
+ this.epochDuration = aztecEpochDuration;
111
183
  this.constants = {
112
- epochDuration: EPOCH_DURATION_IN_L2_SLOTS,
113
- slotDuration: L1_BLOCK_TIME_IN_S * L2_SLOT_DURATION_IN_L1_SLOTS,
184
+ epochDuration: aztecEpochDuration,
185
+ slotDuration: aztecSlotDuration,
114
186
  l1StartBlock: await this.rollup.getL1StartBlock(),
115
187
  l1GenesisTime: await this.rollup.getL1GenesisTime(),
116
- ethereumSlotDuration: L1_BLOCK_TIME_IN_S,
188
+ ethereumSlotDuration,
189
+ proofSubmissionEpochs: Number(await this.rollup.getProofSubmissionEpochs()),
117
190
  };
118
191
 
119
192
  this.logger.info(
@@ -122,38 +195,98 @@ export class EpochsTestContext {
122
195
  }
123
196
 
124
197
  public async teardown() {
125
- this.monitor.stop();
126
- await Promise.all(this.proverNodes.map(node => node.stop()));
127
- await Promise.all(this.nodes.map(node => node.stop()));
198
+ await this.monitor.stop();
199
+ await Promise.all(this.proverNodes.map(node => tryStop(node, this.logger)));
200
+ await Promise.all(this.nodes.map(node => tryStop(node, this.logger)));
128
201
  await this.context.teardown();
129
202
  }
130
203
 
131
- public async createProverNode() {
204
+ public async createProverNode(opts: { dontStart?: boolean } & Partial<ProverNodeConfig> = {}) {
132
205
  this.logger.warn('Creating and syncing a simulated prover node...');
133
206
  const proverNodePrivateKey = this.getNextPrivateKey();
134
207
  const suffix = (this.proverNodes.length + 1).toString();
135
208
  const proverNode = await withLogNameSuffix(suffix, () =>
136
209
  createAndSyncProverNode(
137
210
  proverNodePrivateKey,
138
- { ...this.context.config, proverId: Fr.fromString(suffix) },
211
+ { ...this.context.config },
212
+ {
213
+ dataDirectory: join(this.context.config.dataDirectory!, randomBytes(8).toString('hex')),
214
+ proverId: EthAddress.fromNumber(parseInt(suffix, 10)),
215
+ dontStart: opts.dontStart,
216
+ ...opts,
217
+ },
139
218
  this.context.aztecNode,
140
- join(this.context.config.dataDirectory!, randomBytes(8).toString('hex')),
219
+ this.context.prefilledPublicData ?? [],
220
+ { dateProvider: this.context.dateProvider },
141
221
  ),
142
222
  );
143
223
  this.proverNodes.push(proverNode);
144
224
  return proverNode;
145
225
  }
146
226
 
147
- public async createNonValidatorNode() {
227
+ public createNonValidatorNode(opts: Partial<AztecNodeConfig> = {}) {
148
228
  this.logger.warn('Creating and syncing a node without a validator...');
229
+ return this.createNode({ ...opts, disableValidator: true });
230
+ }
231
+
232
+ public createValidatorNode(
233
+ privateKeys: `0x${string}`[],
234
+ opts: Partial<AztecNodeConfig> & { txDelayerMaxInclusionTimeIntoSlot?: number; dontStartSequencer?: boolean } = {},
235
+ ) {
236
+ this.logger.warn('Creating and syncing a validator node...');
237
+ return this.createNode({ ...opts, disableValidator: false, validatorPrivateKeys: new SecretValue(privateKeys) });
238
+ }
239
+
240
+ private async createNode(
241
+ opts: Partial<AztecNodeConfig> & { txDelayerMaxInclusionTimeIntoSlot?: number; dontStartSequencer?: boolean } = {},
242
+ ) {
149
243
  const suffix = (this.nodes.length + 1).toString();
244
+ const { mockGossipSubNetwork } = this.context;
245
+ const resolvedConfig = { ...this.context.config, ...opts };
246
+ const p2pEnabled = resolvedConfig.p2pEnabled || mockGossipSubNetwork !== undefined;
247
+ const p2pIp = resolvedConfig.p2pIp ?? (p2pEnabled ? '127.0.0.1' : undefined);
150
248
  const node = await withLogNameSuffix(suffix, () =>
151
- AztecNodeService.createAndSync({
152
- ...this.context.config,
153
- disableValidator: true,
154
- dataDirectory: join(this.context.config.dataDirectory!, randomBytes(8).toString('hex')),
155
- }),
249
+ AztecNodeService.createAndSync(
250
+ {
251
+ ...resolvedConfig,
252
+ dataDirectory: join(this.context.config.dataDirectory!, randomBytes(8).toString('hex')),
253
+ validatorPrivateKeys: opts.validatorPrivateKeys ?? new SecretValue([]),
254
+ p2pEnabled,
255
+ p2pIp,
256
+ },
257
+ {
258
+ dateProvider: this.context.dateProvider,
259
+ p2pClientDeps: {
260
+ p2pServiceFactory: mockGossipSubNetwork ? getMockPubSubP2PServiceFactory(mockGossipSubNetwork) : undefined,
261
+ },
262
+ },
263
+ {
264
+ prefilledPublicData: this.context.prefilledPublicData,
265
+ ...opts,
266
+ },
267
+ ),
156
268
  );
269
+
270
+ // REFACTOR: We're getting too much into the internals of the sequencer here.
271
+ // We should have a single method for constructing an aztec node that returns a TestAztecNodeService
272
+ // which directly exposes the delayer and sets any test config.
273
+ if (opts.txDelayerMaxInclusionTimeIntoSlot !== undefined) {
274
+ this.logger.info(
275
+ `Setting tx delayer max inclusion time into slot to ${opts.txDelayerMaxInclusionTimeIntoSlot} seconds`,
276
+ );
277
+ // Here we reach into the sequencer and hook in a tx delayer. The problem is that the sequencer's l1 utils only uses a public client, not a wallet.
278
+ // The delayer needs a wallet (a client that can sign), so we have to create one here.
279
+ const l1Client = createExtendedL1Client(
280
+ resolvedConfig.l1RpcUrls!,
281
+ resolvedConfig.publisherPrivateKeys![0]!.getValue(),
282
+ );
283
+ const sequencer = node.getSequencer() as TestSequencerClient;
284
+ const publisher = sequencer.sequencer.publisher;
285
+ const delayed = DelayedTxUtils.fromL1TxUtils(publisher.l1TxUtils, this.L1_BLOCK_TIME_IN_S, l1Client);
286
+ delayed.delayer!.setMaxInclusionTimeIntoSlot(opts.txDelayerMaxInclusionTimeIntoSlot);
287
+ publisher.l1TxUtils = delayed;
288
+ }
289
+
157
290
  this.nodes.push(node);
158
291
  return node;
159
292
  }
@@ -165,53 +298,159 @@ export class EpochsTestContext {
165
298
 
166
299
  /** Waits until the epoch begins (ie until the immediately previous L1 block is mined). */
167
300
  public async waitUntilEpochStarts(epoch: number) {
168
- const [start] = getTimestampRangeForEpoch(BigInt(epoch), this.constants);
301
+ const [start] = getTimestampRangeForEpoch(EpochNumber(epoch), this.constants);
169
302
  this.logger.info(`Waiting until L1 timestamp ${start} is reached as the start of epoch ${epoch}`);
170
- await waitUntilL1Timestamp(this.l1Client, start - BigInt(L1_BLOCK_TIME_IN_S));
303
+ await waitUntilL1Timestamp(
304
+ this.l1Client,
305
+ start - BigInt(this.L1_BLOCK_TIME_IN_S),
306
+ undefined,
307
+ 30 * this.epochDuration,
308
+ );
171
309
  return start;
172
310
  }
173
311
 
174
- /** Waits until the given L2 block number is mined. */
175
- public async waitUntilL2BlockNumber(target: number, timeout = 60) {
312
+ /** Waits until the given checkpoint number is mined. */
313
+ public async waitUntilCheckpointNumber(target: CheckpointNumber, timeout = 120) {
176
314
  await retryUntil(
177
- () => Promise.resolve(target === this.monitor.l2BlockNumber),
178
- `Wait until L2 block ${target}`,
315
+ () => Promise.resolve(target <= this.monitor.checkpointNumber),
316
+ `Wait until checkpoint ${target}`,
179
317
  timeout,
180
318
  0.1,
181
319
  );
182
320
  }
183
321
 
184
- /** Waits until the given L2 block number is marked as proven. */
185
- public async waitUntilProvenL2BlockNumber(t: number, timeout = 60) {
322
+ /** Waits until the given checkpoint number is marked as proven. */
323
+ public async waitUntilProvenCheckpointNumber(target: CheckpointNumber, timeout = 120) {
186
324
  await retryUntil(
187
- () => Promise.resolve(t === this.monitor.l2ProvenBlockNumber),
188
- `Wait proven L2 block ${t}`,
325
+ () => Promise.resolve(target <= this.monitor.provenCheckpointNumber),
326
+ `Wait proven checkpoint ${target}`,
189
327
  timeout,
190
328
  0.1,
191
329
  );
330
+ return this.monitor.provenCheckpointNumber;
331
+ }
332
+
333
+ /** Waits until the last slot of the proof submission window for a given epoch. */
334
+ public async waitUntilLastSlotOfProofSubmissionWindow(epochNumber: number | bigint) {
335
+ const deadline = getProofSubmissionDeadlineTimestamp(EpochNumber.fromBigInt(BigInt(epochNumber)), this.constants);
336
+ const oneSlotBefore = deadline - BigInt(this.constants.slotDuration);
337
+ const date = new Date(Number(oneSlotBefore) * 1000);
338
+ this.logger.info(`Waiting until last slot of submission window for epoch ${epochNumber} at ${date}`, {
339
+ oneSlotBefore,
340
+ });
341
+ await waitUntilL1Timestamp(this.l1Client, oneSlotBefore);
192
342
  }
193
343
 
194
344
  /** Waits for the aztec node to sync to the target block number. */
195
- public async waitForNodeToSync(blockNumber: number, type: 'finalised' | 'historic') {
345
+ public async waitForNodeToSync(blockNumber: BlockNumber, type: 'proven' | 'finalized' | 'historic') {
196
346
  const waitTime = ARCHIVER_POLL_INTERVAL + WORLD_STATE_BLOCK_CHECK_INTERVAL;
197
347
  let synched = false;
198
348
  while (!synched) {
199
349
  await sleep(waitTime);
200
- const syncState = await this.context.aztecNode.getWorldStateSyncStatus();
201
- if (type === 'finalised') {
202
- synched = syncState.finalisedBlockNumber >= blockNumber;
350
+ const [syncState, tips] = await Promise.all([
351
+ this.context.aztecNode.getWorldStateSyncStatus(),
352
+ await this.context.aztecNode.getL2Tips(),
353
+ ]);
354
+ this.logger.info(`Wait for node synch ${blockNumber} ${type}`, { blockNumber, type, syncState, tips });
355
+ if (type === 'proven') {
356
+ synched = tips.proven.block.number >= blockNumber && syncState.latestBlockNumber >= blockNumber;
357
+ } else if (type === 'finalized') {
358
+ synched = syncState.finalizedBlockNumber >= blockNumber;
203
359
  } else {
204
360
  synched = syncState.oldestHistoricBlockNumber >= blockNumber;
205
361
  }
206
362
  }
207
363
  }
208
364
 
365
+ /** Registers the SpamContract on the given wallet. */
366
+ public async registerSpamContract(wallet: Wallet, salt = Fr.ZERO) {
367
+ const instance = await getContractInstanceFromInstantiationParams(SpamContract.artifact, {
368
+ constructorArgs: [],
369
+ constructorArtifact: undefined,
370
+ salt,
371
+ publicKeys: undefined,
372
+ deployer: undefined,
373
+ });
374
+ await wallet.registerContract(instance, SpamContract.artifact);
375
+ return SpamContract.at(instance.address, wallet);
376
+ }
377
+
378
+ /** Creates an L1 client using a fresh account with funds from anvil, with a tx delayer already set up. */
379
+ public async createL1Client() {
380
+ const { client, delayer } = withDelayer(
381
+ createExtendedL1Client(
382
+ [...this.l1Client.chain.rpcUrls.default.http],
383
+ privateKeyToAccount(this.getNextPrivateKey()),
384
+ this.l1Client.chain,
385
+ ),
386
+ this.context.dateProvider!,
387
+ { ethereumSlotDuration: this.L1_BLOCK_TIME_IN_S },
388
+ );
389
+ expect(await client.getBalance({ address: client.account.address })).toBeGreaterThan(0n);
390
+ return { client, delayer };
391
+ }
392
+
209
393
  /** Verifies whether the given block number is found on the aztec node. */
210
- public async verifyHistoricBlock(blockNumber: L2BlockNumber, expectedSuccess: boolean) {
394
+ public async verifyHistoricBlock(blockNumber: BlockParameter, expectedSuccess: boolean) {
395
+ // We use `findLeavesIndexes` here, but could use any function that queries the world-state
396
+ // at a particular block, so we know whether that historic block is available or has been
397
+ // pruned. Note that `getBlock` would not work here, since it only hits the archiver.
211
398
  const result = await this.context.aztecNode
212
- .findBlockNumbersForIndexes(blockNumber, MerkleTreeId.NULLIFIER_TREE, [0n])
399
+ .findLeavesIndexes(blockNumber, MerkleTreeId.NULLIFIER_TREE, [Fr.ZERO])
213
400
  .then(_ => true)
214
401
  .catch(_ => false);
215
402
  expect(result).toBe(expectedSuccess);
216
403
  }
404
+
405
+ public watchSequencerEvents(
406
+ sequencers: SequencerClient[],
407
+ getMetadata: (i: number) => Record<string, any> = () => ({}),
408
+ ) {
409
+ const stateChanges: TrackedSequencerEvent[] = [];
410
+ const failEvents: TrackedSequencerEvent[] = [];
411
+
412
+ // Note we do not include the 'block-tx-count-check-failed' event here, since it is fine if we dont build
413
+ // due to lack of txs available.
414
+ const failEventsKeys: (keyof SequencerEvents)[] = [
415
+ 'block-build-failed',
416
+ 'checkpoint-publish-failed',
417
+ 'proposer-rollup-check-failed',
418
+ ];
419
+
420
+ const makeEvent = (
421
+ i: number,
422
+ eventName: keyof SequencerEvents,
423
+ args: Parameters<SequencerEvents[keyof SequencerEvents]>[0],
424
+ ) =>
425
+ ({
426
+ ...args,
427
+ type: eventName,
428
+ sequencerIndex: i + 2,
429
+ ...getMetadata(i),
430
+ }) as TrackedSequencerEvent;
431
+
432
+ sequencers.forEach((sequencer, i) => {
433
+ const sequencerIndex = i + 2;
434
+ sequencer.getSequencer().on('state-changed', (args: Parameters<SequencerEvents['state-changed']>[0]) => {
435
+ const noisyStates = [SequencerState.IDLE, SequencerState.PROPOSER_CHECK, SequencerState.SYNCHRONIZING];
436
+ if (!noisyStates.includes(args.newState)) {
437
+ const evt = makeEvent(i, 'state-changed', args);
438
+ stateChanges.push(evt);
439
+ this.logger.verbose(
440
+ `Sequencer ${sequencerIndex} transitioned from state ${args.oldState} to state ${args.newState}`,
441
+ evt,
442
+ );
443
+ }
444
+ });
445
+ failEventsKeys.forEach(eventName => {
446
+ sequencer.getSequencer().on(eventName, (args: Parameters<SequencerEvents[typeof eventName]>[0]) => {
447
+ const evt = makeEvent(i, eventName, args);
448
+ failEvents.push(evt);
449
+ this.logger.error(`Failed event ${eventName} from sequencer ${sequencerIndex}`, undefined, evt);
450
+ });
451
+ });
452
+ });
453
+
454
+ return { failEvents, stateChanges };
455
+ }
217
456
  }
@@ -0,0 +1,74 @@
1
+ import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
2
+ import { Fr } from '@aztec/aztec.js/fields';
3
+ import type { Logger } from '@aztec/aztec.js/log';
4
+ import { Fq } from '@aztec/foundation/curves/bn254';
5
+ import { sleep } from '@aztec/foundation/sleep';
6
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
7
+ import type { TestWallet } from '@aztec/test-wallet/server';
8
+
9
+ import { jest } from '@jest/globals';
10
+ import type { Hex } from 'viem';
11
+
12
+ import { FeesTest } from './fees_test.js';
13
+
14
+ jest.setTimeout(300_000);
15
+
16
+ // Regression for https://github.com/AztecProtocol/aztec-packages/issues/12366
17
+ // Similar to e2e_fees/account_init but with no automine
18
+ describe('e2e_fees bridging_race', () => {
19
+ const ETHEREUM_SLOT_DURATION = 4;
20
+ const AZTEC_SLOT_DURATION = ETHEREUM_SLOT_DURATION * 2;
21
+
22
+ const t = new FeesTest('bridging_race', 1, {
23
+ ethereumSlotDuration: ETHEREUM_SLOT_DURATION,
24
+ aztecSlotDuration: AZTEC_SLOT_DURATION,
25
+ minTxsPerBlock: 0,
26
+ });
27
+
28
+ beforeAll(async () => {
29
+ await t.setup();
30
+ ({ wallet, logger } = t);
31
+ });
32
+
33
+ afterAll(async () => {
34
+ await t.teardown();
35
+ });
36
+
37
+ let logger: Logger;
38
+ let bobsAddress: AztecAddress;
39
+ let wallet: TestWallet;
40
+
41
+ beforeEach(async () => {
42
+ const bobsSecretKey = Fr.random();
43
+ const bobsPrivateSigningKey = Fq.random();
44
+ const bobsSalt = Fr.random();
45
+ const bobsAccountManager = await wallet.createAccount({
46
+ secret: bobsSecretKey,
47
+ salt: bobsSalt,
48
+ contract: new SchnorrAccountContract(bobsPrivateSigningKey),
49
+ });
50
+ bobsAddress = bobsAccountManager.address;
51
+ });
52
+
53
+ it('Alice bridges funds to Bob', async () => {
54
+ // Tweak the token manager so the bridging happens immediately before the end of the current L2 slot
55
+ // This caused the message to be "not in state" when tried to be used
56
+ const l1TokenManager = t.feeJuiceBridgeTestHarness.l1TokenManager;
57
+ const origApprove = l1TokenManager.approve.bind(l1TokenManager);
58
+ l1TokenManager.approve = async (amount: bigint, address: Hex, addressName = '') => {
59
+ await origApprove(amount, address, addressName);
60
+ const sleepTime = (Number(t.chainMonitor.checkpointTimestamp) + AZTEC_SLOT_DURATION) * 1000 - Date.now() - 500;
61
+ logger.info(`Sleeping for ${sleepTime}ms until near end of L2 slot before sending L1 fee juice to L2 inbox`);
62
+ await sleep(sleepTime);
63
+ };
64
+
65
+ // Waiting for the archiver to sync the message _before_ waiting for the mandatory 2 L2 blocks to pass fixed it
66
+ // This was added everywhere we wait for two blocks, which is spread across three different places in the codebase
67
+ // Yes, we need to REFACTOR it at some point
68
+ const claim = await t.feeJuiceBridgeTestHarness.prepareTokensOnL1(bobsAddress);
69
+ const { claimSecret: secret, messageLeafIndex: index } = claim;
70
+ await t.feeJuiceContract.methods.claim(bobsAddress, claim.claimAmount, secret, index).send({ from: bobsAddress });
71
+ const [balance] = await t.getGasBalanceFn(bobsAddress);
72
+ expect(balance).toEqual(claim.claimAmount);
73
+ });
74
+ });