@aztec/end-to-end 0.0.1-commit.d3ec352c → 0.0.1-commit.d431d1c

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 (141) hide show
  1. package/dest/bench/client_flows/benchmark.d.ts +3 -2
  2. package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/benchmark.js +21 -1
  4. package/dest/bench/client_flows/client_flows_benchmark.d.ts +14 -15
  5. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  6. package/dest/bench/client_flows/client_flows_benchmark.js +110 -138
  7. package/dest/bench/client_flows/data_extractor.js +3 -1
  8. package/dest/bench/utils.d.ts +6 -6
  9. package/dest/bench/utils.d.ts.map +1 -1
  10. package/dest/bench/utils.js +18 -11
  11. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +6 -7
  12. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  13. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +98 -113
  14. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +19 -13
  15. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  16. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +91 -71
  17. package/dest/e2e_deploy_contract/deploy_test.d.ts +4 -3
  18. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  19. package/dest/e2e_deploy_contract/deploy_test.js +18 -13
  20. package/dest/e2e_epochs/epochs_test.d.ts +3 -2
  21. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  22. package/dest/e2e_epochs/epochs_test.js +13 -11
  23. package/dest/e2e_fees/bridging_race.notest.js +3 -5
  24. package/dest/e2e_fees/fees_test.d.ts +18 -15
  25. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  26. package/dest/e2e_fees/fees_test.js +126 -141
  27. package/dest/e2e_l1_publisher/write_json.d.ts +3 -3
  28. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  29. package/dest/e2e_l1_publisher/write_json.js +19 -15
  30. package/dest/e2e_multi_validator/utils.js +1 -1
  31. package/dest/e2e_nested_contract/nested_contract_test.d.ts +6 -9
  32. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  33. package/dest/e2e_nested_contract/nested_contract_test.js +32 -40
  34. package/dest/e2e_p2p/inactivity_slash_test.d.ts +4 -4
  35. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
  36. package/dest/e2e_p2p/inactivity_slash_test.js +6 -9
  37. package/dest/e2e_p2p/p2p_network.d.ts +13 -11
  38. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  39. package/dest/e2e_p2p/p2p_network.js +116 -111
  40. package/dest/e2e_p2p/shared.d.ts +2 -2
  41. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  42. package/dest/e2e_p2p/shared.js +4 -4
  43. package/dest/e2e_token_contract/token_contract_test.d.ts +16 -9
  44. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  45. package/dest/e2e_token_contract/token_contract_test.js +90 -92
  46. package/dest/fixtures/e2e_prover_test.d.ts +10 -18
  47. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  48. package/dest/fixtures/e2e_prover_test.js +88 -103
  49. package/dest/fixtures/fixtures.d.ts +2 -3
  50. package/dest/fixtures/fixtures.d.ts.map +1 -1
  51. package/dest/fixtures/fixtures.js +1 -2
  52. package/dest/fixtures/get_acvm_config.js +1 -1
  53. package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
  54. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  55. package/dest/fixtures/l1_to_l2_messaging.js +2 -2
  56. package/dest/fixtures/setup.d.ts +216 -0
  57. package/dest/fixtures/setup.d.ts.map +1 -0
  58. package/dest/fixtures/setup.js +684 -0
  59. package/dest/fixtures/setup_p2p_test.js +3 -3
  60. package/dest/fixtures/utils.d.ts +5 -638
  61. package/dest/fixtures/utils.d.ts.map +1 -1
  62. package/dest/fixtures/utils.js +4 -647
  63. package/dest/fixtures/web3signer.js +1 -1
  64. package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
  65. package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
  66. package/dest/fixtures/with_telemetry_utils.js +2 -2
  67. package/dest/quality_of_service/grafana_client.d.ts +41 -0
  68. package/dest/quality_of_service/grafana_client.d.ts.map +1 -0
  69. package/dest/quality_of_service/{alert_checker.js → grafana_client.js} +1 -1
  70. package/dest/quality_of_service/prometheus_client.d.ts +38 -0
  71. package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
  72. package/dest/quality_of_service/prometheus_client.js +67 -0
  73. package/dest/shared/cross_chain_test_harness.d.ts +16 -4
  74. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  75. package/dest/shared/cross_chain_test_harness.js +3 -3
  76. package/dest/shared/gas_portal_test_harness.d.ts +12 -2
  77. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  78. package/dest/shared/index.d.ts +2 -2
  79. package/dest/shared/index.d.ts.map +1 -1
  80. package/dest/shared/uniswap_l1_l2.d.ts +3 -27
  81. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  82. package/dest/shared/uniswap_l1_l2.js +43 -23
  83. package/dest/simulators/lending_simulator.d.ts +6 -2
  84. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  85. package/dest/simulators/lending_simulator.js +1 -1
  86. package/dest/spartan/setup_test_wallets.d.ts +4 -3
  87. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  88. package/dest/spartan/setup_test_wallets.js +2 -1
  89. package/dest/spartan/tx_metrics.d.ts +52 -0
  90. package/dest/spartan/tx_metrics.d.ts.map +1 -0
  91. package/dest/spartan/tx_metrics.js +248 -0
  92. package/dest/spartan/utils.d.ts +51 -12
  93. package/dest/spartan/utils.d.ts.map +1 -1
  94. package/dest/spartan/utils.js +262 -102
  95. package/package.json +40 -39
  96. package/src/bench/client_flows/benchmark.ts +24 -2
  97. package/src/bench/client_flows/client_flows_benchmark.ts +150 -200
  98. package/src/bench/client_flows/data_extractor.ts +1 -1
  99. package/src/bench/utils.ts +22 -14
  100. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +107 -142
  101. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +140 -125
  102. package/src/e2e_deploy_contract/deploy_test.ts +21 -14
  103. package/src/e2e_epochs/epochs_test.ts +26 -13
  104. package/src/e2e_fees/bridging_race.notest.ts +3 -6
  105. package/src/e2e_fees/fees_test.ts +177 -216
  106. package/src/e2e_l1_publisher/write_json.ts +22 -17
  107. package/src/e2e_multi_validator/utils.ts +1 -1
  108. package/src/e2e_nested_contract/nested_contract_test.ts +35 -56
  109. package/src/e2e_p2p/inactivity_slash_test.ts +9 -12
  110. package/src/e2e_p2p/p2p_network.ts +174 -183
  111. package/src/e2e_p2p/shared.ts +11 -6
  112. package/src/e2e_token_contract/token_contract_test.ts +105 -118
  113. package/src/fixtures/e2e_prover_test.ts +112 -144
  114. package/src/fixtures/fixtures.ts +1 -3
  115. package/src/fixtures/get_acvm_config.ts +1 -1
  116. package/src/fixtures/l1_to_l2_messaging.ts +4 -2
  117. package/src/fixtures/setup.ts +1010 -0
  118. package/src/fixtures/setup_p2p_test.ts +3 -3
  119. package/src/fixtures/utils.ts +27 -966
  120. package/src/fixtures/web3signer.ts +1 -1
  121. package/src/fixtures/with_telemetry_utils.ts +2 -2
  122. package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +1 -1
  123. package/src/quality_of_service/prometheus_client.ts +113 -0
  124. package/src/shared/cross_chain_test_harness.ts +6 -10
  125. package/src/shared/gas_portal_test_harness.ts +1 -1
  126. package/src/shared/index.ts +1 -1
  127. package/src/shared/uniswap_l1_l2.ts +53 -67
  128. package/src/simulators/lending_simulator.ts +2 -2
  129. package/src/spartan/setup_test_wallets.ts +9 -2
  130. package/src/spartan/tx_metrics.ts +231 -0
  131. package/src/spartan/utils.ts +308 -45
  132. package/dest/fixtures/setup_l1_contracts.d.ts +0 -477
  133. package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
  134. package/dest/fixtures/setup_l1_contracts.js +0 -17
  135. package/dest/fixtures/snapshot_manager.d.ts +0 -95
  136. package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
  137. package/dest/fixtures/snapshot_manager.js +0 -505
  138. package/dest/quality_of_service/alert_checker.d.ts +0 -41
  139. package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
  140. package/src/fixtures/setup_l1_contracts.ts +0 -26
  141. package/src/fixtures/snapshot_manager.ts +0 -665
