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

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 (126) hide show
  1. package/dest/bench/client_flows/benchmark.d.ts +1 -1
  2. package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/client_flows_benchmark.d.ts +8 -1
  4. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  5. package/dest/bench/client_flows/client_flows_benchmark.js +53 -30
  6. package/dest/bench/client_flows/config.d.ts +1 -1
  7. package/dest/bench/client_flows/data_extractor.d.ts +1 -1
  8. package/dest/bench/client_flows/data_extractor.js +5 -27
  9. package/dest/bench/utils.d.ts +2 -2
  10. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +1 -1
  11. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  12. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +2 -2
  13. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +1 -1
  14. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  15. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +4 -3
  16. package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -2
  17. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  18. package/dest/e2e_epochs/epochs_test.d.ts +9 -8
  19. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  20. package/dest/e2e_epochs/epochs_test.js +8 -7
  21. package/dest/e2e_fees/bridging_race.notest.d.ts +1 -1
  22. package/dest/e2e_fees/bridging_race.notest.js +1 -1
  23. package/dest/e2e_fees/fees_test.d.ts +3 -2
  24. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  25. package/dest/e2e_fees/fees_test.js +12 -9
  26. package/dest/e2e_l1_publisher/write_json.d.ts +1 -1
  27. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  28. package/dest/e2e_l1_publisher/write_json.js +5 -4
  29. package/dest/e2e_multi_validator/utils.d.ts +1 -1
  30. package/dest/e2e_nested_contract/nested_contract_test.d.ts +1 -1
  31. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  32. package/dest/e2e_nested_contract/nested_contract_test.js +4 -3
  33. package/dest/e2e_p2p/inactivity_slash_test.d.ts +2 -2
  34. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
  35. package/dest/e2e_p2p/inactivity_slash_test.js +6 -2
  36. package/dest/e2e_p2p/p2p_network.d.ts +214 -9
  37. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  38. package/dest/e2e_p2p/p2p_network.js +5 -3
  39. package/dest/e2e_p2p/shared.d.ts +5 -5
  40. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  41. package/dest/e2e_p2p/shared.js +6 -5
  42. package/dest/e2e_token_contract/token_contract_test.d.ts +1 -1
  43. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  44. package/dest/e2e_token_contract/token_contract_test.js +2 -2
  45. package/dest/fixtures/e2e_prover_test.d.ts +3 -1
  46. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  47. package/dest/fixtures/e2e_prover_test.js +18 -14
  48. package/dest/fixtures/fixtures.d.ts +1 -1
  49. package/dest/fixtures/fixtures.d.ts.map +1 -1
  50. package/dest/fixtures/fixtures.js +1 -1
  51. package/dest/fixtures/get_acvm_config.d.ts +1 -1
  52. package/dest/fixtures/get_bb_config.d.ts +1 -1
  53. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  54. package/dest/fixtures/index.d.ts +1 -1
  55. package/dest/fixtures/l1_to_l2_messaging.d.ts +1 -1
  56. package/dest/fixtures/logging.d.ts +1 -1
  57. package/dest/fixtures/setup_l1_contracts.d.ts +475 -4
  58. package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
  59. package/dest/fixtures/setup_p2p_test.d.ts +4 -4
  60. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  61. package/dest/fixtures/setup_p2p_test.js +15 -7
  62. package/dest/fixtures/snapshot_manager.d.ts +2 -2
  63. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  64. package/dest/fixtures/token_utils.d.ts +5 -2
  65. package/dest/fixtures/token_utils.d.ts.map +1 -1
  66. package/dest/fixtures/token_utils.js +7 -4
  67. package/dest/fixtures/utils.d.ts +451 -5
  68. package/dest/fixtures/utils.d.ts.map +1 -1
  69. package/dest/fixtures/utils.js +11 -12
  70. package/dest/fixtures/web3signer.d.ts +1 -1
  71. package/dest/fixtures/with_telemetry_utils.d.ts +1 -1
  72. package/dest/index.d.ts +1 -1
  73. package/dest/quality_of_service/alert_checker.d.ts +1 -1
  74. package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
  75. package/dest/shared/cross_chain_test_harness.d.ts +3 -13
  76. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  77. package/dest/shared/gas_portal_test_harness.d.ts +1 -11
  78. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  79. package/dest/shared/gas_portal_test_harness.js +1 -1
  80. package/dest/shared/index.d.ts +1 -1
  81. package/dest/shared/jest_setup.d.ts +1 -1
  82. package/dest/shared/submit-transactions.d.ts +1 -1
  83. package/dest/shared/submit-transactions.d.ts.map +1 -1
  84. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  85. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  86. package/dest/shared/uniswap_l1_l2.js +11 -11
  87. package/dest/simulators/index.d.ts +1 -1
  88. package/dest/simulators/lending_simulator.d.ts +1 -5
  89. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  90. package/dest/simulators/lending_simulator.js +4 -2
  91. package/dest/simulators/token_simulator.d.ts +1 -1
  92. package/dest/simulators/token_simulator.d.ts.map +1 -1
  93. package/dest/spartan/setup_test_wallets.d.ts +5 -3
  94. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  95. package/dest/spartan/setup_test_wallets.js +43 -9
  96. package/dest/spartan/utils.d.ts +22 -19
  97. package/dest/spartan/utils.d.ts.map +1 -1
  98. package/dest/spartan/utils.js +66 -33
  99. package/package.json +42 -40
  100. package/src/bench/client_flows/client_flows_benchmark.ts +75 -30
  101. package/src/bench/client_flows/data_extractor.ts +6 -28
  102. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +2 -2
  103. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +4 -3
  104. package/src/e2e_deploy_contract/deploy_test.ts +1 -1
  105. package/src/e2e_epochs/epochs_test.ts +15 -14
  106. package/src/e2e_fees/bridging_race.notest.ts +1 -1
  107. package/src/e2e_fees/fees_test.ts +15 -11
  108. package/src/e2e_l1_publisher/write_json.ts +5 -4
  109. package/src/e2e_nested_contract/nested_contract_test.ts +4 -3
  110. package/src/e2e_p2p/inactivity_slash_test.ts +6 -2
  111. package/src/e2e_p2p/p2p_network.ts +7 -3
  112. package/src/e2e_p2p/shared.ts +8 -5
  113. package/src/e2e_token_contract/token_contract_test.ts +2 -2
  114. package/src/fixtures/e2e_prover_test.ts +15 -16
  115. package/src/fixtures/fixtures.ts +1 -2
  116. package/src/fixtures/setup_p2p_test.ts +20 -6
  117. package/src/fixtures/token_utils.ts +4 -4
  118. package/src/fixtures/utils.ts +36 -17
  119. package/src/guides/up_quick_start.sh +1 -1
  120. package/src/shared/cross_chain_test_harness.ts +2 -1
  121. package/src/shared/gas_portal_test_harness.ts +1 -1
  122. package/src/shared/uniswap_l1_l2.ts +11 -11
  123. package/src/simulators/lending_simulator.ts +4 -2
  124. package/src/spartan/DEVELOP.md +7 -0
  125. package/src/spartan/setup_test_wallets.ts +47 -11
  126. package/src/spartan/utils.ts +73 -32
