@aztec/end-to-end 3.0.0-canary.a9708bd → 3.0.0-devnet.3

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 (137) 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/client_flows_benchmark.d.ts +16 -12
  4. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  5. package/dest/bench/client_flows/client_flows_benchmark.js +54 -58
  6. package/dest/bench/utils.d.ts +2 -11
  7. package/dest/bench/utils.d.ts.map +1 -1
  8. package/dest/bench/utils.js +10 -34
  9. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +7 -7
  10. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  11. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +42 -42
  12. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +10 -8
  13. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  14. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +31 -33
  15. package/dest/e2e_deploy_contract/deploy_test.d.ts +10 -4
  16. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  17. package/dest/e2e_deploy_contract/deploy_test.js +9 -18
  18. package/dest/e2e_epochs/epochs_test.d.ts +9 -3
  19. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  20. package/dest/e2e_epochs/epochs_test.js +19 -13
  21. package/dest/e2e_fees/bridging_race.notest.js +12 -9
  22. package/dest/e2e_fees/fees_test.d.ts +5 -5
  23. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  24. package/dest/e2e_fees/fees_test.js +26 -33
  25. package/dest/e2e_l1_publisher/write_json.d.ts +3 -1
  26. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  27. package/dest/e2e_l1_publisher/write_json.js +5 -5
  28. package/dest/e2e_multi_validator/utils.d.ts +1 -1
  29. package/dest/e2e_multi_validator/utils.d.ts.map +1 -1
  30. package/dest/e2e_multi_validator/utils.js +3 -9
  31. package/dest/e2e_nested_contract/nested_contract_test.d.ts +6 -3
  32. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  33. package/dest/e2e_nested_contract/nested_contract_test.js +7 -9
  34. package/dest/e2e_p2p/inactivity_slash_test.d.ts +31 -0
  35. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -0
  36. package/dest/e2e_p2p/inactivity_slash_test.js +135 -0
  37. package/dest/e2e_p2p/p2p_network.d.ts +22 -8
  38. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  39. package/dest/e2e_p2p/p2p_network.js +36 -15
  40. package/dest/e2e_p2p/shared.d.ts +12 -13
  41. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  42. package/dest/e2e_p2p/shared.js +54 -54
  43. package/dest/e2e_token_contract/token_contract_test.d.ts +5 -4
  44. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  45. package/dest/e2e_token_contract/token_contract_test.js +14 -17
  46. package/dest/fixtures/e2e_prover_test.d.ts +8 -6
  47. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  48. package/dest/fixtures/e2e_prover_test.js +42 -51
  49. package/dest/fixtures/get_acvm_config.d.ts +1 -1
  50. package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
  51. package/dest/fixtures/get_bb_config.d.ts +1 -1
  52. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  53. package/dest/fixtures/get_bb_config.js +2 -2
  54. package/dest/fixtures/setup_l1_contracts.d.ts +1 -1
  55. package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
  56. package/dest/fixtures/setup_l1_contracts.js +2 -2
  57. package/dest/fixtures/setup_p2p_test.d.ts +10 -9
  58. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  59. package/dest/fixtures/setup_p2p_test.js +38 -20
  60. package/dest/fixtures/snapshot_manager.d.ts +10 -7
  61. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  62. package/dest/fixtures/snapshot_manager.js +60 -47
  63. package/dest/fixtures/token_utils.d.ts +6 -4
  64. package/dest/fixtures/token_utils.d.ts.map +1 -1
  65. package/dest/fixtures/token_utils.js +11 -15
  66. package/dest/fixtures/utils.d.ts +26 -28
  67. package/dest/fixtures/utils.d.ts.map +1 -1
  68. package/dest/fixtures/utils.js +83 -109
  69. package/dest/fixtures/web3signer.d.ts +5 -0
  70. package/dest/fixtures/web3signer.d.ts.map +1 -0
  71. package/dest/fixtures/web3signer.js +53 -0
  72. package/dest/quality_of_service/alert_checker.d.ts +1 -1
  73. package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
  74. package/dest/shared/cross_chain_test_harness.d.ts +16 -10
  75. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  76. package/dest/shared/cross_chain_test_harness.js +13 -15
  77. package/dest/shared/gas_portal_test_harness.d.ts +9 -6
  78. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  79. package/dest/shared/gas_portal_test_harness.js +10 -7
  80. package/dest/shared/jest_setup.js +1 -1
  81. package/dest/shared/submit-transactions.d.ts +5 -3
  82. package/dest/shared/submit-transactions.d.ts.map +1 -1
  83. package/dest/shared/submit-transactions.js +8 -7
  84. package/dest/shared/uniswap_l1_l2.d.ts +9 -6
  85. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  86. package/dest/shared/uniswap_l1_l2.js +29 -45
  87. package/dest/simulators/lending_simulator.d.ts +2 -1
  88. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  89. package/dest/simulators/lending_simulator.js +3 -2
  90. package/dest/simulators/token_simulator.d.ts +3 -1
  91. package/dest/simulators/token_simulator.d.ts.map +1 -1
  92. package/dest/simulators/token_simulator.js +2 -2
  93. package/dest/spartan/setup_test_wallets.d.ts +19 -13
  94. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  95. package/dest/spartan/setup_test_wallets.js +108 -85
  96. package/dest/spartan/utils.d.ts +68 -3
  97. package/dest/spartan/utils.d.ts.map +1 -1
  98. package/dest/spartan/utils.js +312 -49
  99. package/package.json +39 -38
  100. package/src/bench/client_flows/benchmark.ts +6 -6
  101. package/src/bench/client_flows/client_flows_benchmark.ts +62 -82
  102. package/src/bench/client_flows/data_extractor.ts +1 -1
  103. package/src/bench/utils.ts +9 -37
  104. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +46 -63
  105. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +33 -47
  106. package/src/e2e_deploy_contract/deploy_test.ts +17 -35
  107. package/src/e2e_epochs/epochs_test.ts +22 -19
  108. package/src/e2e_fees/bridging_race.notest.ts +14 -9
  109. package/src/e2e_fees/fees_test.ts +29 -40
  110. package/src/e2e_l1_publisher/write_json.ts +8 -6
  111. package/src/e2e_multi_validator/utils.ts +4 -10
  112. package/src/e2e_nested_contract/nested_contract_test.ts +11 -10
  113. package/src/e2e_p2p/inactivity_slash_test.ts +178 -0
  114. package/src/e2e_p2p/p2p_network.ts +110 -71
  115. package/src/e2e_p2p/shared.ts +57 -56
  116. package/src/e2e_token_contract/token_contract_test.ts +17 -17
  117. package/src/fixtures/e2e_prover_test.ts +52 -88
  118. package/src/fixtures/get_acvm_config.ts +1 -1
  119. package/src/fixtures/get_bb_config.ts +3 -2
  120. package/src/fixtures/setup_l1_contracts.ts +3 -3
  121. package/src/fixtures/setup_p2p_test.ts +60 -27
  122. package/src/fixtures/snapshot_manager.ts +80 -72
  123. package/src/fixtures/token_utils.ts +13 -21
  124. package/src/fixtures/utils.ts +95 -145
  125. package/src/fixtures/web3signer.ts +63 -0
  126. package/src/guides/up_quick_start.sh +2 -10
  127. package/src/quality_of_service/alert_checker.ts +1 -1
  128. package/src/shared/cross_chain_test_harness.ts +18 -29
  129. package/src/shared/gas_portal_test_harness.ts +12 -19
  130. package/src/shared/jest_setup.ts +1 -1
  131. package/src/shared/submit-transactions.ts +12 -8
  132. package/src/shared/uniswap_l1_l2.ts +61 -67
  133. package/src/simulators/lending_simulator.ts +3 -2
  134. package/src/simulators/token_simulator.ts +5 -2
  135. package/src/spartan/DEVELOP.md +8 -3
  136. package/src/spartan/setup_test_wallets.ts +133 -126
  137. package/src/spartan/utils.ts +373 -48
