@aztec/cli 2.1.0-rc.9 → 3.0.0-devnet.2

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 (146) hide show
  1. package/README.md +1 -427
  2. package/dest/cmds/aztec_node/block_number.d.ts +3 -0
  3. package/dest/cmds/aztec_node/block_number.d.ts.map +1 -0
  4. package/dest/cmds/aztec_node/block_number.js +10 -0
  5. package/dest/cmds/aztec_node/get_block.d.ts +3 -0
  6. package/dest/cmds/aztec_node/get_block.d.ts.map +1 -0
  7. package/dest/cmds/aztec_node/get_block.js +9 -0
  8. package/dest/cmds/aztec_node/get_current_base_fee.d.ts +3 -0
  9. package/dest/cmds/aztec_node/get_current_base_fee.d.ts.map +1 -0
  10. package/dest/cmds/aztec_node/get_current_base_fee.js +7 -0
  11. package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.d.ts +5 -0
  12. package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.d.ts.map +1 -0
  13. package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.js +12 -0
  14. package/dest/cmds/aztec_node/get_logs.d.ts +6 -0
  15. package/dest/cmds/aztec_node/get_logs.d.ts.map +1 -0
  16. package/dest/cmds/{pxe → aztec_node}/get_logs.js +4 -4
  17. package/dest/cmds/aztec_node/get_node_info.d.ts +3 -0
  18. package/dest/cmds/aztec_node/get_node_info.d.ts.map +1 -0
  19. package/dest/cmds/{pxe → aztec_node}/get_node_info.js +3 -8
  20. package/dest/cmds/aztec_node/index.d.ts.map +1 -0
  21. package/dest/cmds/aztec_node/index.js +28 -0
  22. package/dest/cmds/infrastructure/index.d.ts +2 -2
  23. package/dest/cmds/infrastructure/index.d.ts.map +1 -1
  24. package/dest/cmds/infrastructure/index.js +7 -8
  25. package/dest/cmds/infrastructure/sequencers.d.ts +2 -3
  26. package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -1
  27. package/dest/cmds/infrastructure/sequencers.js +4 -3
  28. package/dest/cmds/infrastructure/setup_l2_contract.d.ts +1 -1
  29. package/dest/cmds/infrastructure/setup_l2_contract.d.ts.map +1 -1
  30. package/dest/cmds/infrastructure/setup_l2_contract.js +10 -25
  31. package/dest/cmds/l1/advance_epoch.d.ts +1 -1
  32. package/dest/cmds/l1/advance_epoch.d.ts.map +1 -1
  33. package/dest/cmds/l1/advance_epoch.js +6 -5
  34. package/dest/cmds/l1/assume_proven_through.d.ts +1 -1
  35. package/dest/cmds/l1/assume_proven_through.d.ts.map +1 -1
  36. package/dest/cmds/l1/assume_proven_through.js +7 -6
  37. package/dest/cmds/l1/bridge_erc20.d.ts +1 -1
  38. package/dest/cmds/l1/bridge_erc20.d.ts.map +1 -1
  39. package/dest/cmds/l1/bridge_erc20.js +1 -1
  40. package/dest/cmds/l1/deploy_l1_contracts.d.ts +1 -1
  41. package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +1 -1
  42. package/dest/cmds/l1/deploy_l1_contracts.js +3 -3
  43. package/dest/cmds/l1/deploy_new_rollup.d.ts +1 -1
  44. package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -1
  45. package/dest/cmds/l1/deploy_new_rollup.js +4 -4
  46. package/dest/cmds/l1/get_l1_addresses.d.ts +1 -1
  47. package/dest/cmds/l1/get_l1_addresses.d.ts.map +1 -1
  48. package/dest/cmds/l1/index.d.ts.map +1 -1
  49. package/dest/cmds/l1/index.js +7 -7
  50. package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
  51. package/dest/cmds/l1/update_l1_validators.js +4 -3
  52. package/dest/cmds/misc/generate_secret_and_hash.js +1 -1
  53. package/dest/cmds/misc/generate_secret_key.d.ts +1 -1
  54. package/dest/cmds/misc/generate_secret_key.d.ts.map +1 -1
  55. package/dest/cmds/misc/generate_secret_key.js +1 -1
  56. package/dest/config/cached_fetch.d.ts +1 -1
  57. package/dest/config/cached_fetch.d.ts.map +1 -1
  58. package/dest/config/cached_fetch.js +1 -1
  59. package/dest/config/chain_l2_config.d.ts +7 -6
  60. package/dest/config/chain_l2_config.d.ts.map +1 -1
  61. package/dest/config/chain_l2_config.js +103 -40
  62. package/dest/config/enrich_env.js +1 -1
  63. package/dest/utils/aztec.d.ts +2 -8
  64. package/dest/utils/aztec.d.ts.map +1 -1
  65. package/dest/utils/aztec.js +6 -31
  66. package/dest/utils/commands.d.ts +6 -7
  67. package/dest/utils/commands.d.ts.map +1 -1
  68. package/dest/utils/commands.js +5 -6
  69. package/dest/utils/inspect.d.ts +3 -10
  70. package/dest/utils/inspect.d.ts.map +1 -1
  71. package/dest/utils/inspect.js +13 -95
  72. package/dest/utils/setup_contracts.d.ts +1 -3
  73. package/dest/utils/setup_contracts.d.ts.map +1 -1
  74. package/dest/utils/setup_contracts.js +2 -22
  75. package/package.json +26 -25
  76. package/src/cmds/aztec_node/block_number.ts +9 -0
  77. package/src/cmds/aztec_node/get_block.ts +10 -0
  78. package/src/cmds/aztec_node/get_current_base_fee.ts +9 -0
  79. package/src/cmds/aztec_node/get_l1_to_l2_message_witness.ts +27 -0
  80. package/src/cmds/{pxe → aztec_node}/get_logs.ts +8 -7
  81. package/src/cmds/{pxe → aztec_node}/get_node_info.ts +5 -16
  82. package/src/cmds/aztec_node/index.ts +87 -0
  83. package/src/cmds/infrastructure/index.ts +7 -17
  84. package/src/cmds/infrastructure/sequencers.ts +6 -6
  85. package/src/cmds/infrastructure/setup_l2_contract.ts +13 -30
  86. package/src/cmds/l1/advance_epoch.ts +6 -5
  87. package/src/cmds/l1/assume_proven_through.ts +7 -6
  88. package/src/cmds/l1/bridge_erc20.ts +3 -1
  89. package/src/cmds/l1/deploy_l1_contracts.ts +4 -3
  90. package/src/cmds/l1/deploy_new_rollup.ts +4 -2
  91. package/src/cmds/l1/get_l1_addresses.ts +1 -1
  92. package/src/cmds/l1/index.ts +7 -5
  93. package/src/cmds/l1/update_l1_validators.ts +4 -3
  94. package/src/cmds/misc/generate_secret_and_hash.ts +1 -1
  95. package/src/cmds/misc/generate_secret_key.ts +1 -1
  96. package/src/config/cached_fetch.ts +1 -1
  97. package/src/config/chain_l2_config.ts +133 -47
  98. package/src/config/enrich_env.ts +1 -1
  99. package/src/utils/aztec.ts +6 -40
  100. package/src/utils/commands.ts +8 -10
  101. package/src/utils/inspect.ts +18 -111
  102. package/src/utils/setup_contracts.ts +4 -43
  103. package/dest/cmds/pxe/add_contract.d.ts +0 -5
  104. package/dest/cmds/pxe/add_contract.d.ts.map +0 -1
  105. package/dest/cmds/pxe/add_contract.js +0 -29
  106. package/dest/cmds/pxe/block_number.d.ts +0 -3
  107. package/dest/cmds/pxe/block_number.d.ts.map +0 -1
  108. package/dest/cmds/pxe/block_number.js +0 -10
  109. package/dest/cmds/pxe/get_account.d.ts +0 -4
  110. package/dest/cmds/pxe/get_account.d.ts.map +0 -1
  111. package/dest/cmds/pxe/get_account.js +0 -10
  112. package/dest/cmds/pxe/get_accounts.d.ts +0 -3
  113. package/dest/cmds/pxe/get_accounts.d.ts.map +0 -1
  114. package/dest/cmds/pxe/get_accounts.js +0 -25
  115. package/dest/cmds/pxe/get_block.d.ts +0 -3
  116. package/dest/cmds/pxe/get_block.d.ts.map +0 -1
  117. package/dest/cmds/pxe/get_block.js +0 -9
  118. package/dest/cmds/pxe/get_contract_data.d.ts +0 -4
  119. package/dest/cmds/pxe/get_contract_data.d.ts.map +0 -1
  120. package/dest/cmds/pxe/get_contract_data.js +0 -31
  121. package/dest/cmds/pxe/get_current_base_fee.d.ts +0 -3
  122. package/dest/cmds/pxe/get_current_base_fee.d.ts.map +0 -1
  123. package/dest/cmds/pxe/get_current_base_fee.js +0 -7
  124. package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts +0 -4
  125. package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts.map +0 -1
  126. package/dest/cmds/pxe/get_l1_to_l2_message_witness.js +0 -11
  127. package/dest/cmds/pxe/get_logs.d.ts +0 -4
  128. package/dest/cmds/pxe/get_logs.d.ts.map +0 -1
  129. package/dest/cmds/pxe/get_node_info.d.ts +0 -3
  130. package/dest/cmds/pxe/get_node_info.d.ts.map +0 -1
  131. package/dest/cmds/pxe/get_pxe_info.d.ts +0 -3
  132. package/dest/cmds/pxe/get_pxe_info.d.ts.map +0 -1
  133. package/dest/cmds/pxe/get_pxe_info.js +0 -11
  134. package/dest/cmds/pxe/index.d.ts.map +0 -1
  135. package/dest/cmds/pxe/index.js +0 -55
  136. package/src/cmds/pxe/add_contract.ts +0 -41
  137. package/src/cmds/pxe/block_number.ts +0 -9
  138. package/src/cmds/pxe/get_account.ts +0 -16
  139. package/src/cmds/pxe/get_accounts.ts +0 -35
  140. package/src/cmds/pxe/get_block.ts +0 -10
  141. package/src/cmds/pxe/get_contract_data.ts +0 -51
  142. package/src/cmds/pxe/get_current_base_fee.ts +0 -9
  143. package/src/cmds/pxe/get_l1_to_l2_message_witness.ts +0 -25
  144. package/src/cmds/pxe/get_pxe_info.ts +0 -13
  145. package/src/cmds/pxe/index.ts +0 -170
  146. /package/dest/cmds/{pxe → aztec_node}/index.d.ts +0 -0
