Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions yarn-project/aztec/src/bin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ import { createConsoleLogger, createLogger } from '@aztec/foundation/log';

import { Command } from 'commander';

import { NETWORK_FLAG, aztecStartOptions } from '../cli/aztec_start_options.js';
import { enrichEnvironmentWithChainConfig } from '../cli/chain_l2_config.js';
import { injectAztecCommands } from '../cli/index.js';
import { getCliVersion } from '../cli/release_version.js';
import { addOptions } from '../cli/util.js';

const userLog = createConsoleLogger();
const debugLogger = createLogger('cli');
Expand All @@ -26,6 +29,17 @@ async function main() {
process.once('SIGINT', shutdown);
process.once('SIGTERM', shutdown);

// We create a temp command object to detect the presence of the network option
// If it has been given then we enrich the environment with the chain config
const tempCmd = new Command('aztec').allowUnknownOption();
addOptions(tempCmd, aztecStartOptions['NETWORK']);
tempCmd.parse(process.argv);
const networkValue = tempCmd.getOptionValue(NETWORK_FLAG);

if (networkValue !== undefined) {
await enrichEnvironmentWithChainConfig(networkValue);
}

const cliVersion = getCliVersion();
let program = new Command('aztec');
program.description('Aztec command line interface').version(cliVersion);
Expand Down
5 changes: 0 additions & 5 deletions yarn-project/aztec/src/cli/aztec_start_action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { getOtelJsonRpcPropagationMiddleware } from '@aztec/telemetry-client';

import { createSandbox } from '../sandbox/index.js';
import { github, splash } from '../splash.js';
import { enrichEnvironmentWithChainConfig } from './chain_l2_config.js';
import { getCliVersion } from './release_version.js';
import { extractNamespacedOptions, installSignalHandlers } from './util.js';
import { getVersions } from './versioning.js';
Expand Down Expand Up @@ -51,10 +50,6 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
userLog(`Not exposing PXE API through JSON-RPC server`);
}
} else {
// If a network is specified, enrich the environment with the chain config
if (options.network) {
await enrichEnvironmentWithChainConfig(options.network);
}
if (options.node) {
const { startNode } = await import('./cmds/start_node.js');
({ config } = await startNode(options, signalHandlers, services, adminServices, userLog));
Expand Down
4 changes: 3 additions & 1 deletion yarn-project/aztec/src/cli/aztec_start_options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,13 @@ export const universalOptions = [
'dataStoreMapSizeKb',
];

export const NETWORK_FLAG = 'network';

// Define categories and options
export const aztecStartOptions: { [key: string]: AztecStartOption[] } = {
NETWORK: [
{
flag: '--network <value>',
flag: `--${NETWORK_FLAG} <value>`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😆

description: 'Network to run Aztec on',
defaultValue: undefined,
envVar: 'NETWORK',
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec/src/cli/chain_l2_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const alphaTestnetL2ChainConfig: L2ChainConfig = {
aztecEpochDuration: 32,
aztecProofSubmissionWindow: 64,
testAccounts: true,
sponsoredFPC: true,
sponsoredFPC: false,
p2pEnabled: true,
p2pBootstrapNodes: [],
registryAddress: '0xad85d55a4bbef35e95396191c22903aa717edf1c',
Expand Down