@@ -90,7 +90,7 @@ export class TokenContractTest {
90
90
  },
91
91
  async ({ tokenContractAddress, badAccountAddress }) => {
92
92
  // Restore the token contract state.
93
- this.asset = await TokenContract.at(tokenContractAddress, this.wallet);
93
+ this.asset = TokenContract.at(tokenContractAddress, this.wallet);
94
94
  this.logger.verbose(`Token contract address: ${this.asset.address}`);
95
95
 
96
96
  this.tokenSim = new TokenSimulator(this.asset, this.wallet, this.adminAddress, this.logger, [
@@ -98,7 +98,7 @@ export class TokenContractTest {
98
98
  this.account1Address,
99
99
  ]);
100
100
 
101
- this.badAccount = await InvalidAccountContract.at(badAccountAddress, this.wallet);
101
+ this.badAccount = InvalidAccountContract.at(badAccountAddress, this.wallet);
102
102
  this.logger.verbose(`Bad account address: ${this.badAccount.address}`);
103
103
 
104
104
  expect(await this.asset.methods.get_admin().simulate({ from: this.adminAddress })).toBe(
@@ -10,6 +10,7 @@ import {
10
10
  QueuedIVCVerifier,
11
11
  TestCircuitVerifier,
12
12
  } from '@aztec/bb-prover';
13
+ import { BackendType, Barretenberg } from '@aztec/bb.js';
13
14
  import { createBlobSinkClient } from '@aztec/blob-sink/client';
14
15
  import type { BlobSinkServer } from '@aztec/blob-sink/server';
15
16
  import type { DeployL1ContractsReturnType } from '@aztec/ethereum';
@@ -18,6 +19,7 @@ import { SecretValue } from '@aztec/foundation/config';
18
19
  import { FeeAssetHandlerAbi } from '@aztec/l1-artifacts';
19
20
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
20
21
  import { type ProverNode, type ProverNodeConfig, createProverNode } from '@aztec/prover-node';
22
+ import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
21
23
  import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
22
24
  import { TestWallet } from '@aztec/test-wallet/server';
23
25
  import { getGenesisValues } from '@aztec/world-state/testing';
@@ -62,6 +64,7 @@ export class FullProverTest {
62
64
  accounts: AztecAddress[] = [];
63
65
  deployedAccounts!: InitialAccountData[];
64
66
  fakeProofsAsset!: TokenContract;
67
+ fakeProofsAssetInstance!: ContractInstanceWithAddress;
65
68
  tokenSim!: TokenSimulator;
66
69
  aztecNode!: AztecNode;
67
70
  aztecNodeAdmin!: AztecNodeAdmin;
@@ -121,7 +124,7 @@ export class FullProverTest {
121
124
  await publicDeployAccounts(this.wallet, this.accounts.slice(0, 2));
122
125
 
123
126
  this.logger.verbose(`Deploying TokenContract...`);
124
- const asset = await TokenContract.deploy(
127
+ const { contract: asset, instance } = await TokenContract.deploy(
125
128
  this.wallet,
126
129
  this.accounts[0],
127
130
  FullProverTest.TOKEN_NAME,
@@ -129,14 +132,15 @@ export class FullProverTest {
129
132
  FullProverTest.TOKEN_DECIMALS,
130
133
  )
131
134
  .send({ from: this.accounts[0] })
132
- .deployed();
135
+ .wait();
133
136
  this.logger.verbose(`Token deployed to ${asset.address}`);
134
137
 
135
- return { tokenContractAddress: asset.address };
138
+ return { tokenContractAddress: asset.address, tokenContractInstance: instance };
136
139
  },
137
- async ({ tokenContractAddress }) => {
140
+ async ({ tokenContractAddress, tokenContractInstance }) => {
138
141
  // Restore the token contract state.
139
- this.fakeProofsAsset = await TokenContract.at(tokenContractAddress, this.wallet);
142
+ this.fakeProofsAsset = TokenContract.at(tokenContractAddress, this.wallet);
143
+ this.fakeProofsAssetInstance = tokenContractInstance;
140
144
  this.logger.verbose(`Token contract address: ${this.fakeProofsAsset.address}`);
141
145
 
142
146
  this.tokenSim = new TokenSimulator(
@@ -183,9 +187,7 @@ export class FullProverTest {
183
187
  this.acvmConfigCleanup = acvmConfig.cleanup;
184
188
  this.bbConfigCleanup = bbConfig.cleanup;
185
189
 
186
- if (!bbConfig?.bbWorkingDirectory || !bbConfig?.bbBinaryPath) {
187
- throw new Error(`Test must be run with BB native configuration`);
188
- }
190
+ await Barretenberg.initSingleton({ backend: BackendType.NativeUnixSocket });
189
191
 
190
192
  const verifier = await BBCircuitVerifier.new(bbConfig);
191
193
  this.circuitProofVerifier = new QueuedIVCVerifier(bbConfig, verifier);
@@ -212,23 +214,19 @@ export class FullProverTest {
212
214
  this.logger.verbose(`Main setup completed, initializing full prover PXE, Node, and Prover Node`);
213
215
  const { wallet: provenWallet, teardown: provenTeardown } = await setupPXEAndGetWallet(
214
216
  this.aztecNode,
215
- {
216
- proverEnabled: this.realProofs,
217
- bbBinaryPath: bbConfig?.bbBinaryPath,
218
- bbWorkingDirectory: bbConfig?.bbWorkingDirectory,
219
- },
217
+ { proverEnabled: this.realProofs },
220
218
  undefined,
221
219
  true,
222
220
  );
223
221
  this.logger.debug(`Contract address ${this.fakeProofsAsset.address}`);
224
- await provenWallet.registerContract(this.fakeProofsAsset);
222
+ await provenWallet.registerContract(this.fakeProofsAssetInstance, TokenContract.artifact);
225
223
 
226
224
  for (let i = 0; i < 2; i++) {
227
225
  await provenWallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
228
226
  await this.wallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
229
227
  }
230
228
 
231
- const asset = await TokenContract.at(this.fakeProofsAsset.address, provenWallet);
229
+ const asset = TokenContract.at(this.fakeProofsAsset.address, provenWallet);
232
230
  this.provenComponents.push({
233
231
  wallet: provenWallet,
234
232
  teardown: provenTeardown,
@@ -245,7 +243,7 @@ export class FullProverTest {
245
243
  this.logger.verbose('Starting archiver for new prover node');
246
244
  const archiver = await createArchiver(
247
245
  { ...this.context.aztecNodeConfig, dataDirectory: undefined },
248
- { blobSinkClient },
246
+ { blobSinkClient, dateProvider: this.context.dateProvider },
249
247
  { blockUntilSync: true },
250
248
  );
251
249
 
@@ -321,6 +319,7 @@ export class FullProverTest {
321
319
  // clean up the full prover node
322
320
  await this.proverNode.stop();
323
321
 
322
+ await Barretenberg.destroySingleton();
324
323
  await this.bbConfigCleanup?.();
325
324
  await this.acvmConfigCleanup?.();
326
325
  }
@@ -22,8 +22,7 @@ export const BITSIZE_TOO_BIG_ERROR = "Assertion failed: call to assert_max_bit_s
22
22
  export const DUPLICATE_NULLIFIER_ERROR = /dropped|nullifier|reverted/i;
23
23
  export const NO_L1_TO_L2_MSG_ERROR =
24
24
  /No non-nullified L1 to L2 message found for message hash|Tried to consume nonexistent L1-to-L2 message/;
25
- export const STATIC_CALL_STATE_MODIFICATION_ERROR =
26
- /Static call cannot update the state, emit L2->L1 messages or generate logs.*/;
25
+ export const STATIC_CALL_STATE_MODIFICATION_ERROR = /Static call cannot update the state.*/;
27
26
  export const STATIC_CONTEXT_ASSERTION_ERROR = /Assertion failed: Function .* can only be called statically.*/;
28
27
 
29
28
  export const DEFAULT_BLOB_SINK_PORT = '5052';
@@ -2,6 +2,7 @@
2
2
  * Test fixtures and utilities to set up and run a test using multiple validators
3
3
  */
4
4
  import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
5
+ import { range } from '@aztec/foundation/array';
5
6
  import { SecretValue } from '@aztec/foundation/config';
6
7
  import { addLogNameHandler, removeLogNameHandler } from '@aztec/foundation/log';
7
8
  import { bufferToHex } from '@aztec/foundation/string';
@@ -40,6 +41,7 @@ export async function createNodes(
40
41
  dataDirectory?: string,
41
42
  metricsPort?: number,
42
43
  indexOffset = 0,
44
+ validatorsPerNode = 1,
43
45
  ): Promise<AztecNodeService[]> {
44
46
  const nodePromises: Promise<AztecNodeService>[] = [];
45
47
  const loggerIdStorage = new AsyncLocalStorage<string>();
@@ -52,13 +54,18 @@ export async function createNodes(
52
54
  // We run on ports from the bootnode upwards
53
55
  const port = bootNodePort + 1 + index;
54
56
 
57
+ // Determine validator indices for this node
58
+ const validatorIndices = validatorsPerNode === 1 ? index : range(validatorsPerNode, validatorsPerNode * index);
59
+
60
+ // Assign data directory
55
61
  const dataDir = dataDirectory ? `${dataDirectory}-${index}` : undefined;
62
+
56
63
  const nodePromise = createNode(
57
64
  config,
58
65
  dateProvider,
59
66
  port,
60
67
  bootstrapNodeEnr,
61
- index,
68
+ validatorIndices,
62
69
  prefilledPublicData,
63
70
  dataDir,
64
71
  metricsPort,
@@ -84,7 +91,7 @@ export async function createNode(
84
91
  dateProvider: DateProvider,
85
92
  tcpPort: number,
86
93
  bootstrapNode: string | undefined,
87
- addressIndex: number,
94
+ addressIndex: number | number[],
88
95
  prefilledPublicData?: PublicDataTreeLeaf[],
89
96
  dataDirectory?: string,
90
97
  metricsPort?: number,
@@ -188,16 +195,23 @@ export async function createValidatorConfig(
188
195
  config: AztecNodeConfig,
189
196
  bootstrapNodeEnr?: string,
190
197
  port?: number,
191
- addressIndex: number = 1,
198
+ addressIndex: number | number[] = 1,
192
199
  dataDirectory?: string,
193
200
  ) {
194
- const attesterPrivateKey = bufferToHex(getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + addressIndex)!);
201
+ const addressIndices = Array.isArray(addressIndex) ? addressIndex : [addressIndex];
202
+ if (addressIndices.length === 0) {
203
+ throw new Error('At least one address index must be provided to create a validator config');
204
+ }
205
+
206
+ const attesterPrivateKeys = addressIndices.map(index =>
207
+ bufferToHex(getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + index)!),
208
+ );
195
209
  const p2pConfig = await createP2PConfig(config, bootstrapNodeEnr, port, dataDirectory);
196
210
  const nodeConfig: AztecNodeConfig = {
197
211
  ...config,
198
212
  ...p2pConfig,
199
- validatorPrivateKeys: new SecretValue([attesterPrivateKey]),
200
- publisherPrivateKeys: [new SecretValue(attesterPrivateKey)],
213
+ validatorPrivateKeys: new SecretValue(attesterPrivateKeys),
214
+ publisherPrivateKeys: [new SecretValue(attesterPrivateKeys[0])],
201
215
  };
202
216
 
203
217
  return nodeConfig;
@@ -6,9 +6,9 @@ import { TokenContract } from '@aztec/noir-contracts.js/Token';
6
6
 
7
7
  export async function deployToken(wallet: Wallet, admin: AztecAddress, initialAdminBalance: bigint, logger: Logger) {
8
8
  logger.info(`Deploying Token contract...`);
9
- const contract = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18)
9
+ const { contract, instance } = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18)
10
10
  .send({ from: admin })
11
- .deployed();
11
+ .wait();
12
12
 
13
13
  if (initialAdminBalance > 0n) {
14
14
  await mintTokensToPrivate(contract, admin, admin, initialAdminBalance);
@@ -16,7 +16,7 @@ export async function deployToken(wallet: Wallet, admin: AztecAddress, initialAd
16
16
 
17
17
  logger.info('L2 contract deployed');
18
18
 
19
- return contract;
19
+ return { contract, instance };
20
20
  }
21
21
 
22
22
  export async function mintTokensToPrivate(
@@ -36,7 +36,7 @@ export async function expectTokenBalance(
36
36
  logger: Logger,
37
37
  ) {
38
38
  // Then check the balance
39
- const contractWithWallet = await TokenContract.at(token.address, wallet);
39
+ const contractWithWallet = TokenContract.at(token.address, wallet);
40
40
  const balance = await contractWithWallet.methods.balance_of_private(owner).simulate({ from: owner });
41
41
  logger.info(`Account ${owner} balance: ${balance}`);
42
42
  expect(balance).toBe(expectedBalance);
@@ -32,6 +32,7 @@ import {
32
32
  createDelayedL1TxUtilsFromViemWallet,
33
33
  startAnvil,
34
34
  } from '@aztec/ethereum/test';
35
+ import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
35
36
  import { SecretValue } from '@aztec/foundation/config';
36
37
  import { randomBytes } from '@aztec/foundation/crypto';
37
38
  import { EthAddress } from '@aztec/foundation/eth-address';
@@ -117,16 +118,26 @@ export const setupL1Contracts = async (
117
118
  args: Partial<DeployL1ContractsArgs> = {},
118
119
  chain: Chain = foundry,
119
120
  ) => {
120
- const l1Data = await deployL1Contracts(l1RpcUrls, account, chain, logger, {
121
- vkTreeRoot: getVKTreeRoot(),
122
- protocolContractsHash,
123
- genesisArchiveRoot: args.genesisArchiveRoot ?? new Fr(GENESIS_ARCHIVE_ROOT),
124
- salt: args.salt,
125
- initialValidators: args.initialValidators,
126
- ...getL1ContractsConfigEnvVars(),
127
- realVerifier: false,
128
- ...args,
129
- });
121
+ const l1Data = await deployL1Contracts(
122
+ l1RpcUrls,
123
+ account,
124
+ chain,
125
+ logger,
126
+ {
127
+ vkTreeRoot: getVKTreeRoot(),
128
+ protocolContractsHash,
129
+ genesisArchiveRoot: args.genesisArchiveRoot ?? new Fr(GENESIS_ARCHIVE_ROOT),
130
+ salt: args.salt,
131
+ initialValidators: args.initialValidators,
132
+ ...getL1ContractsConfigEnvVars(),
133
+ realVerifier: false,
134
+ ...args,
135
+ },
136
+ {
137
+ priorityFeeBumpPercentage: 0,
138
+ priorityFeeRetryBumpPercentage: 0,
139
+ },
140
+ );
130
141
 
131
142
  return l1Data;
132
143
  };
@@ -489,7 +500,7 @@ export async function setup(
489
500
  deployL1ContractsValues.l1ContractAddresses.rollupAddress,
490
501
  );
491
502
 
492
- const blockReward = await rollup.getBlockReward();
503
+ const blockReward = await rollup.getCheckpointReward();
493
504
  const mintAmount = 10_000n * (blockReward as bigint);
494
505
 
495
506
  const feeJuice = getContract({
@@ -636,7 +647,11 @@ export async function setup(
636
647
  (opts.initialValidators && opts.initialValidators.length > 0)
637
648
  ) {
638
649
  // We need to advance such that the committee is set up.
639
- await cheatCodes.rollup.advanceToEpoch((await cheatCodes.rollup.getEpoch()) + BigInt(config.lagInEpochs + 1));
650
+ await cheatCodes.rollup.advanceToEpoch(
651
+ EpochNumber.fromBigInt(
652
+ BigInt(await cheatCodes.rollup.getEpoch()) + BigInt(config.lagInEpochsForValidatorSet + 1),
653
+ ),
654
+ );
640
655
  await cheatCodes.rollup.setupEpoch();
641
656
  await cheatCodes.rollup.debugRollup();
642
657
  }
@@ -728,7 +743,7 @@ export async function setup(
728
743
 
729
744
  export async function ensureAccountContractsPublished(wallet: Wallet, accountsToDeploy: AztecAddress[]) {
730
745
  // We have to check whether the accounts are already deployed. This can happen if the test runs against
731
- // the sandbox and the test accounts exist
746
+ // the local network and the test accounts exist
732
747
  const accountsAndAddresses = await Promise.all(
733
748
  accountsToDeploy.map(async address => {
734
749
  return {
@@ -848,7 +863,7 @@ export async function setupSponsoredFPC(wallet: Wallet) {
848
863
  salt: new Fr(SPONSORED_FPC_SALT),
849
864
  });
850
865
 
851
- await wallet.registerContract({ instance, artifact: SponsoredFPCContract.artifact });
866
+ await wallet.registerContract(instance, SponsoredFPCContract.artifact);
852
867
  getLogger().info(`SponsoredFPC: ${instance.address}`);
853
868
  return instance;
854
869
  }
@@ -858,10 +873,10 @@ export async function setupSponsoredFPC(wallet: Wallet) {
858
873
  * @param wallet - The wallet
859
874
  */
860
875
  export async function registerSponsoredFPC(wallet: Wallet): Promise<void> {
861
- await wallet.registerContract({ instance: await getSponsoredFPCInstance(), artifact: SponsoredFPCContract.artifact });
876
+ await wallet.registerContract(await getSponsoredFPCInstance(), SponsoredFPCContract.artifact);
862
877
  }
863
878
 
864
- export async function waitForProvenChain(node: AztecNode, targetBlock?: number, timeoutSec = 60, intervalSec = 1) {
879
+ export async function waitForProvenChain(node: AztecNode, targetBlock?: BlockNumber, timeoutSec = 60, intervalSec = 1) {
865
880
  targetBlock ??= await node.getBlockNumber();
866
881
 
867
882
  await retryUntil(
@@ -893,7 +908,11 @@ export function createAndSyncProverNode(
893
908
 
894
909
  // Creating temp store and archiver for simulated prover node
895
910
  const archiverConfig = { ...aztecNodeConfig, dataDirectory: proverNodeConfig.dataDirectory };
896
- const archiver = await createArchiver(archiverConfig, { blobSinkClient }, { blockUntilSync: true });
911
+ const archiver = await createArchiver(
912
+ archiverConfig,
913
+ { blobSinkClient, dateProvider: proverNodeDeps.dateProvider },
914
+ { blockUntilSync: true },
915
+ );
897
916
 
898
917
  // Prover node config is for simulated proofs
899
918
  const proverConfig: ProverNodeConfig = {
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bash
2
- # Run locally from end-to-end folder while running anvil and sandbox with:
2
+ # Run locally from end-to-end folder while running anvil and local network with:
3
3
  # PATH=$PATH:../node_modules/.bin ./src/guides/up_quick_start.sh
4
4
  set -eux
5
5
 
@@ -14,6 +14,7 @@ import type { SiblingPath } from '@aztec/aztec.js/trees';
14
14
  import type { TxReceipt } from '@aztec/aztec.js/tx';
15
15
  import type { Wallet } from '@aztec/aztec.js/wallet';
16
16
  import { type ExtendedViemWalletClient, type L1ContractAddresses, deployL1Contract } from '@aztec/ethereum';
17
+ import { BlockNumber } from '@aztec/foundation/branded-types';
17
18
  import { retryUntil } from '@aztec/foundation/retry';
18
19
  import type { FieldsOf } from '@aztec/foundation/types';
19
20
  import { TestERC20Abi, TokenPortalAbi, TokenPortalBytecode } from '@aztec/l1-artifacts';
@@ -321,7 +322,7 @@ export class CrossChainTestHarness {
321
322
 
322
323
  withdrawFundsFromBridgeOnL1(
323
324
  amount: bigint,
324
- blockNumber: number | bigint,
325
+ blockNumber: BlockNumber,
325
326
  messageIndex: bigint,
326
327
  siblingPath: SiblingPath<number>,
327
328
  ) {
@@ -43,7 +43,7 @@ export class FeeJuicePortalTestingHarnessFactory {
43
43
  throw new Error('Fee Juice portal not deployed on L1');
44
44
  }
45
45
 
46
- const gasL2 = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, wallet);
46
+ const gasL2 = FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, wallet);
47
47
 
48
48
  return new GasBridgingTestHarness(
49
49
  aztecNode,
@@ -262,7 +262,7 @@ export const uniswapL1L2TestSuite = (
262
262
  await wethCrossChainHarness.expectPublicBalanceOnL2(uniswapL2Contract.address, 0n);
263
263
 
264
264
  // Since the outbox is only consumable when the block is proven, we need to set the block to be proven
265
- await cheatCodes.rollup.markAsProven(await rollup.getBlockNumber());
265
+ await cheatCodes.rollup.markAsProven(await rollup.getCheckpointNumber());
266
266
 
267
267
  // 5. Consume L2 to L1 message by calling uniswapPortal.swap_private()
268
268
  logger.info('Execute withdraw and swap on the uniswapPortal!');
@@ -287,7 +287,7 @@ export const uniswapL1L2TestSuite = (
287
287
  const withdrawSiblingPath = withdrawResult!.siblingPath;
288
288
 
289
289
  const withdrawMessageMetadata = {
290
- _l2BlockNumber: BigInt(l2UniswapInteractionReceipt.blockNumber!),
290
+ _checkpointNumber: BigInt(l2UniswapInteractionReceipt.blockNumber!),
291
291
  _leafIndex: BigInt(withdrawL2MessageIndex),
292
292
  _path: withdrawSiblingPath
293
293
  .toBufferArray()
@@ -295,7 +295,7 @@ export const uniswapL1L2TestSuite = (
295
295
  };
296
296
 
297
297
  const swapPrivateMessageMetadata = {
298
- _l2BlockNumber: BigInt(l2UniswapInteractionReceipt.blockNumber!),
298
+ _checkpointNumber: BigInt(l2UniswapInteractionReceipt.blockNumber!),
299
299
  _leafIndex: BigInt(swapPrivateL2MessageIndex),
300
300
  _path: swapPrivateSiblingPath
301
301
  .toBufferArray()
@@ -506,7 +506,7 @@ export const uniswapL1L2TestSuite = (
506
506
  // );
507
507
 
508
508
  // const withdrawMessageMetadata = {
509
- // _l2BlockNumber: BigInt(uniswapL2Interaction.blockNumber!),
509
+ // _checkpointNumber: BigInt(uniswapL2Interaction.blockNumber!),
510
510
  // _leafIndex: BigInt(withdrawL2MessageIndex),
511
511
  // _path: withdrawSiblingPath
512
512
  // .toBufferArray()
@@ -514,7 +514,7 @@ export const uniswapL1L2TestSuite = (
514
514
  // };
515
515
 
516
516
  // const swapPrivateMessageMetadata = {
517
- // _l2BlockNumber: BigInt(uniswapL2Interaction.blockNumber!),
517
+ // _checkpointNumber: BigInt(uniswapL2Interaction.blockNumber!),
518
518
  // _leafIndex: BigInt(swapPrivateL2MessageIndex),
519
519
  // _path: swapPrivateSiblingPath
520
520
  // .toBufferArray()
@@ -872,7 +872,7 @@ export const uniswapL1L2TestSuite = (
872
872
  const withdrawSiblingPath = withdrawResult!.siblingPath;
873
873
 
874
874
  const withdrawMessageMetadata = {
875
- _l2BlockNumber: BigInt(withdrawReceipt.blockNumber!),
875
+ _checkpointNumber: BigInt(withdrawReceipt.blockNumber!),
876
876
  _leafIndex: BigInt(withdrawL2MessageIndex),
877
877
  _path: withdrawSiblingPath
878
878
  .toBufferArray()
@@ -880,7 +880,7 @@ export const uniswapL1L2TestSuite = (
880
880
  };
881
881
 
882
882
  const swapPrivateMessageMetadata = {
883
- _l2BlockNumber: BigInt(withdrawReceipt.blockNumber!),
883
+ _checkpointNumber: BigInt(withdrawReceipt.blockNumber!),
884
884
  _leafIndex: BigInt(swapPrivateL2MessageIndex),
885
885
  _path: swapPrivateSiblingPath
886
886
  .toBufferArray()
@@ -891,7 +891,7 @@ export const uniswapL1L2TestSuite = (
891
891
  await wethCrossChainHarness.expectPrivateBalanceOnL2(ownerAddress, wethL2BalanceBeforeSwap - wethAmountToBridge);
892
892
 
893
893
  // Since the outbox is only consumable when the block is proven, we need to set the block to be proven
894
- await cheatCodes.rollup.markAsProven(await rollup.getBlockNumber());
894
+ await cheatCodes.rollup.markAsProven(await rollup.getCheckpointNumber());
895
895
 
896
896
  // On L1 call swap_public!
897
897
  logger.info('call swap_public on L1');
@@ -1007,7 +1007,7 @@ export const uniswapL1L2TestSuite = (
1007
1007
  const withdrawSiblingPath = withdrawResult!.siblingPath;
1008
1008
 
1009
1009
  const withdrawMessageMetadata = {
1010
- _l2BlockNumber: BigInt(withdrawReceipt.blockNumber!),
1010
+ _checkpointNumber: BigInt(withdrawReceipt.blockNumber!),
1011
1011
  _leafIndex: BigInt(withdrawL2MessageIndex),
1012
1012
  _path: withdrawSiblingPath
1013
1013
  .toBufferArray()
@@ -1015,7 +1015,7 @@ export const uniswapL1L2TestSuite = (
1015
1015
  };
1016
1016
 
1017
1017
  const swapPublicMessageMetadata = {
1018
- _l2BlockNumber: BigInt(withdrawReceipt.blockNumber!),
1018
+ _checkpointNumber: BigInt(withdrawReceipt.blockNumber!),
1019
1019
  _leafIndex: BigInt(swapPublicL2MessageIndex),
1020
1020
  _path: swapPublicSiblingPath
1021
1021
  .toBufferArray()
@@ -1026,7 +1026,7 @@ export const uniswapL1L2TestSuite = (
1026
1026
  await wethCrossChainHarness.expectPublicBalanceOnL2(ownerAddress, 0n);
1027
1027
 
1028
1028
  // Since the outbox is only consumable when the block is proven, we need to set the block to be proven
1029
- await cheatCodes.rollup.markAsProven(await rollup.getBlockNumber());
1029
+ await cheatCodes.rollup.markAsProven(await rollup.getCheckpointNumber());
1030
1030
 
1031
1031
  // Call swap_private on L1
1032
1032
  logger.info('Execute withdraw and swap on the uniswapPortal!');
@@ -3,6 +3,7 @@ import { AztecAddress } from '@aztec/aztec.js/addresses';
3
3
  import { Fr } from '@aztec/aztec.js/fields';
4
4
  import { CheatCodes } from '@aztec/aztec/testing';
5
5
  import type { RollupContract } from '@aztec/ethereum';
6
+ import { SlotNumber } from '@aztec/foundation/branded-types';
6
7
  import { pedersenHash } from '@aztec/foundation/crypto';
7
8
  import type { TestDateProvider } from '@aztec/foundation/timer';
8
9
  import type { LendingContract } from '@aztec/noir-contracts.js/Lending';
@@ -103,7 +104,8 @@ export class LendingSimulator {
103
104
  }
104
105
 
105
106
  const slot = await this.rollup.getSlotAt(BigInt(await this.cc.eth.timestamp()));
106
- const ts = Number(await this.rollup.getTimestampForSlot(slot + BigInt(diff)));
107
+ const targetSlot = SlotNumber(slot + diff);
108
+ const ts = Number(await this.rollup.getTimestampForSlot(targetSlot));
107
109
  const timeDiff = ts - this.time;
108
110
  this.time = ts;
109
111
 
@@ -112,7 +114,7 @@ export class LendingSimulator {
112
114
  if (dateProvider) {
113
115
  dateProvider.setTime(this.time * 1000);
114
116
  }
115
- await this.cc.rollup.markAsProven(await this.rollup.getBlockNumber());
117
+ await this.cc.rollup.markAsProven(await this.rollup.getCheckpointNumber());
116
118
  this.accumulator = muldivDown(this.accumulator, computeMultiplier(this.rate, BigInt(timeDiff)), BASE);
117
119
  }
118
120
 
@@ -61,10 +61,17 @@ The export is important there. The `AZTEC_DOCKER_IMAGE` env var is used as both:
61
61
  - the containers for the aztec infrastructure (validators, provers, etc)
62
62
 
63
63
  # Deploy Metrics
64
+
64
65
  ```bash
65
66
  ./spartan/bootstrap.sh metrics-kind
66
67
  ```
67
68
 
69
+ # Install Chaos Mesh
70
+
71
+ ```bash
72
+ ./spartan/bootstrap.sh chaos-mesh
73
+ ```
74
+
68
75
  # Deploy stuff
69
76
 
70
77
  ```bash
@@ -11,7 +11,7 @@ import type { Logger } from '@aztec/foundation/log';
11
11
  import { retryUntil } from '@aztec/foundation/retry';
12
12
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
13
13
  import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
14
- import { TestWallet, proveInteraction, registerInitialSandboxAccountsInWallet } from '@aztec/test-wallet/server';
14
+ import { TestWallet, proveInteraction, registerInitialLocalNetworkAccountsInWallet } from '@aztec/test-wallet/server';
15
15
 
16
16
  import { getACVMConfig } from '../fixtures/get_acvm_config.js';
17
17
  import { getBBConfig } from '../fixtures/get_bb_config.js';
@@ -28,6 +28,11 @@ export interface TestAccounts {
28
28
  tokenAddress: AztecAddress;
29
29
  }
30
30
 
31
+ export type TestAccountsWithoutTokens = Omit<
32
+ TestAccounts,
33
+ 'tokenAddress' | 'tokenContract' | 'tokenName' | 'tokenAdminAddress'
34
+ >;
35
+
31
36
  const TOKEN_NAME = 'USDC';
32
37
  const TOKEN_SYMBOL = 'USD';
33
38
  const TOKEN_DECIMALS = 18n;
@@ -42,14 +47,14 @@ export async function setupTestAccountsWithTokens(
42
47
  const aztecNode = createAztecNodeClient(nodeUrl);
43
48
  const wallet = await TestWallet.create(aztecNode);
44
49
 
45
- const [recipientAccount, ...accounts] = (await registerInitialSandboxAccountsInWallet(wallet)).slice(
50
+ const [recipientAccount, ...accounts] = (await registerInitialLocalNetworkAccountsInWallet(wallet)).slice(
46
51
  0,
47
52
  ACCOUNT_COUNT + 1,
48
53
  );
49
54
 
50
55
  const tokenAdmin = accounts[0];
51
56
  const tokenAddress = await deployTokenAndMint(wallet, accounts, tokenAdmin, mintAmount, undefined, logger);
52
- const tokenContract = await TokenContract.at(tokenAddress, wallet);
57
+ const tokenContract = TokenContract.at(tokenAddress, wallet);
53
58
 
54
59
  return {
55
60
  aztecNode,
@@ -63,7 +68,7 @@ export async function setupTestAccountsWithTokens(
63
68
  };
64
69
  }
65
70
 
66
- export async function deploySponsoredTestAccounts(
71
+ export async function deploySponsoredTestAccountsWithTokens(
67
72
  wallet: TestWallet,
68
73
  aztecNode: AztecNode,
69
74
  mintAmount: bigint,
@@ -96,7 +101,7 @@ export async function deploySponsoredTestAccounts(
96
101
  new SponsoredFeePaymentMethod(await getSponsoredFPCAddress()),
97
102
  logger,
98
103
  );
99
- const tokenContract = await TokenContract.at(tokenAddress, wallet);
104
+ const tokenContract = TokenContract.at(tokenAddress, wallet);
100
105
 
101
106
  return {
102
107
  aztecNode,
@@ -110,6 +115,37 @@ export async function deploySponsoredTestAccounts(
110
115
  };
111
116
  }
112
117
 
118
+ export async function deploySponsoredTestAccounts(
119
+ wallet: TestWallet,
120
+ aztecNode: AztecNode,
121
+ logger: Logger,
122
+ numberOfFundedWallets = 1,
123
+ ): Promise<TestAccountsWithoutTokens> {
124
+ const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
125
+ const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
126
+ const fundedAccounts = await Promise.all(funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt)));
127
+
128
+ await registerSponsoredFPC(wallet);
129
+
130
+ const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
131
+ const recipientDeployMethod = await recipientAccount.getDeployMethod();
132
+ await recipientDeployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait({ timeout: 2400 });
133
+ await Promise.all(
134
+ fundedAccounts.map(async a => {
135
+ const deployMethod = await a.getDeployMethod();
136
+ await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait({ timeout: 2400 }); // increase timeout on purpose in order to account for two empty epochs
137
+ logger.info(`Account deployed at ${a.address}`);
138
+ }),
139
+ );
140
+
141
+ return {
142
+ aztecNode,
143
+ wallet,
144
+ accounts: fundedAccounts.map(acc => acc.address),
145
+ recipientAddress: recipientAccount.address,
146
+ };
147
+ }
148
+
113
149
  export async function deployTestAccountsWithTokens(
114
150
  nodeUrl: string,
115
151
  l1RpcUrls: string[],
@@ -152,7 +188,7 @@ export async function deployTestAccountsWithTokens(
152
188
  undefined,
153
189
  logger,
154
190
  );
155
- const tokenContract = await TokenContract.at(tokenAddress, wallet);
191
+ const tokenContract = TokenContract.at(tokenAddress, wallet);
156
192
 
157
193
  return {
158
194
  aztecNode,
@@ -228,9 +264,9 @@ async function deployTokenAndMint(
228
264
  logger.verbose(`Minting ${mintAmount} public assets to the ${accounts.length} accounts...`);
229
265
 
230
266
  await Promise.all(
231
- accounts.map(async acc =>
232
- (await TokenContract.at(tokenAddress, wallet)).methods
233
- .mint_to_public(acc, mintAmount)
267
+ accounts.map(acc =>
268
+ TokenContract.at(tokenAddress, wallet)
269
+ .methods.mint_to_public(acc, mintAmount)
234
270
  .send({ from: admin, fee: { paymentMethod } })
235
271
  .wait({ timeout: 600 }),
236
272
  ),
@@ -260,8 +296,8 @@ export async function performTransfers({
260
296
  // Default to sponsored fee payment if no fee method is provided
261
297
  const defaultFeePaymentMethod = feePaymentMethod || new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
262
298
  for (let i = 0; i < rounds; i++) {
263
- const txs = testAccounts.accounts.map(async acc => {
264
- const token = await TokenContract.at(testAccounts.tokenAddress, testAccounts.wallet);
299
+ const txs = testAccounts.accounts.map(acc => {
300
+ const token = TokenContract.at(testAccounts.tokenAddress, testAccounts.wallet);
265
301
  return proveInteraction(wallet, token.methods.transfer_in_public(acc, recipient, transferAmount, 0), {
266
302
  from: acc,
267
303
  fee: {