@aztec/cli 2.0.3 → 2.1.0-rc.10

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 (58) hide show
  1. package/dest/cmds/infrastructure/sequencers.js +2 -2
  2. package/dest/cmds/l1/create_l1_account.js +1 -1
  3. package/dest/cmds/l1/deploy_l1_contracts.d.ts +1 -1
  4. package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +1 -1
  5. package/dest/cmds/l1/deploy_l1_contracts.js +2 -2
  6. package/dest/cmds/l1/get_l1_addresses.js +1 -1
  7. package/dest/cmds/l1/get_l1_balance.js +1 -1
  8. package/dest/cmds/l1/index.d.ts.map +1 -1
  9. package/dest/cmds/l1/index.js +2 -20
  10. package/dest/cmds/l1/prover_stats.js +1 -1
  11. package/dest/cmds/l1/trigger_seed_snapshot.js +1 -1
  12. package/dest/cmds/l1/update_l1_validators.js +15 -7
  13. package/dest/config/cached_fetch.d.ts +18 -0
  14. package/dest/config/cached_fetch.d.ts.map +1 -0
  15. package/dest/config/cached_fetch.js +54 -0
  16. package/dest/config/chain_l2_config.d.ts +7 -4
  17. package/dest/config/chain_l2_config.d.ts.map +1 -1
  18. package/dest/config/chain_l2_config.js +123 -66
  19. package/dest/config/enrich_env.d.ts +4 -0
  20. package/dest/config/enrich_env.d.ts.map +1 -0
  21. package/dest/config/enrich_env.js +12 -0
  22. package/dest/config/index.d.ts +2 -0
  23. package/dest/config/index.d.ts.map +1 -1
  24. package/dest/config/index.js +2 -0
  25. package/dest/config/network_config.d.ts +19 -0
  26. package/dest/config/network_config.d.ts.map +1 -0
  27. package/dest/config/network_config.js +79 -0
  28. package/dest/utils/aztec.d.ts +1 -1
  29. package/dest/utils/aztec.d.ts.map +1 -1
  30. package/dest/utils/aztec.js +4 -3
  31. package/package.json +25 -25
  32. package/src/cmds/infrastructure/sequencers.ts +2 -2
  33. package/src/cmds/l1/create_l1_account.ts +1 -1
  34. package/src/cmds/l1/deploy_l1_contracts.ts +2 -0
  35. package/src/cmds/l1/get_l1_addresses.ts +1 -1
  36. package/src/cmds/l1/get_l1_balance.ts +1 -1
  37. package/src/cmds/l1/index.ts +2 -32
  38. package/src/cmds/l1/prover_stats.ts +1 -1
  39. package/src/cmds/l1/trigger_seed_snapshot.ts +1 -1
  40. package/src/cmds/l1/update_l1_validators.ts +7 -7
  41. package/src/config/cached_fetch.ts +67 -0
  42. package/src/config/chain_l2_config.ts +148 -71
  43. package/src/config/enrich_env.ts +15 -0
  44. package/src/config/index.ts +2 -0
  45. package/src/config/network_config.ts +102 -0
  46. package/src/utils/aztec.ts +4 -2
  47. package/dest/cmds/devnet/bootstrap_network.d.ts +0 -3
  48. package/dest/cmds/devnet/bootstrap_network.d.ts.map +0 -1
  49. package/dest/cmds/devnet/bootstrap_network.js +0 -216
  50. package/dest/cmds/devnet/faucet.d.ts +0 -4
  51. package/dest/cmds/devnet/faucet.d.ts.map +0 -1
  52. package/dest/cmds/devnet/faucet.js +0 -26
  53. package/dest/cmds/devnet/index.d.ts +0 -4
  54. package/dest/cmds/devnet/index.d.ts.map +0 -1
  55. package/dest/cmds/devnet/index.js +0 -14
  56. package/src/cmds/devnet/bootstrap_network.ts +0 -321
  57. package/src/cmds/devnet/faucet.ts +0 -33
  58. package/src/cmds/devnet/index.ts +0 -60
@@ -1,8 +1,8 @@
1
1
  import { Fr, createCompatibleClient } from '@aztec/aztec.js';
2
2
  import { GSEContract, RollupContract, createEthereumChain, getL1ContractsConfigEnvVars } from '@aztec/ethereum';
3
3
  import { RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
4
- import { createPublicClient, createWalletClient, fallback, getContract, http } from 'viem';
5
- import { mnemonicToAccount } from 'viem/accounts';
4
+ import { createPublicClient, createWalletClient, fallback, getContract, http } from '@spalladino/viem';
5
+ import { mnemonicToAccount } from '@spalladino/viem/accounts';
6
6
  export async function sequencers(opts) {
7
7
  const { command, who: maybeWho, mnemonic, bn254SecretKey, rpcUrl, l1RpcUrls, chainId, log, debugLogger } = opts;
8
8
  const client = await createCompatibleClient(rpcUrl, debugLogger);
@@ -1,4 +1,4 @@
1
- import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts';
1
+ import { generatePrivateKey, privateKeyToAccount } from '@spalladino/viem/accounts';
2
2
  import { prettyPrintJSON } from '../../utils/commands.js';
3
3
  export function createL1Account(json, log) {
4
4
  const privateKey = generatePrivateKey();
@@ -1,4 +1,4 @@
1
1
  import { type EthAddress } from '@aztec/aztec.js';
2
2
  import type { LogFn, Logger } from '@aztec/foundation/log';
3
- export declare function deployL1Contracts(rpcUrls: string[], chainId: number, privateKey: string | undefined, mnemonic: string, mnemonicIndex: number, salt: number | undefined, testAccounts: boolean, sponsoredFPC: boolean, acceleratedTestDeployments: boolean, json: boolean, createVerificationJson: string | false, initialValidators: EthAddress[], realVerifier: boolean, log: LogFn, debugLogger: Logger): Promise<void>;
3
+ export declare function deployL1Contracts(rpcUrls: string[], chainId: number, privateKey: string | undefined, mnemonic: string, mnemonicIndex: number, salt: number | undefined, testAccounts: boolean, sponsoredFPC: boolean, acceleratedTestDeployments: boolean, json: boolean, createVerificationJson: string | false, initialValidators: EthAddress[], realVerifier: boolean, existingToken: EthAddress | undefined, log: LogFn, debugLogger: Logger): Promise<void>;
4
4
  //# sourceMappingURL=deploy_l1_contracts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deploy_l1_contracts.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/deploy_l1_contracts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAM,MAAM,iBAAiB,CAAC;AAGtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAM3D,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,OAAO,EACrB,0BAA0B,EAAE,OAAO,EACnC,IAAI,EAAE,OAAO,EACb,sBAAsB,EAAE,MAAM,GAAG,KAAK,EACtC,iBAAiB,EAAE,UAAU,EAAE,EAC/B,YAAY,EAAE,OAAO,EACrB,GAAG,EAAE,KAAK,EACV,WAAW,EAAE,MAAM,iBA6DpB"}
1
+ {"version":3,"file":"deploy_l1_contracts.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/deploy_l1_contracts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAM,MAAM,iBAAiB,CAAC;AAGtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAM3D,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,OAAO,EACrB,0BAA0B,EAAE,OAAO,EACnC,IAAI,EAAE,OAAO,EACb,sBAAsB,EAAE,MAAM,GAAG,KAAK,EACtC,iBAAiB,EAAE,UAAU,EAAE,EAC/B,YAAY,EAAE,OAAO,EACrB,aAAa,EAAE,UAAU,GAAG,SAAS,EACrC,GAAG,EAAE,KAAK,EACV,WAAW,EAAE,MAAM,iBA8DpB"}
@@ -5,7 +5,7 @@ import { SecretValue } from '@aztec/foundation/config';
5
5
  import { getGenesisValues } from '@aztec/world-state/testing';
6
6
  import { deployAztecContracts } from '../../utils/aztec.js';
7
7
  import { getSponsoredFPCAddress } from '../../utils/setup_contracts.js';
8
- export async function deployL1Contracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, testAccounts, sponsoredFPC, acceleratedTestDeployments, json, createVerificationJson, initialValidators, realVerifier, log, debugLogger) {
8
+ export async function deployL1Contracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, testAccounts, sponsoredFPC, acceleratedTestDeployments, json, createVerificationJson, initialValidators, realVerifier, existingToken, log, debugLogger) {
9
9
  const config = getL1ContractsConfigEnvVars();
10
10
  const initialAccounts = testAccounts ? await getInitialTestAccounts() : [];
11
11
  const sponsoredFPCAddress = sponsoredFPC ? await getSponsoredFPCAddress() : [];
@@ -16,7 +16,7 @@ export async function deployL1Contracts(rpcUrls, chainId, privateKey, mnemonic,
16
16
  withdrawer: a,
17
17
  bn254SecretKey: new SecretValue(Fr.random().toBigInt())
18
18
  }));
19
- const { l1ContractAddresses } = await deployAztecContracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidatorOperators, genesisArchiveRoot, fundingNeeded, acceleratedTestDeployments, config, realVerifier, createVerificationJson, debugLogger);
19
+ const { l1ContractAddresses } = await deployAztecContracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidatorOperators, genesisArchiveRoot, fundingNeeded, acceleratedTestDeployments, config, existingToken, realVerifier, createVerificationJson, debugLogger);
20
20
  if (json) {
21
21
  log(JSON.stringify(Object.fromEntries(Object.entries(l1ContractAddresses).map(([k, v])=>[
22
22
  k,
@@ -1,5 +1,5 @@
1
1
  import { RegistryContract, createEthereumChain } from '@aztec/ethereum';
2
- import { createPublicClient, fallback, http } from 'viem';
2
+ import { createPublicClient, fallback, http } from '@spalladino/viem';
3
3
  export async function getL1Addresses(registryAddress, rollupVersion, rpcUrls, chainId, json, log) {
4
4
  const chain = createEthereumChain(rpcUrls, chainId);
5
5
  const publicClient = createPublicClient({
@@ -1,6 +1,6 @@
1
1
  import { createEthereumChain } from '@aztec/ethereum';
2
2
  import { TestERC20Abi } from '@aztec/l1-artifacts';
3
- import { createPublicClient, fallback, getContract, http } from 'viem';
3
+ import { createPublicClient, fallback, getContract, http } from '@spalladino/viem';
4
4
  import { prettyPrintJSON } from '../../utils/commands.js';
5
5
  export async function getL1Balance(who, token, l1RpcUrls, chainId, json, log) {
6
6
  const chain = createEthereumChain(l1RpcUrls, chainId);
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,WAAW,CAAC;AAcjD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAa3D,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,WAghB/E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,WAAW,CAAC;AAcjD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAa3D,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,WAkf/E"}
@@ -8,10 +8,10 @@ const l1RpcUrlsOption = new Option('--l1-rpc-urls <string>', 'List of Ethereum h
8
8
  ]).makeOptionMandatory(true).argParser((arg)=>arg.split(',').map((url)=>url.trim()));
9
9
  const networkOption = new Option('--network <string>', 'Network to execute against').env('NETWORK');
10
10
  export function injectCommands(program, log, debugLogger) {
11
- program.command('deploy-l1-contracts').description('Deploys all necessary Ethereum contracts for Aztec.').addOption(l1RpcUrlsOption).option('-pk, --private-key <string>', 'The private key to use for deployment', PRIVATE_KEY).option('--validators <string>', 'Comma separated list of validators').option('-m, --mnemonic <string>', 'The mnemonic to use in deployment', 'test test test test test test test test test test test junk').option('-i, --mnemonic-index <number>', 'The index of the mnemonic to use in deployment', (arg)=>parseInt(arg), 0).addOption(l1ChainIdOption).option('--salt <number>', 'The optional salt to use in deployment', (arg)=>parseInt(arg)).option('--json', 'Output the contract addresses in JSON format').option('--test-accounts', 'Populate genesis state with initial fee juice for test accounts').option('--sponsored-fpc', 'Populate genesis state with a testing sponsored FPC contract').option('--accelerated-test-deployments', 'Fire and forget deployment transactions, use in testing only', false).option('--real-verifier', 'Deploy the real verifier', false).option('--create-verification-json [path]', 'Create JSON file for etherscan contract verification', false).action(async (options)=>{
11
+ program.command('deploy-l1-contracts').description('Deploys all necessary Ethereum contracts for Aztec.').addOption(l1RpcUrlsOption).option('-pk, --private-key <string>', 'The private key to use for deployment', PRIVATE_KEY).option('--validators <string>', 'Comma separated list of validators').option('-m, --mnemonic <string>', 'The mnemonic to use in deployment', 'test test test test test test test test test test test junk').option('-i, --mnemonic-index <number>', 'The index of the mnemonic to use in deployment', (arg)=>parseInt(arg), 0).addOption(l1ChainIdOption).option('--salt <number>', 'The optional salt to use in deployment', (arg)=>parseInt(arg)).option('--json', 'Output the contract addresses in JSON format').option('--test-accounts', 'Populate genesis state with initial fee juice for test accounts').option('--sponsored-fpc', 'Populate genesis state with a testing sponsored FPC contract').option('--accelerated-test-deployments', 'Fire and forget deployment transactions, use in testing only', false).option('--real-verifier', 'Deploy the real verifier', false).option('--existing-token <address>', 'Use an existing ERC20 for both fee and staking', parseEthereumAddress).option('--create-verification-json [path]', 'Create JSON file for etherscan contract verification', false).action(async (options)=>{
12
12
  const { deployL1Contracts } = await import('./deploy_l1_contracts.js');
13
13
  const initialValidators = options.validators?.split(',').map((validator)=>EthAddress.fromString(validator)) || [];
14
- await deployL1Contracts(options.l1RpcUrls, options.l1ChainId, options.privateKey, options.mnemonic, options.mnemonicIndex, options.salt, options.testAccounts, options.sponsoredFpc, options.acceleratedTestDeployments, options.json, options.createVerificationJson, initialValidators, options.realVerifier, log, debugLogger);
14
+ await deployL1Contracts(options.l1RpcUrls, options.l1ChainId, options.privateKey, options.mnemonic, options.mnemonicIndex, options.salt, options.testAccounts, options.sponsoredFpc, options.acceleratedTestDeployments, options.json, options.createVerificationJson, initialValidators, options.realVerifier, options.existingToken, log, debugLogger);
15
15
  });
16
16
  program.command('deploy-new-rollup').description('Deploys a new rollup contract and adds it to the registry (if you are the owner).').requiredOption('-r, --registry-address <string>', 'The address of the registry contract', parseEthereumAddress).addOption(l1RpcUrlsOption).option('-pk, --private-key <string>', 'The private key to use for deployment', PRIVATE_KEY).option('--validators <string>', 'Comma separated list of validators').option('-m, --mnemonic <string>', 'The mnemonic to use in deployment', MNEMONIC ?? 'test test test test test test test test test test test junk').option('-i, --mnemonic-index <number>', 'The index of the mnemonic to use in deployment', (arg)=>parseInt(arg), 0).addOption(l1ChainIdOption).option('--salt <number>', 'The optional salt to use in deployment', (arg)=>parseInt(arg)).option('--json', 'Output the contract addresses in JSON format').option('--test-accounts', 'Populate genesis state with initial fee juice for test accounts').option('--sponsored-fpc', 'Populate genesis state with a testing sponsored FPC contract').option('--real-verifier', 'Deploy the real verifier', false).action(async (options)=>{
17
17
  const { deployNewRollup } = await import('./deploy_new_rollup.js');
@@ -194,23 +194,5 @@ export function injectCommands(program, log, debugLogger) {
194
194
  const { advanceEpoch } = await import('./advance_epoch.js');
195
195
  await advanceEpoch(options.l1RpcUrls, options.rpcUrl, log);
196
196
  });
197
- program.command('prover-stats', {
198
- hidden: true
199
- }).addOption(l1RpcUrlsOption).addOption(l1ChainIdOption).option('--start-block <number>', 'The L1 block number to start from', parseBigint, 1n).option('--end-block <number>', 'The last L1 block number to query', parseBigint).option('--batch-size <number>', 'The number of blocks to query in each batch', parseBigint, 100n).option('--proving-timeout <number>', 'Cutoff for proving time to consider a block', parseBigint).option('--l1-rollup-address <string>', 'Address of the rollup contract (required if node URL is not set)').option('--node-url <string>', 'JSON RPC URL of an Aztec node to retrieve the rollup contract address (required if L1 rollup address is not set)').option('--raw-logs', 'Output raw logs instead of aggregated stats').action(async (options)=>{
200
- const { proverStats } = await import('./prover_stats.js');
201
- const { l1RpcUrls, chainId, l1RollupAddress, startBlock, endBlock, batchSize, nodeUrl, provingTimeout, rawLogs } = options;
202
- await proverStats({
203
- l1RpcUrls,
204
- chainId,
205
- l1RollupAddress,
206
- startBlock,
207
- endBlock,
208
- batchSize,
209
- nodeUrl,
210
- provingTimeout,
211
- rawLogs,
212
- log
213
- });
214
- });
215
197
  return program;
216
198
  }
@@ -5,9 +5,9 @@ import { EthAddress } from '@aztec/foundation/eth-address';
5
5
  import { createLogger } from '@aztec/foundation/log';
6
6
  import { RollupAbi } from '@aztec/l1-artifacts';
7
7
  import { createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
8
+ import { createPublicClient, fallback, getAbiItem, getAddress, http } from '@spalladino/viem';
8
9
  import chunk from 'lodash.chunk';
9
10
  import groupBy from 'lodash.groupby';
10
- import { createPublicClient, fallback, getAbiItem, getAddress, http } from 'viem';
11
11
  export async function proverStats(opts) {
12
12
  const debugLog = createLogger('cli:prover_stats');
13
13
  const { startBlock, chainId, l1RpcUrls, l1RollupAddress, batchSize, nodeUrl, provingTimeout, endBlock, rawLogs, log } = opts;
@@ -1,6 +1,6 @@
1
1
  import { createEthereumChain, createExtendedL1Client } from '@aztec/ethereum';
2
2
  import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
3
- import { getContract } from 'viem';
3
+ import { getContract } from '@spalladino/viem';
4
4
  export async function triggerSeedSnapshot({ rpcUrls, chainId, privateKey, mnemonic, rollupAddress, log }) {
5
5
  const chain = createEthereumChain(rpcUrls, chainId);
6
6
  const client = createExtendedL1Client(rpcUrls, privateKey ?? mnemonic, chain.chainInfo);
@@ -2,8 +2,8 @@ import { GSEContract, RollupContract, createEthereumChain, createExtendedL1Clien
2
2
  import { EthCheatCodes } from '@aztec/ethereum/test';
3
3
  import { RollupAbi, StakingAssetHandlerAbi } from '@aztec/l1-artifacts';
4
4
  import { ZkPassportProofParams } from '@aztec/stdlib/zkpassport';
5
- import { encodeFunctionData, formatEther, getContract } from 'viem';
6
- import { generatePrivateKey, mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
5
+ import { encodeFunctionData, formatEther, getContract } from '@spalladino/viem';
6
+ import { generatePrivateKey, mnemonicToAccount, privateKeyToAccount } from '@spalladino/viem/accounts';
7
7
  import { addLeadingHex } from '../../utils/aztec.js';
8
8
  export function generateL1Account() {
9
9
  const privateKey = generatePrivateKey();
@@ -34,7 +34,9 @@ export async function addL1Validator({ rpcUrls, chainId, privateKey, mnemonic, a
34
34
  const gseAddress = await rollup.read.getGSE();
35
35
  const gse = new GSEContract(l1Client, gseAddress);
36
36
  const registrationTuple = await gse.makeRegistrationTuple(blsSecretKey);
37
- const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, debugLogger);
37
+ const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, {
38
+ logger: debugLogger
39
+ });
38
40
  const proofParamsObj = ZkPassportProofParams.fromBuffer(proofParams);
39
41
  const merkleProofArray = merkleProof.map((proof)=>addLeadingHex(proof));
40
42
  const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
@@ -88,7 +90,9 @@ export async function addL1ValidatorViaRollup({ rpcUrls, chainId, privateKey, mn
88
90
  const gseAddress = await rollup.read.getGSE();
89
91
  const gse = new GSEContract(l1Client, gseAddress);
90
92
  const registrationTuple = await gse.makeRegistrationTuple(blsSecretKey);
91
- const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, debugLogger);
93
+ const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, {
94
+ logger: debugLogger
95
+ });
92
96
  const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
93
97
  to: rollupAddress.toString(),
94
98
  data: encodeFunctionData({
@@ -128,7 +132,9 @@ export async function removeL1Validator({ rpcUrls, chainId, privateKey, mnemonic
128
132
  const account = getAccount(privateKey, mnemonic);
129
133
  const chain = createEthereumChain(rpcUrls, chainId);
130
134
  const l1Client = createExtendedL1Client(rpcUrls, account, chain.chainInfo);
131
- const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, debugLogger);
135
+ const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, {
136
+ logger: debugLogger
137
+ });
132
138
  dualLog(`Removing validator ${validatorAddress.toString()} from rollup ${rollupAddress.toString()}`);
133
139
  const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
134
140
  to: rollupAddress.toString(),
@@ -148,7 +154,9 @@ export async function pruneRollup({ rpcUrls, chainId, privateKey, mnemonic, roll
148
154
  const account = getAccount(privateKey, mnemonic);
149
155
  const chain = createEthereumChain(rpcUrls, chainId);
150
156
  const l1Client = createExtendedL1Client(rpcUrls, account, chain.chainInfo);
151
- const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, debugLogger);
157
+ const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, {
158
+ logger: debugLogger
159
+ });
152
160
  dualLog(`Trying prune`);
153
161
  const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
154
162
  to: rollupAddress.toString(),
@@ -208,7 +216,7 @@ export async function debugRollup({ rpcUrls, chainId, rollupAddress, log }) {
208
216
  log(`Committee: ${committee?.map((v)=>v.toString()).join(', ')}`);
209
217
  const archive = await rollup.archive();
210
218
  log(`Archive: ${archive}`);
211
- const epochNum = await rollup.getEpochNumber();
219
+ const epochNum = await rollup.getCurrentEpochNumber();
212
220
  log(`Current epoch: ${epochNum}`);
213
221
  const slot = await rollup.getSlotNumber();
214
222
  log(`Current slot: ${slot}`);
@@ -0,0 +1,18 @@
1
+ export interface CachedFetchOptions {
2
+ /** Cache duration in milliseconds */
3
+ cacheDurationMs: number;
4
+ /** The cache file */
5
+ cacheFile?: string;
6
+ }
7
+ /**
8
+ * Fetches data from a URL with file-based caching support.
9
+ * This utility can be used by both remote config and bootnodes fetching.
10
+ *
11
+ * @param url - The URL to fetch from
12
+ * @param networkName - Network name for cache directory structure
13
+ * @param options - Caching and error handling options
14
+ * @param cacheDir - Optional cache directory (defaults to no caching)
15
+ * @returns The fetched and parsed JSON data, or undefined if fetch fails and throwOnError is false
16
+ */
17
+ export declare function cachedFetch<T = any>(url: string, options: CachedFetchOptions, fetch?: typeof globalThis.fetch, log?: import("@aztec/aztec.js").Logger): Promise<T | undefined>;
18
+ //# sourceMappingURL=cached_fetch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cached_fetch.d.ts","sourceRoot":"","sources":["../../src/config/cached_fetch.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,kBAAkB;IACjC,qCAAqC;IACrC,eAAe,EAAE,MAAM,CAAC;IACxB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAAC,CAAC,GAAG,GAAG,EACvC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,kBAAkB,EAC3B,KAAK,0BAAmB,EACxB,GAAG,mCAA+B,GACjC,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAuCxB"}
@@ -0,0 +1,54 @@
1
+ import { createLogger } from '@aztec/aztec.js';
2
+ import { mkdir, readFile, stat, writeFile } from 'fs/promises';
3
+ import { dirname } from 'path';
4
+ /**
5
+ * Fetches data from a URL with file-based caching support.
6
+ * This utility can be used by both remote config and bootnodes fetching.
7
+ *
8
+ * @param url - The URL to fetch from
9
+ * @param networkName - Network name for cache directory structure
10
+ * @param options - Caching and error handling options
11
+ * @param cacheDir - Optional cache directory (defaults to no caching)
12
+ * @returns The fetched and parsed JSON data, or undefined if fetch fails and throwOnError is false
13
+ */ export async function cachedFetch(url, options, fetch = globalThis.fetch, log = createLogger('cached_fetch')) {
14
+ const { cacheDurationMs, cacheFile } = options;
15
+ // Try to read from cache first
16
+ try {
17
+ if (cacheFile) {
18
+ const info = await stat(cacheFile);
19
+ if (info.mtimeMs + cacheDurationMs > Date.now()) {
20
+ const cachedData = JSON.parse(await readFile(cacheFile, 'utf-8'));
21
+ return cachedData;
22
+ }
23
+ }
24
+ } catch {
25
+ log.trace('Failed to read data from cache');
26
+ }
27
+ try {
28
+ const response = await fetch(url);
29
+ if (!response.ok) {
30
+ log.warn(`Failed to fetch from ${url}: ${response.status} ${response.statusText}`);
31
+ return undefined;
32
+ }
33
+ const data = await response.json();
34
+ try {
35
+ if (cacheFile) {
36
+ await mkdir(dirname(cacheFile), {
37
+ recursive: true
38
+ });
39
+ await writeFile(cacheFile, JSON.stringify(data), 'utf-8');
40
+ }
41
+ } catch (err) {
42
+ log.warn('Failed to cache data on disk: ' + cacheFile, {
43
+ cacheFile,
44
+ err
45
+ });
46
+ }
47
+ return data;
48
+ } catch (err) {
49
+ log.warn(`Failed to fetch from ${url}`, {
50
+ err
51
+ });
52
+ return undefined;
53
+ }
54
+ }
@@ -9,24 +9,27 @@ export type L2ChainConfig = L1ContractsConfig & Pick<P2PConfig, 'txPoolDeleteTxs
9
9
  sponsoredFPC: boolean;
10
10
  p2pEnabled: boolean;
11
11
  p2pBootstrapNodes: string[];
12
- registryAddress: string;
13
- slashFactoryAddress: string;
14
- feeAssetHandlerAddress: string;
15
12
  seqMinTxsPerBlock: number;
16
13
  seqMaxTxsPerBlock: number;
17
14
  realProofs: boolean;
18
- snapshotsUrl: string;
15
+ snapshotsUrls: string[];
19
16
  autoUpdate: SharedNodeConfig['autoUpdate'];
20
17
  autoUpdateUrl?: string;
21
18
  maxTxPoolSize: number;
22
19
  publicIncludeMetrics?: string[];
23
20
  publicMetricsCollectorUrl?: string;
24
21
  publicMetricsCollectFrom?: string[];
22
+ dbMapSizeKb: number;
23
+ archiverStoreMapSizeKb: number;
24
+ noteHashTreeMapSizeKb: number;
25
+ nullifierTreeMapSizeKb: number;
26
+ publicDataTreeMapSizeKb: number;
25
27
  sentinelEnabled: boolean;
26
28
  };
27
29
  export declare const stagingIgnitionL2ChainConfig: L2ChainConfig;
28
30
  export declare const stagingPublicL2ChainConfig: L2ChainConfig;
29
31
  export declare const testnetL2ChainConfig: L2ChainConfig;
32
+ export declare const ignitionL2ChainConfig: L2ChainConfig;
30
33
  export declare function getBootnodes(networkName: NetworkNames, cacheDir?: string): Promise<any>;
31
34
  export declare function getL2ChainConfig(networkName: NetworkNames, cacheDir?: string): Promise<L2ChainConfig | undefined>;
32
35
  export declare function enrichEnvironmentWithChainConfig(networkName: NetworkNames): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"chain_l2_config.d.ts","sourceRoot":"","sources":["../../src/config/chain_l2_config.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACnF,OAAO,KAAK,EAAU,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAOrE,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAC3C,IAAI,CAAC,SAAS,EAAE,2BAA2B,CAAC,GAC5C,IAAI,CAAC,aAAa,EAAE,sBAAsB,GAAG,uBAAuB,CAAC,GAAG;IACtE,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC3C,aAAa,CAAC,EAA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