From e232bacb30775e1bfd5464d33b10b78f527b9063 Mon Sep 17 00:00:00 2001 From: AztecBot Date: Mon, 2 Mar 2026 16:08:02 +0000 Subject: [PATCH 1/2] feat: allow custom addresses to be prefunded with fee juice in local network (backport #21000) Cherry-pick of PR #21000 with conflicts. start_node.ts has conflict markers where the AztecAddress import could not be cleanly applied (import context differs between next and v4). --- yarn-project/aztec/src/cli/cmds/start_node.ts | 9 ++++++++- .../aztec/src/local-network/local-network.ts | 10 +++++++--- yarn-project/ethereum/src/config.ts | 12 ++++++++++++ yarn-project/foundation/src/config/env_var.ts | 1 + yarn-project/node-lib/src/config/index.ts | 12 ++++++++++++ 5 files changed, 40 insertions(+), 4 deletions(-) diff --git a/yarn-project/aztec/src/cli/cmds/start_node.ts b/yarn-project/aztec/src/cli/cmds/start_node.ts index a034cf3a6f5a..e80b8a84302f 100644 --- a/yarn-project/aztec/src/cli/cmds/start_node.ts +++ b/yarn-project/aztec/src/cli/cmds/start_node.ts @@ -14,8 +14,14 @@ import type { LogFn } from '@aztec/foundation/log'; import { sleep } from '@aztec/foundation/sleep'; import { ProvingJobConsumerSchema, createProvingJobBrokerClient } from '@aztec/prover-client/broker'; import { type CliPXEOptions, type PXEConfig, allPxeConfigMappings } from '@aztec/pxe/config'; +<<<<<<< HEAD import { AztecNodeAdminApiSchema, AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client'; import { P2PApiSchema, ProverNodeApiSchema, type ProvingJobBroker } from '@aztec/stdlib/interfaces/server'; +======= +import { AztecAddress } from '@aztec/stdlib/aztec-address'; +import { AztecNodeAdminApiSchema, AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client'; +import { P2PApiSchema, ProverNodeApiSchema, type ProvingJobBroker } from '@aztec/stdlib/interfaces/server'; +>>>>>>> 8ec1d44 (allow custom addresses to be prefunded with fee juice in local network) import { type TelemetryClientConfig, initTelemetryClient, @@ -154,7 +160,8 @@ export async function startNode( const testAccounts = nodeConfig.testAccounts ? (await getInitialTestAccountsData()).map(a => a.address) : []; const sponsoredFPCAccounts = nodeConfig.sponsoredFPC ? [await getSponsoredFPCAddress()] : []; - const initialFundedAccounts = testAccounts.concat(sponsoredFPCAccounts); + const prefundAddresses = (nodeConfig.prefundAddresses ?? []).map(a => AztecAddress.fromString(a)); + const initialFundedAccounts = testAccounts.concat(sponsoredFPCAccounts).concat(prefundAddresses); userLog(`Initial funded accounts: ${initialFundedAccounts.map(a => a.toString()).join(', ')}`); diff --git a/yarn-project/aztec/src/local-network/local-network.ts b/yarn-project/aztec/src/local-network/local-network.ts index 1b3882881359..a2d04e8b22ab 100644 --- a/yarn-project/aztec/src/local-network/local-network.ts +++ b/yarn-project/aztec/src/local-network/local-network.ts @@ -19,6 +19,7 @@ import { DateProvider, TestDateProvider } from '@aztec/foundation/timer'; import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree'; import { protocolContractsHash } from '@aztec/protocol-contracts'; import { SequencerState } from '@aztec/sequencer-client'; +import { AztecAddress } from '@aztec/stdlib/aztec-address'; import type { ProvingJobBroker } from '@aztec/stdlib/interfaces/server'; import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees'; import { @@ -138,9 +139,12 @@ export async function createLocalNetwork(config: Partial = { const bananaFPC = await getBananaFPCAddress(initialAccounts); const sponsoredFPC = await getSponsoredFPCAddress(); - const fundedAddresses = initialAccounts.length - ? [...initialAccounts.map(a => a.address), bananaFPC, sponsoredFPC] - : []; + const prefundAddresses = (aztecNodeConfig.prefundAddresses ?? []).map(a => AztecAddress.fromString(a)); + const fundedAddresses = [ + ...initialAccounts.map(a => a.address), + ...(initialAccounts.length ? [bananaFPC, sponsoredFPC] : []), + ...prefundAddresses, + ]; const { genesisArchiveRoot, prefilledPublicData, fundingNeeded } = await getGenesisValues(fundedAddresses); const dateProvider = new TestDateProvider(); diff --git a/yarn-project/ethereum/src/config.ts b/yarn-project/ethereum/src/config.ts index 5c271cd915cb..6ccee3ce7c2a 100644 --- a/yarn-project/ethereum/src/config.ts +++ b/yarn-project/ethereum/src/config.ts @@ -19,6 +19,8 @@ export type GenesisStateConfig = { testAccounts: boolean; /** Whether to populate the genesis state with initial fee juice for the sponsored FPC */ sponsoredFPC: boolean; + /** Additional addresses to prefund with fee juice at genesis */ + prefundAddresses: string[]; }; export type L1ContractsConfig = { @@ -259,6 +261,16 @@ export const genesisStateConfigMappings: ConfigMappingsType description: 'Whether to populate the genesis state with initial fee juice for the sponsored FPC.', ...booleanConfigHelper(false), }, + prefundAddresses: { + env: 'PREFUND_ADDRESSES', + description: 'Comma-separated list of Aztec addresses to prefund with fee juice at genesis.', + parseEnv: (val: string) => + val + .split(',') + .map(a => a.trim()) + .filter(a => a.length > 0), + defaultValue: [], + }, }; export function getL1ContractsConfigEnvVars(): L1ContractsConfig { diff --git a/yarn-project/foundation/src/config/env_var.ts b/yarn-project/foundation/src/config/env_var.ts index 9eb0ef616f8c..901cf01c3bac 100644 --- a/yarn-project/foundation/src/config/env_var.ts +++ b/yarn-project/foundation/src/config/env_var.ts @@ -247,6 +247,7 @@ export type EnvVar = | 'TELEMETRY' | 'TEST_ACCOUNTS' | 'SPONSORED_FPC' + | 'PREFUND_ADDRESSES' | 'TX_COLLECTION_FAST_NODES_TIMEOUT_BEFORE_REQ_RESP_MS' | 'TX_COLLECTION_SLOW_NODES_INTERVAL_MS' | 'TX_COLLECTION_SLOW_REQ_RESP_INTERVAL_MS' diff --git a/yarn-project/node-lib/src/config/index.ts b/yarn-project/node-lib/src/config/index.ts index c8403d2b09bc..e6df4c979d94 100644 --- a/yarn-project/node-lib/src/config/index.ts +++ b/yarn-project/node-lib/src/config/index.ts @@ -5,6 +5,8 @@ export type SharedNodeConfig = { testAccounts: boolean; /** Whether to populate the genesis state with initial fee juice for the sponsored FPC */ sponsoredFPC: boolean; + /** Additional addresses to prefund with fee juice at genesis */ + prefundAddresses: string[]; /** Sync mode: full to always sync via L1, snapshot to download a snapshot if there is no local data, force-snapshot to download even if there is local data. */ syncMode: 'full' | 'snapshot' | 'force-snapshot'; /** Base URLs for snapshots index. Index file will be searched at `SNAPSHOTS_BASE_URL/aztec-L1_CHAIN_ID-VERSION-ROLLUP_ADDRESS/index.json` */ @@ -35,6 +37,16 @@ export const sharedNodeConfigMappings: ConfigMappingsType = { description: 'Whether to populate the genesis state with initial fee juice for the sponsored FPC.', ...booleanConfigHelper(false), }, + prefundAddresses: { + env: 'PREFUND_ADDRESSES', + description: 'Comma-separated list of Aztec addresses to prefund with fee juice at genesis.', + parseEnv: (val: string) => + val + .split(',') + .map(a => a.trim()) + .filter(a => a.length > 0), + defaultValue: [], + }, syncMode: { env: 'SYNC_MODE', description: From 2164b2bada21aeffbe418a5021223057b777cbf9 Mon Sep 17 00:00:00 2001 From: AztecBot Date: Mon, 2 Mar 2026 16:08:15 +0000 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20resolve=20cherry-pick=20conflict=20?= =?UTF-8?q?=E2=80=94=20add=20AztecAddress=20import=20to=20start=5Fnode.ts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yarn-project/aztec/src/cli/cmds/start_node.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/yarn-project/aztec/src/cli/cmds/start_node.ts b/yarn-project/aztec/src/cli/cmds/start_node.ts index e80b8a84302f..ab26d4a3633c 100644 --- a/yarn-project/aztec/src/cli/cmds/start_node.ts +++ b/yarn-project/aztec/src/cli/cmds/start_node.ts @@ -14,14 +14,9 @@ import type { LogFn } from '@aztec/foundation/log'; import { sleep } from '@aztec/foundation/sleep'; import { ProvingJobConsumerSchema, createProvingJobBrokerClient } from '@aztec/prover-client/broker'; import { type CliPXEOptions, type PXEConfig, allPxeConfigMappings } from '@aztec/pxe/config'; -<<<<<<< HEAD -import { AztecNodeAdminApiSchema, AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client'; -import { P2PApiSchema, ProverNodeApiSchema, type ProvingJobBroker } from '@aztec/stdlib/interfaces/server'; -======= import { AztecAddress } from '@aztec/stdlib/aztec-address'; import { AztecNodeAdminApiSchema, AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client'; import { P2PApiSchema, ProverNodeApiSchema, type ProvingJobBroker } from '@aztec/stdlib/interfaces/server'; ->>>>>>> 8ec1d44 (allow custom addresses to be prefunded with fee juice in local network) import { type TelemetryClientConfig, initTelemetryClient,