diff --git a/iac/network/common/gcp/main.tf b/iac/network/common/gcp/main.tf index 68a8b4660353..c60cb25827ea 100644 --- a/iac/network/common/gcp/main.tf +++ b/iac/network/common/gcp/main.tf @@ -16,7 +16,6 @@ module "iam" { } module "firewall" { - source = "../../modules/firewall/gcp" - p2p_tcp_ports = var.p2p_ports - p2p_udp_ports = var.p2p_ports + source = "../../modules/firewall/gcp" + p2p_ports = var.p2p_ports } diff --git a/spartan/aztec-network/files/config/deploy-l1-contracts.sh b/spartan/aztec-network/files/config/deploy-l1-contracts.sh index 547dd3f494de..9fb4b33afc3a 100755 --- a/spartan/aztec-network/files/config/deploy-l1-contracts.sh +++ b/spartan/aztec-network/files/config/deploy-l1-contracts.sh @@ -44,12 +44,19 @@ fi output="" MAX_RETRIES=5 RETRY_DELAY=15 + TEST_ACCOUNTS=${TEST_ACCOUNTS:-false} TEST_ACCOUNTS_ARG="" if [ "$TEST_ACCOUNTS" = "true" ]; then TEST_ACCOUNTS_ARG="--test-accounts" fi +SPONSORED_FPC=${SPONSORED_FPC:-false} +SPONSORED_FPC_ARG="" +if [ "$SPONSORED_FPC" = "true" ]; then + SPONSORED_FPC_ARG="--sponsored-fpc" +fi + ACCELERATED_TEST_DEPLOYMENTS_ARG="" if [ "$ACCELERATED_TEST_DEPLOYMENTS" = "true" ]; then ACCELERATED_TEST_DEPLOYMENTS_ARG="--accelerated-test-deployments" @@ -57,7 +64,7 @@ fi for attempt in $(seq 1 $MAX_RETRIES); do # Construct base command - base_cmd="LOG_LEVEL=debug node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js deploy-l1-contracts $TEST_ACCOUNTS_ARG $ACCELERATED_TEST_DEPLOYMENTS_ARG" + base_cmd="LOG_LEVEL=debug node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js deploy-l1-contracts $TEST_ACCOUNTS_ARG $ACCELERATED_TEST_DEPLOYMENTS_ARG $SPONSORED_FPC_ARG" # Add account - use private key if set, otherwise use mnemonic if [ -n "${L1_DEPLOYMENT_PRIVATE_KEY:-}" ]; then diff --git a/spartan/aztec-network/templates/_helpers.tpl b/spartan/aztec-network/templates/_helpers.tpl index 7ea1a700460e..145b42914fde 100644 --- a/spartan/aztec-network/templates/_helpers.tpl +++ b/spartan/aztec-network/templates/_helpers.tpl @@ -288,6 +288,8 @@ Combined wait-for-services and configure-env container for full nodes value: "{{ .Values.aztec.contracts.registryAddress }}" - name: SLASH_FACTORY_CONTRACT_ADDRESS value: "{{ .Values.aztec.contracts.slashFactoryAddress }}" + - name: FEE_ASSET_HANDLER_CONTRACT_ADDRESS + value: "{{ .Values.aztec.contracts.feeAssetHandlerContractAddress }}" {{- end -}} {{/* diff --git a/spartan/aztec-network/templates/blob-sink.yaml b/spartan/aztec-network/templates/blob-sink.yaml index 60362f78d633..01df0939e06c 100644 --- a/spartan/aztec-network/templates/blob-sink.yaml +++ b/spartan/aztec-network/templates/blob-sink.yaml @@ -31,6 +31,9 @@ spec: {{- if .Values.storage.localSsd }} {{- include "aztec-network.gcpLocalSsd" . | nindent 6 }} {{- end }} + {{- if .Values.network.public }} + serviceAccountName: {{ include "aztec-network.fullname" . }}-node + {{- end }} dnsPolicy: ClusterFirstWithHostNet initContainers: {{- include "aztec-network.serviceAddressSetupContainer" . | nindent 8 }} @@ -80,6 +83,8 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace + - name: ROLLUP_CONTRACT_ADDRESS + value: "{{ .Values.aztec.contracts.rollupAddress }}" - name: BLOB_SINK_PORT value: "{{ .Values.blobSink.service.nodePort }}" - name: LOG_LEVEL diff --git a/spartan/aztec-network/templates/boot-node.yaml b/spartan/aztec-network/templates/boot-node.yaml index e53ed0ab85d5..b7beffb521af 100644 --- a/spartan/aztec-network/templates/boot-node.yaml +++ b/spartan/aztec-network/templates/boot-node.yaml @@ -89,6 +89,8 @@ spec: value: "{{ .Values.ethereum.acceleratedTestDeployments }}" - name: TEST_ACCOUNTS value: "{{ .Values.aztec.testAccounts }}" + - name: SPONSORED_FPC + value: "{{ .Values.aztec.sponsoredFPC }}" - name: REGISTRY_CONTRACT_ADDRESS value: "{{ .Values.bootNode.contracts.registryAddress }}" - name: TELEMETRY @@ -230,6 +232,8 @@ spec: value: "{{ .Values.telemetry.excludeMetrics }}" - name: TEST_ACCOUNTS value: "{{ .Values.aztec.testAccounts }}" + - name: SPONSORED_FPC + value: "{{ .Values.aztec.sponsoredFPC }}" {{- if .Values.blobSink.enabled }} - name: BLOB_SINK_URL value: {{ include "aztec-network.blobSinkUrl" . }} diff --git a/spartan/aztec-network/templates/full-node.yaml b/spartan/aztec-network/templates/full-node.yaml index 57b81cf513c0..e83e308f2020 100644 --- a/spartan/aztec-network/templates/full-node.yaml +++ b/spartan/aztec-network/templates/full-node.yaml @@ -154,6 +154,8 @@ spec: value: "{{ .Values.network.p2pBootstrapNodesAsFullPeers }}" - name: TEST_ACCOUNTS value: "{{ .Values.aztec.testAccounts }}" + - name: SPONSORED_FPC + value: "{{ .Values.aztec.sponsoredFPC }}" {{- if .Values.blobSink.enabled }} - name: BLOB_SINK_URL value: {{ include "aztec-network.blobSinkUrl" . }} diff --git a/spartan/aztec-network/templates/prover-node.yaml b/spartan/aztec-network/templates/prover-node.yaml index 283c7a4b6539..7f30c9f83d85 100644 --- a/spartan/aztec-network/templates/prover-node.yaml +++ b/spartan/aztec-network/templates/prover-node.yaml @@ -234,6 +234,8 @@ spec: value: "{{ .Values.telemetry.excludeMetrics }}" - name: TEST_ACCOUNTS value: "{{ .Values.aztec.testAccounts }}" + - name: SPONSORED_FPC + value: "{{ .Values.aztec.sponsoredFPC }}" {{- if .Values.blobSink.enabled }} - name: BLOB_SINK_URL value: {{ include "aztec-network.blobSinkUrl" . }} diff --git a/spartan/aztec-network/templates/setup-l2-contracts.yaml b/spartan/aztec-network/templates/setup-l2-contracts.yaml index 56bf8c89ef36..15e2513bf213 100644 --- a/spartan/aztec-network/templates/setup-l2-contracts.yaml +++ b/spartan/aztec-network/templates/setup-l2-contracts.yaml @@ -65,7 +65,22 @@ spec: done echo "PXE service is ready!" set -e - LOG_LEVEL=debug node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js setup-protocol-contracts --skipProofWait + export LOG_LEVEL=debug + + TEST_ACCOUNTS=${TEST_ACCOUNTS:-false} + TEST_ACCOUNTS_ARG="" + if [ "$TEST_ACCOUNTS" = "true" ]; then + TEST_ACCOUNTS_ARG="--testAccounts" + fi + + SPONSORED_FPC=${SPONSORED_FPC:-false} + SPONSORED_FPC_ARG="" + if [ "$SPONSORED_FPC" = "true" ]; then + SPONSORED_FPC_ARG="--sponsoredFPC" + fi + + node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js setup-protocol-contracts --skipProofWait $TEST_ACCOUNTS_ARG $SPONSORED_FPC_ARG + echo "L2 contracts initialized" env: - name: K8S_POD_UID @@ -80,6 +95,10 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace + - name: TEST_ACCOUNTS + value: "{{ .Values.aztec.testAccounts }}" + - name: SPONSORED_FPC + value: "{{ .Values.aztec.sponsoredFPC }}" - name: TELEMETRY value: "{{ .Values.telemetry.enabled }}" - name: LOG_LEVEL diff --git a/spartan/aztec-network/templates/validator.yaml b/spartan/aztec-network/templates/validator.yaml index 2989643a9313..6c1136cc6b48 100644 --- a/spartan/aztec-network/templates/validator.yaml +++ b/spartan/aztec-network/templates/validator.yaml @@ -187,6 +187,8 @@ spec: value: "{{ .Values.telemetry.excludeMetrics }}" - name: TEST_ACCOUNTS value: "{{ .Values.aztec.testAccounts }}" + - name: SPONSORED_FPC + value: "{{ .Values.aztec.sponsoredFPC }}" - name: P2P_BOOTSTRAP_NODES_AS_FULL_PEERS value: "{{ .Values.network.p2pBootstrapNodesAsFullPeers }}" {{- if .Values.blobSink.enabled }} diff --git a/spartan/aztec-network/values.yaml b/spartan/aztec-network/values.yaml index f79743ac5d73..30676220b10f 100644 --- a/spartan/aztec-network/values.yaml +++ b/spartan/aztec-network/values.yaml @@ -51,6 +51,8 @@ aztec: contracts: registryAddress: "" slashFactoryAddress: "" + rollupAddress: "" # only needed for blob sink + feeAssetHandlerContractAddress: "" slotDuration: 36 # in seconds, aka L2 slot duration. Must be a multiple of {{ ethereum.blockTime }} epochDuration: 32 # how many L2 slots in an epoch @@ -59,6 +61,7 @@ aztec: l1Salt: "" # leave empty for random salt testAccounts: true + sponsoredFPC: false l1DeploymentMnemonic: "test test test test test test test test test test test junk" # the mnemonic used when deploying contracts manaTarget: "" # use default value diff --git a/spartan/aztec-network/values/alpha-testnet.yaml b/spartan/aztec-network/values/alpha-testnet.yaml new file mode 100644 index 000000000000..90c422ad40bd --- /dev/null +++ b/spartan/aztec-network/values/alpha-testnet.yaml @@ -0,0 +1,88 @@ +telemetry: + enabled: true + +aztec: + realProofs: true + numberOfDefaultAccounts: 0 + testAccounts: true + sponsoredFPC: false + bootstrapENRs: "enr:-LO4QLbJddVpePYjaiCftOBY-L7O6Mfj_43TAn5Q1Y-5qQ_OWmSFc7bTKWHzw5xmdVIqXUiizum_kIRniXdPnWHHcwEEhWF6dGVjqDAwLTExMTU1MTExLTAwMDAwMDAwLTAtMTgwNmEwMjgtMWE1MzBmM2KCaWSCdjSCaXCEI8nh9YlzZWNwMjU2azGhA-_dX6aFcXP1DLk91negbXL2a0mNYGXH4hrMvb2i92I0g3VkcIKd0A,enr:-LO4QN4WF8kFyV3sQVX0C_y_03Eepxk5Wac70l9QJcIDRYwKS6aRst1YcfbTDdvovXdRfKf-WSXNVWViGLhDA-dUz2MEhWF6dGVjqDAwLTExMTU1MTExLTAwMDAwMDAwLTAtMTgwNmEwMjgtMWE1MzBmM2KCaWSCdjSCaXCEIicTHolzZWNwMjU2azGhAsz7aFFYRnP5xjTux5UW-HyEQcW_EJrZMT1CNm79N4g-g3VkcIKd0A,enr:-LO4QFrGfkRaCk_iFTeUjR5ESwo45Eov9hx_T1-BLdoT-iHzFgCiHMT4V1KBtdFp8D0ajLSe5HcNYrhalmdJXgv6NTUEhWF6dGVjqDAwLTExMTU1MTExLTAwMDAwMDAwLTAtMTgwNmEwMjgtMWE1MzBmM2KCaWSCdjSCaXCEIlICt4lzZWNwMjU2azGhAlC6nKB3iDtRFqWKWqxf_t-P9hc-SZ6VFBJV4y3bTZBQg3VkcIKd0A" + contracts: + registryAddress: "0xad85d55a4bbef35e95396191c22903aa717edf1c" + rollupAddress: "0x8e9152bb1b0577ea82508c001785e92fc96035fd" + slashFactoryAddress: "0xf667f50fd68b30c38b12d29fee537fa5ea158eb8" + feeAssetHandlerContractAddress: "0xf0664fec6ac15313e18d5ad8225e46b7c6463338" + +network: + public: true + setupL2Contracts: false + p2pBootstrapNodesAsFullPeers: false + +blobSink: + enabled: true + dataStoreConfig: + dataDir: "/data" + storageSize: "128Gi" + dataStoreMapSize: "134217728" # 128 GB + +bot: + enabled: false + +pxe: + enabled: false + +faucet: + enabled: false + +bootNode: + enabled: false + # unused. + externalHost: "http://localhost:8080" + +proverNode: + l1FixedPriorityFeePerGas: 3 + l1GasLimitBufferPercentage: 15 + l1GasPriceMax: 1000 + maxOldSpaceSize: "8192" + storageSize: "512Gi" + resources: + requests: + cpu: "3" + memory: "10Gi" + +validator: + replicas: 3 + l1FixedPriorityFeePerGas: 3 + l1GasLimitBufferPercentage: 15 + l1GasPriceMax: 1000 + storageSize: "512Gi" + sequencer: + minTxsPerBlock: 0 + maxTxsPerBlock: 4 + validator: + disabled: false + maxOldSpaceSize: "8192" + resources: + requests: + cpu: "3" + memory: "10Gi" + +proverAgent: + replicas: 32 + bb: + hardwareConcurrency: 31 + gke: + spotEnabled: true + resources: + requests: + memory: "116Gi" + cpu: "31" + +ethereum: + chainId: "11155111" + l1GasPriceMax: 1000 + l1FixedPriorityFeePerGas: 3 + +jobs: + deployL1Verifier: + enable: false diff --git a/spartan/aztec-network/values/rc-1.yaml b/spartan/aztec-network/values/rc-1.yaml index b0ab27a1ec72..57b0ce89ae1e 100644 --- a/spartan/aztec-network/values/rc-1.yaml +++ b/spartan/aztec-network/values/rc-1.yaml @@ -6,6 +6,8 @@ aztec: epochDuration: 32 proofSubmissionWindow: 64 realProofs: true + testAccounts: true + sponsoredFPC: true images: aztec: diff --git a/spartan/scripts/prepare_sepolia_accounts.sh b/spartan/scripts/prepare_sepolia_accounts.sh index bc1ee1fde5c3..8bcf5a905c7a 100755 --- a/spartan/scripts/prepare_sepolia_accounts.sh +++ b/spartan/scripts/prepare_sepolia_accounts.sh @@ -25,6 +25,26 @@ eth_amount=${2:-"1"} output_file=${3:-"mnemonic.tmp"} XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-"$HOME/.config"} +# Install bc if needed +if ! command -v bc &>/dev/null; then + echo "Installing bc..." + apt-get update && apt-get install -y bc +fi + +# Install cast if needed +if ! command -v cast &>/dev/null; then + echo "Installing cast..." + curl -L https://foundry.paradigm.xyz | bash + $HOME/.foundry/bin/foundryup && export PATH="$PATH:$HOME/.foundry/bin" || $XDG_CONFIG_HOME/.foundry/bin/foundryup && export PATH="$PATH:$XDG_CONFIG_HOME/.foundry/bin" +fi + +# Install yq if needed +if ! command -v yq &>/dev/null; then + echo "Installing yq..." + wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/local/bin/yq + chmod +x /usr/local/bin/yq +fi + # Convert ETH to wei wei_amount=$(cast to-wei "$eth_amount" ether) @@ -59,25 +79,7 @@ max_index=$((max_index > bot_max_index ? max_index : bot_max_index)) # Total number of accounts needed total_accounts=$((num_validators + num_provers + num_bots)) -# Install bc if needed -if ! command -v bc &>/dev/null; then - echo "Installing bc..." - apt-get update && apt-get install -y bc -fi -# Install cast if needed -if ! command -v cast &>/dev/null; then - echo "Installing cast..." - curl -L https://foundry.paradigm.xyz | bash - $HOME/.foundry/bin/foundryup && export PATH="$PATH:$HOME/.foundry/bin" || $XDG_CONFIG_HOME/.foundry/bin/foundryup && export PATH="$PATH:$XDG_CONFIG_HOME/.foundry/bin" -fi - -# Install yq if needed -if ! command -v yq &>/dev/null; then - echo "Installing yq..." - wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/local/bin/yq - chmod +x /usr/local/bin/yq -fi # Create a new mnemonic echo "Creating mnemonic..." diff --git a/spartan/terraform/gke-cluster/cluster/main.tf b/spartan/terraform/gke-cluster/cluster/main.tf index 72ff2f978ceb..bfd2d8034bb7 100644 --- a/spartan/terraform/gke-cluster/cluster/main.tf +++ b/spartan/terraform/gke-cluster/cluster/main.tf @@ -25,6 +25,15 @@ resource "google_container_cluster" "primary" { issue_client_certificate = false } } + + resource_usage_export_config { + enable_network_egress_metering = true + enable_resource_consumption_metering = true + + bigquery_destination { + dataset_id = "egress_consumption" + } + } } # Create 2 core node pool with local ssd @@ -103,6 +112,42 @@ resource "google_container_node_pool" "aztec_nodes-2core" { } } +# Create 4 core node pool no ssd +resource "google_container_node_pool" "aztec_nodes-4core" { + name = "${var.cluster_name}-4core" + location = var.zone + cluster = var.cluster_name + version = var.node_version + # Enable autoscaling + autoscaling { + min_node_count = 0 + max_node_count = 16 + } + + # Node configuration + node_config { + machine_type = "t2d-standard-4" + + service_account = var.service_account + oauth_scopes = [ + "https://www.googleapis.com/auth/cloud-platform" + ] + + labels = { + env = "production" + local-ssd = "false" + node-type = "network" + } + tags = ["aztec-gke-node", "aztec"] + } + + # Management configuration + management { + auto_repair = true + auto_upgrade = false + } +} + # Create spot instance node pool with autoscaling resource "google_container_node_pool" "spot_nodes_32core" { name = "${var.cluster_name}-32core-spot" diff --git a/spartan/terraform/gke-cluster/main.tf b/spartan/terraform/gke-cluster/main.tf index 7baca828d340..6ea8919414eb 100644 --- a/spartan/terraform/gke-cluster/main.tf +++ b/spartan/terraform/gke-cluster/main.tf @@ -1,8 +1,7 @@ terraform { - backend "s3" { + backend "gcs" { bucket = "aztec-terraform" - key = "aztec-gke-cluster/terraform.tfstate" - region = "eu-west-2" + prefix = "terraform/state/gke-cluster" } required_providers { google = { diff --git a/yarn-project/aztec-node/src/aztec-node/config.ts b/yarn-project/aztec-node/src/aztec-node/config.ts index f630b941e599..58729cbc0e82 100644 --- a/yarn-project/aztec-node/src/aztec-node/config.ts +++ b/yarn-project/aztec-node/src/aztec-node/config.ts @@ -29,6 +29,8 @@ export type AztecNodeConfig = ArchiverConfig & 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; }; @@ -55,6 +57,11 @@ export const aztecNodeConfigMappings: ConfigMappingsType = { 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.js/src/contract/proven_tx.ts b/yarn-project/aztec.js/src/contract/proven_tx.ts index 5f3fd5196fa5..43763834daa7 100644 --- a/yarn-project/aztec.js/src/contract/proven_tx.ts +++ b/yarn-project/aztec.js/src/contract/proven_tx.ts @@ -11,12 +11,17 @@ export class ProvenTx extends Tx { super(tx.data, tx.clientIvcProof, tx.contractClassLogs, tx.publicFunctionCalldata); } + // Clone the TX data to get a serializable object. + protected getPlainDataTx(): Tx { + return new Tx(this.data, this.clientIvcProof, this.contractClassLogs, this.publicFunctionCalldata); + } + /** * Sends the transaction to the network via the provided wallet. */ public send(): SentTx { const promise = (() => { - return this.wallet.sendTx(this); + return this.wallet.sendTx(this.getPlainDataTx()); })(); return new SentTx(this.wallet, promise); diff --git a/yarn-project/aztec/src/cli/chain_l2_config.ts b/yarn-project/aztec/src/cli/chain_l2_config.ts index 233efb871c30..bb7ca1fba3c5 100644 --- a/yarn-project/aztec/src/cli/chain_l2_config.ts +++ b/yarn-project/aztec/src/cli/chain_l2_config.ts @@ -11,9 +11,12 @@ export type L2ChainConfig = { aztecEpochDuration: number; aztecProofSubmissionWindow: number; testAccounts: boolean; + sponsoredFPC: boolean; p2pEnabled: boolean; p2pBootstrapNodes: string[]; registryAddress: string; + slashFactoryAddress: string; + feeAssetHandlerAddress: string; seqMinTxsPerBlock: number; seqMaxTxsPerBlock: number; realProofs: boolean; @@ -26,9 +29,12 @@ export const testnetIgnitionL2ChainConfig: L2ChainConfig = { aztecEpochDuration: 32, aztecProofSubmissionWindow: 64, testAccounts: true, + sponsoredFPC: false, p2pEnabled: true, p2pBootstrapNodes: [], registryAddress: '0x12b3ebc176a1646b911391eab3760764f2e05fe3', + slashFactoryAddress: '', + feeAssetHandlerAddress: '', seqMinTxsPerBlock: 0, seqMaxTxsPerBlock: 0, realProofs: true, @@ -40,10 +46,13 @@ export const alphaTestnetL2ChainConfig: L2ChainConfig = { aztecSlotDuration: 36, aztecEpochDuration: 32, aztecProofSubmissionWindow: 64, - testAccounts: false, + testAccounts: true, + sponsoredFPC: true, p2pEnabled: true, p2pBootstrapNodes: [], - registryAddress: '', // To be updated + registryAddress: '0xad85d55a4bbef35e95396191c22903aa717edf1c', + slashFactoryAddress: '0xf667f50fd68b30c38b12d29fee537fa5ea158eb8', + feeAssetHandlerAddress: '0xf0664fec6ac15313e18d5ad8225e46b7c6463338', seqMinTxsPerBlock: 0, seqMaxTxsPerBlock: 4, realProofs: true, @@ -94,9 +103,12 @@ export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames enrichVar('AZTEC_PROOF_SUBMISSION_WINDOW', config.aztecProofSubmissionWindow.toString()); enrichVar('BOOTSTRAP_NODES', config.p2pBootstrapNodes.join(',')); enrichVar('TEST_ACCOUNTS', config.testAccounts.toString()); + enrichVar('SPONSORED_FPC', config.sponsoredFPC.toString()); enrichVar('P2P_ENABLED', config.p2pEnabled.toString()); enrichVar('L1_CHAIN_ID', config.l1ChainId.toString()); enrichVar('REGISTRY_CONTRACT_ADDRESS', config.registryAddress); + enrichVar('SLASH_FACTORY_CONTRACT_ADDRESS', config.slashFactoryAddress); + enrichVar('FEE_ASSET_HANDLER_CONTRACT_ADDRESS', config.feeAssetHandlerAddress); enrichVar('SEQ_MIN_TX_PER_BLOCK', config.seqMinTxsPerBlock.toString()); enrichVar('SEQ_MAX_TX_PER_BLOCK', config.seqMaxTxsPerBlock.toString()); enrichVar('DATA_DIRECTORY', path.join(process.env.HOME || '~', '.aztec', networkName, 'data')); diff --git a/yarn-project/aztec/src/cli/cmds/start_node.ts b/yarn-project/aztec/src/cli/cmds/start_node.ts index 9923c361ad05..154ac35f6f5d 100644 --- a/yarn-project/aztec/src/cli/cmds/start_node.ts +++ b/yarn-project/aztec/src/cli/cmds/start_node.ts @@ -1,5 +1,6 @@ import { getInitialTestAccounts } from '@aztec/accounts/testing'; import { type AztecNodeConfig, aztecNodeConfigMappings, getConfigEnvVars } from '@aztec/aztec-node'; +import { getSponsoredFPCAddress } from '@aztec/cli/cli-utils'; import { NULL_KEY } from '@aztec/ethereum'; import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server'; import type { LogFn } from '@aztec/foundation/log'; @@ -47,10 +48,16 @@ export async function startNode( await preloadCrsDataForVerifying(nodeConfig, userLog); - const initialFundedAccounts = nodeConfig.testAccounts ? await getInitialTestAccounts() : []; - const { genesisBlockHash, genesisArchiveRoot, prefilledPublicData } = await getGenesisValues( - initialFundedAccounts.map(a => a.address), - ); + const testAccounts = nodeConfig.testAccounts ? (await getInitialTestAccounts()).map(a => a.address) : []; + const sponsoredFPCAccounts = nodeConfig.sponsoredFPC ? [await getSponsoredFPCAddress()] : []; + const initialFundedAccounts = testAccounts.concat(sponsoredFPCAccounts); + + userLog(`Initial funded accounts: ${initialFundedAccounts.map(a => a.toString()).join(', ')}`); + + const { genesisBlockHash, genesisArchiveRoot, prefilledPublicData } = await getGenesisValues(initialFundedAccounts); + + userLog(`Genesis block hash: ${genesisBlockHash.toString()}`); + userLog(`Genesis archive root: ${genesisArchiveRoot.toString()}`); // Deploy contracts if needed if (nodeSpecificOptions.deployAztecContracts || nodeSpecificOptions.deployAztecContractsSalt) { diff --git a/yarn-project/aztec/src/cli/cmds/start_p2p_bootstrap.ts b/yarn-project/aztec/src/cli/cmds/start_p2p_bootstrap.ts index 8c51fc454d86..a943e27ee51b 100644 --- a/yarn-project/aztec/src/cli/cmds/start_p2p_bootstrap.ts +++ b/yarn-project/aztec/src/cli/cmds/start_p2p_bootstrap.ts @@ -17,7 +17,8 @@ export async function startP2PBootstrap( ) { // Start a P2P bootstrap node. const config = extractRelevantOptions(options, bootnodeConfigMappings, 'p2p'); - userLog(`Starting P2P bootstrap node with config: ${jsonStringify(config)}`); + const safeConfig = { ...config, peerIdPrivateKey: '' }; + userLog(`Starting P2P bootstrap node with config: ${jsonStringify(safeConfig)}`); const telemetryClient = initTelemetryClient(getTelemetryClientConfig()); const store = await createStore('p2p-bootstrap', 1, config, createLogger('p2p:bootstrap:store')); const node = new BootstrapNode(store, telemetryClient); diff --git a/yarn-project/aztec/src/cli/cmds/start_prover_node.ts b/yarn-project/aztec/src/cli/cmds/start_prover_node.ts index ca92cbbdee0d..659ce4ab29c9 100644 --- a/yarn-project/aztec/src/cli/cmds/start_prover_node.ts +++ b/yarn-project/aztec/src/cli/cmds/start_prover_node.ts @@ -1,4 +1,5 @@ import { getInitialTestAccounts } from '@aztec/accounts/testing'; +import { getSponsoredFPCAddress } from '@aztec/cli/cli-utils'; import { NULL_KEY } from '@aztec/ethereum'; import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server'; import { Agent, makeUndiciFetch } from '@aztec/foundation/json-rpc/undici'; @@ -101,8 +102,15 @@ export async function startProverNode( await preloadCrsDataForVerifying(proverConfig, userLog); - const initialFundedAccounts = proverConfig.testAccounts ? await getInitialTestAccounts() : []; - const { prefilledPublicData } = await getGenesisValues(initialFundedAccounts.map(a => a.address)); + const testAccounts = proverConfig.testAccounts ? (await getInitialTestAccounts()).map(a => a.address) : []; + const sponsoredFPCAccounts = proverConfig.sponsoredFPC ? [await getSponsoredFPCAddress()] : []; + const initialFundedAccounts = testAccounts.concat(sponsoredFPCAccounts); + + userLog(`Initial funded accounts: ${initialFundedAccounts.map(a => a.toString()).join(', ')}`); + const { genesisArchiveRoot, genesisBlockHash, prefilledPublicData } = await getGenesisValues(initialFundedAccounts); + + userLog(`Genesis block hash: ${genesisBlockHash.toString()}`); + userLog(`Genesis archive root: ${genesisArchiveRoot.toString()}`); const proverNode = await createProverNode(proverConfig, { telemetry, broker }, { prefilledPublicData }); services.proverNode = [proverNode, ProverNodeApiSchema]; diff --git a/yarn-project/cli/src/cmds/l1/index.ts b/yarn-project/cli/src/cmds/l1/index.ts index 6aae5d1fcca3..b792415807d4 100644 --- a/yarn-project/cli/src/cmds/l1/index.ts +++ b/yarn-project/cli/src/cmds/l1/index.ts @@ -57,7 +57,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger options.mnemonicIndex, options.salt, options.testAccounts, - options.sponsoredFPC, + options.sponsoredFpc, options.acceleratedTestDeployments, options.json, initialValidators, diff --git a/yarn-project/foundation/src/config/env_var.ts b/yarn-project/foundation/src/config/env_var.ts index 32ec18b1497e..0938c513bb44 100644 --- a/yarn-project/foundation/src/config/env_var.ts +++ b/yarn-project/foundation/src/config/env_var.ts @@ -165,6 +165,7 @@ export type EnvVar = | 'REWARD_DISTRIBUTOR_CONTRACT_ADDRESS' | 'TELEMETRY' | 'TEST_ACCOUNTS' + | 'SPONSORED_FPC' | 'TX_GOSSIP_VERSION' | 'TXE_PORT' | 'VALIDATOR_ATTESTATIONS_POLLING_INTERVAL_MS' diff --git a/yarn-project/p2p/src/config.ts b/yarn-project/p2p/src/config.ts index b4f3f91bd033..ce45457b02d1 100644 --- a/yarn-project/p2p/src/config.ts +++ b/yarn-project/p2p/src/config.ts @@ -371,6 +371,7 @@ export type BootnodeConfig = Pick< const bootnodeConfigKeys: (keyof BootnodeConfig)[] = [ 'p2pIp', 'p2pPort', + 'listenAddress', 'peerIdPrivateKey', 'dataDirectory', 'dataStoreMapSizeKB', diff --git a/yarn-project/prover-node/src/config.ts b/yarn-project/prover-node/src/config.ts index c4680d31748f..924f603d81bb 100644 --- a/yarn-project/prover-node/src/config.ts +++ b/yarn-project/prover-node/src/config.ts @@ -36,6 +36,8 @@ export type ProverNodeConfig = ArchiverConfig & 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; }; type SpecificProverNodeConfig = { @@ -95,6 +97,11 @@ export const proverNodeConfigMappings: ConfigMappingsType = { 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 getProverNodeConfigFromEnv(): ProverNodeConfig {