@aztec/aztec 1.0.0-staging.2 → 1.0.0-staging.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dest/bin/index.js CHANGED
@@ -8,6 +8,7 @@ import { injectCommands as injectInfrastructureCommands } from '@aztec/cli/infra
8
8
  import { injectCommands as injectL1Commands } from '@aztec/cli/l1';
9
9
  import { injectCommands as injectMiscCommands } from '@aztec/cli/misc';
10
10
  import { injectCommands as injectPXECommands } from '@aztec/cli/pxe';
11
+ import { getActiveNetworkName } from '@aztec/foundation/config';
11
12
  import { createConsoleLogger, createLogger } from '@aztec/foundation/log';
12
13
  import { Command } from 'commander';
13
14
  import { NETWORK_FLAG } from '../cli/aztec_start_options.js';
@@ -29,10 +30,7 @@ const debugLogger = createLogger('cli');
29
30
  if (networkIndex !== -1) {
30
31
  networkValue = args[networkIndex].split('=')[1] || args[networkIndex + 1];
31
32
  }
32
- networkValue = networkValue || process.env.NETWORK;
33
- if (networkValue !== undefined) {
34
- await enrichEnvironmentWithChainConfig(networkValue);
35
- }
33
+ await enrichEnvironmentWithChainConfig(getActiveNetworkName(networkValue));
36
34
  const cliVersion = getCliVersion();
37
35
  let program = new Command('aztec');
38
36
  program.description('Aztec command line interface').version(cliVersion);
@@ -1,11 +1,7 @@
1
+ import type { NetworkNames } from '@aztec/foundation/config';
1
2
  import type { SharedNodeConfig } from '@aztec/node-lib/config';