@@ -1,12 +1,13 @@
1
- import { createPXEClient, makeFetch } from '@aztec/aztec.js';
1
+ import { createAztecNodeClient } from '@aztec/aztec.js/node';
2
2
  import { RollupCheatCodes } from '@aztec/ethereum/test';
3
3
  import type { LogFn } from '@aztec/foundation/log';
4
+ import { DateProvider } from '@aztec/foundation/timer';
4
5
 
5
- export async function advanceEpoch(l1RpcUrls: string[], rpcUrl: string, log: LogFn) {
6
- const pxe = createPXEClient(rpcUrl, {}, makeFetch([], true));
7
- const rollupAddress = await pxe.getNodeInfo().then(i => i.l1ContractAddresses.rollupAddress);
6
+ export async function advanceEpoch(l1RpcUrls: string[], nodeUrl: string, log: LogFn) {
7
+ const aztecNode = createAztecNodeClient(nodeUrl);
8
+ const rollupAddress = await aztecNode.getNodeInfo().then(i => i.l1ContractAddresses.rollupAddress);
8
9
 
9
- const cheat = RollupCheatCodes.create(l1RpcUrls, { rollupAddress });
10
+ const cheat = RollupCheatCodes.create(l1RpcUrls, { rollupAddress }, new DateProvider());
10
11
 
11
12
  await cheat.advanceToNextEpoch();
12
13
  log(`Warped time to advance to next epoch`);
@@ -1,18 +1,19 @@
1
- import { createPXEClient, makeFetch } from '@aztec/aztec.js';
1
+ import { createAztecNodeClient } from '@aztec/aztec.js/node';
2
2
  import { RollupCheatCodes } from '@aztec/ethereum/test';
3
3
  import type { LogFn } from '@aztec/foundation/log';
4
+ import { DateProvider } from '@aztec/foundation/timer';
4
5
 
5
6
  export async function assumeProvenThrough(
6
7
  blockNumberOrLatest: number | undefined,
7
8
  l1RpcUrls: string[],
8
- rpcUrl: string,
9
+ nodeUrl: string,
9
10
  log: LogFn,
10
11
  ) {
11
- const pxe = createPXEClient(rpcUrl, {}, makeFetch([], true));
12
- const rollupAddress = await pxe.getNodeInfo().then(i => i.l1ContractAddresses.rollupAddress);
13
- const blockNumber = blockNumberOrLatest ?? (await pxe.getBlockNumber());
12
+ const aztecNode = createAztecNodeClient(nodeUrl);
13
+ const rollupAddress = await aztecNode.getNodeInfo().then(i => i.l1ContractAddresses.rollupAddress);
14
+ const blockNumber = blockNumberOrLatest ?? (await aztecNode.getBlockNumber());
14
15
 
15
- const rollupCheatCodes = RollupCheatCodes.create(l1RpcUrls, { rollupAddress });
16
+ const rollupCheatCodes = RollupCheatCodes.create(l1RpcUrls, { rollupAddress }, new DateProvider());
16
17
 
17
18
  await rollupCheatCodes.markAsProven(blockNumber);
18
19
  log(`Assumed proven through block ${blockNumber}`);
@@ -1,4 +1,6 @@
1
- import { type AztecAddress, type EthAddress, type Fr, L1ToL2TokenPortalManager } from '@aztec/aztec.js';
1
+ import type { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
2
+ import { L1ToL2TokenPortalManager } from '@aztec/aztec.js/ethereum';
3
+ import type { Fr } from '@aztec/aztec.js/fields';
2
4
  import { createEthereumChain, createExtendedL1Client } from '@aztec/ethereum';
3
5
  import type { LogFn, Logger } from '@aztec/foundation/log';
4
6
 
@@ -1,5 +1,6 @@
1
- import { getInitialTestAccounts } from '@aztec/accounts/testing';
2
- import { type EthAddress, Fr } from '@aztec/aztec.js';
1
+ import { getInitialTestAccountsData } from '@aztec/accounts/testing';
2
+ import type { EthAddress } from '@aztec/aztec.js/addresses';
3
+ import { Fr } from '@aztec/aztec.js/fields';
3
4
  import { getL1ContractsConfigEnvVars } from '@aztec/ethereum';
4
5
  import { SecretValue } from '@aztec/foundation/config';
5
6
  import type { LogFn, Logger } from '@aztec/foundation/log';
@@ -28,7 +29,7 @@ export async function deployL1Contracts(
28
29
  ) {
29
30
  const config = getL1ContractsConfigEnvVars();
30
31
 
31
- const initialAccounts = testAccounts ? await getInitialTestAccounts() : [];
32
+ const initialAccounts = testAccounts ? await getInitialTestAccountsData() : [];
32
33
  const sponsoredFPCAddress = sponsoredFPC ? await getSponsoredFPCAddress() : [];
33
34
  const initialFundedAccounts = initialAccounts.map(a => a.address).concat(sponsoredFPCAddress);
34
35
  const { genesisArchiveRoot, fundingNeeded } = await getGenesisValues(initialFundedAccounts);
@@ -1,4 +1,4 @@
1
- import { getInitialTestAccounts } from '@aztec/accounts/testing';
1
+ import { getInitialTestAccountsData } from '@aztec/accounts/testing';
2
2
  import { type Operator, getL1ContractsConfigEnvVars } from '@aztec/ethereum';
3
3
  import type { EthAddress } from '@aztec/foundation/eth-address';
4
4
  import type { LogFn, Logger } from '@aztec/foundation/log';
@@ -20,12 +20,13 @@ export async function deployNewRollup(
20
20
  json: boolean,
21
21
  initialValidators: Operator[],
22
22
  realVerifier: boolean,
23
+ createVerificationJson: string | false,
23
24
  log: LogFn,
24
25
  debugLogger: Logger,
25
26
  ) {
26
27
  const config = getL1ContractsConfigEnvVars();
27
28
 
28
- const initialAccounts = testAccounts ? await getInitialTestAccounts() : [];
29
+ const initialAccounts = testAccounts ? await getInitialTestAccountsData() : [];
29
30
  const sponsoredFPCAddress = sponsoredFPC ? await getSponsoredFPCAddress() : [];
30
31
  const initialFundedAccounts = initialAccounts.map(a => a.address).concat(sponsoredFPCAddress);
31
32
  const { genesisArchiveRoot, fundingNeeded } = await getGenesisValues(initialFundedAccounts);
@@ -43,6 +44,7 @@ export async function deployNewRollup(
43
44
  fundingNeeded,
44
45
  config,
45
46
  realVerifier,
47
+ createVerificationJson,
46
48
  debugLogger,
47
49
  );
48
50
 
@@ -1,4 +1,4 @@
1
- import { EthAddress } from '@aztec/aztec.js';
1
+ import { EthAddress } from '@aztec/aztec.js/addresses';
2
2
  import { RegistryContract, type ViemPublicClient, createEthereumChain } from '@aztec/ethereum';
3
3
  import type { LogFn } from '@aztec/foundation/log';
4
4
 
@@ -9,10 +9,10 @@ import {
9
9
  MNEMONIC,
10
10
  PRIVATE_KEY,
11
11
  l1ChainIdOption,
12
+ nodeOption,
12
13
  parseAztecAddress,
13
14
  parseBigint,
14
15
  parseEthereumAddress,
15
- pxeOption,
16
16
  } from '../../utils/commands.js';
17
17
 
18
18
  export { addL1Validator } from './update_l1_validators.js';
@@ -94,6 +94,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
94
94
  .option('--test-accounts', 'Populate genesis state with initial fee juice for test accounts')
95
95
  .option('--sponsored-fpc', 'Populate genesis state with a testing sponsored FPC contract')
96
96
  .option('--real-verifier', 'Deploy the real verifier', false)
97
+ .option('--create-verification-json [path]', 'Create JSON file for etherscan contract verification', false)
97
98
  .action(async options => {
98
99
  const { deployNewRollup } = await import('./deploy_new_rollup.js');
99
100
 
@@ -112,6 +113,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
112
113
  options.json,
113
114
  initialValidators,
114
115
  options.realVerifier,
116
+ options.createVerificationJson,
115
117
  log,
116
118
  debugLogger,
117
119
  );
@@ -509,20 +511,20 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
509
511
  )
510
512
  .argument('[blockNumber]', 'The target block number, defaults to the latest pending block number.', parseBigint)
511
513
  .addOption(l1RpcUrlsOption)
512
- .addOption(pxeOption)
514
+ .addOption(nodeOption)
513
515
  .action(async (blockNumber, options) => {
514
516
  const { assumeProvenThrough } = await import('./assume_proven_through.js');
515
- await assumeProvenThrough(blockNumber, options.l1RpcUrls, options.rpcUrl, log);
517
+ await assumeProvenThrough(blockNumber, options.l1RpcUrls, options.nodeUrl, log);
516
518
  });
517
519
 
518
520
  program
519
521
  .command('advance-epoch')
520
522
  .description('Use L1 cheat codes to warp time until the next epoch.')
521
523
  .addOption(l1RpcUrlsOption)
522
- .addOption(pxeOption)
524
+ .addOption(nodeOption)
523
525
  .action(async options => {
524
526
  const { advanceEpoch } = await import('./advance_epoch.js');
525
- await advanceEpoch(options.l1RpcUrls, options.rpcUrl, log);
527
+ await advanceEpoch(options.l1RpcUrls, options.nodeUrl, log);
526
528
  });
527
529
 
528
530
  return program;
@@ -11,6 +11,7 @@ import {
11
11
  import { EthCheatCodes } from '@aztec/ethereum/test';
12
12
  import type { EthAddress } from '@aztec/foundation/eth-address';
13
13
  import type { LogFn, Logger } from '@aztec/foundation/log';
14
+ import { DateProvider } from '@aztec/foundation/timer';
14
15
  import { RollupAbi, StakingAssetHandlerAbi } from '@aztec/l1-artifacts';
15
16
  import { ZkPassportProofParams } from '@aztec/stdlib/zkpassport';
16
17
 
@@ -120,7 +121,7 @@ export async function addL1Validator({
120
121
  await l1Client.waitForTransactionReceipt({ hash: receipt.transactionHash });
121
122
  if (isAnvilTestChain(chainId)) {
122
123
  dualLog(`Funding validator on L1`);
123
- const cheatCodes = new EthCheatCodes(rpcUrls, debugLogger);
124
+ const cheatCodes = new EthCheatCodes(rpcUrls, new DateProvider(), debugLogger);
124
125
  await cheatCodes.setBalance(attesterAddress, 10n ** 20n);
125
126
  } else {
126
127
  const balance = await l1Client.getBalance({ address: attesterAddress.toString() });
@@ -194,7 +195,7 @@ export async function addL1ValidatorViaRollup({
194
195
  await l1Client.waitForTransactionReceipt({ hash: receipt.transactionHash });
195
196
  if (isAnvilTestChain(chainId)) {
196
197
  dualLog(`Funding validator on L1`);
197
- const cheatCodes = new EthCheatCodes(rpcUrls, debugLogger);
198
+ const cheatCodes = new EthCheatCodes(rpcUrls, new DateProvider(), debugLogger);
198
199
  await cheatCodes.setBalance(attesterAddress, 10n ** 20n);
199
200
  } else {
200
201
  const balance = await l1Client.getBalance({ address: attesterAddress.toString() });
@@ -275,7 +276,7 @@ export async function fastForwardEpochs({
275
276
  client: publicClient,
276
277
  });
277
278
 
278
- const cheatCodes = new EthCheatCodes(rpcUrls, debugLogger);
279
+ const cheatCodes = new EthCheatCodes(rpcUrls, new DateProvider(), debugLogger);
279
280
  const currentSlot = await rollup.read.getCurrentSlot();
280
281
  const l2SlotsInEpoch = await rollup.read.getEpochDuration();
281
282
  const timestamp = await rollup.read.getTimestampForSlot([currentSlot + l2SlotsInEpoch * numEpochs]);
@@ -1,4 +1,4 @@
1
- import { computeSecretHash } from '@aztec/aztec.js';
1
+ import { computeSecretHash } from '@aztec/aztec.js/crypto';
2
2
  import { Fr } from '@aztec/foundation/fields';
3
3
  import type { LogFn } from '@aztec/foundation/log';
4
4
 
@@ -1,4 +1,4 @@
1
- import { Fr } from '@aztec/aztec.js';
1
+ import { Fr } from '@aztec/aztec.js/fields';
2
2
 
3
3
  export function generateSecretKey() {
4
4
  return { secretKey: Fr.random() };
@@ -1,4 +1,4 @@
1
- import { createLogger } from '@aztec/aztec.js';
1
+ import { createLogger } from '@aztec/aztec.js/log';
2
2
 
3
3
  import { mkdir, readFile, stat, writeFile } from 'fs/promises';
4
4
  import { dirname } from 'path';
@@ -1,14 +1,12 @@
1
1
  import { DefaultL1ContractsConfig, type L1ContractsConfig } from '@aztec/ethereum';
2
- import type { EnvVar, NetworkNames } from '@aztec/foundation/config';
2
+ import type { NetworkNames } from '@aztec/foundation/config';
3
3
  import { EthAddress } from '@aztec/foundation/eth-address';
4
4
  import type { SharedNodeConfig } from '@aztec/node-lib/config';
5
- import type { P2PConfig } from '@aztec/p2p/config';
6
5
  import type { SlasherConfig } from '@aztec/stdlib/interfaces/server';
7
6
 
8
- import path, { join } from 'path';
7
+ import path from 'path';
9
8
 
10
9
  import publicIncludeMetrics from '../../public_include_metric_prefixes.json' with { type: 'json' };
11
- import { cachedFetch } from './cached_fetch.js';
12
10
  import { enrichEthAddressVar, enrichVar } from './enrich_env.js';
13
11
 
14
12
  const SNAPSHOTS_URL = 'https://aztec-labs-snapshots.com';
@@ -17,7 +15,6 @@ const defaultDBMapSizeKb = 128 * 1_024 * 1_024; // 128 GB
17
15
  const tbMapSizeKb = 1_024 * 1_024 * 1_024; // 1 TB
18
16
 
19
17
  export type L2ChainConfig = L1ContractsConfig &
20
- Pick<P2PConfig, 'txPoolDeleteTxsAfterReorg'> &
21
18
  Omit<SlasherConfig, 'slashValidatorsNever' | 'slashValidatorsAlways'> & {
22
19
  l1ChainId: number;
23
20
  testAccounts: boolean;
@@ -45,6 +42,7 @@ export type L2ChainConfig = L1ContractsConfig &
45
42
 
46
43
  // Control whether sentinel is enabled or not. Needed for slashing
47
44
  sentinelEnabled: boolean;
45
+ disableTransactions: boolean;
48
46
  };
49
47
 
50
48
  const DefaultSlashConfig = {
@@ -96,6 +94,7 @@ export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
96
94
  l1ChainId: 11155111,
97
95
  testAccounts: false,
98
96
  sponsoredFPC: false,
97
+ disableTransactions: true,
99
98
  p2pEnabled: true,
100
99
  p2pBootstrapNodes: [],
101
100
  seqMinTxsPerBlock: 0,
@@ -108,7 +107,6 @@ export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
108
107
  publicIncludeMetrics,
109
108
  publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
110
109
  publicMetricsCollectFrom: ['sequencer'],
111
- txPoolDeleteTxsAfterReorg: false,
112
110
 
113
111
  /** How many seconds an L1 slot lasts. */
114
112
  ethereumSlotDuration: 12,
@@ -128,7 +126,6 @@ export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
128
126
  slashingRoundSizeInEpochs: 4,
129
127
  slashingLifetimeInRounds: 40,
130
128
  slashingExecutionDelayInRounds: 28,
131
- slashingDisableDuration: 5 * 24 * 60 * 60, // 5 days in seconds
132
129
  slashAmountSmall: 2_000n * 10n ** 18n,
133
130
  slashAmountMedium: 10_000n * 10n ** 18n,
134
131
  slashAmountLarge: 50_000n * 10n ** 18n,
@@ -143,10 +140,10 @@ export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
143
140
 
144
141
  /** The proving cost per mana */
145
142
  provingCostPerMana: 0n,
143
+ localEjectionThreshold: 196_000n * 10n ** 18n,
146
144
 
147
145
  ejectionThreshold: 100_000n * 10n ** 18n,
148
146
  activationThreshold: 200_000n * 10n ** 18n,
149
- localEjectionThreshold: 196_000n * 10n ** 18n,
150
147
 
151
148
  governanceProposerRoundSize: 300, // TODO TMNT-322
152
149
  governanceProposerQuorum: 151, // TODO TMNT-322
@@ -168,6 +165,7 @@ export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
168
165
  slashGracePeriodL2Slots: 32 * 4, // One round from genesis
169
166
  slashOffenseExpirationRounds: 8,
170
167
  sentinelEnabled: true,
168
+ slashingDisableDuration: 5 * 24 * 60 * 60,
171
169
  slashExecuteRoundsLookBack: 4,
172
170
 
173
171
  ...DefaultNetworkDBMapSizeConfig,
@@ -177,6 +175,7 @@ export const stagingPublicL2ChainConfig: L2ChainConfig = {
177
175
  l1ChainId: 11155111,
178
176
  testAccounts: false,
179
177
  sponsoredFPC: true,
178
+ disableTransactions: false,
180
179
  p2pEnabled: true,
181
180
  p2pBootstrapNodes: [],
182
181
  seqMinTxsPerBlock: 0,
@@ -189,7 +188,59 @@ export const stagingPublicL2ChainConfig: L2ChainConfig = {
189
188
  publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
190
189
  publicMetricsCollectFrom: ['sequencer'],
191
190
  maxTxPoolSize: 100_000_000, // 100MB
192
- txPoolDeleteTxsAfterReorg: true,
191
+
192
+ // Deployment stuff
193
+ /** How many seconds an L1 slot lasts. */
194
+ ethereumSlotDuration: 12,
195
+ /** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
196
+ aztecSlotDuration: 36,
197
+ /** How many L2 slots an epoch lasts. */
198
+ aztecEpochDuration: 32,
199
+ /** The target validator committee size. */
200
+ aztecTargetCommitteeSize: 48,
201
+ /** The number of epochs to lag behind the current epoch for validator selection. */
202
+ lagInEpochs: DefaultL1ContractsConfig.lagInEpochs,
203
+ /** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */
204
+ localEjectionThreshold: DefaultL1ContractsConfig.localEjectionThreshold,
205
+ /** The number of epochs after an epoch ends that proofs are still accepted. */
206
+ aztecProofSubmissionEpochs: 1,
207
+ /** The deposit amount for a validator */
208
+ activationThreshold: DefaultL1ContractsConfig.activationThreshold,
209
+ /** The minimum stake for a validator. */
210
+ ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold,
211
+ /** The slashing round size */
212
+ slashingRoundSizeInEpochs: DefaultL1ContractsConfig.slashingRoundSizeInEpochs,
213
+ /** Governance proposing round size */
214
+ governanceProposerRoundSize: DefaultL1ContractsConfig.governanceProposerRoundSize,
215
+ /** The mana target for the rollup */
216
+ manaTarget: DefaultL1ContractsConfig.manaTarget,
217
+ /** The proving cost per mana */
218
+ provingCostPerMana: DefaultL1ContractsConfig.provingCostPerMana,
219
+ /** Exit delay for stakers */
220
+ exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
221
+
222
+ ...DefaultSlashConfig,
223
+
224
+ ...DefaultNetworkDBMapSizeConfig,
225
+ };
226
+
227
+ export const nextNetL2ChainConfig: L2ChainConfig = {
228
+ l1ChainId: 11155111,
229
+ testAccounts: true,
230
+ sponsoredFPC: true,
231
+ p2pEnabled: true,
232
+ disableTransactions: false,
233
+ p2pBootstrapNodes: [],
234
+ seqMinTxsPerBlock: 0,
235
+ seqMaxTxsPerBlock: 8,
236
+ realProofs: true,
237
+ snapshotsUrls: [],
238
+ autoUpdate: 'config-and-version',
239
+ autoUpdateUrl: '',
240
+ publicIncludeMetrics,
241
+ publicMetricsCollectorUrl: '',
242
+ publicMetricsCollectFrom: [''],
243
+ maxTxPoolSize: 100_000_000, // 100MB
193
244
 
194
245
  // Deployment stuff
195
246
  /** How many seconds an L1 slot lasts. */
@@ -231,9 +282,10 @@ export const testnetL2ChainConfig: L2ChainConfig = {
231
282
  testAccounts: false,
232
283
  sponsoredFPC: true,
233
284
  p2pEnabled: true,
285
+ disableTransactions: true,
234
286
  p2pBootstrapNodes: [],
235
287
  seqMinTxsPerBlock: 0,
236
- seqMaxTxsPerBlock: 20,
288
+ seqMaxTxsPerBlock: 0,
237
289
  realProofs: true,
238
290
  snapshotsUrls: [`${SNAPSHOTS_URL}/testnet/`],
239
291
  autoUpdate: 'config-and-version',
@@ -242,7 +294,6 @@ export const testnetL2ChainConfig: L2ChainConfig = {
242
294
  publicIncludeMetrics,
243
295
  publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
244
296
  publicMetricsCollectFrom: ['sequencer'],
245
- txPoolDeleteTxsAfterReorg: true,
246
297
 
247
298
  // Deployment stuff
248
299
  /** How many seconds an L1 slot lasts. */
@@ -268,7 +319,7 @@ export const testnetL2ChainConfig: L2ChainConfig = {
268
319
  /** Governance proposing round size */
269
320
  governanceProposerRoundSize: DefaultL1ContractsConfig.governanceProposerRoundSize,
270
321
  /** The mana target for the rollup */
271
- manaTarget: DefaultL1ContractsConfig.manaTarget,
322
+ manaTarget: 0n,
272
323
  /** The proving cost per mana */
273
324
  provingCostPerMana: DefaultL1ContractsConfig.provingCostPerMana,
274
325
  /** Exit delay for stakers */
@@ -277,28 +328,27 @@ export const testnetL2ChainConfig: L2ChainConfig = {
277
328
  ...DefaultSlashConfig,
278
329
  slashPrunePenalty: 0n,
279
330
  slashDataWithholdingPenalty: 0n,
280
- slashInactivityPenalty: DefaultL1ContractsConfig.slashAmountMedium,
281
331
 
282
332
  ...DefaultNetworkDBMapSizeConfig,
283
333
  };
284
334
 
285
- export const ignitionL2ChainConfig: L2ChainConfig = {
335
+ export const mainnetL2ChainConfig: L2ChainConfig = {
286
336
  l1ChainId: 1,
287
337
  testAccounts: false,
288
338
  sponsoredFPC: false,
289
339
  p2pEnabled: true,
340
+ disableTransactions: true,
290
341
  p2pBootstrapNodes: [],
291
342
  seqMinTxsPerBlock: 0,
292
343
  seqMaxTxsPerBlock: 0,
293
344
  realProofs: true,
294
- snapshotsUrls: [`${SNAPSHOTS_URL}/ignition/`],
345
+ snapshotsUrls: [`${SNAPSHOTS_URL}/mainnet/`],
295
346
  autoUpdate: 'notify',
296
- autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/ignition.json',
347
+ autoUpdateUrl: 'https://storage.googleapis.com/aztec-mainnet/auto-update/mainnet.json',
297
348
  maxTxPoolSize: 100_000_000, // 100MB
298
349
  publicIncludeMetrics,
299
350
  publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
300
351
  publicMetricsCollectFrom: ['sequencer'],
301
- txPoolDeleteTxsAfterReorg: false,
302
352
 
303
353
  /** How many seconds an L1 slot lasts. */
304
354
  ethereumSlotDuration: 12,
@@ -308,17 +358,20 @@ export const ignitionL2ChainConfig: L2ChainConfig = {
308
358
  aztecEpochDuration: 32,
309
359
  /** The target validator committee size. */
310
360
  aztecTargetCommitteeSize: 24,
311
- /** The number of epochs to lag behind the current epoch for validator selection. */
312
- lagInEpochs: 2,
313
361
  /** The number of epochs after an epoch ends that proofs are still accepted. */
314
362
  aztecProofSubmissionEpochs: 1,
315
363
  /** How many sequencers must agree with a slash for it to be executed. */
316
364
  slashingQuorum: 65,
317
365
 
366
+ /** The number of epochs to lag behind the current epoch for validator selection. */
367
+ lagInEpochs: 2,
368
+
369
+ localEjectionThreshold: 196_000n * 10n ** 18n,
370
+ slashingDisableDuration: 5 * 24 * 60 * 60,
371
+
318
372
  slashingRoundSizeInEpochs: 4,
319
373
  slashingLifetimeInRounds: 40,
320
374
  slashingExecutionDelayInRounds: 28,
321
- slashingDisableDuration: 5 * 24 * 60 * 60, // 5 days in seconds
322
375
  slashAmountSmall: 2_000n * 10n ** 18n,
323
376
  slashAmountMedium: 10_000n * 10n ** 18n,
324
377
  slashAmountLarge: 50_000n * 10n ** 18n,
@@ -336,7 +389,6 @@ export const ignitionL2ChainConfig: L2ChainConfig = {
336
389
 
337
390
  ejectionThreshold: 100_000n * 10n ** 18n,
338
391
  activationThreshold: 200_000n * 10n ** 18n,
339
- localEjectionThreshold: 196_000n * 10n ** 18n,
340
392
 
341
393
  governanceProposerRoundSize: 300, // TODO TMNT-322
342
394
  governanceProposerQuorum: 151, // TODO TMNT-322
@@ -363,22 +415,60 @@ export const ignitionL2ChainConfig: L2ChainConfig = {
363
415
  ...DefaultNetworkDBMapSizeConfig,
364
416
  };
365
417
 
366
- const BOOTNODE_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour;
418
+ export const devnetL2ChainConfig: L2ChainConfig = {
419
+ l1ChainId: 11155111,
420
+ testAccounts: true,
421
+ sponsoredFPC: true,
422
+ p2pEnabled: true,
423
+ disableTransactions: false,
424
+ p2pBootstrapNodes: [],
425
+ seqMinTxsPerBlock: 0,
426
+ seqMaxTxsPerBlock: 8,
427
+ realProofs: false,
428
+ snapshotsUrls: [],
429
+ autoUpdate: 'config-and-version',
430
+ autoUpdateUrl: '',
431
+ publicIncludeMetrics,
432
+ publicMetricsCollectorUrl: '',
433
+ publicMetricsCollectFrom: [''],
434
+ maxTxPoolSize: 100_000_000, // 100MB
435
+
436
+ // Deployment stuff
437
+ /** How many seconds an L1 slot lasts. */
438
+ ethereumSlotDuration: 12,
439
+ /** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
440
+ aztecSlotDuration: 36,
441
+ /** How many L2 slots an epoch lasts. */
442
+ aztecEpochDuration: 8,
443
+ /** The target validator committee size. */
444
+ aztecTargetCommitteeSize: 1,
445
+ /** The number of epochs to lag behind the current epoch for validator selection. */
446
+ lagInEpochs: 1,
447
+ /** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */
448
+ localEjectionThreshold: DefaultL1ContractsConfig.localEjectionThreshold,
449
+ /** The number of epochs after an epoch ends that proofs are still accepted. */
450
+ aztecProofSubmissionEpochs: 1,
451
+ /** The deposit amount for a validator */
452
+ activationThreshold: DefaultL1ContractsConfig.activationThreshold,
453
+ /** The minimum stake for a validator. */
454
+ ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold,
455
+ /** The slashing round size */
456
+ slashingRoundSizeInEpochs: DefaultL1ContractsConfig.slashingRoundSizeInEpochs,
457
+ /** Governance proposing round size */
458
+ governanceProposerRoundSize: DefaultL1ContractsConfig.governanceProposerRoundSize,
459
+ /** The mana target for the rollup */
460
+ manaTarget: DefaultL1ContractsConfig.manaTarget,
461
+ /** The proving cost per mana */
462
+ provingCostPerMana: DefaultL1ContractsConfig.provingCostPerMana,
463
+ /** Exit delay for stakers */
464
+ exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
367
465
 
368
- export async function getBootnodes(networkName: NetworkNames, cacheDir?: string) {
369
- const url = `http://static.aztec.network/${networkName}/bootnodes.json`;
370
- const data = await cachedFetch(url, {
371
- cacheDurationMs: BOOTNODE_CACHE_DURATION_MS,
372
- cacheFile: cacheDir ? join(cacheDir, networkName, 'bootnodes.json') : undefined,
373
- });
466
+ ...DefaultSlashConfig,
374
467
 
375
- return data?.bootnodes;
376
- }
468
+ ...DefaultNetworkDBMapSizeConfig,
469
+ };
377
470
 
378
- export async function getL2ChainConfig(
379
- networkName: NetworkNames,
380
- cacheDir?: string,
381
- ): Promise<L2ChainConfig | undefined> {
471
+ export function getL2ChainConfig(networkName: NetworkNames): L2ChainConfig | undefined {
382
472
  let config: L2ChainConfig | undefined;
383
473
  if (networkName === 'staging-public') {
384
474
  config = { ...stagingPublicL2ChainConfig };
@@ -386,16 +476,12 @@ export async function getL2ChainConfig(
386
476
  config = { ...testnetL2ChainConfig };
387
477
  } else if (networkName === 'staging-ignition') {
388
478
  config = { ...stagingIgnitionL2ChainConfig };
389
- } else if (networkName === 'ignition') {
390
- config = { ...ignitionL2ChainConfig };
391
- }
392
- if (!config) {
393
- return undefined;
394
- }
395
- // If the bootnodes are not set, get them from the network
396
- const bootnodeKey: EnvVar = 'BOOTSTRAP_NODES';
397
- if (!process.env[bootnodeKey]) {
398
- config.p2pBootstrapNodes = await getBootnodes(networkName, cacheDir);
479
+ } else if (networkName === 'mainnet') {
480
+ config = { ...mainnetL2ChainConfig };
481
+ } else if (networkName === 'next-net') {
482
+ config = { ...nextNetL2ChainConfig };
483
+ } else if (networkName === 'devnet') {
484
+ config = { ...devnetL2ChainConfig };
399
485
  }
400
486
  return config;
401
487
  }
@@ -404,14 +490,13 @@ function getDefaultDataDir(networkName: NetworkNames): string {
404
490
  return path.join(process.env.HOME || '~', '.aztec', networkName, 'data');
405
491
  }
406
492
 
407
- export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames) {
493
+ export function enrichEnvironmentWithChainConfig(networkName: NetworkNames) {
408
494
  if (networkName === 'local') {
409
495
  return;
410
496
  }
411
497
 
412
498
  enrichVar('DATA_DIRECTORY', getDefaultDataDir(networkName));
413
- const cacheDir = process.env.DATA_DIRECTORY ? join(process.env.DATA_DIRECTORY, 'cache') : undefined;
414
- const config = await getL2ChainConfig(networkName, cacheDir);
499
+ const config = getL2ChainConfig(networkName);
415
500
 
416
501
  if (!config) {
417
502
  throw new Error(`Unknown network name: ${networkName}`);
@@ -496,4 +581,5 @@ export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames
496
581
  enrichVar('SLASH_MAX_PAYLOAD_SIZE', config.slashMaxPayloadSize.toString());
497
582
 
498
583
  enrichVar('SENTINEL_ENABLED', config.sentinelEnabled.toString());
584
+ enrichVar('TRANSACTIONS_DISABLED', config.disableTransactions.toString());
499
585
  }
@@ -1,4 +1,4 @@
1
- import { EthAddress } from '@aztec/aztec.js';
1
+ import { EthAddress } from '@aztec/aztec.js/addresses';
2
2
  import type { EnvVar } from '@aztec/foundation/config';
3
3
 
4
4
  export function enrichVar(envVar: EnvVar, value: string | undefined) {