diff --git a/yarn-project/aztec-node/src/aztec-node/config.ts b/yarn-project/aztec-node/src/aztec-node/config.ts index 58729cbc0e82..3d92a28e3847 100644 --- a/yarn-project/aztec-node/src/aztec-node/config.ts +++ b/yarn-project/aztec-node/src/aztec-node/config.ts @@ -1,5 +1,10 @@ import { type ArchiverConfig, archiverConfigMappings } from '@aztec/archiver/config'; -import { type L1ContractAddresses, l1ContractAddressesMapping } from '@aztec/ethereum'; +import { + type GenesisStateConfig, + type L1ContractAddresses, + genesisStateConfigMappings, + l1ContractAddressesMapping, +} from '@aztec/ethereum'; import { type ConfigMappingsType, booleanConfigHelper, getConfigFromMappings } from '@aztec/foundation/config'; import { type DataStoreConfig, dataConfigMappings } from '@aztec/kv-store/config'; import { type P2PConfig, p2pConfigMappings } from '@aztec/p2p/config'; @@ -24,13 +29,10 @@ export type AztecNodeConfig = ArchiverConfig & WorldStateConfig & Pick & P2PConfig & - DataStoreConfig & { + DataStoreConfig & + GenesisStateConfig & { /** Whether the validator is disabled for this node */ disableValidator: boolean; - /** Whether to populate the genesis state with initial fee juice for the test accounts */ - testAccounts: boolean; - /** Whether to populate the genesis state with initial fee juice for the sponsored FPC */ - sponsoredFPC: boolean; } & { l1Contracts: L1ContractAddresses; }; @@ -43,6 +45,7 @@ export const aztecNodeConfigMappings: ConfigMappingsType = { ...proverClientConfigMappings, ...worldStateConfigMappings, ...p2pConfigMappings, + ...genesisStateConfigMappings, l1Contracts: { description: 'The deployed L1 contract addresses', nested: l1ContractAddressesMapping, @@ -52,16 +55,6 @@ export const aztecNodeConfigMappings: ConfigMappingsType = { description: 'Whether the validator is disabled for this node.', ...booleanConfigHelper(), }, - testAccounts: { - env: 'TEST_ACCOUNTS', - description: 'Whether to populate the genesis state with initial fee juice for the test accounts.', - ...booleanConfigHelper(), - }, - sponsoredFPC: { - env: 'SPONSORED_FPC', - description: 'Whether to populate the genesis state with initial fee juice for the sponsored FPC.', - ...booleanConfigHelper(false), - }, }; /** diff --git a/yarn-project/aztec/src/cli/aztec_start_action.ts b/yarn-project/aztec/src/cli/aztec_start_action.ts index c4b7c8e506e3..af1e3e159916 100644 --- a/yarn-project/aztec/src/cli/aztec_start_action.ts +++ b/yarn-project/aztec/src/cli/aztec_start_action.ts @@ -26,6 +26,7 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg const cliVersion = getCliVersion(); const sandboxOptions = extractNamespacedOptions(options, 'sandbox'); const nodeOptions = extractNamespacedOptions(options, 'node'); + sandboxOptions.testAccounts = true; userLog(`${splash}\n${github}\n\n`); userLog(`Setting up Aztec Sandbox ${cliVersion}, please stand by...`); diff --git a/yarn-project/aztec/src/cli/aztec_start_options.ts b/yarn-project/aztec/src/cli/aztec_start_options.ts index 852176c80d75..d5ff12e2c9cc 100644 --- a/yarn-project/aztec/src/cli/aztec_start_options.ts +++ b/yarn-project/aztec/src/cli/aztec_start_options.ts @@ -84,12 +84,6 @@ export const aztecStartOptions: { [key: string]: AztecStartOption[] } = { defaultValue: undefined, envVar: undefined, }, - { - flag: '--sandbox.testAccounts', - description: 'Deploy test accounts on sandbox start', - envVar: 'TEST_ACCOUNTS', - ...booleanConfigHelper(true), - }, { flag: '--sandbox.noPXE', description: 'Do not expose PXE service on sandbox start', @@ -269,12 +263,6 @@ export const aztecStartOptions: { [key: string]: AztecStartOption[] } = { envVar: 'WS_BLOCK_CHECK_INTERVAL_MS', parseVal: val => parseInt(val, 10), }, - { - flag: '--node.testAccounts', - description: 'Populate genesis state with initial fee juice for test accounts', - envVar: 'TEST_ACCOUNTS', - ...booleanConfigHelper(), - }, ], 'P2P SUBSYSTEM': [ { diff --git a/yarn-project/ethereum/src/config.ts b/yarn-project/ethereum/src/config.ts index a519f426c949..4d31e6736972 100644 --- a/yarn-project/ethereum/src/config.ts +++ b/yarn-project/ethereum/src/config.ts @@ -1,12 +1,20 @@ import { type ConfigMappingsType, bigintConfigHelper, + booleanConfigHelper, getConfigFromMappings, numberConfigHelper, } from '@aztec/foundation/config'; import { type L1TxUtilsConfig, l1TxUtilsConfigMappings } from './l1_tx_utils.js'; +export type GenesisStateConfig = { + /** Whether to populate the genesis state with initial fee juice for the test accounts */ + testAccounts: boolean; + /** Whether to populate the genesis state with initial fee juice for the sponsored FPC */ + sponsoredFPC: boolean; +}; + export type L1ContractsConfig = { /** How many seconds an L1 slot lasts. */ ethereumSlotDuration: number; @@ -114,6 +122,23 @@ export const l1ContractsConfigMappings: ConfigMappingsType = ...l1TxUtilsConfigMappings, }; +export const genesisStateConfigMappings: ConfigMappingsType = { + testAccounts: { + env: 'TEST_ACCOUNTS', + description: 'Whether to populate the genesis state with initial fee juice for the test accounts.', + ...booleanConfigHelper(false), + }, + sponsoredFPC: { + env: 'SPONSORED_FPC', + description: 'Whether to populate the genesis state with initial fee juice for the sponsored FPC.', + ...booleanConfigHelper(false), + }, +}; + export function getL1ContractsConfigEnvVars(): L1ContractsConfig { return getConfigFromMappings(l1ContractsConfigMappings); } + +export function getGenesisStateConfigEnvVars(): GenesisStateConfig { + return getConfigFromMappings(genesisStateConfigMappings); +} diff --git a/yarn-project/prover-node/src/config.ts b/yarn-project/prover-node/src/config.ts index 924f603d81bb..319ab66f0da9 100644 --- a/yarn-project/prover-node/src/config.ts +++ b/yarn-project/prover-node/src/config.ts @@ -1,11 +1,7 @@ import { type ArchiverConfig, archiverConfigMappings } from '@aztec/archiver/config'; import type { ACVMConfig, BBConfig } from '@aztec/bb-prover/config'; -import { - type ConfigMappingsType, - booleanConfigHelper, - getConfigFromMappings, - numberConfigHelper, -} from '@aztec/foundation/config'; +import { type GenesisStateConfig, genesisStateConfigMappings } from '@aztec/ethereum'; +import { type ConfigMappingsType, getConfigFromMappings, numberConfigHelper } from '@aztec/foundation/config'; import { type DataStoreConfig, dataConfigMappings } from '@aztec/kv-store/config'; import { type P2PConfig, p2pConfigMappings } from '@aztec/p2p/config'; import { @@ -33,12 +29,8 @@ export type ProverNodeConfig = ArchiverConfig & TxSenderConfig & DataStoreConfig & ProverCoordinationConfig & - SpecificProverNodeConfig & { - /** Whether to populate the genesis state with initial fee juice for the test accounts */ - testAccounts: boolean; - /** Whether to populate the genesis state with initial fee juice for the sponsored FPC */ - sponsoredFPC: boolean; - }; + SpecificProverNodeConfig & + GenesisStateConfig; type SpecificProverNodeConfig = { proverNodeMaxPendingJobs: number; @@ -92,16 +84,7 @@ export const proverNodeConfigMappings: ConfigMappingsType = { ...getTxSenderConfigMappings('PROVER'), ...proverCoordinationConfigMappings, ...specificProverNodeConfigMappings, - testAccounts: { - env: 'TEST_ACCOUNTS', - description: 'Whether to populate the genesis state with initial fee juice for the test accounts.', - ...booleanConfigHelper(false), - }, - sponsoredFPC: { - env: 'SPONSORED_FPC', - description: 'Whether to populate the genesis state with initial fee juice for the sponsored FPC.', - ...booleanConfigHelper(false), - }, + ...genesisStateConfigMappings, }; export function getProverNodeConfigFromEnv(): ProverNodeConfig {