2
- export type NetworkNames = 'testnet-ignition' | 'alpha-testnet';
3
3
  export type L2ChainConfig = {
4
4
  l1ChainId: number;
5
- ethereumSlotDuration: number;
6
- aztecSlotDuration: number;
7
- aztecEpochDuration: number;
8
- aztecProofSubmissionEpochs: number;
9
5
  testAccounts: boolean;
10
6
  sponsoredFPC: boolean;
11
7
  p2pEnabled: boolean;
@@ -23,10 +19,50 @@ export type L2ChainConfig = {
23
19
  publicIncludeMetrics?: string[];
24
20
  publicMetricsCollectorUrl?: string;
25
21
  publicMetricsCollectFrom?: string[];
22
+ /** How many seconds an L1 slot lasts. */
23
+ ethereumSlotDuration: number;
24
+ /** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
25
+ aztecSlotDuration: number;
26
+ /** How many L2 slots an epoch lasts. */
27
+ aztecEpochDuration: number;
28
+ /** The target validator committee size. */
29
+ aztecTargetCommitteeSize: number;
30
+ /** The number of epochs after an epoch ends that proofs are still accepted. */
31
+ aztecProofSubmissionEpochs: number;
32
+ /** The deposit amount for a validator */
33
+ depositAmount: bigint;
34
+ /** The minimum stake for a validator. */
35
+ minimumStake: bigint;
36
+ /** The slashing quorum */
37
+ slashingQuorum: number;
38
+ /** The slashing round size */
39
+ slashingRoundSize: number;
40
+ /** Governance proposing quorum */
41
+ governanceProposerQuorum: number;
42
+ /** Governance proposing round size */
43
+ governanceProposerRoundSize: number;
44
+ /** The mana target for the rollup */
45
+ manaTarget: bigint;
46
+ /** The proving cost per mana */
47
+ provingCostPerMana: bigint;
48
+ slashPayloadTtlSeconds: number;
49
+ slashPruneEnabled: boolean;
50
+ slashPrunePenalty: bigint;
51
+ slashPruneMaxPenalty: bigint;
52
+ slashInactivityEnabled: boolean;
53
+ slashInactivityCreateTargetPercentage: number;
54
+ slashInactivitySignalTargetPercentage: number;
55
+ slashInactivityCreatePenalty: bigint;
56
+ slashInvalidBlockEnabled: boolean;
57
+ slashInvalidBlockPenalty: bigint;
58
+ slashInvalidBlockMaxPenalty: bigint;
26
59
  };
27
60
  export declare const testnetIgnitionL2ChainConfig: L2ChainConfig;
28
61
  export declare const alphaTestnetL2ChainConfig: L2ChainConfig;
29
62
  export declare function getBootnodes(networkName: NetworkNames): Promise<any>;
30
- export declare function getL2ChainConfig(networkName: NetworkNames): Promise<L2ChainConfig | undefined>;
63
+ export declare function getL2ChainConfig(networkName: NetworkNames): Promise<{
64
+ config: L2ChainConfig;
65
+ networkName: string;
66
+ } | undefined>;
31
67
  export declare function enrichEnvironmentWithChainConfig(networkName: NetworkNames): Promise<void>;
32
68
  //# source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AyC;IACzC,aAAa,EAAE,MAAM,CAAC;IACtB,yCAAyC;IACzC,YAAY,EAAE,MAAM,CAAC;IACrB,0BAA0B;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,8BAA8B;IAC9B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kCAAkC;IAClC,wBAAwB,EAAE,MAAM,CAAC;IACjC,sCAAsC;IACtC,2BAA2B,EAAE,MAAM,CAAC;IACpC,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,gCAAgC;IAChC,kBAAkB,EAAE,MAAM,CAAC;IAG3B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,sBAAsB,EAAE,OAAO,CAAC;IAChC,qCAAqC,EAAE,MAAM,CAAC;IAC9C,qCAAqC,EAAE,MAAM,CAAC;IAC9C,4BAA4B,EAAE,MAAM,CAAC;IACrC,wBAAwB,EAAE,OAAO,CAAC;IAClC,wBAAwB,EAAE,MAAM,CAAC;IACjC,2BAA2B,EAAE,MAAM,CAAC;CACrC,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,aAyD1C,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,aA4DvC,CAAC;AAEF,wBAAsB,YAAY,CAAC,WAAW,EAAE,YAAY,gBAW3D;AAED,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,YAAY,GACxB,OAAO,CAAC;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAAC,CAWrE;AAmBD,wBAAsB,gCAAgC,CAAC,WAAW,EAAE,YAAY,iBA0E/E"}
@@ -1,14 +1,11 @@
1
1
  import { EthAddress } from '@aztec/aztec.js';
2
+ import { DefaultL1ContractsConfig } from '@aztec/ethereum';
2
3
  import path from 'path';
3
4
  import publicIncludeMetrics from '../../public_include_metric_prefixes.json' with {
4
5
  type: 'json'
5
6
  };
6
7
  export const testnetIgnitionL2ChainConfig = {
7
8
  l1ChainId: 11155111,
8
- ethereumSlotDuration: 12,
9
- aztecSlotDuration: 36,
10
- aztecEpochDuration: 32,
11
- aztecProofSubmissionEpochs: 1,
12
9
  testAccounts: true,
13
10
  sponsoredFPC: false,
14
11
  p2pEnabled: true,
@@ -22,14 +19,36 @@ export const testnetIgnitionL2ChainConfig = {
22
19
  snapshotsUrl: 'https://storage.googleapis.com/aztec-testnet/snapshots/',
23
20
  autoUpdate: 'disabled',
24
21
  autoUpdateUrl: undefined,
25
- maxTxPoolSize: 100_000_000
22
+ maxTxPoolSize: 100_000_000,
23
+ // Deployment stuff
24
+ /** How many seconds an L1 slot lasts. */ ethereumSlotDuration: 12,
25
+ /** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */ aztecSlotDuration: 36,
26
+ /** How many L2 slots an epoch lasts. */ aztecEpochDuration: 32,
27
+ /** The target validator committee size. */ aztecTargetCommitteeSize: 48,
28
+ /** The number of epochs after an epoch ends that proofs are still accepted. */ aztecProofSubmissionEpochs: 1,
29
+ /** The deposit amount for a validator */ depositAmount: DefaultL1ContractsConfig.depositAmount,
30
+ /** The minimum stake for a validator. */ minimumStake: DefaultL1ContractsConfig.minimumStake,
31
+ /** The slashing quorum */ slashingQuorum: DefaultL1ContractsConfig.slashingQuorum,
32
+ /** The slashing round size */ slashingRoundSize: DefaultL1ContractsConfig.slashingRoundSize,
33
+ /** Governance proposing quorum */ governanceProposerQuorum: DefaultL1ContractsConfig.governanceProposerQuorum,
34
+ /** Governance proposing round size */ governanceProposerRoundSize: DefaultL1ContractsConfig.governanceProposerRoundSize,
35
+ /** The mana target for the rollup */ manaTarget: 0n,
36
+ /** The proving cost per mana */ provingCostPerMana: 0n,
37
+ // slashing stuff
38
+ slashInactivityEnabled: false,
39
+ slashInactivityCreateTargetPercentage: 0,
40
+ slashInactivitySignalTargetPercentage: 0,
41
+ slashInactivityCreatePenalty: 0n,
42
+ slashInvalidBlockEnabled: false,
43
+ slashPayloadTtlSeconds: 0,
44
+ slashPruneEnabled: false,
45
+ slashPrunePenalty: 0n,
46
+ slashPruneMaxPenalty: 0n,
47
+ slashInvalidBlockPenalty: 0n,
48
+ slashInvalidBlockMaxPenalty: 0n
26
49
  };
27
50
  export const alphaTestnetL2ChainConfig = {
28
51
  l1ChainId: 11155111,
29
- ethereumSlotDuration: 12,
30
- aztecSlotDuration: 36,
31
- aztecEpochDuration: 32,
32
- aztecProofSubmissionEpochs: 1,
33
52
  testAccounts: false,
34
53
  sponsoredFPC: true,
35
54
  p2pEnabled: true,
@@ -48,7 +67,33 @@ export const alphaTestnetL2ChainConfig = {
48
67
  publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec.network',
49
68
  publicMetricsCollectFrom: [
50
69
  'sequencer'
51
- ]
70
+ ],
71
+ // Deployment stuff
72
+ /** How many seconds an L1 slot lasts. */ ethereumSlotDuration: 12,
73
+ /** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */ aztecSlotDuration: 36,
74
+ /** How many L2 slots an epoch lasts. */ aztecEpochDuration: 32,
75
+ /** The target validator committee size. */ aztecTargetCommitteeSize: 48,
76
+ /** The number of epochs after an epoch ends that proofs are still accepted. */ aztecProofSubmissionEpochs: 1,
77
+ /** The deposit amount for a validator */ depositAmount: DefaultL1ContractsConfig.depositAmount,
78
+ /** The minimum stake for a validator. */ minimumStake: DefaultL1ContractsConfig.minimumStake,
79
+ /** The slashing quorum */ slashingQuorum: 101,
80
+ /** The slashing round size */ slashingRoundSize: 200,
81
+ /** Governance proposing quorum */ governanceProposerQuorum: 151,
82
+ /** Governance proposing round size */ governanceProposerRoundSize: 300,
83
+ /** The mana target for the rollup */ manaTarget: DefaultL1ContractsConfig.manaTarget,
84
+ /** The proving cost per mana */ provingCostPerMana: DefaultL1ContractsConfig.provingCostPerMana,
85
+ // slashing stuff
86
+ slashPayloadTtlSeconds: 36 * 32 * 24,
87
+ slashPruneEnabled: true,
88
+ slashPrunePenalty: 17n * (DefaultL1ContractsConfig.depositAmount / 100n),
89
+ slashPruneMaxPenalty: 17n * (DefaultL1ContractsConfig.depositAmount / 100n),
90
+ slashInactivityEnabled: true,
91
+ slashInactivityCreateTargetPercentage: 1,
92
+ slashInactivitySignalTargetPercentage: 1,
93
+ slashInactivityCreatePenalty: 17n * (DefaultL1ContractsConfig.depositAmount / 100n),
94
+ slashInvalidBlockEnabled: true,
95
+ slashInvalidBlockPenalty: DefaultL1ContractsConfig.depositAmount,
96
+ slashInvalidBlockMaxPenalty: DefaultL1ContractsConfig.depositAmount
52
97
  };
53
98
  export async function getBootnodes(networkName) {
54
99
  const url = `http://static.aztec.network/${networkName}/bootnodes.json`;
@@ -65,13 +110,19 @@ export async function getL2ChainConfig(networkName) {
65
110
  ...testnetIgnitionL2ChainConfig
66
111
  };
67
112
  config.p2pBootstrapNodes = await getBootnodes(networkName);
68
- return config;
69
- } else if (networkName === 'alpha-testnet') {
113
+ return {
114
+ config,
115
+ networkName
116
+ };
117
+ } else if (networkName === 'alpha-testnet' || networkName === 'testnet') {
70
118
  const config = {
71
119
  ...alphaTestnetL2ChainConfig
72
120
  };
73
- config.p2pBootstrapNodes = await getBootnodes(networkName);
74
- return config;
121
+ config.p2pBootstrapNodes = await getBootnodes('alpha-testnet');
122
+ return {
123
+ config,
124
+ networkName: 'alpha-testnet'
125
+ };
75
126
  }
76
127
  return undefined;
77
128
  }
@@ -91,14 +142,14 @@ function enrichEthAddressVar(envVar, value) {
91
142
  enrichVar(envVar, value);
92
143
  }
93
144
  export async function enrichEnvironmentWithChainConfig(networkName) {
94
- const config = await getL2ChainConfig(networkName);
95
- if (!config) {
145
+ if (networkName === 'local') {
146
+ return;
147
+ }
148
+ const result = await getL2ChainConfig(networkName);
149
+ if (!result) {
96
150
  throw new Error(`Unknown network name: ${networkName}`);
97
151
  }
98
- enrichVar('ETHEREUM_SLOT_DURATION', config.ethereumSlotDuration.toString());
99
- enrichVar('AZTEC_SLOT_DURATION', config.aztecSlotDuration.toString());
100
- enrichVar('AZTEC_EPOCH_DURATION', config.aztecEpochDuration.toString());
101
- enrichVar('AZTEC_PROOF_SUBMISSION_EPOCHS', config.aztecProofSubmissionEpochs.toString());
152
+ const { config, networkName: name } = result;
102
153
  enrichVar('BOOTSTRAP_NODES', config.p2pBootstrapNodes.join(','));
103
154
  enrichVar('TEST_ACCOUNTS', config.testAccounts.toString());
104
155
  enrichVar('SPONSORED_FPC', config.sponsoredFPC.toString());
@@ -106,7 +157,7 @@ export async function enrichEnvironmentWithChainConfig(networkName) {
106
157
  enrichVar('L1_CHAIN_ID', config.l1ChainId.toString());
107
158
  enrichVar('SEQ_MIN_TX_PER_BLOCK', config.seqMinTxsPerBlock.toString());
108
159
  enrichVar('SEQ_MAX_TX_PER_BLOCK', config.seqMaxTxsPerBlock.toString());
109
- enrichVar('DATA_DIRECTORY', path.join(process.env.HOME || '~', '.aztec', networkName, 'data'));
160
+ enrichVar('DATA_DIRECTORY', path.join(process.env.HOME || '~', '.aztec', name, 'data'));
110
161
  enrichVar('PROVER_REAL_PROOFS', config.realProofs.toString());
111
162
  enrichVar('PXE_PROVER_ENABLED', config.realProofs.toString());
112
163
  enrichVar('SYNC_SNAPSHOTS_URL', config.snapshotsUrl);
@@ -129,4 +180,30 @@ export async function enrichEnvironmentWithChainConfig(networkName) {
129
180
  enrichEthAddressVar('REGISTRY_CONTRACT_ADDRESS', config.registryAddress);
130
181
  enrichEthAddressVar('SLASH_FACTORY_CONTRACT_ADDRESS', config.slashFactoryAddress);
131
182
  enrichEthAddressVar('FEE_ASSET_HANDLER_CONTRACT_ADDRESS', config.feeAssetHandlerAddress);
183
+ // Deployment stuff
184
+ enrichVar('ETHEREUM_SLOT_DURATION', config.ethereumSlotDuration.toString());
185
+ enrichVar('AZTEC_SLOT_DURATION', config.aztecSlotDuration.toString());
186
+ enrichVar('AZTEC_EPOCH_DURATION', config.aztecEpochDuration.toString());
187
+ enrichVar('AZTEC_TARGET_COMMITTEE_SIZE', config.aztecTargetCommitteeSize.toString());
188
+ enrichVar('AZTEC_PROOF_SUBMISSION_EPOCHS', config.aztecProofSubmissionEpochs.toString());
189
+ enrichVar('AZTEC_DEPOSIT_AMOUNT', config.depositAmount.toString());
190
+ enrichVar('AZTEC_MINIMUM_STAKE', config.minimumStake.toString());
191
+ enrichVar('AZTEC_SLASHING_QUORUM', config.slashingQuorum.toString());
192
+ enrichVar('AZTEC_SLASHING_ROUND_SIZE', config.slashingRoundSize.toString());
193
+ enrichVar('AZTEC_GOVERNANCE_PROPOSER_QUORUM', config.governanceProposerQuorum.toString());
194
+ enrichVar('AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE', config.governanceProposerRoundSize.toString());
195
+ enrichVar('AZTEC_MANA_TARGET', config.manaTarget.toString());
196
+ enrichVar('AZTEC_PROVING_COST_PER_MANA', config.provingCostPerMana.toString());
197
+ // Slashing
198
+ enrichVar('SLASH_PAYLOAD_TTL_SECONDS', config.slashPayloadTtlSeconds.toString());
199
+ enrichVar('SLASH_PRUNE_ENABLED', config.slashPruneEnabled.toString());
200
+ enrichVar('SLASH_PRUNE_PENALTY', config.slashPrunePenalty.toString());
201
+ enrichVar('SLASH_PRUNE_MAX_PENALTY', config.slashPruneMaxPenalty.toString());
202
+ enrichVar('SLASH_INACTIVITY_ENABLED', config.slashInactivityEnabled.toString());
203
+ enrichVar('SLASH_INACTIVITY_CREATE_TARGET_PERCENTAGE', config.slashInactivityCreateTargetPercentage.toString());
204
+ enrichVar('SLASH_INACTIVITY_SIGNAL_TARGET_PERCENTAGE', config.slashInactivitySignalTargetPercentage.toString());
205
+ enrichVar('SLASH_INACTIVITY_CREATE_PENALTY', config.slashInactivityCreatePenalty.toString());
206
+ enrichVar('SLASH_INVALID_BLOCK_ENABLED', config.slashInvalidBlockEnabled.toString());
207
+ enrichVar('SLASH_INVALID_BLOCK_PENALTY', config.slashInvalidBlockPenalty.toString());
208
+ enrichVar('SLASH_INVALID_BLOCK_MAX_PENALTY', config.slashInvalidBlockMaxPenalty.toString());
132
209
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/aztec",
3
- "version": "1.0.0-staging.2",
3
+ "version": "1.0.0-staging.3",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js"
@@ -27,35 +27,35 @@
27
27
  "../package.common.json"
28
28
  ],
29
29
  "dependencies": {
30
- "@aztec/accounts": "1.0.0-staging.2",
31
- "@aztec/archiver": "1.0.0-staging.2",
32
- "@aztec/aztec-faucet": "1.0.0-staging.2",
33
- "@aztec/aztec-node": "1.0.0-staging.2",
34
- "@aztec/aztec.js": "1.0.0-staging.2",
35
- "@aztec/bb-prover": "1.0.0-staging.2",
36
- "@aztec/bb.js": "1.0.0-staging.2",
37
- "@aztec/blob-sink": "1.0.0-staging.2",
38
- "@aztec/bot": "1.0.0-staging.2",
39
- "@aztec/builder": "1.0.0-staging.2",
40
- "@aztec/cli": "1.0.0-staging.2",
41
- "@aztec/cli-wallet": "1.0.0-staging.2",
42
- "@aztec/constants": "1.0.0-staging.2",
43
- "@aztec/entrypoints": "1.0.0-staging.2",
44
- "@aztec/ethereum": "1.0.0-staging.2",
45
- "@aztec/foundation": "1.0.0-staging.2",
46
- "@aztec/kv-store": "1.0.0-staging.2",
47
- "@aztec/noir-contracts.js": "1.0.0-staging.2",
48
- "@aztec/noir-protocol-circuits-types": "1.0.0-staging.2",
49
- "@aztec/p2p": "1.0.0-staging.2",
50
- "@aztec/p2p-bootstrap": "1.0.0-staging.2",
51
- "@aztec/protocol-contracts": "1.0.0-staging.2",
52
- "@aztec/prover-client": "1.0.0-staging.2",
53
- "@aztec/prover-node": "1.0.0-staging.2",
54
- "@aztec/pxe": "1.0.0-staging.2",
55
- "@aztec/stdlib": "1.0.0-staging.2",
56
- "@aztec/telemetry-client": "1.0.0-staging.2",
57
- "@aztec/txe": "1.0.0-staging.2",
58
- "@aztec/world-state": "1.0.0-staging.2",
30
+ "@aztec/accounts": "1.0.0-staging.3",
31
+ "@aztec/archiver": "1.0.0-staging.3",
32
+ "@aztec/aztec-faucet": "1.0.0-staging.3",
33
+ "@aztec/aztec-node": "1.0.0-staging.3",
34
+ "@aztec/aztec.js": "1.0.0-staging.3",
35
+ "@aztec/bb-prover": "1.0.0-staging.3",
36
+ "@aztec/bb.js": "1.0.0-staging.3",
37
+ "@aztec/blob-sink": "1.0.0-staging.3",
38
+ "@aztec/bot": "1.0.0-staging.3",
39
+ "@aztec/builder": "1.0.0-staging.3",
40
+ "@aztec/cli": "1.0.0-staging.3",
41
+ "@aztec/cli-wallet": "1.0.0-staging.3",
42
+ "@aztec/constants": "1.0.0-staging.3",
43
+ "@aztec/entrypoints": "1.0.0-staging.3",
44
+ "@aztec/ethereum": "1.0.0-staging.3",
45
+ "@aztec/foundation": "1.0.0-staging.3",
46
+ "@aztec/kv-store": "1.0.0-staging.3",
47
+ "@aztec/noir-contracts.js": "1.0.0-staging.3",
48
+ "@aztec/noir-protocol-circuits-types": "1.0.0-staging.3",
49
+ "@aztec/p2p": "1.0.0-staging.3",
50
+ "@aztec/p2p-bootstrap": "1.0.0-staging.3",
51
+ "@aztec/protocol-contracts": "1.0.0-staging.3",
52
+ "@aztec/prover-client": "1.0.0-staging.3",
53
+ "@aztec/prover-node": "1.0.0-staging.3",
54
+ "@aztec/pxe": "1.0.0-staging.3",
55
+ "@aztec/stdlib": "1.0.0-staging.3",
56
+ "@aztec/telemetry-client": "1.0.0-staging.3",
57
+ "@aztec/txe": "1.0.0-staging.3",
58
+ "@aztec/world-state": "1.0.0-staging.3",
59
59
  "@types/chalk": "^2.2.0",
60
60
  "abitype": "^0.8.11",
61
61
  "chalk": "^5.3.0",
package/src/bin/index.ts CHANGED
@@ -8,12 +8,13 @@ import { injectCommands as injectInfrastructureCommands } from '@aztec/cli/infra
8
8
  import { injectCommands as injectL1Commands } from '@aztec/cli/l1';
9
9
  import { injectCommands as injectMiscCommands } from '@aztec/cli/misc';
10
10
  import { injectCommands as injectPXECommands } from '@aztec/cli/pxe';
11
+ import { getActiveNetworkName } from '@aztec/foundation/config';
11
12
  import { createConsoleLogger, createLogger } from '@aztec/foundation/log';
12
13
 
13
14
  import { Command } from 'commander';
14
15
 
15
16
  import { NETWORK_FLAG } from '../cli/aztec_start_options.js';
16
- import { type NetworkNames, enrichEnvironmentWithChainConfig } from '../cli/chain_l2_config.js';
17
+ import { enrichEnvironmentWithChainConfig } from '../cli/chain_l2_config.js';
17
18
  import { injectAztecCommands } from '../cli/index.js';
18
19
  import { getCliVersion } from '../cli/release_version.js';
19
20
 
@@ -38,11 +39,7 @@ async function main() {
38
39
  networkValue = args[networkIndex].split('=')[1] || args[networkIndex + 1];
39
40
  }
40
41
 
41
- networkValue = networkValue || process.env.NETWORK;
42
-
43
- if (networkValue !== undefined) {
44
- await enrichEnvironmentWithChainConfig(networkValue as NetworkNames);
45
- }
42
+ await enrichEnvironmentWithChainConfig(getActiveNetworkName(networkValue));
46
43
 
47
44
  const cliVersion = getCliVersion();
48
45
  let program = new Command('aztec');
@@ -1,19 +1,14 @@
1
1
  import { EthAddress } from '@aztec/aztec.js';
2
- import type { EnvVar } from '@aztec/foundation/config';
2
+ import { DefaultL1ContractsConfig } from '@aztec/ethereum';
3
+ import type { EnvVar, NetworkNames } from '@aztec/foundation/config';
3
4
  import type { SharedNodeConfig } from '@aztec/node-lib/config';
4
5
 
5
6
  import path from 'path';
6
7
 
7
8
  import publicIncludeMetrics from '../../public_include_metric_prefixes.json' with { type: 'json' };
8
9
 
9
- export type NetworkNames = 'testnet-ignition' | 'alpha-testnet';
10
-
11
10
  export type L2ChainConfig = {
12
11
  l1ChainId: number;
13
- ethereumSlotDuration: number;
14
- aztecSlotDuration: number;
15
- aztecEpochDuration: number;
16
- aztecProofSubmissionEpochs: number;
17
12
  testAccounts: boolean;
18
13
  sponsoredFPC: boolean;
19
14
  p2pEnabled: boolean;
@@ -31,14 +26,52 @@ export type L2ChainConfig = {
31
26
  publicIncludeMetrics?: string[];
32
27
  publicMetricsCollectorUrl?: string;
33
28
  publicMetricsCollectFrom?: string[];
29
+
30
+ // Deployment stuff
31
+
32
+ /** How many seconds an L1 slot lasts. */
33
+ ethereumSlotDuration: number;
34
+ /** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
35
+ aztecSlotDuration: number;
36
+ /** How many L2 slots an epoch lasts. */
37
+ aztecEpochDuration: number;
38
+ /** The target validator committee size. */
39
+ aztecTargetCommitteeSize: number;
40
+ /** The number of epochs after an epoch ends that proofs are still accepted. */
41
+ aztecProofSubmissionEpochs: number;
42
+ /** The deposit amount for a validator */
43
+ depositAmount: bigint;
44
+ /** The minimum stake for a validator. */
45
+ minimumStake: bigint;
46
+ /** The slashing quorum */
47
+ slashingQuorum: number;
48
+ /** The slashing round size */
49
+ slashingRoundSize: number;
50
+ /** Governance proposing quorum */
51
+ governanceProposerQuorum: number;
52
+ /** Governance proposing round size */
53
+ governanceProposerRoundSize: number;
54
+ /** The mana target for the rollup */
55
+ manaTarget: bigint;
56
+ /** The proving cost per mana */
57
+ provingCostPerMana: bigint;
58
+
59
+ // slashing stuff
60
+ slashPayloadTtlSeconds: number;
61
+ slashPruneEnabled: boolean;
62
+ slashPrunePenalty: bigint;
63
+ slashPruneMaxPenalty: bigint;
64
+ slashInactivityEnabled: boolean;
65
+ slashInactivityCreateTargetPercentage: number;
66
+ slashInactivitySignalTargetPercentage: number;
67
+ slashInactivityCreatePenalty: bigint;
68
+ slashInvalidBlockEnabled: boolean;
69
+ slashInvalidBlockPenalty: bigint;
70
+ slashInvalidBlockMaxPenalty: bigint;
34
71
  };
35
72
 
36
73
  export const testnetIgnitionL2ChainConfig: L2ChainConfig = {
37
74
  l1ChainId: 11155111,
38
- ethereumSlotDuration: 12,
39
- aztecSlotDuration: 36,
40
- aztecEpochDuration: 32,
41
- aztecProofSubmissionEpochs: 1,
42
75
  testAccounts: true,
43
76
  sponsoredFPC: false,
44
77
  p2pEnabled: true,
@@ -53,14 +86,51 @@ export const testnetIgnitionL2ChainConfig: L2ChainConfig = {
53
86
  autoUpdate: 'disabled',
54
87
  autoUpdateUrl: undefined,
55
88
  maxTxPoolSize: 100_000_000, // 100MB
56
- };
57
89
 
58
- export const alphaTestnetL2ChainConfig: L2ChainConfig = {
59
- l1ChainId: 11155111,
90
+ // Deployment stuff
91
+ /** How many seconds an L1 slot lasts. */
60
92
  ethereumSlotDuration: 12,
93
+ /** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
61
94
  aztecSlotDuration: 36,
95
+ /** How many L2 slots an epoch lasts. */
62
96
  aztecEpochDuration: 32,
97
+ /** The target validator committee size. */
98
+ aztecTargetCommitteeSize: 48,
99
+ /** The number of epochs after an epoch ends that proofs are still accepted. */
63
100
  aztecProofSubmissionEpochs: 1,
101
+ /** The deposit amount for a validator */
102
+ depositAmount: DefaultL1ContractsConfig.depositAmount,
103
+ /** The minimum stake for a validator. */
104
+ minimumStake: DefaultL1ContractsConfig.minimumStake,
105
+ /** The slashing quorum */
106
+ slashingQuorum: DefaultL1ContractsConfig.slashingQuorum,
107
+ /** The slashing round size */
108
+ slashingRoundSize: DefaultL1ContractsConfig.slashingRoundSize,
109
+ /** Governance proposing quorum */
110
+ governanceProposerQuorum: DefaultL1ContractsConfig.governanceProposerQuorum,
111
+ /** Governance proposing round size */
112
+ governanceProposerRoundSize: DefaultL1ContractsConfig.governanceProposerRoundSize,
113
+ /** The mana target for the rollup */
114
+ manaTarget: 0n,
115
+ /** The proving cost per mana */
116
+ provingCostPerMana: 0n,
117
+
118
+ // slashing stuff
119
+ slashInactivityEnabled: false,
120
+ slashInactivityCreateTargetPercentage: 0,
121
+ slashInactivitySignalTargetPercentage: 0,
122
+ slashInactivityCreatePenalty: 0n,
123
+ slashInvalidBlockEnabled: false,
124
+ slashPayloadTtlSeconds: 0,
125
+ slashPruneEnabled: false,
126
+ slashPrunePenalty: 0n,
127
+ slashPruneMaxPenalty: 0n,
128
+ slashInvalidBlockPenalty: 0n,
129
+ slashInvalidBlockMaxPenalty: 0n,
130
+ };
131
+
132
+ export const alphaTestnetL2ChainConfig: L2ChainConfig = {
133
+ l1ChainId: 11155111,
64
134
  testAccounts: false,
65
135
  sponsoredFPC: true,
66
136
  p2pEnabled: true,
@@ -78,6 +148,47 @@ export const alphaTestnetL2ChainConfig: L2ChainConfig = {
78
148
  publicIncludeMetrics,
79
149
  publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec.network',
80
150
  publicMetricsCollectFrom: ['sequencer'],
151
+
152
+ // Deployment stuff
153
+ /** How many seconds an L1 slot lasts. */
154
+ ethereumSlotDuration: 12,
155
+ /** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
156
+ aztecSlotDuration: 36,
157
+ /** How many L2 slots an epoch lasts. */
158
+ aztecEpochDuration: 32,
159
+ /** The target validator committee size. */
160
+ aztecTargetCommitteeSize: 48,
161
+ /** The number of epochs after an epoch ends that proofs are still accepted. */
162
+ aztecProofSubmissionEpochs: 1,
163
+ /** The deposit amount for a validator */
164
+ depositAmount: DefaultL1ContractsConfig.depositAmount,
165
+ /** The minimum stake for a validator. */
166
+ minimumStake: DefaultL1ContractsConfig.minimumStake,
167
+ /** The slashing quorum */
168
+ slashingQuorum: 101,
169
+ /** The slashing round size */
170
+ slashingRoundSize: 200,
171
+ /** Governance proposing quorum */
172
+ governanceProposerQuorum: 151,
173
+ /** Governance proposing round size */
174
+ governanceProposerRoundSize: 300,
175
+ /** The mana target for the rollup */
176
+ manaTarget: DefaultL1ContractsConfig.manaTarget,
177
+ /** The proving cost per mana */
178
+ provingCostPerMana: DefaultL1ContractsConfig.provingCostPerMana,
179
+
180
+ // slashing stuff
181
+ slashPayloadTtlSeconds: 36 * 32 * 24, // 24 epochs
182
+ slashPruneEnabled: true,
183
+ slashPrunePenalty: 17n * (DefaultL1ContractsConfig.depositAmount / 100n),
184
+ slashPruneMaxPenalty: 17n * (DefaultL1ContractsConfig.depositAmount / 100n),
185
+ slashInactivityEnabled: true,
186
+ slashInactivityCreateTargetPercentage: 1,
187
+ slashInactivitySignalTargetPercentage: 1,
188
+ slashInactivityCreatePenalty: 17n * (DefaultL1ContractsConfig.depositAmount / 100n),
189
+ slashInvalidBlockEnabled: true,
190
+ slashInvalidBlockPenalty: DefaultL1ContractsConfig.depositAmount,
191
+ slashInvalidBlockMaxPenalty: DefaultL1ContractsConfig.depositAmount,
81
192
  };
82
193
 
83
194
  export async function getBootnodes(networkName: NetworkNames) {
@@ -93,15 +204,17 @@ export async function getBootnodes(networkName: NetworkNames) {
93
204
  return json['bootnodes'];
94
205
  }
95
206
 
96
- export async function getL2ChainConfig(networkName: NetworkNames): Promise<L2ChainConfig | undefined> {
207
+ export async function getL2ChainConfig(
208
+ networkName: NetworkNames,
209
+ ): Promise<{ config: L2ChainConfig; networkName: string } | undefined> {
97
210
  if (networkName === 'testnet-ignition') {
98
211
  const config = { ...testnetIgnitionL2ChainConfig };
99
212
  config.p2pBootstrapNodes = await getBootnodes(networkName);
100
- return config;
101
- } else if (networkName === 'alpha-testnet') {
213
+ return { config, networkName };
214
+ } else if (networkName === 'alpha-testnet' || networkName === 'testnet') {
102
215
  const config = { ...alphaTestnetL2ChainConfig };
103
- config.p2pBootstrapNodes = await getBootnodes(networkName);
104
- return config;
216
+ config.p2pBootstrapNodes = await getBootnodes('alpha-testnet');
217
+ return { config, networkName: 'alpha-testnet' };
105
218
  }
106
219
  return undefined;
107
220
  }
@@ -124,14 +237,15 @@ function enrichEthAddressVar(envVar: EnvVar, value: string) {
124
237
  }
125
238
 
126
239
  export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames) {
127
- const config = await getL2ChainConfig(networkName);
128
- if (!config) {
240
+ if (networkName === 'local') {
241
+ return;
242
+ }
243
+
244
+ const result = await getL2ChainConfig(networkName);
245
+ if (!result) {
129
246
  throw new Error(`Unknown network name: ${networkName}`);
130
247
  }
131
- enrichVar('ETHEREUM_SLOT_DURATION', config.ethereumSlotDuration.toString());
132
- enrichVar('AZTEC_SLOT_DURATION', config.aztecSlotDuration.toString());
133
- enrichVar('AZTEC_EPOCH_DURATION', config.aztecEpochDuration.toString());
134
- enrichVar('AZTEC_PROOF_SUBMISSION_EPOCHS', config.aztecProofSubmissionEpochs.toString());
248
+ const { config, networkName: name } = result;
135
249
  enrichVar('BOOTSTRAP_NODES', config.p2pBootstrapNodes.join(','));
136
250
  enrichVar('TEST_ACCOUNTS', config.testAccounts.toString());
137
251
  enrichVar('SPONSORED_FPC', config.sponsoredFPC.toString());
@@ -139,7 +253,7 @@ export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames
139
253
  enrichVar('L1_CHAIN_ID', config.l1ChainId.toString());
140
254
  enrichVar('SEQ_MIN_TX_PER_BLOCK', config.seqMinTxsPerBlock.toString());
141
255
  enrichVar('SEQ_MAX_TX_PER_BLOCK', config.seqMaxTxsPerBlock.toString());
142
- enrichVar('DATA_DIRECTORY', path.join(process.env.HOME || '~', '.aztec', networkName, 'data'));
256
+ enrichVar('DATA_DIRECTORY', path.join(process.env.HOME || '~', '.aztec', name, 'data'));
143
257
  enrichVar('PROVER_REAL_PROOFS', config.realProofs.toString());
144
258
  enrichVar('PXE_PROVER_ENABLED', config.realProofs.toString());
145
259
  enrichVar('SYNC_SNAPSHOTS_URL', config.snapshotsUrl);
@@ -168,4 +282,32 @@ export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames
168
282
  enrichEthAddressVar('REGISTRY_CONTRACT_ADDRESS', config.registryAddress);
169
283
  enrichEthAddressVar('SLASH_FACTORY_CONTRACT_ADDRESS', config.slashFactoryAddress);
170
284
  enrichEthAddressVar('FEE_ASSET_HANDLER_CONTRACT_ADDRESS', config.feeAssetHandlerAddress);
285
+
286
+ // Deployment stuff
287
+ enrichVar('ETHEREUM_SLOT_DURATION', config.ethereumSlotDuration.toString());
288
+ enrichVar('AZTEC_SLOT_DURATION', config.aztecSlotDuration.toString());
289
+ enrichVar('AZTEC_EPOCH_DURATION', config.aztecEpochDuration.toString());
290
+ enrichVar('AZTEC_TARGET_COMMITTEE_SIZE', config.aztecTargetCommitteeSize.toString());
291
+ enrichVar('AZTEC_PROOF_SUBMISSION_EPOCHS', config.aztecProofSubmissionEpochs.toString());
292
+ enrichVar('AZTEC_DEPOSIT_AMOUNT', config.depositAmount.toString());
293
+ enrichVar('AZTEC_MINIMUM_STAKE', config.minimumStake.toString());
294
+ enrichVar('AZTEC_SLASHING_QUORUM', config.slashingQuorum.toString());
295
+ enrichVar('AZTEC_SLASHING_ROUND_SIZE', config.slashingRoundSize.toString());
296
+ enrichVar('AZTEC_GOVERNANCE_PROPOSER_QUORUM', config.governanceProposerQuorum.toString());
297
+ enrichVar('AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE', config.governanceProposerRoundSize.toString());
298
+ enrichVar('AZTEC_MANA_TARGET', config.manaTarget.toString());
299
+ enrichVar('AZTEC_PROVING_COST_PER_MANA', config.provingCostPerMana.toString());
300
+
301
+ // Slashing
302
+ enrichVar('SLASH_PAYLOAD_TTL_SECONDS', config.slashPayloadTtlSeconds.toString());
303
+ enrichVar('SLASH_PRUNE_ENABLED', config.slashPruneEnabled.toString());
304
+ enrichVar('SLASH_PRUNE_PENALTY', config.slashPrunePenalty.toString());
305
+ enrichVar('SLASH_PRUNE_MAX_PENALTY', config.slashPruneMaxPenalty.toString());
306
+ enrichVar('SLASH_INACTIVITY_ENABLED', config.slashInactivityEnabled.toString());
307
+ enrichVar('SLASH_INACTIVITY_CREATE_TARGET_PERCENTAGE', config.slashInactivityCreateTargetPercentage.toString());
308
+ enrichVar('SLASH_INACTIVITY_SIGNAL_TARGET_PERCENTAGE', config.slashInactivitySignalTargetPercentage.toString());
309
+ enrichVar('SLASH_INACTIVITY_CREATE_PENALTY', config.slashInactivityCreatePenalty.toString());
310
+ enrichVar('SLASH_INVALID_BLOCK_ENABLED', config.slashInvalidBlockEnabled.toString());
311
+ enrichVar('SLASH_INVALID_BLOCK_PENALTY', config.slashInvalidBlockPenalty.toString());
312
+ enrichVar('SLASH_INVALID_BLOCK_MAX_PENALTY', config.slashInvalidBlockMaxPenalty.toString());
171
313
  }