diff --git a/yarn-project/aztec/src/cli/aztec_start_action.ts b/yarn-project/aztec/src/cli/aztec_start_action.ts index 7a3c3331a4a4..7b03c921e83e 100644 --- a/yarn-project/aztec/src/cli/aztec_start_action.ts +++ b/yarn-project/aztec/src/cli/aztec_start_action.ts @@ -27,8 +27,7 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg let config: ChainConfig | undefined = undefined; if (options.localNetwork) { - const localNetwork = extractNamespacedOptions(options, 'local-network'); - localNetwork.testAccounts = true; + const localNetwork = extractNamespacedOptions(options, 'localNetwork'); userLog(`${splash}\n${github}\n\n`); userLog(`Setting up Aztec local network ${packageVersion ?? 'unknown'}, please stand by...`); diff --git a/yarn-project/aztec/src/cli/aztec_start_options.test.ts b/yarn-project/aztec/src/cli/aztec_start_options.test.ts index 057e459467bc..befe8bedf91a 100644 --- a/yarn-project/aztec/src/cli/aztec_start_options.test.ts +++ b/yarn-project/aztec/src/cli/aztec_start_options.test.ts @@ -94,6 +94,21 @@ describe('aztec_start_options commander integration', () => { expect(typeof opts.port).toBe('number'); }); + it('respects TEST_ACCOUNTS env var for local network', () => { + process.env.TEST_ACCOUNTS = 'false'; + const cmd = buildCommandWith(['LOCAL_NETWORK']); + cmd.parse(['node', 'cli']); + const opts = cmd.opts(); + expect(opts['localNetwork.testAccounts']).toBe(false); + }); + + it('defaults testAccounts to true for local network', () => { + const cmd = buildCommandWith(['LOCAL_NETWORK']); + cmd.parse(['node', 'cli']); + const opts = cmd.opts(); + expect(opts['localNetwork.testAccounts']).toBe(true); + }); + it('parses optional boolean flag values', () => { const cmd = buildCommandWith(['P2P SUBSYSTEM']); diff --git a/yarn-project/aztec/src/cli/aztec_start_options.ts b/yarn-project/aztec/src/cli/aztec_start_options.ts index 3034ceea504c..b4c85349f9cb 100644 --- a/yarn-project/aztec/src/cli/aztec_start_options.ts +++ b/yarn-project/aztec/src/cli/aztec_start_options.ts @@ -129,6 +129,12 @@ export const aztecStartOptions: { [key: string]: AztecStartOption[] } = { defaultValue: DefaultMnemonic, env: 'MNEMONIC', }, + { + flag: '--local-network.testAccounts', + description: 'Deploy test accounts on local network start', + env: 'TEST_ACCOUNTS', + ...booleanConfigHelper(true), + }, ], API: [ {