@@ -1,5 +1,6 @@
1
- import { getSchnorrWallet } from '@aztec/accounts/schnorr';
2
- import { Fr, computeSecretHash, createLogger } from '@aztec/aztec.js';
1
+ import { computeSecretHash } from '@aztec/aztec.js/crypto';
2
+ import { Fr } from '@aztec/aztec.js/fields';
3
+ import { createLogger } from '@aztec/aztec.js/log';
3
4
  import { TokenBlacklistContract } from '@aztec/noir-contracts.js/TokenBlacklist';
4
5
  import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAccount';
5
6
  import { jest } from '@jest/globals';
@@ -37,20 +38,15 @@ export class BlacklistTokenContractTest {
37
38
  static CHANGE_ROLES_DELAY = 86400;
38
39
  snapshotManager;
39
40
  logger;
40
- wallets = [];
41
- pxe;
42
- accounts = [];
41
+ wallet;
43
42
  asset;
44
43
  tokenSim;
45
44
  badAccount;
46
45
  cheatCodes;
47
46
  sequencer;
48
47
  aztecNode;
49
- admin;
50
48
  adminAddress;
51
- other;
52
49
  otherAddress;
53
- blacklisted;
54
50
  blacklistedAddress;
55
51
  constructor(testName){
56
52
  this.logger = createLogger(`e2e:e2e_blacklist_token_contract:${testName}`);
@@ -66,32 +62,32 @@ export class BlacklistTokenContractTest {
66
62
  */ async applyBaseSnapshots() {
67
63
  // Adding a timeout of 2 minutes in here such that it is propagated to the underlying tests
68
64
  jest.setTimeout(120_000);
69
- await this.snapshotManager.snapshot('3_accounts', deployAccounts(3, this.logger), async ({ deployedAccounts }, { pxe, cheatCodes, aztecNode, sequencer })=>{
70
- this.pxe = pxe;
65
+ await this.snapshotManager.snapshot('3_accounts', deployAccounts(3, this.logger), ({ deployedAccounts }, { cheatCodes, aztecNode, sequencer, wallet })=>{
71
66
  this.cheatCodes = cheatCodes;
72
67
  this.aztecNode = aztecNode;
73
68
  this.sequencer = sequencer;
74
- this.wallets = await Promise.all(deployedAccounts.map((a)=>getSchnorrWallet(pxe, a.address, a.signingKey)));
75
- this.admin = this.wallets[0];
76
- this.adminAddress = this.admin.getAddress();
77
- this.other = this.wallets[1];
78
- this.otherAddress = this.other.getAddress();
79
- this.blacklisted = this.wallets[2];
80
- this.blacklistedAddress = this.blacklisted.getAddress();
81
- this.accounts = this.wallets.map((w)=>w.getCompleteAddress());
69
+ this.wallet = wallet;
70
+ this.adminAddress = deployedAccounts[0].address;
71
+ this.otherAddress = deployedAccounts[1].address;
72
+ this.blacklistedAddress = deployedAccounts[2].address;
73
+ return Promise.resolve();
82
74
  });
83
75
  await this.snapshotManager.snapshot('e2e_blacklist_token_contract', async ()=>{
84
76
  // Create the token contract state.
85
77
  // Move this account thing to addAccounts above?
86
78
  this.logger.verbose(`Public deploy accounts...`);
87
- await publicDeployAccounts(this.admin, this.accounts.slice(0, 3));
79
+ await publicDeployAccounts(this.wallet, [
80
+ this.adminAddress,
81
+ this.otherAddress,
82
+ this.blacklistedAddress
83
+ ]);
88
84
  this.logger.verbose(`Deploying TokenContract...`);
89
- this.asset = await TokenBlacklistContract.deploy(this.admin, this.adminAddress).send({
85
+ this.asset = await TokenBlacklistContract.deploy(this.wallet, this.adminAddress).send({
90
86
  from: this.adminAddress
91
87
  }).deployed();
92
88
  this.logger.verbose(`Token deployed to ${this.asset.address}`);
93
89
  this.logger.verbose(`Deploying bad account...`);
94
- this.badAccount = await InvalidAccountContract.deploy(this.admin).send({
90
+ this.badAccount = await InvalidAccountContract.deploy(this.wallet).send({
95
91
  from: this.adminAddress
96
92
  }).deployed();
97
93
  this.logger.verbose(`Deployed to ${this.badAccount.address}.`);
@@ -102,10 +98,14 @@ export class BlacklistTokenContractTest {
102
98
  };
103
99
  }, async ({ tokenContractAddress, badAccountAddress })=>{
104
100
  // Restore the token contract state.
105
- this.asset = await TokenBlacklistContract.at(tokenContractAddress, this.wallets[0]);
101
+ this.asset = await TokenBlacklistContract.at(tokenContractAddress, this.wallet);
106
102
  this.logger.verbose(`Token contract address: ${this.asset.address}`);
107
- this.tokenSim = new TokenSimulator(this.asset, this.admin, this.adminAddress, this.logger, this.accounts.map((a)=>a.address));
108
- this.badAccount = await InvalidAccountContract.at(badAccountAddress, this.wallets[0]);
103
+ this.tokenSim = new TokenSimulator(this.asset, this.wallet, this.adminAddress, this.logger, [
104
+ this.adminAddress,
105
+ this.otherAddress,
106
+ this.blacklistedAddress
107
+ ]);
108
+ this.badAccount = await InvalidAccountContract.at(badAccountAddress, this.wallet);
109
109
  this.logger.verbose(`Bad account address: ${this.badAccount.address}`);
110
110
  expect(await this.asset.methods.get_roles(this.adminAddress).simulate({
111
111
  from: this.adminAddress
@@ -120,29 +120,29 @@ export class BlacklistTokenContractTest {
120
120
  await this.snapshotManager.teardown();
121
121
  }
122
122
  async addPendingShieldNoteToPXE(contract, recipient, amount, secretHash, txHash) {
123
- const txEffects = await this.pxe.getTxEffect(txHash);
123
+ const txEffects = await this.aztecNode.getTxEffect(txHash);
124
124
  await contract.methods.deliver_transparent_note(contract.address, amount, secretHash, txHash.hash, txEffects.data.noteHashes, txEffects.data.nullifiers[0], recipient).simulate({
125
125
  from: recipient
126
126
  });
127
127
  }
128
128
  async applyMintSnapshot() {
129
129
  await this.snapshotManager.snapshot('mint', async ()=>{
130
- const { asset, accounts, wallets } = this;
130
+ const { asset } = this;
131
131
  const amount = 10000n;
132
132
  const adminMinterRole = new Role().withAdmin().withMinter();
133
- await this.asset.withWallet(this.admin).methods.update_roles(this.admin.getAddress(), adminMinterRole.toNoirStruct()).send({
133
+ await this.asset.methods.update_roles(this.adminAddress, adminMinterRole.toNoirStruct()).send({
134
134
  from: this.adminAddress
135
135
  }).wait();
136
136
  const blacklistRole = new Role().withBlacklisted();
137
- await this.asset.withWallet(this.admin).methods.update_roles(this.blacklisted.getAddress(), blacklistRole.toNoirStruct()).send({
137
+ await this.asset.methods.update_roles(this.blacklistedAddress, blacklistRole.toNoirStruct()).send({
138
138
  from: this.adminAddress
139
139
  }).wait();
140
140
  await this.crossTimestampOfChange();
141
- expect(await this.asset.methods.get_roles(this.admin.getAddress()).simulate({
141
+ expect(await this.asset.methods.get_roles(this.adminAddress).simulate({
142
142
  from: this.adminAddress
143
143
  })).toEqual(adminMinterRole.toNoirStruct());
144
144
  this.logger.verbose(`Minting ${amount} publicly...`);
145
- await asset.methods.mint_public(accounts[0].address, amount).send({
145
+ await asset.methods.mint_public(this.adminAddress, amount).send({
146
146
  from: this.adminAddress
147
147
  }).wait();
148
148
  this.logger.verbose(`Minting ${amount} privately...`);
@@ -151,8 +151,8 @@ export class BlacklistTokenContractTest {
151
151
  const receipt = await asset.methods.mint_private(amount, secretHash).send({
152
152
  from: this.adminAddress
153
153
  }).wait();
154
- await this.addPendingShieldNoteToPXE(asset, wallets[0].getAddress(), amount, secretHash, receipt.txHash);
155
- const txClaim = asset.methods.redeem_shield(accounts[0].address, amount, secret).send({
154
+ await this.addPendingShieldNoteToPXE(asset, this.adminAddress, amount, secretHash, receipt.txHash);
155
+ const txClaim = asset.methods.redeem_shield(this.adminAddress, amount, secret).send({
156
156
  from: this.adminAddress
157
157
  });
158
158
  await txClaim.wait();
@@ -161,21 +161,21 @@ export class BlacklistTokenContractTest {
161
161
  amount
162
162
  };
163
163
  }, async ({ amount })=>{
164
- const { asset, accounts: [{ address }], tokenSim } = this;
165
- tokenSim.mintPublic(address, amount);
166
- const publicBalance = await asset.methods.balance_of_public(address).simulate({
167
- from: address
164
+ const { asset, tokenSim } = this;
165
+ tokenSim.mintPublic(this.adminAddress, amount);
166
+ const publicBalance = await asset.methods.balance_of_public(this.adminAddress).simulate({
167
+ from: this.adminAddress
168
168
  });
169
169
  this.logger.verbose(`Public balance of wallet 0: ${publicBalance}`);
170
- expect(publicBalance).toEqual(this.tokenSim.balanceOfPublic(address));
171
- tokenSim.mintPrivate(address, amount);
172
- const privateBalance = await asset.methods.balance_of_private(address).simulate({
173
- from: address
170
+ expect(publicBalance).toEqual(this.tokenSim.balanceOfPublic(this.adminAddress));
171
+ tokenSim.mintPrivate(this.adminAddress, amount);
172
+ const privateBalance = await asset.methods.balance_of_private(this.adminAddress).simulate({
173
+ from: this.adminAddress
174
174
  });
175
175
  this.logger.verbose(`Private balance of wallet 0: ${privateBalance}`);
176
- expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(address));
176
+ expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(this.adminAddress));
177
177
  const totalSupply = await asset.methods.total_supply().simulate({
178
- from: address
178
+ from: this.adminAddress
179
179
  });
180
180
  this.logger.verbose(`Total supply: ${totalSupply}`);
181
181
  expect(totalSupply).toEqual(tokenSim.totalSupply);
@@ -1,35 +1,37 @@
1
1
  import type { AztecNodeConfig } from '@aztec/aztec-node';
2
- import { type AccountWallet, AztecAddress, type AztecNode, type CompleteAddress, EthAddress, type Logger, type PXE } from '@aztec/aztec.js';
2
+ import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
3
+ import { type Logger } from '@aztec/aztec.js/log';
4
+ import type { AztecNode } from '@aztec/aztec.js/node';
3
5
  import { CheatCodes } from '@aztec/aztec/testing';
4
- import { type DeployL1ContractsReturnType, type ExtendedViemWalletClient } from '@aztec/ethereum';
6
+ import { type DeployL1ContractsArgs, type DeployL1ContractsReturnType, type ExtendedViemWalletClient } from '@aztec/ethereum';
5
7
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
6
8
  import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge';
7
9
  import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
10
+ import type { TestWallet } from '@aztec/test-wallet/server';
8
11
  import { type SubsystemsContext } from '../fixtures/snapshot_manager.js';
12
+ import type { SetupOptions } from '../fixtures/utils.js';
9
13
  import { CrossChainTestHarness } from '../shared/cross_chain_test_harness.js';
10
14
  export declare class CrossChainMessagingTest {
11
15
  private snapshotManager;
12
16
  logger: Logger;
13
- accounts: CompleteAddress[];
14
17
  aztecNode: AztecNode;
15
- pxe: PXE;
16
18
  aztecNodeConfig: AztecNodeConfig;
17
19
  aztecNodeAdmin: AztecNodeAdmin;
20
+ ctx: SubsystemsContext;
18
21
  l1Client: ExtendedViemWalletClient | undefined;
19
- user1Wallet: AccountWallet;
22
+ wallet: TestWallet;
23
+ ownerAddress: AztecAddress;
20
24
  user1Address: AztecAddress;
21
- user2Wallet: AccountWallet;
22
25
  user2Address: AztecAddress;
23
26
  crossChainTestHarness: CrossChainTestHarness;
24
27
  ethAccount: EthAddress;
25
- ownerAddress: AztecAddress;
26
28
  l2Token: TokenContract;
27
29
  l2Bridge: TokenBridgeContract;
28
30
  inbox: any;
29
31
  outbox: any;
30
32
  cheatCodes: CheatCodes;
31
33
  deployL1ContractsValues: DeployL1ContractsReturnType;
32
- constructor(testName: string);
34
+ constructor(testName: string, opts?: SetupOptions, deployL1ContractsArgs?: Partial<DeployL1ContractsArgs>);
33
35
  assumeProven(): Promise<void>;
34
36
  setup(): Promise<void>;
35
37
  snapshot: <T>(name: string, apply: (context: SubsystemsContext) => Promise<T>, restore?: (snapshotData: T, context: SubsystemsContext) => Promise<void>) => Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"cross_chain_messaging_test.d.ts","sourceRoot":"","sources":["../../src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EACL,KAAK,aAAa,EAClB,YAAY,EACZ,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,UAAU,EACV,KAAK,MAAM,EACX,KAAK,GAAG,EAET,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAG9B,MA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AO,CAAC,IAAI,CAA2B,KAChG,OAAO,CAAC,IAAI,CAAC,CAAwD;IAElE,QAAQ;IAIR,kBAAkB;CAiGzB"}
1
+ {"version":3,"file":"cross_chain_messaging_test.d.ts","sourceRoot":"","sources":["../../src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAG9B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAK5D,OAAO,EAEL,KAAK,iBAAiB,EAIvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAI9E,qBAAa,uBAAuB;IAClC,OAAO,CAAC,eAAe,CAAmB;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAG,SAAS,CAAC;IACtB,eAAe,EAAG,eAAe,CAAC;IAClC,cAAc,EAAG,cAAc,CAAC;IAChC,GAAG,EAAG,iBAAiB,CAAC;IAExB,QAAQ,EAAG,wBAAwB,GAAG,SAAS,CAAC;IAEhD,MAAM,EAAG,UAAU,CAAC;IACpB,YAAY,EAAG,YAAY,CAAC;IAC5B,YAAY,EAAG,YAAY,CAAC;IAC5B,YAAY,EAAG,YAAY,CAAC;IAC5B,qBAAqB,EAAG,qBAAqB,CAAC;IAC9C,UAAU,EAAG,UAAU,CAAC;IACxB,OAAO,EAAG,aAAa,CAAC;IACxB,QAAQ,EAAG,mBAAmB,CAAC;IAE/B,KAAK,EAAG,GAAG,CAAC;IACZ,MAAM,EAAG,GAAG,CAAC;IACb,UAAU,EAAG,UAAU,CAAC;IAExB,uBAAuB,EAAG,2BAA2B,CAAC;gBAE1C,QAAQ,EAAE,MAAM,EAAE,IAAI,GAAE,YAAiB,EAAE,qBAAqB,GAAE,OAAO,CAAC,qBAAqB,CAAM;IAQ3G,YAAY;IAIZ,KAAK;IAUX,QAAQ,GAAI,CAAC,EACX,MAAM,MAAM,EACZ,OAAO,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,CAAC,CAAC,EACjD,UAAS,CAAC,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAA2B,KAChG,OAAO,CAAC,IAAI,CAAC,CAAwD;IAElE,QAAQ;IAIR,kBAAkB;CAuFzB"}
@@ -1,6 +1,5 @@
1
- import { getSchnorrWallet } from '@aztec/accounts/schnorr';
2
- import { AztecAddress, EthAddress, createLogger } from '@aztec/aztec.js';
3
- import { CheatCodes } from '@aztec/aztec/testing';
1
+ import { EthAddress } from '@aztec/aztec.js/addresses';
2
+ import { createLogger } from '@aztec/aztec.js/log';
4
3
  import { createExtendedL1Client, deployL1Contract } from '@aztec/ethereum';
5
4
  import { InboxAbi, OutboxAbi, TestERC20Abi, TestERC20Bytecode } from '@aztec/l1-artifacts';
6
5
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
@@ -13,65 +12,65 @@ const { E2E_DATA_PATH: dataPath } = process.env;
13
12
  export class CrossChainMessagingTest {
14
13
  snapshotManager;
15
14
  logger;
16
- accounts = [];
17
15
  aztecNode;
18
- pxe;
19
16
  aztecNodeConfig;
20
17
  aztecNodeAdmin;
18
+ ctx;
21
19
  l1Client;
22
- user1Wallet;
20
+ wallet;
21
+ ownerAddress;
23
22
  user1Address;
24
- user2Wallet;
25
23
  user2Address;
26
24
  crossChainTestHarness;
27
25
  ethAccount;
28
- ownerAddress;
29
26
  l2Token;
30
27
  l2Bridge;
31
28
  inbox;
32
29
  outbox;
33
30
  cheatCodes;
34
31
  deployL1ContractsValues;
35
- constructor(testName){
32
+ constructor(testName, opts = {}, deployL1ContractsArgs = {}){
36
33
  this.logger = createLogger(`e2e:e2e_cross_chain_messaging:${testName}`);
37
- this.snapshotManager = createSnapshotManager(`e2e_cross_chain_messaging/${testName}`, dataPath);
34
+ this.snapshotManager = createSnapshotManager(`e2e_cross_chain_messaging/${testName}`, dataPath, opts, {
35
+ initialValidators: [],
36
+ ...deployL1ContractsArgs
37
+ });
38
38
  }
39
39
  async assumeProven() {
40
40
  await this.cheatCodes.rollup.markAsProven();
41
41
  }
42
42
  async setup() {
43
- const { aztecNode, pxe, aztecNodeConfig, deployL1ContractsValues } = await this.snapshotManager.setup();
44
- this.aztecNode = aztecNode;
45
- this.pxe = pxe;
46
- this.aztecNodeConfig = aztecNodeConfig;
47
- this.cheatCodes = await CheatCodes.create(this.aztecNodeConfig.l1RpcUrls, this.pxe);
48
- this.deployL1ContractsValues = deployL1ContractsValues;
49
- this.aztecNodeAdmin = aztecNode;
43
+ this.ctx = await this.snapshotManager.setup();
44
+ this.aztecNode = this.ctx.aztecNode;
45
+ this.wallet = this.ctx.wallet;
46
+ this.aztecNodeConfig = this.ctx.aztecNodeConfig;
47
+ this.cheatCodes = this.ctx.cheatCodes;
48
+ this.deployL1ContractsValues = this.ctx.deployL1ContractsValues;
49
+ this.aztecNodeAdmin = this.ctx.aztecNode;
50
50
  }
51
51
  snapshot = (name, apply, restore = ()=>Promise.resolve())=>this.snapshotManager.snapshot(name, apply, restore);
52
52
  async teardown() {
53
53
  await this.snapshotManager.teardown();
54
54
  }
55
55
  async applyBaseSnapshots() {
56
- // Note that we are using the same `pxe`, `aztecNodeConfig` and `aztecNode` across all snapshots.
56
+ // Note that we are using the same `wallet`, `aztecNodeConfig` and `aztecNode` across all snapshots.
57
57
  // This is to not have issues with different networks.
58
- await this.snapshotManager.snapshot('3_accounts', deployAccounts(3, this.logger), async ({ deployedAccounts }, { pxe, aztecNodeConfig, aztecNode })=>{
59
- const wallets = await Promise.all(deployedAccounts.map((a)=>getSchnorrWallet(pxe, a.address, a.signingKey)));
60
- this.accounts = wallets.map((w)=>w.getCompleteAddress());
61
- wallets.forEach((w, i)=>this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
62
- this.user1Wallet = wallets[0];
63
- this.user1Address = this.user1Wallet.getAddress();
64
- this.user2Wallet = wallets[1];
65
- this.user2Address = this.user2Wallet.getAddress();
66
- this.pxe = pxe;
58
+ await this.snapshotManager.snapshot('3_accounts', deployAccounts(3, this.logger), ({ deployedAccounts }, { wallet, aztecNodeConfig, aztecNode })=>{
59
+ [this.ownerAddress, this.user1Address, this.user2Address] = deployedAccounts.map((a)=>a.address);
60
+ this.wallet = wallet;
67
61
  this.aztecNode = aztecNode;
68
62
  this.aztecNodeConfig = aztecNodeConfig;
63
+ return Promise.resolve();
69
64
  });
70
65
  await this.snapshotManager.snapshot('e2e_cross_chain_messaging', async ()=>{
71
66
  // Create the token contract state.
72
67
  // Move this account thing to addAccounts above?
73
68
  this.logger.verbose(`Public deploy accounts...`);
74
- await publicDeployAccounts(this.user1Wallet, this.accounts.slice(0, 3));
69
+ await publicDeployAccounts(this.wallet, [
70
+ this.ownerAddress,
71
+ this.user1Address,
72
+ this.user2Address
73
+ ]);
75
74
  this.l1Client = createExtendedL1Client(this.aztecNodeConfig.l1RpcUrls, MNEMONIC);
76
75
  const underlyingERC20Address = await deployL1Contract(this.l1Client, TestERC20Abi, TestERC20Bytecode, [
77
76
  'Underlying',
@@ -79,15 +78,14 @@ export class CrossChainMessagingTest {
79
78
  this.l1Client.account.address
80
79
  ]).then(({ address })=>address);
81
80
  this.logger.verbose(`Setting up cross chain harness...`);
82
- this.crossChainTestHarness = await CrossChainTestHarness.new(this.aztecNode, this.pxe, this.l1Client, this.user1Wallet, this.user1Address, this.logger, underlyingERC20Address);
81
+ this.crossChainTestHarness = await CrossChainTestHarness.new(this.aztecNode, this.l1Client, this.wallet, this.ownerAddress, this.logger, underlyingERC20Address);
83
82
  this.logger.verbose(`L2 token deployed to: ${this.crossChainTestHarness.l2Token.address}`);
84
83
  return this.crossChainTestHarness.toCrossChainContext();
85
84
  }, async (crossChainContext)=>{
86
- this.l2Token = await TokenContract.at(crossChainContext.l2Token, this.user1Wallet);
87
- this.l2Bridge = await TokenBridgeContract.at(crossChainContext.l2Bridge, this.user1Wallet);
85
+ this.l2Token = await TokenContract.at(crossChainContext.l2Token, this.wallet);
86
+ this.l2Bridge = await TokenBridgeContract.at(crossChainContext.l2Bridge, this.wallet);
88
87
  // There is an issue with the reviver so we are getting strings sometimes. Working around it here.
89
88
  this.ethAccount = EthAddress.fromString(crossChainContext.ethAccount.toString());
90
- this.ownerAddress = AztecAddress.fromString(crossChainContext.ownerAddress.toString());
91
89
  const tokenPortalAddress = EthAddress.fromString(crossChainContext.tokenPortal.toString());
92
90
  const l1Client = createExtendedL1Client(this.aztecNodeConfig.l1RpcUrls, MNEMONIC);
93
91
  const inbox = getContract({
@@ -100,7 +98,7 @@ export class CrossChainMessagingTest {
100
98
  abi: OutboxAbi,
101
99
  client: l1Client
102
100
  });
103
- this.crossChainTestHarness = new CrossChainTestHarness(this.aztecNode, this.pxe, this.logger, this.l2Token, this.l2Bridge, this.ethAccount, tokenPortalAddress, crossChainContext.underlying, l1Client, this.aztecNodeConfig.l1Contracts, this.user1Wallet, this.user1Address);
101
+ this.crossChainTestHarness = new CrossChainTestHarness(this.aztecNode, this.logger, this.l2Token, this.l2Bridge, this.ethAccount, tokenPortalAddress, crossChainContext.underlying, l1Client, this.aztecNodeConfig.l1Contracts, this.wallet, this.ownerAddress);
104
102
  this.l1Client = l1Client;
105
103
  this.inbox = inbox;
106
104
  this.outbox = outbox;
@@ -1,11 +1,18 @@
1
- import { type AccountWallet, type AztecAddress, type AztecNode, type ContractArtifact, type ContractBase, Fr, type Logger, type PXE, type PublicKeys, type Wallet } from '@aztec/aztec.js';
1
+ import type { ContractArtifact } from '@aztec/aztec.js/abi';
2
+ import type { AztecAddress } from '@aztec/aztec.js/addresses';
3
+ import { type ContractBase } from '@aztec/aztec.js/contracts';
4
+ import { Fr } from '@aztec/aztec.js/fields';
5
+ import type { PublicKeys } from '@aztec/aztec.js/keys';
6
+ import { type Logger } from '@aztec/aztec.js/log';
7
+ import type { AztecNode } from '@aztec/aztec.js/node';
8
+ import type { Wallet } from '@aztec/aztec.js/wallet';
2
9
  import type { StatefulTestContract } from '@aztec/noir-test-contracts.js/StatefulTest';
3
10
  import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
11
+ import type { TestWallet } from '@aztec/test-wallet/server';
4
12
  export declare class DeployTest {
5
13
  private snapshotManager;
6
14
  logger: Logger;
7
- pxe: PXE;
8
- wallet: AccountWallet;
15
+ wallet: TestWallet;
9
16
  defaultAccountAddress: AztecAddress;
10
17
  aztecNode: AztecNode;
11
18
  aztecNodeAdmin: AztecNodeAdmin;
@@ -20,7 +27,6 @@ export declare class DeployTest {
20
27
  constructorName?: string;
21
28
  deployer?: AztecAddress;
22
29
  }): Promise<T>;
23
- registerRandomAccount(): Promise<AztecAddress>;
24
30
  }
25
31
  export type StatefulContractCtorArgs = Parameters<StatefulTestContract['methods']['constructor']>;
26
32
  export type ContractArtifactClass<T extends ContractBase> = {
@@ -1 +1 @@
1
- {"version":3,"file":"deploy_test.d.ts","sourceRoot":"","sources":["../../src/e2e_deploy_contract/deploy_test.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,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ACxB,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC;QACjB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,EAAE,YAAY,CAAC;KACpB,GACL,OAAO,CAAC,CAAC,CAAC;CAYd;AAED,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC;AAElG,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,YAAY,IAAI;IAC1D,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACtD,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC"}
@@ -1,11 +1,11 @@
1
- import { getSchnorrWallet } from '@aztec/accounts/schnorr';
2
- import { Fr, createLogger, getContractInstanceFromInstantiationParams } from '@aztec/aztec.js';
1
+ import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
2
+ import { Fr } from '@aztec/aztec.js/fields';
3
+ import { createLogger } from '@aztec/aztec.js/log';
3
4
  import { createSnapshotManager, deployAccounts } from '../fixtures/snapshot_manager.js';
4
5
  const { E2E_DATA_PATH: dataPath } = process.env;
5
6
  export class DeployTest {
6
7
  snapshotManager;
7
8
  logger;
8
- pxe;
9
9
  wallet;
10
10
  defaultAccountAddress;
11
11
  aztecNode;
@@ -17,7 +17,7 @@ export class DeployTest {
17
17
  async setup() {
18
18
  await this.applyInitialAccountSnapshot();
19
19
  const context = await this.snapshotManager.setup();
20
- ({ pxe: this.pxe, aztecNode: this.aztecNode } = context);
20
+ ({ aztecNode: this.aztecNode, wallet: this.wallet } = context);
21
21
  this.aztecNodeAdmin = context.aztecNode;
22
22
  return this;
23
23
  }
@@ -25,11 +25,9 @@ export class DeployTest {
25
25
  await this.snapshotManager.teardown();
26
26
  }
27
27
  async applyInitialAccountSnapshot() {
28
- await this.snapshotManager.snapshot('initial_account', deployAccounts(1, this.logger), async ({ deployedAccounts }, { pxe })=>{
29
- const wallets = await Promise.all(deployedAccounts.map((a)=>getSchnorrWallet(pxe, a.address, a.signingKey)));
30
- wallets.forEach((w, i)=>this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
31
- this.wallet = wallets[0];
32
- this.defaultAccountAddress = this.wallet.getAddress();
28
+ await this.snapshotManager.snapshot('initial_account', deployAccounts(1, this.logger), ({ deployedAccounts })=>{
29
+ this.defaultAccountAddress = deployedAccounts[0].address;
30
+ return Promise.resolve();
33
31
  });
34
32
  }
35
33
  async registerContract(wallet, contractArtifact, opts = {}) {
@@ -37,18 +35,11 @@ export class DeployTest {
37
35
  const instance = await getContractInstanceFromInstantiationParams(contractArtifact.artifact, {
38
36
  constructorArgs: initArgs ?? [],
39
37
  constructorArtifact: constructorName,
40
- salt,
38
+ salt: salt ?? Fr.random(),
41
39
  publicKeys,
42
40
  deployer
43
41
  });
44
- await wallet.registerContract({
45
- artifact: contractArtifact.artifact,
46
- instance
47
- });
42
+ await wallet.registerContract(instance, contractArtifact.artifact);
48
43
  return contractArtifact.at(instance.address, wallet);
49
44
  }
50
- async registerRandomAccount() {
51
- const completeAddress = await this.pxe.registerAccount(Fr.random(), Fr.random());
52
- return completeAddress.address;
53
- }
54
45
  }
@@ -1,10 +1,13 @@
1
1
  import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
2
- import { Fr, type Logger, type Wallet } from '@aztec/aztec.js';
2
+ import { Fr } from '@aztec/aztec.js/fields';
3
+ import type { Logger } from '@aztec/aztec.js/log';
4
+ import type { Wallet } from '@aztec/aztec.js/wallet';
5
+ import { EpochCache } from '@aztec/epoch-cache';
3
6
  import { type ExtendedViemWalletClient } from '@aztec/ethereum';
4
7
  import { RollupContract } from '@aztec/ethereum/contracts';
5
8
  import { ChainMonitor, type Delayer } from '@aztec/ethereum/test';
6
9
  import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
7
- import { ProverNode } from '@aztec/prover-node';
10
+ import { ProverNode, type ProverNodeConfig } from '@aztec/prover-node';
8
11
  import { type SequencerClient, type SequencerEvents } from '@aztec/sequencer-client';
9
12
  import { EthAddress, type L2BlockNumber } from '@aztec/stdlib/block';
10
13
  import { type L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
@@ -35,6 +38,7 @@ export declare class EpochsTestContext {
35
38
  constants: L1RollupConstants;
36
39
  logger: Logger;
37
40
  monitor: ChainMonitor;
41
+ epochCache: EpochCache;
38
42
  proverDelayer: Delayer;
39
43
  sequencerDelayer: Delayer;
40
44
  proverNodes: ProverNode[];
@@ -51,7 +55,9 @@ export declare class EpochsTestContext {
51
55
  };
52
56
  setup(opts?: EpochsTestOpts): Promise<void>;
53
57
  teardown(): Promise<void>;
54
- createProverNode(): Promise<ProverNode>;
58
+ createProverNode(opts?: {
59
+ dontStart?: boolean;
60
+ } & Partial<ProverNodeConfig>): Promise<ProverNode>;
55
61
  createNonValidatorNode(opts?: Partial<AztecNodeConfig>): Promise<AztecNodeService>;
56
62
  createValidatorNode(privateKeys: `0x${string}`[], opts?: Partial<AztecNodeConfig> & {
57
63
  txDelayerMaxInclusionTimeIntoSlot?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"epochs_test.d.ts","sourceRoot":"","sources":["../../src/e2e_epochs/epochs_test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EACL,EAAE,EACF,KAAK,MAAM,EAEX,KAAK,MAAM,EAKZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAA4B,KAAK,wBAAwB,EAA0B,MAAM,iBAAiB,CAAC;AAClH,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAkB,KAAK,OAAO,EAAqC,MAAM,sBAAsB,CAAC;AAIrH,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAElE,OAAO,EAAE,UAA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CAAA;KAAO;YAMtG,UAAU;IAsDxB,OAAO,CAAC,iBAAiB;IAKzB,0FAA0F;IAC7E,oBAAoB,CAAC,KAAK,EAAE,MAAM;IAY/C,sDAAsD;IACzC,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,SAAK;IAShE,iEAAiE;IACpD,4BAA4B,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,SAAK;IAUjE,kFAAkF;IACrE,wCAAwC,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IAUlF,mEAAmE;IACtD,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,WAAW,GAAG,UAAU;IAoB7F,sDAAsD;IACzC,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,KAAU;IAYhE,0GAA0G;IAC7F,cAAc;;;;IAc3B,0EAA0E;IAC7D,mBAAmB,CAAC,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,OAAO;IAW9E,oBAAoB,CACzB,UAAU,EAAE,eAAe,EAAE,EAC7B,WAAW,GAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAc;;;;CAiD/D"}
@@ -1,11 +1,17 @@
1
1
  import { AztecNodeService } from '@aztec/aztec-node';
2
- import { Fr, MerkleTreeId, getContractInstanceFromInstantiationParams, getTimestampRangeForEpoch, retryUntil, sleep } from '@aztec/aztec.js';
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 { MerkleTreeId } from '@aztec/aztec.js/trees';
6
+ import { EpochCache } from '@aztec/epoch-cache';
3
7
  import { DefaultL1ContractsConfig, createExtendedL1Client } from '@aztec/ethereum';
4
8
  import { RollupContract } from '@aztec/ethereum/contracts';
5
9
  import { ChainMonitor, DelayedTxUtils, waitUntilL1Timestamp, withDelayer } from '@aztec/ethereum/test';
6
10
  import { SecretValue } from '@aztec/foundation/config';
7
11
  import { randomBytes } from '@aztec/foundation/crypto';
8
12
  import { withLogNameSuffix } from '@aztec/foundation/log';
13
+ import { retryUntil } from '@aztec/foundation/retry';
14
+ import { sleep } from '@aztec/foundation/sleep';
9
15
  import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
10
16
  import { getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
11
17
  import { SequencerState } from '@aztec/sequencer-client';
@@ -30,6 +36,7 @@ export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
30
36
  constants;
31
37
  logger;
32
38
  monitor;
39
+ epochCache;
33
40
  proverDelayer;
34
41
  sequencerDelayer;
35
42
  proverNodes = [];
@@ -81,9 +88,6 @@ export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
81
88
  // using the prover's eth address if the proverId is used for something in the rollup contract
82
89
  // Use numeric EthAddress for deterministic prover id
83
90
  proverId: EthAddress.fromNumber(1),
84
- // This must be enough so that the tx from the prover is delayed properly,
85
- // but not so much to hang the sequencer and timeout the teardown
86
- txPropagationMaxQueryAttempts: opts.txPropagationMaxQueryAttempts ?? 12,
87
91
  worldStateBlockHistory: WORLD_STATE_BLOCK_HISTORY,
88
92
  exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
89
93
  slasherFlavor: 'none',
@@ -99,6 +103,9 @@ export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
99
103
  this.logger = context.logger;
100
104
  this.l1Client = context.deployL1ContractsValues.l1Client;
101
105
  this.rollup = RollupContract.getFromConfig(context.config);
106
+ this.epochCache = await EpochCache.create(this.rollup, context.config, {
107
+ dateProvider: context.dateProvider
108
+ });
102
109
  // Loop that tracks L1 and L2 block numbers and logs whenever there's a new one.
103
110
  this.monitor = new ChainMonitor(this.rollup, context.dateProvider, this.logger).start();
104
111
  // This is hideous.
@@ -126,15 +133,17 @@ export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
126
133
  await Promise.all(this.nodes.map((node)=>tryStop(node, this.logger)));
127
134
  await this.context.teardown();
128
135
  }
129
- async createProverNode() {
136
+ async createProverNode(opts = {}) {
130
137
  this.logger.warn('Creating and syncing a simulated prover node...');
131
138
  const proverNodePrivateKey = this.getNextPrivateKey();
132
139
  const suffix = (this.proverNodes.length + 1).toString();
133
140
  const proverNode = await withLogNameSuffix(suffix, ()=>createAndSyncProverNode(proverNodePrivateKey, {
134
- ...this.context.config,
135
- proverId: EthAddress.fromNumber(parseInt(suffix, 10))
141
+ ...this.context.config
136
142
  }, {
137
- dataDirectory: join(this.context.config.dataDirectory, randomBytes(8).toString('hex'))
143
+ dataDirectory: join(this.context.config.dataDirectory, randomBytes(8).toString('hex')),
144
+ proverId: EthAddress.fromNumber(parseInt(suffix, 10)),
145
+ dontStart: opts.dontStart,
146
+ ...opts
138
147
  }, this.context.aztecNode, undefined, {
139
148
  dateProvider: this.context.dateProvider
140
149
  }));
@@ -255,10 +264,7 @@ export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
255
264
  publicKeys: undefined,
256
265
  deployer: undefined
257
266
  });
258
- await wallet.registerContract({
259
- artifact: SpamContract.artifact,
260
- instance
261
- });
267
+ await wallet.registerContract(instance, SpamContract.artifact);
262
268
  return SpamContract.at(instance.address, wallet);
263
269
  }
264
270
  /** Creates an L1 client using a fresh account with funds from anvil, with a tx delayer already set up. */ async createL1Client() {
@@ -318,7 +324,7 @@ export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
318
324
  sequencer.getSequencer().on(eventName, (args)=>{
319
325
  const evt = makeEvent(i, eventName, args);
320
326
  failEvents.push(evt);
321
- this.logger.error(`Failed event ${eventName} from sequencer ${sequencerIndex}`, evt);
327
+ this.logger.error(`Failed event ${eventName} from sequencer ${sequencerIndex}`, undefined, evt);
322
328
  });
323
329
  });
324
330
  });