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
4 changes: 3 additions & 1 deletion yarn-project/aztec/src/cli/cmds/start_node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Agent, makeUndiciFetch } from '@aztec/foundation/json-rpc/undici';
import type { LogFn } from '@aztec/foundation/log';
import { ProvingJobConsumerSchema, createProvingJobBrokerClient } from '@aztec/prover-client/broker';
import { type CliPXEOptions, type PXEConfig, allPxeConfigMappings } from '@aztec/pxe/config';
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';
import {
Expand Down Expand Up @@ -82,7 +83,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(', ')}`);

Expand Down
10 changes: 7 additions & 3 deletions yarn-project/aztec/src/local-network/local-network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -138,9 +139,12 @@ export async function createLocalNetwork(config: Partial<LocalNetworkConfig> = {

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] : []),
Copy link
Contributor

Choose a reason for hiding this comment

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

The bananaFPC is still a think when users start our local network? Wow.

...prefundAddresses,
];
const { genesisArchiveRoot, prefilledPublicData, fundingNeeded } = await getGenesisValues(fundedAddresses);

const dateProvider = new TestDateProvider();
Expand Down
12 changes: 12 additions & 0 deletions yarn-project/ethereum/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -259,6 +261,16 @@ export const genesisStateConfigMappings: ConfigMappingsType<GenesisStateConfig>
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: [],
},
Comment on lines +264 to +273
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rather make this a list of AztecAddress rather than strings, and have the AztecAddress.fromString run as part of the parseEnv. But it's just a nit. And I don't recall if the package dependencies will allow you to do it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We'd end up with circular deps indeed (without further refactoring)

};

export function getL1ContractsConfigEnvVars(): L1ContractsConfig {
Expand Down
1 change: 1 addition & 0 deletions yarn-project/foundation/src/config/env_var.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
12 changes: 12 additions & 0 deletions yarn-project/node-lib/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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` */
Expand Down Expand Up @@ -35,6 +37,16 @@ export const sharedNodeConfigMappings: ConfigMappingsType<SharedNodeConfig> = {
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: [],
},
Comment on lines +40 to +49
Copy link
Contributor

Choose a reason for hiding this comment

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

I hate that we have duplicate config across the board.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

;(

syncMode: {
env: 'SYNC_MODE',
description:
Expand Down
Loading