@aztec/cli 2.0.3 → 2.1.0-rc.1

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.
@@ -18,7 +18,7 @@ export declare function getFunctionAbi(artifact: ContractArtifact, fnName: strin
18
18
  * @param privateKey - The private key to be used in contract deployment.
19
19
  * @param mnemonic - The mnemonic to be used in contract deployment.
20
20
  */
21
- export declare function deployAztecContracts(rpcUrls: string[], chainId: number, privateKey: string | undefined, mnemonic: string, mnemonicIndex: number, salt: number | undefined, initialValidators: Operator[], genesisArchiveRoot: Fr, feeJuicePortalInitialBalance: bigint, acceleratedTestDeployments: boolean, config: L1ContractsConfig, realVerifier: boolean, createVerificationJson: string | false, debugLogger: Logger): Promise<DeployL1ContractsReturnType>;
21
+ export declare function deployAztecContracts(rpcUrls: string[], chainId: number, privateKey: string | undefined, mnemonic: string, mnemonicIndex: number, salt: number | undefined, initialValidators: Operator[], genesisArchiveRoot: Fr, feeJuicePortalInitialBalance: bigint, acceleratedTestDeployments: boolean, config: L1ContractsConfig, existingToken: EthAddress | undefined, realVerifier: boolean, createVerificationJson: string | false, debugLogger: Logger): Promise<DeployL1ContractsReturnType>;
22
22
  export declare function deployNewRollupContracts(registryAddress: EthAddress, rpcUrls: string[], chainId: number, privateKey: string | undefined, mnemonic: string, mnemonicIndex: number, salt: number | undefined, initialValidators: Operator[], genesisArchiveRoot: Fr, feeJuicePortalInitialBalance: bigint, config: L1ContractsConfig, realVerifier: boolean, logger: Logger): Promise<{
23
23
  rollup: RollupContract;
24
24
  slashFactoryAddress: EthAddress;
@@ -1 +1 @@
1
- {"version":3,"file":"aztec.d.ts","sourceRoot":"","sources":["../../src/utils/aztec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAIjB,MAAM,qBAAqB,CAAC;AAC7B,OA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CAAC,CAKjE;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,6BA4BpE;AAED;;;;;;;GAOG;AACH,wBAAsB,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,KAAK;;;;GAO3G;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,KAAK,MAAM,KAAG,MAK7C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,KAAG,KAAK,MAAM,EAKtD,CAAC;AAOF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAUtE;AAKD;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,oBAAoB,EAAE,MAAM,iBAyB9E"}
@@ -25,7 +25,7 @@ import { encodeArgs } from './encoding.js';
25
25
  * @param chainId - The chain ID of the L1 host.
26
26
  * @param privateKey - The private key to be used in contract deployment.
27
27
  * @param mnemonic - The mnemonic to be used in contract deployment.
28
- */ export async function deployAztecContracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot, feeJuicePortalInitialBalance, acceleratedTestDeployments, config, realVerifier, createVerificationJson, debugLogger) {
28
+ */ export async function deployAztecContracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot, feeJuicePortalInitialBalance, acceleratedTestDeployments, config, existingToken, realVerifier, createVerificationJson, debugLogger) {
29
29
  const { createEthereumChain, deployL1Contracts } = await import('@aztec/ethereum');
30
30
  const { mnemonicToAccount, privateKeyToAccount } = await import('viem/accounts');
31
31
  const account = !privateKey ? mnemonicToAccount(mnemonic, {
@@ -42,6 +42,7 @@ import { encodeArgs } from './encoding.js';
42
42
  acceleratedTestDeployments,
43
43
  feeJuicePortalInitialBalance,
44
44
  realVerifier,
45
+ existingTokenAddress: existingToken,
45
46
  ...config
46
47
  }, config, createVerificationJson);
47
48
  return result;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/cli",
3
- "version": "2.0.3",
3
+ "version": "2.1.0-rc.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./contracts": "./dest/cmds/contracts/index.js",
@@ -70,17 +70,17 @@
70
70
  ]
71
71
  },
72
72
  "dependencies": {
73
- "@aztec/archiver": "2.0.3",
74
- "@aztec/aztec.js": "2.0.3",
75
- "@aztec/constants": "2.0.3",
76
- "@aztec/entrypoints": "2.0.3",
77
- "@aztec/ethereum": "2.0.3",
78
- "@aztec/foundation": "2.0.3",
79
- "@aztec/l1-artifacts": "2.0.3",
80
- "@aztec/node-lib": "2.0.3",
81
- "@aztec/p2p": "2.0.3",
82
- "@aztec/stdlib": "2.0.3",
83
- "@aztec/world-state": "2.0.3",
73
+ "@aztec/archiver": "2.1.0-rc.1",
74
+ "@aztec/aztec.js": "2.1.0-rc.1",
75
+ "@aztec/constants": "2.1.0-rc.1",
76
+ "@aztec/entrypoints": "2.1.0-rc.1",
77
+ "@aztec/ethereum": "2.1.0-rc.1",
78
+ "@aztec/foundation": "2.1.0-rc.1",
79
+ "@aztec/l1-artifacts": "2.1.0-rc.1",
80
+ "@aztec/node-lib": "2.1.0-rc.1",
81
+ "@aztec/p2p": "2.1.0-rc.1",
82
+ "@aztec/stdlib": "2.1.0-rc.1",
83
+ "@aztec/world-state": "2.1.0-rc.1",
84
84
  "@iarna/toml": "^2.2.5",
85
85
  "@libp2p/peer-id-factory": "^3.0.4",
86
86
  "commander": "^12.1.0",
@@ -92,8 +92,8 @@
92
92
  "viem": "2.23.7"
93
93
  },
94
94
  "devDependencies": {
95
- "@aztec/accounts": "2.0.3",
96
- "@aztec/protocol-contracts": "2.0.3",
95
+ "@aztec/accounts": "2.1.0-rc.1",
96
+ "@aztec/protocol-contracts": "2.1.0-rc.1",
97
97
  "@jest/globals": "^30.0.0",
98
98
  "@types/jest": "^30.0.0",
99
99
  "@types/lodash.chunk": "^4.2.9",
@@ -109,15 +109,15 @@
109
109
  "typescript": "^5.3.3"
110
110
  },
111
111
  "peerDependencies": {
112
- "@aztec/accounts": "2.0.3",
113
- "@aztec/bb-prover": "2.0.3",
114
- "@aztec/ethereum": "2.0.3",
115
- "@aztec/l1-artifacts": "2.0.3",
116
- "@aztec/noir-contracts.js": "2.0.3",
117
- "@aztec/noir-protocol-circuits-types": "2.0.3",
118
- "@aztec/noir-test-contracts.js": "2.0.3",
119
- "@aztec/protocol-contracts": "2.0.3",
120
- "@aztec/stdlib": "2.0.3"
112
+ "@aztec/accounts": "2.1.0-rc.1",
113
+ "@aztec/bb-prover": "2.1.0-rc.1",
114
+ "@aztec/ethereum": "2.1.0-rc.1",
115
+ "@aztec/l1-artifacts": "2.1.0-rc.1",
116
+ "@aztec/noir-contracts.js": "2.1.0-rc.1",
117
+ "@aztec/noir-protocol-circuits-types": "2.1.0-rc.1",
118
+ "@aztec/noir-test-contracts.js": "2.1.0-rc.1",
119
+ "@aztec/protocol-contracts": "2.1.0-rc.1",
120
+ "@aztec/stdlib": "2.1.0-rc.1"
121
121
  },
122
122
  "files": [
123
123
  "dest",
@@ -22,6 +22,7 @@ export async function deployL1Contracts(
22
22
  createVerificationJson: string | false,
23
23
  initialValidators: EthAddress[],
24
24
  realVerifier: boolean,
25
+ existingToken: EthAddress | undefined,
25
26
  log: LogFn,
26
27
  debugLogger: Logger,
27
28
  ) {
@@ -50,6 +51,7 @@ export async function deployL1Contracts(
50
51
  fundingNeeded,
51
52
  acceleratedTestDeployments,
52
53
  config,
54
+ existingToken,
53
55
  realVerifier,
54
56
  createVerificationJson,
55
57
  debugLogger,
@@ -48,6 +48,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
48
48
  .option('--sponsored-fpc', 'Populate genesis state with a testing sponsored FPC contract')
49
49
  .option('--accelerated-test-deployments', 'Fire and forget deployment transactions, use in testing only', false)
50
50
  .option('--real-verifier', 'Deploy the real verifier', false)
51
+ .option('--existing-token <address>', 'Use an existing ERC20 for both fee and staking', parseEthereumAddress)
51
52
  .option('--create-verification-json [path]', 'Create JSON file for etherscan contract verification', false)
52
53
  .action(async options => {
53
54
  const { deployL1Contracts } = await import('./deploy_l1_contracts.js');
@@ -68,6 +69,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
68
69
  options.createVerificationJson,
69
70
  initialValidators,
70
71
  options.realVerifier,
72
+ options.existingToken,
71
73
  log,
72
74
  debugLogger,
73
75
  );
@@ -0,0 +1,67 @@
1
+ import { createLogger } from '@aztec/aztec.js';
2
+
3
+ import { mkdir, readFile, stat, writeFile } from 'fs/promises';
4
+ import { dirname } from 'path';
5
+
6
+ export interface CachedFetchOptions {
7
+ /** Cache duration in milliseconds */
8
+ cacheDurationMs: number;
9
+ /** The cache file */
10
+ cacheFile?: string;
11
+ }
12
+
13
+ /**
14
+ * Fetches data from a URL with file-based caching support.
15
+ * This utility can be used by both remote config and bootnodes fetching.
16
+ *
17
+ * @param url - The URL to fetch from
18
+ * @param networkName - Network name for cache directory structure
19
+ * @param options - Caching and error handling options
20
+ * @param cacheDir - Optional cache directory (defaults to no caching)
21
+ * @returns The fetched and parsed JSON data, or undefined if fetch fails and throwOnError is false
22
+ */
23
+ export async function cachedFetch<T = any>(
24
+ url: string,
25
+ options: CachedFetchOptions,
26
+ fetch = globalThis.fetch,
27
+ log = createLogger('cached_fetch'),
28
+ ): Promise<T | undefined> {
29
+ const { cacheDurationMs, cacheFile } = options;
30
+
31
+ // Try to read from cache first
32
+ try {
33
+ if (cacheFile) {
34
+ const info = await stat(cacheFile);
35
+ if (info.mtimeMs + cacheDurationMs > Date.now()) {
36
+ const cachedData = JSON.parse(await readFile(cacheFile, 'utf-8'));
37
+ return cachedData;
38
+ }
39
+ }
40
+ } catch {
41
+ log.trace('Failed to read data from cache');
42
+ }
43
+
44
+ try {
45
+ const response = await fetch(url);
46
+ if (!response.ok) {
47
+ log.warn(`Failed to fetch from ${url}: ${response.status} ${response.statusText}`);
48
+ return undefined;
49
+ }
50
+
51
+ const data = await response.json();
52
+
53
+ try {
54
+ if (cacheFile) {
55
+ await mkdir(dirname(cacheFile), { recursive: true });
56
+ await writeFile(cacheFile, JSON.stringify(data), 'utf-8');
57
+ }
58
+ } catch (err) {
59
+ log.warn('Failed to cache data on disk: ' + cacheFile, { cacheFile, err });
60
+ }
61
+
62
+ return data;
63
+ } catch (err) {
64
+ log.warn(`Failed to fetch from ${url}`, { err });
65
+ return undefined;
66
+ }
67
+ }
@@ -5,10 +5,14 @@ import type { SharedNodeConfig } from '@aztec/node-lib/config';
5
5
  import type { P2PConfig } from '@aztec/p2p/config';
6
6
  import type { SlasherConfig } from '@aztec/stdlib/interfaces/server';
7
7
 
8
- import { mkdir, readFile, stat, writeFile } from 'fs/promises';
9
- import path, { dirname, join } from 'path';
8
+ import path, { join } from 'path';
10
9
 
11
10
  import publicIncludeMetrics from '../../public_include_metric_prefixes.json' with { type: 'json' };
11
+ import { cachedFetch } from './cached_fetch.js';
12
+ import { enrichEthAddressVar, enrichVar } from './enrich_env.js';
13
+
14
+ const defaultDBMapSizeKb = 128 * 1_024 * 1_024; // 128 GB
15
+ const tbMapSizeKb = 1_024 * 1_024 * 1_024; // 1 TB
12
16
 
13
17
  export type L2ChainConfig = L1ContractsConfig &
14
18
  Pick<P2PConfig, 'txPoolDeleteTxsAfterReorg'> &
@@ -18,9 +22,6 @@ export type L2ChainConfig = L1ContractsConfig &
18
22
  sponsoredFPC: boolean;
19
23
  p2pEnabled: boolean;
20
24
  p2pBootstrapNodes: string[];
21
- registryAddress: string;
22
- slashFactoryAddress: string;
23
- feeAssetHandlerAddress: string;
24
25
  seqMinTxsPerBlock: number;
25
26
  seqMaxTxsPerBlock: number;
26
27
  realProofs: boolean;
@@ -32,6 +33,14 @@ export type L2ChainConfig = L1ContractsConfig &
32
33
  publicMetricsCollectorUrl?: string;
33
34
  publicMetricsCollectFrom?: string[];
34
35
 
36
+ // Setting the dbMapSize provides the default for every DB in the node.
37
+ // Then we explicitly override the sizes for the archiver and the larger trees.
38
+ dbMapSizeKb: number;
39
+ archiverStoreMapSizeKb: number;
40
+ noteHashTreeMapSizeKb: number;
41
+ nullifierTreeMapSizeKb: number;
42
+ publicDataTreeMapSizeKb: number;
43
+
35
44
  // Control whether sentinel is enabled or not. Needed for slashing
36
45
  sentinelEnabled: boolean;
37
46
  };
@@ -47,6 +56,8 @@ const DefaultSlashConfig = {
47
56
  slashingOffsetInRounds: 2,
48
57
  /** No slash vetoer */
49
58
  slashingVetoer: EthAddress.ZERO,
59
+ /** Use default disable duration */
60
+ slashingDisableDuration: DefaultL1ContractsConfig.slashingDisableDuration,
50
61
  /** Use default slash amounts */
51
62
  slashAmountSmall: DefaultL1ContractsConfig.slashAmountSmall,
52
63
  slashAmountMedium: DefaultL1ContractsConfig.slashAmountMedium,
@@ -63,11 +74,20 @@ const DefaultSlashConfig = {
63
74
  slashProposeInvalidAttestationsPenalty: DefaultL1ContractsConfig.slashAmountLarge,
64
75
  slashAttestDescendantOfInvalidPenalty: DefaultL1ContractsConfig.slashAmountLarge,
65
76
  slashUnknownPenalty: DefaultL1ContractsConfig.slashAmountSmall,
66
- slashBroadcastedInvalidBlockPenalty: DefaultL1ContractsConfig.slashAmountMedium,
77
+ slashBroadcastedInvalidBlockPenalty: 0n, // DefaultL1ContractsConfig.slashAmountSmall // Disabled until further testing
67
78
  slashMaxPayloadSize: 50,
68
79
  slashGracePeriodL2Slots: 32 * 2, // Two epochs from genesis
69
80
  slashOffenseExpirationRounds: 8,
70
81
  sentinelEnabled: true,
82
+ slashExecuteRoundsLookBack: 4,
83
+ } satisfies Partial<L2ChainConfig>;
84
+
85
+ const DefaultNetworkDBMapSizeConfig = {
86
+ dbMapSizeKb: defaultDBMapSizeKb,
87
+ archiverStoreMapSizeKb: tbMapSizeKb,
88
+ noteHashTreeMapSizeKb: tbMapSizeKb,
89
+ nullifierTreeMapSizeKb: tbMapSizeKb,
90
+ publicDataTreeMapSizeKb: tbMapSizeKb,
71
91
  } satisfies Partial<L2ChainConfig>;
72
92
 
73
93
  export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
@@ -76,9 +96,6 @@ export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
76
96
  sponsoredFPC: false,
77
97
  p2pEnabled: true,
78
98
  p2pBootstrapNodes: [],
79
- registryAddress: '0x6c04b1c116ec1ea0f918e3cc91e87b0af3e23b73',
80
- slashFactoryAddress: '',
81
- feeAssetHandlerAddress: '',
82
99
  seqMinTxsPerBlock: 0,
83
100
  seqMaxTxsPerBlock: 0,
84
101
  realProofs: true,
@@ -99,6 +116,8 @@ export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
99
116
  aztecEpochDuration: 32,
100
117
  /** The target validator committee size. */
101
118
  aztecTargetCommitteeSize: 24,
119
+ /** The number of epochs to lag behind the current epoch for validator selection. */
120
+ lagInEpochs: 2,
102
121
  /** The number of epochs after an epoch ends that proofs are still accepted. */
103
122
  aztecProofSubmissionEpochs: 1,
104
123
  /** How many sequencers must agree with a slash for it to be executed. */
@@ -107,6 +126,7 @@ export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
107
126
  slashingRoundSizeInEpochs: 4,
108
127
  slashingLifetimeInRounds: 40,
109
128
  slashingExecutionDelayInRounds: 28,
129
+ slashingDisableDuration: 5 * 24 * 60 * 60, // 5 days in seconds
110
130
  slashAmountSmall: 2_000n * 10n ** 18n,
111
131
  slashAmountMedium: 10_000n * 10n ** 18n,
112
132
  slashAmountLarge: 50_000n * 10n ** 18n,
@@ -124,6 +144,7 @@ export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
124
144
 
125
145
  ejectionThreshold: 100_000n * 10n ** 18n,
126
146
  activationThreshold: 200_000n * 10n ** 18n,
147
+ localEjectionThreshold: 196_000n * 10n ** 18n,
127
148
 
128
149
  governanceProposerRoundSize: 300, // TODO TMNT-322
129
150
  governanceProposerQuorum: 151, // TODO TMNT-322
@@ -140,11 +161,14 @@ export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
140
161
  slashProposeInvalidAttestationsPenalty: 50_000n * 10n ** 18n,
141
162
  slashAttestDescendantOfInvalidPenalty: 50_000n * 10n ** 18n,
142
163
  slashUnknownPenalty: 2_000n * 10n ** 18n,
143
- slashBroadcastedInvalidBlockPenalty: 10_000n * 10n ** 18n,
164
+ slashBroadcastedInvalidBlockPenalty: 0n, // 10_000n * 10n ** 18n, Disabled for now until further testing
144
165
  slashMaxPayloadSize: 50,
145
166
  slashGracePeriodL2Slots: 32 * 4, // One round from genesis
146
167
  slashOffenseExpirationRounds: 8,
147
168
  sentinelEnabled: true,
169
+ slashExecuteRoundsLookBack: 4,
170
+
171
+ ...DefaultNetworkDBMapSizeConfig,
148
172
  };
149
173
 
150
174
  export const stagingPublicL2ChainConfig: L2ChainConfig = {
@@ -153,9 +177,6 @@ export const stagingPublicL2ChainConfig: L2ChainConfig = {
153
177
  sponsoredFPC: true,
154
178
  p2pEnabled: true,
155
179
  p2pBootstrapNodes: [],
156
- registryAddress: '0x2e48addca360da61e4d6c21ff2b1961af56eb83b',
157
- slashFactoryAddress: '0xe19410632fd00695bc5a08dd82044b7b26317742',
158
- feeAssetHandlerAddress: '0xb46dc3d91f849999330b6dd93473fa29fc45b076',
159
180
  seqMinTxsPerBlock: 0,
160
181
  seqMaxTxsPerBlock: 20,
161
182
  realProofs: true,
@@ -177,6 +198,10 @@ export const stagingPublicL2ChainConfig: L2ChainConfig = {
177
198
  aztecEpochDuration: 32,
178
199
  /** The target validator committee size. */
179
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,
180
205
  /** The number of epochs after an epoch ends that proofs are still accepted. */
181
206
  aztecProofSubmissionEpochs: 1,
182
207
  /** The deposit amount for a validator */
@@ -195,6 +220,8 @@ export const stagingPublicL2ChainConfig: L2ChainConfig = {
195
220
  exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
196
221
 
197
222
  ...DefaultSlashConfig,
223
+
224
+ ...DefaultNetworkDBMapSizeConfig,
198
225
  };
199
226
 
200
227
  export const testnetL2ChainConfig: L2ChainConfig = {
@@ -203,9 +230,6 @@ export const testnetL2ChainConfig: L2ChainConfig = {
203
230
  sponsoredFPC: true,
204
231
  p2pEnabled: true,
205
232
  p2pBootstrapNodes: [],
206
- registryAddress: '0xc2f24280f5c7f4897370dfdeb30f79ded14f1c81',
207
- slashFactoryAddress: '0x76291684ae928d6e5bcff348e36917f4cc532db8',
208
- feeAssetHandlerAddress: '0x50513c3713ffd33301e85f30d86ab764df421fe9',
209
233
  seqMinTxsPerBlock: 0,
210
234
  seqMaxTxsPerBlock: 20,
211
235
  realProofs: true,
@@ -227,12 +251,16 @@ export const testnetL2ChainConfig: L2ChainConfig = {
227
251
  aztecEpochDuration: 32,
228
252
  /** The target validator committee size. */
229
253
  aztecTargetCommitteeSize: 48,
254
+ /** The number of epochs to lag behind the current epoch for validator selection. */
255
+ lagInEpochs: 2,
230
256
  /** The number of epochs after an epoch ends that proofs are still accepted. */
231
257
  aztecProofSubmissionEpochs: 1,
232
258
  /** The deposit amount for a validator */
233
259
  activationThreshold: DefaultL1ContractsConfig.activationThreshold,
234
260
  /** The minimum stake for a validator. */
235
261
  ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold,
262
+ /** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */
263
+ localEjectionThreshold: DefaultL1ContractsConfig.localEjectionThreshold,
236
264
  /** The slashing round size */
237
265
  slashingRoundSizeInEpochs: DefaultL1ContractsConfig.slashingRoundSizeInEpochs,
238
266
  /** Governance proposing round size */
@@ -248,42 +276,101 @@ export const testnetL2ChainConfig: L2ChainConfig = {
248
276
  slashPrunePenalty: 0n,
249
277
  slashDataWithholdingPenalty: 0n,
250
278
  slashInactivityPenalty: DefaultL1ContractsConfig.slashAmountMedium,
279
+
280
+ ...DefaultNetworkDBMapSizeConfig,
281
+ };
282
+
283
+ export const ignitionL2ChainConfig: L2ChainConfig = {
284
+ l1ChainId: 1,
285
+ testAccounts: false,
286
+ sponsoredFPC: false,
287
+ p2pEnabled: true,
288
+ p2pBootstrapNodes: [],
289
+ seqMinTxsPerBlock: 0,
290
+ seqMaxTxsPerBlock: 0,
291
+ realProofs: true,
292
+ snapshotsUrl: 'https://storage.googleapis.com/aztec-testnet/snapshots/ignition/',
293
+ autoUpdate: 'notify',
294
+ autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/ignition.json',
295
+ maxTxPoolSize: 100_000_000, // 100MB
296
+ publicIncludeMetrics,
297
+ publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
298
+ publicMetricsCollectFrom: ['sequencer'],
299
+ txPoolDeleteTxsAfterReorg: false,
300
+
301
+ /** How many seconds an L1 slot lasts. */
302
+ ethereumSlotDuration: 12,
303
+ /** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
304
+ aztecSlotDuration: 72,
305
+ /** How many L2 slots an epoch lasts. */
306
+ aztecEpochDuration: 32,
307
+ /** The target validator committee size. */
308
+ aztecTargetCommitteeSize: 24,
309
+ /** The number of epochs to lag behind the current epoch for validator selection. */
310
+ lagInEpochs: 2,
311
+ /** The number of epochs after an epoch ends that proofs are still accepted. */
312
+ aztecProofSubmissionEpochs: 1,
313
+ /** How many sequencers must agree with a slash for it to be executed. */
314
+ slashingQuorum: 65,
315
+
316
+ slashingRoundSizeInEpochs: 4,
317
+ slashingLifetimeInRounds: 40,
318
+ slashingExecutionDelayInRounds: 28,
319
+ slashingDisableDuration: 5 * 24 * 60 * 60, // 5 days in seconds
320
+ slashAmountSmall: 2_000n * 10n ** 18n,
321
+ slashAmountMedium: 10_000n * 10n ** 18n,
322
+ slashAmountLarge: 50_000n * 10n ** 18n,
323
+ slashingOffsetInRounds: 2,
324
+ slasherFlavor: 'tally',
325
+ slashingVetoer: EthAddress.ZERO, // TODO TMNT-329
326
+
327
+ /** The mana target for the rollup */
328
+ manaTarget: 0n,
329
+
330
+ exitDelaySeconds: 5 * 24 * 60 * 60,
331
+
332
+ /** The proving cost per mana */
333
+ provingCostPerMana: 0n,
334
+
335
+ ejectionThreshold: 100_000n * 10n ** 18n,
336
+ activationThreshold: 200_000n * 10n ** 18n,
337
+ localEjectionThreshold: 196_000n * 10n ** 18n,
338
+
339
+ governanceProposerRoundSize: 300, // TODO TMNT-322
340
+ governanceProposerQuorum: 151, // TODO TMNT-322
341
+
342
+ // Node slashing config
343
+ // TODO TMNT-330
344
+ slashMinPenaltyPercentage: 0.5,
345
+ slashMaxPenaltyPercentage: 2.0,
346
+ slashInactivityTargetPercentage: 0.7,
347
+ slashInactivityConsecutiveEpochThreshold: 2,
348
+ slashInactivityPenalty: 2_000n * 10n ** 18n,
349
+ slashPrunePenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for prune offenses right now
350
+ slashDataWithholdingPenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for data withholding offenses right now
351
+ slashProposeInvalidAttestationsPenalty: 50_000n * 10n ** 18n,
352
+ slashAttestDescendantOfInvalidPenalty: 50_000n * 10n ** 18n,
353
+ slashUnknownPenalty: 2_000n * 10n ** 18n,
354
+ slashBroadcastedInvalidBlockPenalty: 0n, // 10_000n * 10n ** 18n, Disabled for now until further testing
355
+ slashMaxPayloadSize: 50,
356
+ slashGracePeriodL2Slots: 32 * 4, // One round from genesis
357
+ slashOffenseExpirationRounds: 8,
358
+ sentinelEnabled: true,
359
+ slashExecuteRoundsLookBack: 4,
360
+
361
+ ...DefaultNetworkDBMapSizeConfig,
251
362
  };
252
363
 
253
364
  const BOOTNODE_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour;
254
365
 
255
366
  export async function getBootnodes(networkName: NetworkNames, cacheDir?: string) {
256
- const cacheFile = cacheDir ? join(cacheDir, networkName, 'bootnodes.json') : undefined;
257
- try {
258
- if (cacheFile) {
259
- const info = await stat(cacheFile);
260
- if (info.mtimeMs + BOOTNODE_CACHE_DURATION_MS > Date.now()) {
261
- return JSON.parse(await readFile(cacheFile, 'utf-8'))['bootnodes'];
262
- }
263
- }
264
- } catch {
265
- // no-op. Get the remote-file
266
- }
267
-
268
367
  const url = `http://static.aztec.network/${networkName}/bootnodes.json`;
269
- const response = await fetch(url);
270
- if (!response.ok) {
271
- throw new Error(
272
- `Failed to fetch basic contract addresses from ${url}. Check you are using a correct network name.`,
273
- );
274
- }
275
- const json = await response.json();
276
-
277
- try {
278
- if (cacheFile) {
279
- await mkdir(dirname(cacheFile), { recursive: true });
280
- await writeFile(cacheFile, JSON.stringify(json), 'utf-8');
281
- }
282
- } catch {
283
- // no-op
284
- }
368
+ const data = await cachedFetch(url, {
369
+ cacheDurationMs: BOOTNODE_CACHE_DURATION_MS,
370
+ cacheFile: cacheDir ? join(cacheDir, networkName, 'bootnodes.json') : undefined,
371
+ });
285
372
 
286
- return json['bootnodes'];
373
+ return data?.bootnodes;
287
374
  }
288
375
 
289
376
  export async function getL2ChainConfig(
@@ -297,6 +384,8 @@ export async function getL2ChainConfig(
297
384
  config = { ...testnetL2ChainConfig };
298
385
  } else if (networkName === 'staging-ignition') {
299
386
  config = { ...stagingIgnitionL2ChainConfig };
387
+ } else if (networkName === 'ignition') {
388
+ config = { ...ignitionL2ChainConfig };
300
389
  }
301
390
  if (!config) {
302
391
  return undefined;
@@ -309,23 +398,6 @@ export async function getL2ChainConfig(
309
398
  return config;
310
399
  }
311
400
 
312
- function enrichVar(envVar: EnvVar, value: string | undefined) {
313
- // Don't override
314
- if (process.env[envVar] || value === undefined) {
315
- return;
316
- }
317
- process.env[envVar] = value;
318
- }
319
-
320
- function enrichEthAddressVar(envVar: EnvVar, value: string) {
321
- // EthAddress doesn't like being given empty strings
322
- if (value === '') {
323
- enrichVar(envVar, EthAddress.ZERO.toString());
324
- return;
325
- }
326
- enrichVar(envVar, value);
327
- }
328
-
329
401
  function getDefaultDataDir(networkName: NetworkNames): string {
330
402
  return path.join(process.env.HOME || '~', '.aztec', networkName, 'data');
331
403
  }
@@ -355,6 +427,12 @@ export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames
355
427
  enrichVar('SYNC_SNAPSHOTS_URL', config.snapshotsUrl);
356
428
  enrichVar('P2P_MAX_TX_POOL_SIZE', config.maxTxPoolSize.toString());
357
429
 
430
+ enrichVar('DATA_STORE_MAP_SIZE_KB', config.dbMapSizeKb.toString());
431
+ enrichVar('ARCHIVER_STORE_MAP_SIZE_KB', config.archiverStoreMapSizeKb.toString());
432
+ enrichVar('NOTE_HASH_TREE_MAP_SIZE_KB', config.noteHashTreeMapSizeKb.toString());
433
+ enrichVar('NULLIFIER_TREE_MAP_SIZE_KB', config.nullifierTreeMapSizeKb.toString());
434
+ enrichVar('PUBLIC_DATA_TREE_MAP_SIZE_KB', config.publicDataTreeMapSizeKb.toString());
435
+
358
436
  if (config.autoUpdate) {
359
437
  enrichVar('AUTO_UPDATE', config.autoUpdate?.toString());
360
438
  }
@@ -375,10 +453,6 @@ export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames
375
453
  enrichVar('PUBLIC_OTEL_COLLECT_FROM', config.publicMetricsCollectFrom.join(','));
376
454
  }
377
455
 
378
- enrichEthAddressVar('REGISTRY_CONTRACT_ADDRESS', config.registryAddress);
379
- enrichEthAddressVar('SLASH_FACTORY_CONTRACT_ADDRESS', config.slashFactoryAddress);
380
- enrichEthAddressVar('FEE_ASSET_HANDLER_CONTRACT_ADDRESS', config.feeAssetHandlerAddress);
381
-
382
456
  // Deployment stuff
383
457
  enrichVar('ETHEREUM_SLOT_DURATION', config.ethereumSlotDuration.toString());
384
458
  enrichVar('AZTEC_SLOT_DURATION', config.aztecSlotDuration.toString());
@@ -387,6 +461,7 @@ export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames
387
461
  enrichVar('AZTEC_PROOF_SUBMISSION_EPOCHS', config.aztecProofSubmissionEpochs.toString());
388
462
  enrichVar('AZTEC_ACTIVATION_THRESHOLD', config.activationThreshold.toString());
389
463
  enrichVar('AZTEC_EJECTION_THRESHOLD', config.ejectionThreshold.toString());
464
+ enrichVar('AZTEC_LOCAL_EJECTION_THRESHOLD', config.localEjectionThreshold.toString());
390
465
  enrichVar('AZTEC_SLASHING_QUORUM', config.slashingQuorum?.toString());
391
466
  enrichVar('AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS', config.slashingRoundSizeInEpochs.toString());
392
467
  enrichVar('AZTEC_GOVERNANCE_PROPOSER_QUORUM', config.governanceProposerQuorum?.toString());
@@ -0,0 +1,15 @@
1
+ import { EthAddress } from '@aztec/aztec.js';
2
+ import type { EnvVar } from '@aztec/foundation/config';
3
+
4
+ export function enrichVar(envVar: EnvVar, value: string | undefined) {
5
+ // Don't override
6
+ if (process.env[envVar] || value === undefined) {
7
+ return;
8
+ }
9
+ process.env[envVar] = value;
10
+ }
11
+
12
+ export function enrichEthAddressVar(envVar: EnvVar, value: string) {
13
+ // EthAddress doesn't like being given empty strings
14
+ enrichVar(envVar, value || EthAddress.ZERO.toString());
15
+ }
@@ -1,2 +1,4 @@
1
+ export * from './cached_fetch.js';
1
2
  export * from './chain_l2_config.js';
2
3
  export * from './get_l1_config.js';
4
+ export * from './network_config.js';