@@ -6,17 +6,15 @@ import { ChildContract } from '@aztec/noir-test-contracts.js/Child';
6
6
  import { ParentContract } from '@aztec/noir-test-contracts.js/Parent';
7
7
 
8
8
  import {
9
- type ISnapshotManager,
10
- type SubsystemsContext,
11
- createSnapshotManager,
9
+ type EndToEndContext,
12
10
  deployAccounts,
13
11
  publicDeployAccounts,
14
- } from '../fixtures/snapshot_manager.js';
15
-
16
- const { E2E_DATA_PATH: dataPath } = process.env;
12
+ setup,
13
+ teardown as teardownSubsystems,
14
+ } from '../fixtures/setup.js';
17
15
 
18
16
  export class NestedContractTest {
19
- private snapshotManager: ISnapshotManager;
17
+ context!: EndToEndContext;
20
18
  logger: Logger;
21
19
  wallet!: Wallet;
22
20
  defaultAccountAddress!: AztecAddress;
@@ -30,67 +28,48 @@ export class NestedContractTest {
30
28
  private numberOfAccounts = 1,
31
29
  ) {
32
30
  this.logger = createLogger(`e2e:e2e_nested_contract:${testName}`);
33
- this.snapshotManager = createSnapshotManager(`e2e_nested_contract/${testName}-${numberOfAccounts}`, dataPath);
34
31
  }
35
32
 
36
33
  /**
37
- * Adds two state shifts to snapshot manager.
38
- * 1. Add 3 accounts.
39
- * 2. Publicly deploy accounts
34
+ * Applies base setup by deploying accounts and publicly deploying them.
40
35
  */
41
- async applyBaseSnapshots() {
42
- await this.snapshotManager.snapshot(
43
- 'accounts',
44
- deployAccounts(this.numberOfAccounts, this.logger),
45
- ({ deployedAccounts }, { wallet, aztecNode }) => {
46
- this.wallet = wallet;
47
- [{ address: this.defaultAccountAddress }] = deployedAccounts;
48
- this.aztecNode = aztecNode;
49
- return Promise.resolve();
50
- },
51
- );
36
+ async applyBaseSetup() {
37
+ this.logger.info('Deploying accounts');
38
+ const { deployedAccounts } = await deployAccounts(
39
+ this.numberOfAccounts,
40
+ this.logger,
41
+ )({
42
+ wallet: this.context.wallet,
43
+ initialFundedAccounts: this.context.initialFundedAccounts,
44
+ });
45
+ this.wallet = this.context.wallet;
46
+ [{ address: this.defaultAccountAddress }] = deployedAccounts;
47
+ this.aztecNode = this.context.aztecNodeService!;
52
48
 
53
- await this.snapshotManager.snapshot(
54
- 'public_deploy',
55
- async () => {},
56
- async () => {
57
- this.logger.verbose(`Public deploy accounts...`);
58
- await publicDeployAccounts(this.wallet, [this.defaultAccountAddress]);
59
- },
60
- );
49
+ this.logger.info('Public deploy accounts');
50
+ await publicDeployAccounts(this.wallet, [this.defaultAccountAddress]);
61
51
  }
62
52
 
63
53
  async setup() {
64
- await this.snapshotManager.setup();
54
+ this.logger.info('Setting up fresh subsystems');
55
+ this.context = await setup(0, {
56
+ fundSponsoredFPC: true,
57
+ skipAccountDeployment: true,
58
+ });
59
+ await this.applyBaseSetup();
65
60
  }
66
61
 
67
62
  async teardown() {
68
- await this.snapshotManager.teardown();
63
+ await teardownSubsystems(this.context);
69
64
  }
70
65
 
71
- snapshot = <T>(
72
- name: string,
73
- apply: (context: SubsystemsContext) => Promise<T>,
74
- restore: (snapshotData: T, context: SubsystemsContext) => Promise<void> = () => Promise.resolve(),
75
- ): Promise<void> => this.snapshotManager.snapshot(name, apply, restore);
76
-
77
- async applyManualSnapshots() {
78
- await this.snapshotManager.snapshot(
79
- 'manual',
80
- async () => {
81
- const parentContract = await ParentContract.deploy(this.wallet)
82
- .send({ from: this.defaultAccountAddress })
83
- .deployed();
84
- const childContract = await ChildContract.deploy(this.wallet)
85
- .send({ from: this.defaultAccountAddress })
86
- .deployed();
87
- return { parentContractAddress: parentContract.address, childContractAddress: childContract.address };
88
- },
89
- ({ parentContractAddress, childContractAddress }) => {
90
- this.parentContract = ParentContract.at(parentContractAddress, this.wallet);
91
- this.childContract = ChildContract.at(childContractAddress, this.wallet);
92
- return Promise.resolve();
93
- },
94
- );
66
+ async applyManual() {
67
+ this.logger.info('Deploying parent and child contracts');
68
+ const parentContract = await ParentContract.deploy(this.wallet)
69
+ .send({ from: this.defaultAccountAddress })
70
+ .deployed();
71
+ const childContract = await ChildContract.deploy(this.wallet).send({ from: this.defaultAccountAddress }).deployed();
72
+ this.parentContract = parentContract;
73
+ this.childContract = childContract;
95
74
  }
96
75
  }
@@ -1,6 +1,6 @@
1
1
  import type { AztecNodeService } from '@aztec/aztec-node';
2
2
  import { EthAddress } from '@aztec/aztec.js/addresses';
3
- import { RollupContract } from '@aztec/ethereum';
3
+ import { RollupContract } from '@aztec/ethereum/contracts';
4
4
  import { EpochNumber } from '@aztec/foundation/branded-types';
5
5
 
6
6
  import fs from 'fs';
@@ -24,7 +24,7 @@ const SLASHING_UNIT = BigInt(1e18);
24
24
  const SLASHING_AMOUNT = SLASHING_UNIT * 3n;
25
25
 
26
26
  // How many epochs it may take to set everything up, so we dont slash during this period
27
- const SETUP_EPOCH_DURATION = 5;
27
+ const SETUP_EPOCH_DURATION = 8;
28
28
 
29
29
  export class P2PInactivityTest {
30
30
  public nodes!: AztecNodeService[];
@@ -82,8 +82,8 @@ export class P2PInactivityTest {
82
82
  }
83
83
 
84
84
  public async setup() {
85
- await this.test.applyBaseSnapshots();
86
85
  await this.test.setup();
86
+ await this.test.applyBaseSetup();
87
87
 
88
88
  // Set slashing penalties for inactivity
89
89
  const { rollup } = await this.test.getContracts();
@@ -98,13 +98,13 @@ export class P2PInactivityTest {
98
98
  this.rollup = rollup;
99
99
 
100
100
  if (!this.keepInitialNode) {
101
- await this.test.ctx.aztecNode.stop();
101
+ await this.test.ctx.aztecNodeService!.stop();
102
102
  }
103
103
 
104
104
  // Create all active nodes
105
105
  this.activeNodes = await createNodes(
106
106
  this.test.ctx.aztecNodeConfig,
107
- this.test.ctx.dateProvider,
107
+ this.test.ctx.dateProvider!,
108
108
  this.test.bootstrapNodeEnr,
109
109
  NUM_NODES - this.inactiveNodeCount - Number(this.keepInitialNode),
110
110
  BOOT_NODE_UDP_PORT,
@@ -118,7 +118,7 @@ export class P2PInactivityTest {
118
118
  const inactiveConfig = { ...this.test.ctx.aztecNodeConfig, dontStartSequencer: true };
119
119
  this.inactiveNodes = await createNodes(
120
120
  inactiveConfig,
121
- this.test.ctx.dateProvider,
121
+ this.test.ctx.dateProvider!,
122
122
  this.test.bootstrapNodeEnr,
123
123
  this.inactiveNodeCount,
124
124
  BOOT_NODE_UDP_PORT,
@@ -129,7 +129,7 @@ export class P2PInactivityTest {
129
129
  );
130
130
 
131
131
  this.nodes = [
132
- ...(this.keepInitialNode ? [this.test.ctx.aztecNode] : []),
132
+ ...(this.keepInitialNode ? [this.test.ctx.aztecNodeService!] : []),
133
133
  ...this.activeNodes,
134
134
  ...this.inactiveNodes,
135
135
  ];
@@ -151,11 +151,8 @@ export class P2PInactivityTest {
151
151
  // This prevents race conditions where validators propose blocks before the network is ready
152
152
  await this.test.waitForP2PMeshConnectivity(this.nodes, NUM_NODES);
153
153
 
154
- const ethereumSlotDuration = this.test.ctx.aztecNodeConfig.ethereumSlotDuration!;
155
- this.test.logger.warn(`Advancing to the L1 slot before epoch ${SETUP_EPOCH_DURATION + 1} to start slashing`);
156
- await this.test.ctx.cheatCodes.rollup.advanceToEpoch(EpochNumber(SETUP_EPOCH_DURATION + 1), {
157
- offset: -ethereumSlotDuration,
158
- });
154
+ this.test.logger.warn(`Advancing to epoch ${SETUP_EPOCH_DURATION - 1} (slashing will start after it is completed)`);
155
+ await this.test.ctx.cheatCodes.rollup.advanceToEpoch(EpochNumber(SETUP_EPOCH_DURATION - 1));
159
156
 
160
157
  return this;
161
158
  }