@aztec/aztec 1.0.0 → 1.1.0
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 +2 -4
- package/dest/cli/aztec_start_options.d.ts.map +1 -1
- package/dest/cli/aztec_start_options.js +2 -2
- package/dest/cli/chain_l2_config.d.ts +46 -6
- package/dest/cli/chain_l2_config.d.ts.map +1 -1
- package/dest/cli/chain_l2_config.js +121 -24
- package/dest/cli/util.d.ts +12 -1
- package/dest/cli/util.d.ts.map +1 -1
- package/dest/cli/util.js +71 -15
- package/package.json +30 -30
- package/src/bin/index.ts +3 -6
- package/src/cli/aztec_start_options.ts +2 -1
- package/src/cli/chain_l2_config.ts +195 -29
- package/src/cli/util.ts +64 -16
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
|
-
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aztec_start_options.d.ts","sourceRoot":"","sources":["../../src/cli/aztec_start_options.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,MAAM,
|
|
1
|
+
{"version":3,"file":"aztec_start_options.d.ts","sourceRoot":"","sources":["../../src/cli/aztec_start_options.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,MAAM,EAKZ,MAAM,0BAA0B,CAAC;AAelC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,GAAG,CAAC;IAClB,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,CAAC;IACpC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,GAAG,CAAC;CACjC;AAED,eAAO,MAAM,UAAU,GAAI,WAAW,MAAM,EAAE,gBAAgB,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,uBAiB1F,CAAC;AAGF,eAAO,MAAM,gBAAgB,UAU5B,CAAC;AAEF,eAAO,MAAM,YAAY,YAAY,CAAC;AAGtC,eAAO,MAAM,iBAAiB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;CAsXlE,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { faucetConfigMapping } from '@aztec/aztec-faucet/config';
|
|
|
3
3
|
import { sequencerClientConfigMappings } from '@aztec/aztec-node/config';
|
|
4
4
|
import { blobSinkConfigMappings } from '@aztec/blob-sink/server';
|
|
5
5
|
import { botConfigMappings } from '@aztec/bot/config';
|
|
6
|
-
import { booleanConfigHelper, isBooleanConfigValue, omitConfigMappings } from '@aztec/foundation/config';
|
|
6
|
+
import { SecretValue, booleanConfigHelper, isBooleanConfigValue, omitConfigMappings } from '@aztec/foundation/config';
|
|
7
7
|
import { bootnodeConfigMappings, p2pConfigMappings } from '@aztec/p2p/config';
|
|
8
8
|
import { proverAgentConfigMappings, proverBrokerConfigMappings } from '@aztec/prover-client/broker';
|
|
9
9
|
import { proverNodeConfigMappings } from '@aztec/prover-node/config';
|
|
@@ -134,7 +134,7 @@ export const aztecStartOptions = {
|
|
|
134
134
|
description: 'List of API keys for the corresponding Ethereum consensus nodes',
|
|
135
135
|
defaultValue: [],
|
|
136
136
|
envVar: 'L1_CONSENSUS_HOST_API_KEYS',
|
|
137
|
-
parseVal: (val)=>val.split(',').map((
|
|
137
|
+
parseVal: (val)=>val.split(',').map((key)=>new SecretValue(key))
|
|
138
138
|
},
|
|
139
139
|
{
|
|
140
140
|
flag: '--l1-consensus-host-api-key-headers <value>',
|
|
@@ -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;
|
|
@@ -20,10 +16,54 @@ export type L2ChainConfig = {
|
|
|
20
16
|
autoUpdate: SharedNodeConfig['autoUpdate'];
|
|
21
17
|
autoUpdateUrl?: string;
|
|
22
18
|
maxTxPoolSize: number;
|
|
19
|
+
publicIncludeMetrics?: string[];
|
|
20
|
+
publicMetricsCollectorUrl?: string;
|
|
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
|
+
slashInactivityMaxPenalty: bigint;
|
|
57
|
+
slashInvalidBlockEnabled: boolean;
|
|
58
|
+
slashInvalidBlockPenalty: bigint;
|
|
59
|
+
slashInvalidBlockMaxPenalty: bigint;
|
|
23
60
|
};
|
|
24
61
|
export declare const testnetIgnitionL2ChainConfig: L2ChainConfig;
|
|
25
62
|
export declare const alphaTestnetL2ChainConfig: L2ChainConfig;
|
|
26
63
|
export declare function getBootnodes(networkName: NetworkNames): Promise<any>;
|
|
27
|
-
export declare function getL2ChainConfig(networkName: NetworkNames): Promise<
|
|
64
|
+
export declare function getL2ChainConfig(networkName: NetworkNames): Promise<{
|
|
65
|
+
config: L2ChainConfig;
|
|
66
|
+
networkName: string;
|
|
67
|
+
} | undefined>;
|
|
28
68
|
export declare function enrichEnvironmentWithChainConfig(networkName: NetworkNames): Promise<void>;
|
|
29
69
|
//# sourceMappingURL=chain_l2_config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain_l2_config.d.ts","sourceRoot":"","sources":["../../src/cli/chain_l2_config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"chain_l2_config.d.ts","sourceRoot":"","sources":["../../src/cli/chain_l2_config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAU,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAM/D,MAAM,MAAM,aAAa,GAAG;IAC1B,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,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;IAIpC,yCAAyC;IACzC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,uFAAuF;IACvF,iBAAiB,EAAE,MAAM,CAAC;IAC1B,wCAAwC;IACxC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,2CAA2C;IAC3C,wBAAwB,EAAE,MAAM,CAAC;IACjC,+EAA+E;IAC/E,0BAA0B,EAAE,MAAM,CAAC;IACnC,yCAAyC;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,yBAAyB,EAAE,MAAM,CAAC;IAClC,wBAAwB,EAAE,OAAO,CAAC;IAClC,wBAAwB,EAAE,MAAM,CAAC;IACjC,2BAA2B,EAAE,MAAM,CAAC;CACrC,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,aA0D1C,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,aA6DvC,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,iBA2E/E"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/aztec.js';
|
|
2
|
+
import { DefaultL1ContractsConfig } from '@aztec/ethereum';
|
|
2
3
|
import path from 'path';
|
|
4
|
+
import publicIncludeMetrics from '../../public_include_metric_prefixes.json' with {
|
|
5
|
+
type: 'json'
|
|
6
|
+
};
|
|
3
7
|
export const testnetIgnitionL2ChainConfig = {
|
|
4
8
|
l1ChainId: 11155111,
|
|
5
|
-
ethereumSlotDuration: 12,
|
|
6
|
-
aztecSlotDuration: 36,
|
|
7
|
-
aztecEpochDuration: 32,
|
|
8
|
-
aztecProofSubmissionEpochs: 1,
|
|
9
9
|
testAccounts: true,
|
|
10
10
|
sponsoredFPC: false,
|
|
11
11
|
p2pEnabled: true,
|
|
@@ -19,28 +19,83 @@ export const testnetIgnitionL2ChainConfig = {
|
|
|
19
19
|
snapshotsUrl: 'https://storage.googleapis.com/aztec-testnet/snapshots/',
|
|
20
20
|
autoUpdate: 'disabled',
|
|
21
21
|
autoUpdateUrl: undefined,
|
|
22
|
-
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
|
+
slashInactivityMaxPenalty: 0n,
|
|
43
|
+
slashInvalidBlockEnabled: false,
|
|
44
|
+
slashPayloadTtlSeconds: 0,
|
|
45
|
+
slashPruneEnabled: false,
|
|
46
|
+
slashPrunePenalty: 0n,
|
|
47
|
+
slashPruneMaxPenalty: 0n,
|
|
48
|
+
slashInvalidBlockPenalty: 0n,
|
|
49
|
+
slashInvalidBlockMaxPenalty: 0n
|
|
23
50
|
};
|
|
24
51
|
export const alphaTestnetL2ChainConfig = {
|
|
25
52
|
l1ChainId: 11155111,
|
|
26
|
-
ethereumSlotDuration: 12,
|
|
27
|
-
aztecSlotDuration: 36,
|
|
28
|
-
aztecEpochDuration: 32,
|
|
29
|
-
aztecProofSubmissionEpochs: 1,
|
|
30
53
|
testAccounts: false,
|
|
31
54
|
sponsoredFPC: true,
|
|
32
55
|
p2pEnabled: true,
|
|
33
56
|
p2pBootstrapNodes: [],
|
|
34
|
-
registryAddress: '
|
|
35
|
-
slashFactoryAddress: '
|
|
36
|
-
feeAssetHandlerAddress: '
|
|
57
|
+
registryAddress: '0x95383433ea735eee6e23874a5b1321a541a9f053',
|
|
58
|
+
slashFactoryAddress: '0x5a1316892c6a5ac20e8347ee629c191a944ef2e7',
|
|
59
|
+
feeAssetHandlerAddress: '0xfe7bf646fae39c2811dbf5d0620014c098548f24',
|
|
37
60
|
seqMinTxsPerBlock: 0,
|
|
38
61
|
seqMaxTxsPerBlock: 20,
|
|
39
62
|
realProofs: true,
|
|
40
63
|
snapshotsUrl: 'https://storage.googleapis.com/aztec-testnet/snapshots/',
|
|
41
64
|
autoUpdate: 'config-and-version',
|
|
42
65
|
autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/alpha-testnet.json',
|
|
43
|
-
maxTxPoolSize:
|
|
66
|
+
maxTxPoolSize: 100_000_000,
|
|
67
|
+
publicIncludeMetrics,
|
|
68
|
+
publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec.network',
|
|
69
|
+
publicMetricsCollectFrom: [
|
|
70
|
+
'sequencer'
|
|
71
|
+
],
|
|
72
|
+
// Deployment stuff
|
|
73
|
+
/** How many seconds an L1 slot lasts. */ ethereumSlotDuration: 12,
|
|
74
|
+
/** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */ aztecSlotDuration: 36,
|
|
75
|
+
/** How many L2 slots an epoch lasts. */ aztecEpochDuration: 32,
|
|
76
|
+
/** The target validator committee size. */ aztecTargetCommitteeSize: 48,
|
|
77
|
+
/** The number of epochs after an epoch ends that proofs are still accepted. */ aztecProofSubmissionEpochs: 1,
|
|
78
|
+
/** The deposit amount for a validator */ depositAmount: DefaultL1ContractsConfig.depositAmount,
|
|
79
|
+
/** The minimum stake for a validator. */ minimumStake: DefaultL1ContractsConfig.minimumStake,
|
|
80
|
+
/** The slashing quorum */ slashingQuorum: 101,
|
|
81
|
+
/** The slashing round size */ slashingRoundSize: 200,
|
|
82
|
+
/** Governance proposing quorum */ governanceProposerQuorum: 151,
|
|
83
|
+
/** Governance proposing round size */ governanceProposerRoundSize: 300,
|
|
84
|
+
/** The mana target for the rollup */ manaTarget: DefaultL1ContractsConfig.manaTarget,
|
|
85
|
+
/** The proving cost per mana */ provingCostPerMana: DefaultL1ContractsConfig.provingCostPerMana,
|
|
86
|
+
// slashing stuff
|
|
87
|
+
slashPayloadTtlSeconds: 36 * 32 * 24,
|
|
88
|
+
slashPruneEnabled: true,
|
|
89
|
+
slashPrunePenalty: 17n * (DefaultL1ContractsConfig.depositAmount / 100n),
|
|
90
|
+
slashPruneMaxPenalty: 17n * (DefaultL1ContractsConfig.depositAmount / 100n),
|
|
91
|
+
slashInactivityEnabled: true,
|
|
92
|
+
slashInactivityCreateTargetPercentage: 1,
|
|
93
|
+
slashInactivitySignalTargetPercentage: 1,
|
|
94
|
+
slashInactivityCreatePenalty: 17n * (DefaultL1ContractsConfig.depositAmount / 100n),
|
|
95
|
+
slashInactivityMaxPenalty: 17n * (DefaultL1ContractsConfig.depositAmount / 100n),
|
|
96
|
+
slashInvalidBlockEnabled: true,
|
|
97
|
+
slashInvalidBlockPenalty: DefaultL1ContractsConfig.depositAmount,
|
|
98
|
+
slashInvalidBlockMaxPenalty: DefaultL1ContractsConfig.depositAmount
|
|
44
99
|
};
|
|
45
100
|
export async function getBootnodes(networkName) {
|
|
46
101
|
const url = `http://static.aztec.network/${networkName}/bootnodes.json`;
|
|
@@ -57,13 +112,19 @@ export async function getL2ChainConfig(networkName) {
|
|
|
57
112
|
...testnetIgnitionL2ChainConfig
|
|
58
113
|
};
|
|
59
114
|
config.p2pBootstrapNodes = await getBootnodes(networkName);
|
|
60
|
-
return
|
|
61
|
-
|
|
115
|
+
return {
|
|
116
|
+
config,
|
|
117
|
+
networkName
|
|
118
|
+
};
|
|
119
|
+
} else if (networkName === 'alpha-testnet' || networkName === 'testnet') {
|
|
62
120
|
const config = {
|
|
63
121
|
...alphaTestnetL2ChainConfig
|
|
64
122
|
};
|
|
65
|
-
config.p2pBootstrapNodes = await getBootnodes(
|
|
66
|
-
return
|
|
123
|
+
config.p2pBootstrapNodes = await getBootnodes('alpha-testnet');
|
|
124
|
+
return {
|
|
125
|
+
config,
|
|
126
|
+
networkName: 'alpha-testnet'
|
|
127
|
+
};
|
|
67
128
|
}
|
|
68
129
|
return undefined;
|
|
69
130
|
}
|
|
@@ -83,14 +144,14 @@ function enrichEthAddressVar(envVar, value) {
|
|
|
83
144
|
enrichVar(envVar, value);
|
|
84
145
|
}
|
|
85
146
|
export async function enrichEnvironmentWithChainConfig(networkName) {
|
|
86
|
-
|
|
87
|
-
|
|
147
|
+
if (networkName === 'local') {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const result = await getL2ChainConfig(networkName);
|
|
151
|
+
if (!result) {
|
|
88
152
|
throw new Error(`Unknown network name: ${networkName}`);
|
|
89
153
|
}
|
|
90
|
-
|
|
91
|
-
enrichVar('AZTEC_SLOT_DURATION', config.aztecSlotDuration.toString());
|
|
92
|
-
enrichVar('AZTEC_EPOCH_DURATION', config.aztecEpochDuration.toString());
|
|
93
|
-
enrichVar('AZTEC_PROOF_SUBMISSION_EPOCHS', config.aztecProofSubmissionEpochs.toString());
|
|
154
|
+
const { config, networkName: name } = result;
|
|
94
155
|
enrichVar('BOOTSTRAP_NODES', config.p2pBootstrapNodes.join(','));
|
|
95
156
|
enrichVar('TEST_ACCOUNTS', config.testAccounts.toString());
|
|
96
157
|
enrichVar('SPONSORED_FPC', config.sponsoredFPC.toString());
|
|
@@ -98,7 +159,7 @@ export async function enrichEnvironmentWithChainConfig(networkName) {
|
|
|
98
159
|
enrichVar('L1_CHAIN_ID', config.l1ChainId.toString());
|
|
99
160
|
enrichVar('SEQ_MIN_TX_PER_BLOCK', config.seqMinTxsPerBlock.toString());
|
|
100
161
|
enrichVar('SEQ_MAX_TX_PER_BLOCK', config.seqMaxTxsPerBlock.toString());
|
|
101
|
-
enrichVar('DATA_DIRECTORY', path.join(process.env.HOME || '~', '.aztec',
|
|
162
|
+
enrichVar('DATA_DIRECTORY', path.join(process.env.HOME || '~', '.aztec', name, 'data'));
|
|
102
163
|
enrichVar('PROVER_REAL_PROOFS', config.realProofs.toString());
|
|
103
164
|
enrichVar('PXE_PROVER_ENABLED', config.realProofs.toString());
|
|
104
165
|
enrichVar('SYNC_SNAPSHOTS_URL', config.snapshotsUrl);
|
|
@@ -109,7 +170,43 @@ export async function enrichEnvironmentWithChainConfig(networkName) {
|
|
|
109
170
|
if (config.autoUpdateUrl) {
|
|
110
171
|
enrichVar('AUTO_UPDATE_URL', config.autoUpdateUrl);
|
|
111
172
|
}
|
|
173
|
+
if (config.publicIncludeMetrics) {
|
|
174
|
+
enrichVar('PUBLIC_OTEL_INCLUDE_METRICS', config.publicIncludeMetrics.join(','));
|
|
175
|
+
}
|
|
176
|
+
if (config.publicMetricsCollectorUrl) {
|
|
177
|
+
enrichVar('PUBLIC_OTEL_EXPORTER_OTLP_METRICS_ENDPOINT', config.publicMetricsCollectorUrl);
|
|
178
|
+
}
|
|
179
|
+
if (config.publicMetricsCollectFrom) {
|
|
180
|
+
enrichVar('PUBLIC_OTEL_COLLECT_FROM', config.publicMetricsCollectFrom.join(','));
|
|
181
|
+
}
|
|
112
182
|
enrichEthAddressVar('REGISTRY_CONTRACT_ADDRESS', config.registryAddress);
|
|
113
183
|
enrichEthAddressVar('SLASH_FACTORY_CONTRACT_ADDRESS', config.slashFactoryAddress);
|
|
114
184
|
enrichEthAddressVar('FEE_ASSET_HANDLER_CONTRACT_ADDRESS', config.feeAssetHandlerAddress);
|
|
185
|
+
// Deployment stuff
|
|
186
|
+
enrichVar('ETHEREUM_SLOT_DURATION', config.ethereumSlotDuration.toString());
|
|
187
|
+
enrichVar('AZTEC_SLOT_DURATION', config.aztecSlotDuration.toString());
|
|
188
|
+
enrichVar('AZTEC_EPOCH_DURATION', config.aztecEpochDuration.toString());
|
|
189
|
+
enrichVar('AZTEC_TARGET_COMMITTEE_SIZE', config.aztecTargetCommitteeSize.toString());
|
|
190
|
+
enrichVar('AZTEC_PROOF_SUBMISSION_EPOCHS', config.aztecProofSubmissionEpochs.toString());
|
|
191
|
+
enrichVar('AZTEC_DEPOSIT_AMOUNT', config.depositAmount.toString());
|
|
192
|
+
enrichVar('AZTEC_MINIMUM_STAKE', config.minimumStake.toString());
|
|
193
|
+
enrichVar('AZTEC_SLASHING_QUORUM', config.slashingQuorum.toString());
|
|
194
|
+
enrichVar('AZTEC_SLASHING_ROUND_SIZE', config.slashingRoundSize.toString());
|
|
195
|
+
enrichVar('AZTEC_GOVERNANCE_PROPOSER_QUORUM', config.governanceProposerQuorum.toString());
|
|
196
|
+
enrichVar('AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE', config.governanceProposerRoundSize.toString());
|
|
197
|
+
enrichVar('AZTEC_MANA_TARGET', config.manaTarget.toString());
|
|
198
|
+
enrichVar('AZTEC_PROVING_COST_PER_MANA', config.provingCostPerMana.toString());
|
|
199
|
+
// Slashing
|
|
200
|
+
enrichVar('SLASH_PAYLOAD_TTL_SECONDS', config.slashPayloadTtlSeconds.toString());
|
|
201
|
+
enrichVar('SLASH_PRUNE_ENABLED', config.slashPruneEnabled.toString());
|
|
202
|
+
enrichVar('SLASH_PRUNE_PENALTY', config.slashPrunePenalty.toString());
|
|
203
|
+
enrichVar('SLASH_PRUNE_MAX_PENALTY', config.slashPruneMaxPenalty.toString());
|
|
204
|
+
enrichVar('SLASH_INACTIVITY_ENABLED', config.slashInactivityEnabled.toString());
|
|
205
|
+
enrichVar('SLASH_INACTIVITY_CREATE_TARGET_PERCENTAGE', config.slashInactivityCreateTargetPercentage.toString());
|
|
206
|
+
enrichVar('SLASH_INACTIVITY_SIGNAL_TARGET_PERCENTAGE', config.slashInactivitySignalTargetPercentage.toString());
|
|
207
|
+
enrichVar('SLASH_INACTIVITY_CREATE_PENALTY', config.slashInactivityCreatePenalty.toString());
|
|
208
|
+
enrichVar('SLASH_INACTIVITY_MAX_PENALTY', config.slashInactivityMaxPenalty.toString());
|
|
209
|
+
enrichVar('SLASH_INVALID_BLOCK_ENABLED', config.slashInvalidBlockEnabled.toString());
|
|
210
|
+
enrichVar('SLASH_INVALID_BLOCK_PENALTY', config.slashInvalidBlockPenalty.toString());
|
|
211
|
+
enrichVar('SLASH_INVALID_BLOCK_MAX_PENALTY', config.slashInvalidBlockMaxPenalty.toString());
|
|
115
212
|
}
|
package/dest/cli/util.d.ts
CHANGED
|
@@ -8,6 +8,18 @@ import type { PXEService } from '@aztec/pxe/server';
|
|
|
8
8
|
import type { ProverConfig } from '@aztec/stdlib/interfaces/server';
|
|
9
9
|
import type { Command } from 'commander';
|
|
10
10
|
import { type AztecStartOption } from './aztec_start_options.js';
|
|
11
|
+
export declare const enum ExitCode {
|
|
12
|
+
SUCCESS = 0,
|
|
13
|
+
ERROR = 1,
|
|
14
|
+
ROLLUP_UPGRADE = 78,// EX_CONFIG from FreeBSD (https://man.freebsd.org/cgi/man.cgi?query=sysexits)
|
|
15
|
+
VERSION_UPGRADE = 79,// prev + 1 because there's nothing better
|
|
16
|
+
SIGHUP = 129,
|
|
17
|
+
SIGINT = 130,
|
|
18
|
+
SIGQUIT = 131,
|
|
19
|
+
SIGTERM = 143
|
|
20
|
+
}
|
|
21
|
+
export declare function shutdown(logFn: LogFn, exitCode: ExitCode, cb?: Array<() => Promise<void>>): Promise<never>;
|
|
22
|
+
export declare function isShuttingDown(): boolean;
|
|
11
23
|
export declare const installSignalHandlers: (logFn: LogFn, cb?: Array<() => Promise<void>>) => void;
|
|
12
24
|
/**
|
|
13
25
|
* Creates logs for the initial accounts
|
|
@@ -60,5 +72,4 @@ export declare function preloadCrsDataForVerifying({ realProofs }: Pick<AztecNod
|
|
|
60
72
|
*/
|
|
61
73
|
export declare function preloadCrsDataForServerSideProving({ realProofs }: Pick<ProverConfig, 'realProofs'>, log: LogFn): Promise<void>;
|
|
62
74
|
export declare function setupUpdateMonitor(autoUpdateMode: SharedNodeConfig['autoUpdate'], updatesLocation: URL, followsCanonicalRollup: boolean, publicClient: ViemClient, registryContractAddress: EthAddress, signalHandlers: Array<() => Promise<void>>, updateNodeConfig?: (config: object) => Promise<void>): Promise<void>;
|
|
63
|
-
export declare function shutdown(logFn: LogFn, cb?: Array<() => Promise<void>>): Promise<void>;
|
|
64
75
|
//# sourceMappingURL=util.d.ts.map
|
package/dest/cli/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/cli/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,KAAK,KAAK,EAAgB,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAKpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,KAAK,gBAAgB,EAAqB,MAAM,0BAA0B,CAAC;AAEpF,eAAO,MAAM,qBAAqB,GAAI,OAAO,KAAK,EAAE,KAAK,KAAK,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/cli/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,KAAK,KAAK,EAAgB,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAKpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,KAAK,gBAAgB,EAAqB,MAAM,0BAA0B,CAAC;AAEpF,0BAAkB,QAAQ;IACxB,OAAO,IAAI;IACX,KAAK,IAAI;IACT,cAAc,KAAK,CAAE,8EAA8E;IACnG,eAAe,KAAK,CAAE,0CAA0C;IAEhE,MAAM,MAAM;IACZ,MAAM,MAAM;IACZ,OAAO,MAAM;IACb,OAAO,MAAM;CACd;AAGD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAgB1G;AAED,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAED,eAAO,MAAM,qBAAqB,GAAI,OAAO,KAAK,EAAE,KAAK,KAAK,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,SAalF,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,sBAAsB,EAAE;IACtB;;OAEG;IACH,OAAO,EAAE,cAAc,CAAC;IACxB;;OAEG;IACH,SAAS,EAAE,EAAE,CAAC;CACf,EAAE,EACH,GAAG,EAAE,UAAU,qBAyBhB;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;CAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAiB/F;AAED,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,EACvB,gBAAgB,EAAE,MAAM,GACvB,MAAM,CAKR;AAmBD,eAAO,MAAM,UAAU,GAAI,KAAK,OAAO,EAAE,SAAS,gBAAgB,EAAE,SASnE,CAAC;AAEF,eAAO,MAAM,uBAAuB,cAwBnC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,GAAI,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,WAAW,MAAM,wBASvF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GAAI,CAAC,EACtC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC5B,UAAU,kBAAkB,CAAC,CAAC,CAAC,EAC/B,WAAW,MAAM,KAChB,CA8BF,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,0BAA0B,CAC9C,EAAE,UAAU,EAAE,EAAE,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,EACnD,GAAG,EAAE,KAAK,GACT,OAAO,CAAC,IAAI,CAAC,CAKf;AAED;;;;GAIG;AACH,wBAAsB,kCAAkC,CACtD,EAAE,UAAU,EAAE,EAAE,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,EAChD,GAAG,EAAE,KAAK,GACT,OAAO,CAAC,IAAI,CAAC,CAKf;AAED,wBAAsB,kBAAkB,CACtC,cAAc,EAAE,gBAAgB,CAAC,YAAY,CAAC,EAC9C,eAAe,EAAE,GAAG,EACpB,sBAAsB,EAAE,OAAO,EAC/B,YAAY,EAAE,UAAU,EACxB,uBAAuB,EAAE,UAAU,EACnC,cAAc,EAAE,KAAK,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAC1C,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,iBA8ErD"}
|
package/dest/cli/util.js
CHANGED
|
@@ -3,13 +3,63 @@ import { UpdateChecker } from '@aztec/stdlib/update-checker';
|
|
|
3
3
|
import { getTelemetryClient } from '@aztec/telemetry-client';
|
|
4
4
|
import chalk from 'chalk';
|
|
5
5
|
import { aztecStartOptions } from './aztec_start_options.js';
|
|
6
|
+
export var ExitCode = /*#__PURE__*/ function(ExitCode) {
|
|
7
|
+
ExitCode[ExitCode["SUCCESS"] = 0] = "SUCCESS";
|
|
8
|
+
ExitCode[ExitCode["ERROR"] = 1] = "ERROR";
|
|
9
|
+
ExitCode[ExitCode["ROLLUP_UPGRADE"] = 78] = "ROLLUP_UPGRADE";
|
|
10
|
+
ExitCode[ExitCode["VERSION_UPGRADE"] = 79] = "VERSION_UPGRADE";
|
|
11
|
+
// 128 + int(SIGNAL)
|
|
12
|
+
ExitCode[ExitCode["SIGHUP"] = 129] = "SIGHUP";
|
|
13
|
+
ExitCode[ExitCode["SIGINT"] = 130] = "SIGINT";
|
|
14
|
+
ExitCode[ExitCode["SIGQUIT"] = 131] = "SIGQUIT";
|
|
15
|
+
ExitCode[ExitCode["SIGTERM"] = 143] = "SIGTERM";
|
|
16
|
+
return ExitCode;
|
|
17
|
+
}({});
|
|
18
|
+
let shutdownPromise;
|
|
19
|
+
export function shutdown(logFn, exitCode, cb) {
|
|
20
|
+
if (shutdownPromise) {
|
|
21
|
+
logFn('Already shutting down.');
|
|
22
|
+
return shutdownPromise;
|
|
23
|
+
}
|
|
24
|
+
logFn('Shutting down...', {
|
|
25
|
+
exitCode
|
|
26
|
+
});
|
|
27
|
+
if (cb) {
|
|
28
|
+
shutdownPromise = Promise.allSettled(cb).then(()=>process.exit(exitCode));
|
|
29
|
+
} else {
|
|
30
|
+
// synchronously shuts down the process
|
|
31
|
+
// no need to set shutdownPromise on this branch of the if statement because no more code will be executed
|
|
32
|
+
process.exit(exitCode);
|
|
33
|
+
}
|
|
34
|
+
return shutdownPromise;
|
|
35
|
+
}
|
|
36
|
+
export function isShuttingDown() {
|
|
37
|
+
return shutdownPromise !== undefined;
|
|
38
|
+
}
|
|
6
39
|
export const installSignalHandlers = (logFn, cb)=>{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
40
|
+
const signals = [
|
|
41
|
+
[
|
|
42
|
+
'SIGINT',
|
|
43
|
+
130
|
|
44
|
+
],
|
|
45
|
+
[
|
|
46
|
+
'SIGTERM',
|
|
47
|
+
143
|
|
48
|
+
],
|
|
49
|
+
[
|
|
50
|
+
'SIGHUP',
|
|
51
|
+
129
|
|
52
|
+
],
|
|
53
|
+
[
|
|
54
|
+
'SIQUIT',
|
|
55
|
+
131
|
|
56
|
+
]
|
|
57
|
+
];
|
|
58
|
+
for (const [signal, exitCode] of signals){
|
|
59
|
+
process.removeAllListeners(signal);
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
61
|
+
process.once(signal, ()=>shutdown(logFn, exitCode, cb));
|
|
62
|
+
}
|
|
13
63
|
};
|
|
14
64
|
/**
|
|
15
65
|
* Creates logs for the initial accounts
|
|
@@ -183,6 +233,9 @@ export async function setupUpdateMonitor(autoUpdateMode, updatesLocation, follow
|
|
|
183
233
|
});
|
|
184
234
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
185
235
|
checker.on('newRollupVersion', async ({ latestVersion, currentVersion })=>{
|
|
236
|
+
if (isShuttingDown()) {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
186
239
|
// if node follows canonical rollup then this is equivalent to a config update
|
|
187
240
|
if (!followsCanonicalRollup) {
|
|
188
241
|
return;
|
|
@@ -192,7 +245,7 @@ export async function setupUpdateMonitor(autoUpdateMode, updatesLocation, follow
|
|
|
192
245
|
latestVersion,
|
|
193
246
|
currentVersion
|
|
194
247
|
});
|
|
195
|
-
await shutdown(logger.info, signalHandlers);
|
|
248
|
+
await shutdown(logger.info, 78, signalHandlers);
|
|
196
249
|
} else if (autoUpdateMode === 'notify') {
|
|
197
250
|
logger.warn(`New rollup detected. Please restart the node`, {
|
|
198
251
|
latestVersion,
|
|
@@ -202,12 +255,15 @@ export async function setupUpdateMonitor(autoUpdateMode, updatesLocation, follow
|
|
|
202
255
|
});
|
|
203
256
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
204
257
|
checker.on('newNodeVersion', async ({ latestVersion, currentVersion })=>{
|
|
258
|
+
if (isShuttingDown()) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
205
261
|
if (autoUpdateMode === 'config-and-version') {
|
|
206
262
|
logger.info(`New node version detected. Please update and restart the node`, {
|
|
207
263
|
latestVersion,
|
|
208
264
|
currentVersion
|
|
209
265
|
});
|
|
210
|
-
await shutdown(logger.info, signalHandlers);
|
|
266
|
+
await shutdown(logger.info, 79, signalHandlers);
|
|
211
267
|
} else if (autoUpdateMode === 'notify') {
|
|
212
268
|
logger.info(`New node version detected. Please update and restart the node`, {
|
|
213
269
|
latestVersion,
|
|
@@ -217,6 +273,9 @@ export async function setupUpdateMonitor(autoUpdateMode, updatesLocation, follow
|
|
|
217
273
|
});
|
|
218
274
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
219
275
|
checker.on('updateNodeConfig', async (config)=>{
|
|
276
|
+
if (isShuttingDown()) {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
220
279
|
if ((autoUpdateMode === 'config' || autoUpdateMode === 'config-and-version') && updateNodeConfig) {
|
|
221
280
|
logger.warn(`Config change detected. Updating node`, config);
|
|
222
281
|
try {
|
|
@@ -237,6 +296,10 @@ export async function setupUpdateMonitor(autoUpdateMode, updatesLocation, follow
|
|
|
237
296
|
if (Array.isArray(publicIncludeMetrics) && publicIncludeMetrics.every((m)=>typeof m === 'string')) {
|
|
238
297
|
getTelemetryClient().setExportedPublicTelemetry(publicIncludeMetrics);
|
|
239
298
|
}
|
|
299
|
+
const publicMetricsCollectFrom = config.publicMetricsCollectFrom;
|
|
300
|
+
if (Array.isArray(publicMetricsCollectFrom) && publicMetricsCollectFrom.every((m)=>typeof m === 'string')) {
|
|
301
|
+
getTelemetryClient().setPublicTelemetryCollectFrom(publicMetricsCollectFrom);
|
|
302
|
+
}
|
|
240
303
|
} catch (err) {
|
|
241
304
|
logger.warn('Failed to update config', {
|
|
242
305
|
err
|
|
@@ -247,10 +310,3 @@ export async function setupUpdateMonitor(autoUpdateMode, updatesLocation, follow
|
|
|
247
310
|
});
|
|
248
311
|
checker.start();
|
|
249
312
|
}
|
|
250
|
-
export async function shutdown(logFn, cb) {
|
|
251
|
-
logFn('Shutting down...');
|
|
252
|
-
if (cb) {
|
|
253
|
-
await Promise.all(cb);
|
|
254
|
-
}
|
|
255
|
-
process.exit(0);
|
|
256
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/aztec",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
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.
|
|
31
|
-
"@aztec/archiver": "1.
|
|
32
|
-
"@aztec/aztec-faucet": "1.
|
|
33
|
-
"@aztec/aztec-node": "1.
|
|
34
|
-
"@aztec/aztec.js": "1.
|
|
35
|
-
"@aztec/bb-prover": "1.
|
|
36
|
-
"@aztec/bb.js": "1.
|
|
37
|
-
"@aztec/blob-sink": "1.
|
|
38
|
-
"@aztec/bot": "1.
|
|
39
|
-
"@aztec/builder": "1.
|
|
40
|
-
"@aztec/cli": "1.
|
|
41
|
-
"@aztec/cli-wallet": "1.
|
|
42
|
-
"@aztec/constants": "1.
|
|
43
|
-
"@aztec/entrypoints": "1.
|
|
44
|
-
"@aztec/ethereum": "1.
|
|
45
|
-
"@aztec/foundation": "1.
|
|
46
|
-
"@aztec/kv-store": "1.
|
|
47
|
-
"@aztec/noir-contracts.js": "1.
|
|
48
|
-
"@aztec/noir-protocol-circuits-types": "1.
|
|
49
|
-
"@aztec/p2p": "1.
|
|
50
|
-
"@aztec/p2p-bootstrap": "1.
|
|
51
|
-
"@aztec/protocol-contracts": "1.
|
|
52
|
-
"@aztec/prover-client": "1.
|
|
53
|
-
"@aztec/prover-node": "1.
|
|
54
|
-
"@aztec/pxe": "1.
|
|
55
|
-
"@aztec/stdlib": "1.
|
|
56
|
-
"@aztec/telemetry-client": "1.
|
|
57
|
-
"@aztec/txe": "1.
|
|
58
|
-
"@aztec/world-state": "1.
|
|
30
|
+
"@aztec/accounts": "1.1.0",
|
|
31
|
+
"@aztec/archiver": "1.1.0",
|
|
32
|
+
"@aztec/aztec-faucet": "1.1.0",
|
|
33
|
+
"@aztec/aztec-node": "1.1.0",
|
|
34
|
+
"@aztec/aztec.js": "1.1.0",
|
|
35
|
+
"@aztec/bb-prover": "1.1.0",
|
|
36
|
+
"@aztec/bb.js": "1.1.0",
|
|
37
|
+
"@aztec/blob-sink": "1.1.0",
|
|
38
|
+
"@aztec/bot": "1.1.0",
|
|
39
|
+
"@aztec/builder": "1.1.0",
|
|
40
|
+
"@aztec/cli": "1.1.0",
|
|
41
|
+
"@aztec/cli-wallet": "1.1.0",
|
|
42
|
+
"@aztec/constants": "1.1.0",
|
|
43
|
+
"@aztec/entrypoints": "1.1.0",
|
|
44
|
+
"@aztec/ethereum": "1.1.0",
|
|
45
|
+
"@aztec/foundation": "1.1.0",
|
|
46
|
+
"@aztec/kv-store": "1.1.0",
|
|
47
|
+
"@aztec/noir-contracts.js": "1.1.0",
|
|
48
|
+
"@aztec/noir-protocol-circuits-types": "1.1.0",
|
|
49
|
+
"@aztec/p2p": "1.1.0",
|
|
50
|
+
"@aztec/p2p-bootstrap": "1.1.0",
|
|
51
|
+
"@aztec/protocol-contracts": "1.1.0",
|
|
52
|
+
"@aztec/prover-client": "1.1.0",
|
|
53
|
+
"@aztec/prover-node": "1.1.0",
|
|
54
|
+
"@aztec/pxe": "1.1.0",
|
|
55
|
+
"@aztec/stdlib": "1.1.0",
|
|
56
|
+
"@aztec/telemetry-client": "1.1.0",
|
|
57
|
+
"@aztec/txe": "1.1.0",
|
|
58
|
+
"@aztec/world-state": "1.1.0",
|
|
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 {
|
|
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
|
-
|
|
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');
|
|
@@ -6,6 +6,7 @@ import { botConfigMappings } from '@aztec/bot/config';
|
|
|
6
6
|
import {
|
|
7
7
|
type ConfigMapping,
|
|
8
8
|
type EnvVar,
|
|
9
|
+
SecretValue,
|
|
9
10
|
booleanConfigHelper,
|
|
10
11
|
isBooleanConfigValue,
|
|
11
12
|
omitConfigMappings,
|
|
@@ -158,7 +159,7 @@ export const aztecStartOptions: { [key: string]: AztecStartOption[] } = {
|
|
|
158
159
|
description: 'List of API keys for the corresponding Ethereum consensus nodes',
|
|
159
160
|
defaultValue: [],
|
|
160
161
|
envVar: 'L1_CONSENSUS_HOST_API_KEYS',
|
|
161
|
-
parseVal: (val: string) => val.split(',').map(
|
|
162
|
+
parseVal: (val: string) => val.split(',').map(key => new SecretValue(key)),
|
|
162
163
|
},
|
|
163
164
|
{
|
|
164
165
|
flag: '--l1-consensus-host-api-key-headers <value>',
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/aztec.js';
|
|
2
|
-
import
|
|
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
10
|
export type L2ChainConfig = {
|
|
10
11
|
l1ChainId: number;
|
|
11
|
-
ethereumSlotDuration: number;
|
|
12
|
-
aztecSlotDuration: number;
|
|
13
|
-
aztecEpochDuration: number;
|
|
14
|
-
aztecProofSubmissionEpochs: number;
|
|
15
12
|
testAccounts: boolean;
|
|
16
13
|
sponsoredFPC: boolean;
|
|
17
14
|
p2pEnabled: boolean;
|
|
@@ -26,14 +23,56 @@ export type L2ChainConfig = {
|
|
|
26
23
|
autoUpdate: SharedNodeConfig['autoUpdate'];
|
|
27
24
|
autoUpdateUrl?: string;
|
|
28
25
|
maxTxPoolSize: number;
|
|
26
|
+
publicIncludeMetrics?: string[];
|
|
27
|
+
publicMetricsCollectorUrl?: string;
|
|
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
|
+
slashInactivityMaxPenalty: bigint;
|
|
69
|
+
slashInvalidBlockEnabled: boolean;
|
|
70
|
+
slashInvalidBlockPenalty: bigint;
|
|
71
|
+
slashInvalidBlockMaxPenalty: bigint;
|
|
29
72
|
};
|
|
30
73
|
|
|
31
74
|
export const testnetIgnitionL2ChainConfig: L2ChainConfig = {
|
|
32
75
|
l1ChainId: 11155111,
|
|
33
|
-
ethereumSlotDuration: 12,
|
|
34
|
-
aztecSlotDuration: 36,
|
|
35
|
-
aztecEpochDuration: 32,
|
|
36
|
-
aztecProofSubmissionEpochs: 1,
|
|
37
76
|
testAccounts: true,
|
|
38
77
|
sponsoredFPC: false,
|
|
39
78
|
p2pEnabled: true,
|
|
@@ -48,28 +87,111 @@ export const testnetIgnitionL2ChainConfig: L2ChainConfig = {
|
|
|
48
87
|
autoUpdate: 'disabled',
|
|
49
88
|
autoUpdateUrl: undefined,
|
|
50
89
|
maxTxPoolSize: 100_000_000, // 100MB
|
|
51
|
-
};
|
|
52
90
|
|
|
53
|
-
|
|
54
|
-
|
|
91
|
+
// Deployment stuff
|
|
92
|
+
/** How many seconds an L1 slot lasts. */
|
|
55
93
|
ethereumSlotDuration: 12,
|
|
94
|
+
/** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
|
|
56
95
|
aztecSlotDuration: 36,
|
|
96
|
+
/** How many L2 slots an epoch lasts. */
|
|
57
97
|
aztecEpochDuration: 32,
|
|
98
|
+
/** The target validator committee size. */
|
|
99
|
+
aztecTargetCommitteeSize: 48,
|
|
100
|
+
/** The number of epochs after an epoch ends that proofs are still accepted. */
|
|
58
101
|
aztecProofSubmissionEpochs: 1,
|
|
102
|
+
/** The deposit amount for a validator */
|
|
103
|
+
depositAmount: DefaultL1ContractsConfig.depositAmount,
|
|
104
|
+
/** The minimum stake for a validator. */
|
|
105
|
+
minimumStake: DefaultL1ContractsConfig.minimumStake,
|
|
106
|
+
/** The slashing quorum */
|
|
107
|
+
slashingQuorum: DefaultL1ContractsConfig.slashingQuorum,
|
|
108
|
+
/** The slashing round size */
|
|
109
|
+
slashingRoundSize: DefaultL1ContractsConfig.slashingRoundSize,
|
|
110
|
+
/** Governance proposing quorum */
|
|
111
|
+
governanceProposerQuorum: DefaultL1ContractsConfig.governanceProposerQuorum,
|
|
112
|
+
/** Governance proposing round size */
|
|
113
|
+
governanceProposerRoundSize: DefaultL1ContractsConfig.governanceProposerRoundSize,
|
|
114
|
+
/** The mana target for the rollup */
|
|
115
|
+
manaTarget: 0n,
|
|
116
|
+
/** The proving cost per mana */
|
|
117
|
+
provingCostPerMana: 0n,
|
|
118
|
+
|
|
119
|
+
// slashing stuff
|
|
120
|
+
slashInactivityEnabled: false,
|
|
121
|
+
slashInactivityCreateTargetPercentage: 0,
|
|
122
|
+
slashInactivitySignalTargetPercentage: 0,
|
|
123
|
+
slashInactivityCreatePenalty: 0n,
|
|
124
|
+
slashInactivityMaxPenalty: 0n,
|
|
125
|
+
slashInvalidBlockEnabled: false,
|
|
126
|
+
slashPayloadTtlSeconds: 0,
|
|
127
|
+
slashPruneEnabled: false,
|
|
128
|
+
slashPrunePenalty: 0n,
|
|
129
|
+
slashPruneMaxPenalty: 0n,
|
|
130
|
+
slashInvalidBlockPenalty: 0n,
|
|
131
|
+
slashInvalidBlockMaxPenalty: 0n,
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export const alphaTestnetL2ChainConfig: L2ChainConfig = {
|
|
135
|
+
l1ChainId: 11155111,
|
|
59
136
|
testAccounts: false,
|
|
60
137
|
sponsoredFPC: true,
|
|
61
138
|
p2pEnabled: true,
|
|
62
139
|
p2pBootstrapNodes: [],
|
|
63
|
-
registryAddress: '
|
|
64
|
-
slashFactoryAddress: '
|
|
65
|
-
feeAssetHandlerAddress: '
|
|
140
|
+
registryAddress: '0x95383433ea735eee6e23874a5b1321a541a9f053',
|
|
141
|
+
slashFactoryAddress: '0x5a1316892c6a5ac20e8347ee629c191a944ef2e7',
|
|
142
|
+
feeAssetHandlerAddress: '0xfe7bf646fae39c2811dbf5d0620014c098548f24',
|
|
66
143
|
seqMinTxsPerBlock: 0,
|
|
67
144
|
seqMaxTxsPerBlock: 20,
|
|
68
145
|
realProofs: true,
|
|
69
146
|
snapshotsUrl: 'https://storage.googleapis.com/aztec-testnet/snapshots/',
|
|
70
147
|
autoUpdate: 'config-and-version',
|
|
71
148
|
autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/alpha-testnet.json',
|
|
72
|
-
maxTxPoolSize:
|
|
149
|
+
maxTxPoolSize: 100_000_000, // 100MB
|
|
150
|
+
publicIncludeMetrics,
|
|
151
|
+
publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec.network',
|
|
152
|
+
publicMetricsCollectFrom: ['sequencer'],
|
|
153
|
+
|
|
154
|
+
// Deployment stuff
|
|
155
|
+
/** How many seconds an L1 slot lasts. */
|
|
156
|
+
ethereumSlotDuration: 12,
|
|
157
|
+
/** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
|
|
158
|
+
aztecSlotDuration: 36,
|
|
159
|
+
/** How many L2 slots an epoch lasts. */
|
|
160
|
+
aztecEpochDuration: 32,
|
|
161
|
+
/** The target validator committee size. */
|
|
162
|
+
aztecTargetCommitteeSize: 48,
|
|
163
|
+
/** The number of epochs after an epoch ends that proofs are still accepted. */
|
|
164
|
+
aztecProofSubmissionEpochs: 1,
|
|
165
|
+
/** The deposit amount for a validator */
|
|
166
|
+
depositAmount: DefaultL1ContractsConfig.depositAmount,
|
|
167
|
+
/** The minimum stake for a validator. */
|
|
168
|
+
minimumStake: DefaultL1ContractsConfig.minimumStake,
|
|
169
|
+
/** The slashing quorum */
|
|
170
|
+
slashingQuorum: 101,
|
|
171
|
+
/** The slashing round size */
|
|
172
|
+
slashingRoundSize: 200,
|
|
173
|
+
/** Governance proposing quorum */
|
|
174
|
+
governanceProposerQuorum: 151,
|
|
175
|
+
/** Governance proposing round size */
|
|
176
|
+
governanceProposerRoundSize: 300,
|
|
177
|
+
/** The mana target for the rollup */
|
|
178
|
+
manaTarget: DefaultL1ContractsConfig.manaTarget,
|
|
179
|
+
/** The proving cost per mana */
|
|
180
|
+
provingCostPerMana: DefaultL1ContractsConfig.provingCostPerMana,
|
|
181
|
+
|
|
182
|
+
// slashing stuff
|
|
183
|
+
slashPayloadTtlSeconds: 36 * 32 * 24, // 24 epochs
|
|
184
|
+
slashPruneEnabled: true,
|
|
185
|
+
slashPrunePenalty: 17n * (DefaultL1ContractsConfig.depositAmount / 100n),
|
|
186
|
+
slashPruneMaxPenalty: 17n * (DefaultL1ContractsConfig.depositAmount / 100n),
|
|
187
|
+
slashInactivityEnabled: true,
|
|
188
|
+
slashInactivityCreateTargetPercentage: 1,
|
|
189
|
+
slashInactivitySignalTargetPercentage: 1,
|
|
190
|
+
slashInactivityCreatePenalty: 17n * (DefaultL1ContractsConfig.depositAmount / 100n),
|
|
191
|
+
slashInactivityMaxPenalty: 17n * (DefaultL1ContractsConfig.depositAmount / 100n),
|
|
192
|
+
slashInvalidBlockEnabled: true,
|
|
193
|
+
slashInvalidBlockPenalty: DefaultL1ContractsConfig.depositAmount,
|
|
194
|
+
slashInvalidBlockMaxPenalty: DefaultL1ContractsConfig.depositAmount,
|
|
73
195
|
};
|
|
74
196
|
|
|
75
197
|
export async function getBootnodes(networkName: NetworkNames) {
|
|
@@ -85,15 +207,17 @@ export async function getBootnodes(networkName: NetworkNames) {
|
|
|
85
207
|
return json['bootnodes'];
|
|
86
208
|
}
|
|
87
209
|
|
|
88
|
-
export async function getL2ChainConfig(
|
|
210
|
+
export async function getL2ChainConfig(
|
|
211
|
+
networkName: NetworkNames,
|
|
212
|
+
): Promise<{ config: L2ChainConfig; networkName: string } | undefined> {
|
|
89
213
|
if (networkName === 'testnet-ignition') {
|
|
90
214
|
const config = { ...testnetIgnitionL2ChainConfig };
|
|
91
215
|
config.p2pBootstrapNodes = await getBootnodes(networkName);
|
|
92
|
-
return config;
|
|
93
|
-
} else if (networkName === 'alpha-testnet') {
|
|
216
|
+
return { config, networkName };
|
|
217
|
+
} else if (networkName === 'alpha-testnet' || networkName === 'testnet') {
|
|
94
218
|
const config = { ...alphaTestnetL2ChainConfig };
|
|
95
|
-
config.p2pBootstrapNodes = await getBootnodes(
|
|
96
|
-
return config;
|
|
219
|
+
config.p2pBootstrapNodes = await getBootnodes('alpha-testnet');
|
|
220
|
+
return { config, networkName: 'alpha-testnet' };
|
|
97
221
|
}
|
|
98
222
|
return undefined;
|
|
99
223
|
}
|
|
@@ -116,14 +240,15 @@ function enrichEthAddressVar(envVar: EnvVar, value: string) {
|
|
|
116
240
|
}
|
|
117
241
|
|
|
118
242
|
export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames) {
|
|
119
|
-
|
|
120
|
-
|
|
243
|
+
if (networkName === 'local') {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
const result = await getL2ChainConfig(networkName);
|
|
248
|
+
if (!result) {
|
|
121
249
|
throw new Error(`Unknown network name: ${networkName}`);
|
|
122
250
|
}
|
|
123
|
-
|
|
124
|
-
enrichVar('AZTEC_SLOT_DURATION', config.aztecSlotDuration.toString());
|
|
125
|
-
enrichVar('AZTEC_EPOCH_DURATION', config.aztecEpochDuration.toString());
|
|
126
|
-
enrichVar('AZTEC_PROOF_SUBMISSION_EPOCHS', config.aztecProofSubmissionEpochs.toString());
|
|
251
|
+
const { config, networkName: name } = result;
|
|
127
252
|
enrichVar('BOOTSTRAP_NODES', config.p2pBootstrapNodes.join(','));
|
|
128
253
|
enrichVar('TEST_ACCOUNTS', config.testAccounts.toString());
|
|
129
254
|
enrichVar('SPONSORED_FPC', config.sponsoredFPC.toString());
|
|
@@ -131,7 +256,7 @@ export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames
|
|
|
131
256
|
enrichVar('L1_CHAIN_ID', config.l1ChainId.toString());
|
|
132
257
|
enrichVar('SEQ_MIN_TX_PER_BLOCK', config.seqMinTxsPerBlock.toString());
|
|
133
258
|
enrichVar('SEQ_MAX_TX_PER_BLOCK', config.seqMaxTxsPerBlock.toString());
|
|
134
|
-
enrichVar('DATA_DIRECTORY', path.join(process.env.HOME || '~', '.aztec',
|
|
259
|
+
enrichVar('DATA_DIRECTORY', path.join(process.env.HOME || '~', '.aztec', name, 'data'));
|
|
135
260
|
enrichVar('PROVER_REAL_PROOFS', config.realProofs.toString());
|
|
136
261
|
enrichVar('PXE_PROVER_ENABLED', config.realProofs.toString());
|
|
137
262
|
enrichVar('SYNC_SNAPSHOTS_URL', config.snapshotsUrl);
|
|
@@ -145,7 +270,48 @@ export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames
|
|
|
145
270
|
enrichVar('AUTO_UPDATE_URL', config.autoUpdateUrl);
|
|
146
271
|
}
|
|
147
272
|
|
|
273
|
+
if (config.publicIncludeMetrics) {
|
|
274
|
+
enrichVar('PUBLIC_OTEL_INCLUDE_METRICS', config.publicIncludeMetrics.join(','));
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if (config.publicMetricsCollectorUrl) {
|
|
278
|
+
enrichVar('PUBLIC_OTEL_EXPORTER_OTLP_METRICS_ENDPOINT', config.publicMetricsCollectorUrl);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (config.publicMetricsCollectFrom) {
|
|
282
|
+
enrichVar('PUBLIC_OTEL_COLLECT_FROM', config.publicMetricsCollectFrom.join(','));
|
|
283
|
+
}
|
|
284
|
+
|
|
148
285
|
enrichEthAddressVar('REGISTRY_CONTRACT_ADDRESS', config.registryAddress);
|
|
149
286
|
enrichEthAddressVar('SLASH_FACTORY_CONTRACT_ADDRESS', config.slashFactoryAddress);
|
|
150
287
|
enrichEthAddressVar('FEE_ASSET_HANDLER_CONTRACT_ADDRESS', config.feeAssetHandlerAddress);
|
|
288
|
+
|
|
289
|
+
// Deployment stuff
|
|
290
|
+
enrichVar('ETHEREUM_SLOT_DURATION', config.ethereumSlotDuration.toString());
|
|
291
|
+
enrichVar('AZTEC_SLOT_DURATION', config.aztecSlotDuration.toString());
|
|
292
|
+
enrichVar('AZTEC_EPOCH_DURATION', config.aztecEpochDuration.toString());
|
|
293
|
+
enrichVar('AZTEC_TARGET_COMMITTEE_SIZE', config.aztecTargetCommitteeSize.toString());
|
|
294
|
+
enrichVar('AZTEC_PROOF_SUBMISSION_EPOCHS', config.aztecProofSubmissionEpochs.toString());
|
|
295
|
+
enrichVar('AZTEC_DEPOSIT_AMOUNT', config.depositAmount.toString());
|
|
296
|
+
enrichVar('AZTEC_MINIMUM_STAKE', config.minimumStake.toString());
|
|
297
|
+
enrichVar('AZTEC_SLASHING_QUORUM', config.slashingQuorum.toString());
|
|
298
|
+
enrichVar('AZTEC_SLASHING_ROUND_SIZE', config.slashingRoundSize.toString());
|
|
299
|
+
enrichVar('AZTEC_GOVERNANCE_PROPOSER_QUORUM', config.governanceProposerQuorum.toString());
|
|
300
|
+
enrichVar('AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE', config.governanceProposerRoundSize.toString());
|
|
301
|
+
enrichVar('AZTEC_MANA_TARGET', config.manaTarget.toString());
|
|
302
|
+
enrichVar('AZTEC_PROVING_COST_PER_MANA', config.provingCostPerMana.toString());
|
|
303
|
+
|
|
304
|
+
// Slashing
|
|
305
|
+
enrichVar('SLASH_PAYLOAD_TTL_SECONDS', config.slashPayloadTtlSeconds.toString());
|
|
306
|
+
enrichVar('SLASH_PRUNE_ENABLED', config.slashPruneEnabled.toString());
|
|
307
|
+
enrichVar('SLASH_PRUNE_PENALTY', config.slashPrunePenalty.toString());
|
|
308
|
+
enrichVar('SLASH_PRUNE_MAX_PENALTY', config.slashPruneMaxPenalty.toString());
|
|
309
|
+
enrichVar('SLASH_INACTIVITY_ENABLED', config.slashInactivityEnabled.toString());
|
|
310
|
+
enrichVar('SLASH_INACTIVITY_CREATE_TARGET_PERCENTAGE', config.slashInactivityCreateTargetPercentage.toString());
|
|
311
|
+
enrichVar('SLASH_INACTIVITY_SIGNAL_TARGET_PERCENTAGE', config.slashInactivitySignalTargetPercentage.toString());
|
|
312
|
+
enrichVar('SLASH_INACTIVITY_CREATE_PENALTY', config.slashInactivityCreatePenalty.toString());
|
|
313
|
+
enrichVar('SLASH_INACTIVITY_MAX_PENALTY', config.slashInactivityMaxPenalty.toString());
|
|
314
|
+
enrichVar('SLASH_INVALID_BLOCK_ENABLED', config.slashInvalidBlockEnabled.toString());
|
|
315
|
+
enrichVar('SLASH_INVALID_BLOCK_PENALTY', config.slashInvalidBlockPenalty.toString());
|
|
316
|
+
enrichVar('SLASH_INVALID_BLOCK_MAX_PENALTY', config.slashInvalidBlockMaxPenalty.toString());
|
|
151
317
|
}
|
package/src/cli/util.ts
CHANGED
|
@@ -14,13 +14,54 @@ import type { Command } from 'commander';
|
|
|
14
14
|
|
|
15
15
|
import { type AztecStartOption, aztecStartOptions } from './aztec_start_options.js';
|
|
16
16
|
|
|
17
|
+
export const enum ExitCode {
|
|
18
|
+
SUCCESS = 0,
|
|
19
|
+
ERROR = 1,
|
|
20
|
+
ROLLUP_UPGRADE = 78, // EX_CONFIG from FreeBSD (https://man.freebsd.org/cgi/man.cgi?query=sysexits)
|
|
21
|
+
VERSION_UPGRADE = 79, // prev + 1 because there's nothing better
|
|
22
|
+
// 128 + int(SIGNAL)
|
|
23
|
+
SIGHUP = 129,
|
|
24
|
+
SIGINT = 130,
|
|
25
|
+
SIGQUIT = 131,
|
|
26
|
+
SIGTERM = 143,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let shutdownPromise: Promise<never> | undefined;
|
|
30
|
+
export function shutdown(logFn: LogFn, exitCode: ExitCode, cb?: Array<() => Promise<void>>): Promise<never> {
|
|
31
|
+
if (shutdownPromise) {
|
|
32
|
+
logFn('Already shutting down.');
|
|
33
|
+
return shutdownPromise;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
logFn('Shutting down...', { exitCode });
|
|
37
|
+
if (cb) {
|
|
38
|
+
shutdownPromise = Promise.allSettled(cb).then(() => process.exit(exitCode));
|
|
39
|
+
} else {
|
|
40
|
+
// synchronously shuts down the process
|
|
41
|
+
// no need to set shutdownPromise on this branch of the if statement because no more code will be executed
|
|
42
|
+
process.exit(exitCode);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return shutdownPromise;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function isShuttingDown(): boolean {
|
|
49
|
+
return shutdownPromise !== undefined;
|
|
50
|
+
}
|
|
51
|
+
|
|
17
52
|
export const installSignalHandlers = (logFn: LogFn, cb?: Array<() => Promise<void>>) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
53
|
+
const signals = [
|
|
54
|
+
['SIGINT', ExitCode.SIGINT],
|
|
55
|
+
['SIGTERM', ExitCode.SIGTERM],
|
|
56
|
+
['SIGHUP', ExitCode.SIGHUP],
|
|
57
|
+
['SIQUIT', ExitCode.SIGQUIT],
|
|
58
|
+
] as const;
|
|
59
|
+
|
|
60
|
+
for (const [signal, exitCode] of signals) {
|
|
61
|
+
process.removeAllListeners(signal);
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
63
|
+
process.once(signal, () => shutdown(logFn, exitCode, cb));
|
|
64
|
+
}
|
|
24
65
|
};
|
|
25
66
|
|
|
26
67
|
/**
|
|
@@ -262,6 +303,10 @@ export async function setupUpdateMonitor(
|
|
|
262
303
|
|
|
263
304
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
264
305
|
checker.on('newRollupVersion', async ({ latestVersion, currentVersion }) => {
|
|
306
|
+
if (isShuttingDown()) {
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
|
|
265
310
|
// if node follows canonical rollup then this is equivalent to a config update
|
|
266
311
|
if (!followsCanonicalRollup) {
|
|
267
312
|
return;
|
|
@@ -269,7 +314,7 @@ export async function setupUpdateMonitor(
|
|
|
269
314
|
|
|
270
315
|
if (autoUpdateMode === 'config' || autoUpdateMode === 'config-and-version') {
|
|
271
316
|
logger.info(`New rollup version detected. Please restart the node`, { latestVersion, currentVersion });
|
|
272
|
-
await shutdown(logger.info, signalHandlers);
|
|
317
|
+
await shutdown(logger.info, ExitCode.ROLLUP_UPGRADE, signalHandlers);
|
|
273
318
|
} else if (autoUpdateMode === 'notify') {
|
|
274
319
|
logger.warn(`New rollup detected. Please restart the node`, { latestVersion, currentVersion });
|
|
275
320
|
}
|
|
@@ -277,9 +322,12 @@ export async function setupUpdateMonitor(
|
|
|
277
322
|
|
|
278
323
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
279
324
|
checker.on('newNodeVersion', async ({ latestVersion, currentVersion }) => {
|
|
325
|
+
if (isShuttingDown()) {
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
280
328
|
if (autoUpdateMode === 'config-and-version') {
|
|
281
329
|
logger.info(`New node version detected. Please update and restart the node`, { latestVersion, currentVersion });
|
|
282
|
-
await shutdown(logger.info, signalHandlers);
|
|
330
|
+
await shutdown(logger.info, ExitCode.VERSION_UPGRADE, signalHandlers);
|
|
283
331
|
} else if (autoUpdateMode === 'notify') {
|
|
284
332
|
logger.info(`New node version detected. Please update and restart the node`, { latestVersion, currentVersion });
|
|
285
333
|
}
|
|
@@ -287,6 +335,10 @@ export async function setupUpdateMonitor(
|
|
|
287
335
|
|
|
288
336
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
289
337
|
checker.on('updateNodeConfig', async config => {
|
|
338
|
+
if (isShuttingDown()) {
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
|
|
290
342
|
if ((autoUpdateMode === 'config' || autoUpdateMode === 'config-and-version') && updateNodeConfig) {
|
|
291
343
|
logger.warn(`Config change detected. Updating node`, config);
|
|
292
344
|
try {
|
|
@@ -306,6 +358,10 @@ export async function setupUpdateMonitor(
|
|
|
306
358
|
if (Array.isArray(publicIncludeMetrics) && publicIncludeMetrics.every(m => typeof m === 'string')) {
|
|
307
359
|
getTelemetryClient().setExportedPublicTelemetry(publicIncludeMetrics);
|
|
308
360
|
}
|
|
361
|
+
const publicMetricsCollectFrom: unknown = (config as any).publicMetricsCollectFrom;
|
|
362
|
+
if (Array.isArray(publicMetricsCollectFrom) && publicMetricsCollectFrom.every(m => typeof m === 'string')) {
|
|
363
|
+
getTelemetryClient().setPublicTelemetryCollectFrom(publicMetricsCollectFrom);
|
|
364
|
+
}
|
|
309
365
|
} catch (err) {
|
|
310
366
|
logger.warn('Failed to update config', { err });
|
|
311
367
|
}
|
|
@@ -315,11 +371,3 @@ export async function setupUpdateMonitor(
|
|
|
315
371
|
|
|
316
372
|
checker.start();
|
|
317
373
|
}
|
|
318
|
-
|
|
319
|
-
export async function shutdown(logFn: LogFn, cb?: Array<() => Promise<void>>) {
|
|
320
|
-
logFn('Shutting down...');
|
|
321
|
-
if (cb) {
|
|
322
|
-
await Promise.all(cb);
|
|
323
|
-
}
|
|
324
|
-
process.exit(0);
|
|
325
|
-
}
|