Skip to content

[BUG] TEST_ACCOUNTS=false is ignored when running aztec start --sandbox #21563

@wei3erHase

Description

@wei3erHase

What are you trying to do?

Disable test account deployment when starting a local sandbox network by setting TEST_ACCOUNTS=false:

TEST_ACCOUNTS=false aztec start --sandbox

The expectation is that no test accounts are deployed, but they are deployed anyway.

Code Reference

The bug is in yarn-project/aztec/src/cli/aztec_start_action.ts. In the sandbox branch, testAccounts is unconditionally hardcoded to true regardless of any environment variable:

// aztec_start_action.ts — sandbox branch
const sandboxOptions = extractNamespacedOptions(options, 'sandbox');
const nodeOptions = extractNamespacedOptions(options, 'node');
sandboxOptions.testAccounts = true;  // ← always true, TEST_ACCOUNTS env var is never consulted

This value is then passed directly to createSandbox:

const { node, pxe, stop } = await createSandbox(
  {
    ...
    testAccounts: sandboxOptions.testAccounts,  // always true
    ...
  },
  userLog,
);

Meanwhile, the shell wrapper (aztec-up/bin/aztec) correctly respects the env var:

export TEST_ACCOUNTS=${TEST_ACCOUNTS:-true}  # honours a pre-set value

But the TypeScript layer overrides it before it can be used.

Note: the non-sandbox node path (start_node.ts) correctly reads TEST_ACCOUNTS via getConfigEnvVars() — this bug is specific to the sandbox branch.

Aztec Version

v1.2.1

Additional Context

Proposed fix

  1. Add a --sandbox.testAccounts option to the SANDBOX section of aztec_start_options.ts, bound to the TEST_ACCOUNTS env var with a default of true:
{
  flag: '--sandbox.testAccounts',
  description: 'Deploy test accounts on sandbox start',
  envVar: 'TEST_ACCOUNTS',
  ...booleanConfigHelper(true),
},
  1. Remove the hardcoded override in aztec_start_action.ts:
// delete this line:
sandboxOptions.testAccounts = true;

With this change sandboxOptions.testAccounts will be populated by Commander from the env var (defaulting to true), exactly like --sandbox.noPXE already works for NO_PXE.

A failing spec that captures the regression lives in yarn-project/aztec/src/cli/aztec_start_action.test.ts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions