diff --git a/.github/workflows/fund-sepolia-accounts.yml b/.github/workflows/fund-sepolia-accounts.yml index 27bbd3cd19a2..a77e296913b0 100644 --- a/.github/workflows/fund-sepolia-accounts.yml +++ b/.github/workflows/fund-sepolia-accounts.yml @@ -12,6 +12,37 @@ on: required: true type: string default: sepolia-accounts-mnemonic + ref: + description: The branch or tag to checkout + required: false + type: string + default: master + secrets: + GCP_SA_KEY: + required: true + SEPOLIA_FUNDING_PRIVATE_KEY: + required: true + GCP_SEPOLIA_URL: + required: true + GCP_SEPOLIA_API_KEY: + required: true + + workflow_dispatch: + inputs: + values_file: + description: The values file to use, e.g. 1-validators.yaml + required: true + type: string + sepolia_accounts_mnemonic_secret_name: + description: The name of the secret which holds the sepolia accounts mnemonic. Will create a new one if it doesn't exist. + required: true + type: string + default: sepolia-accounts-mnemonic + ref: + description: The branch or tag to checkout + required: false + type: string + default: master jobs: fund-sepolia-accounts: @@ -20,7 +51,7 @@ jobs: - name: Checkout code uses: actions/checkout@v4 with: - ref: ${{ github.ref }} + ref: ${{ inputs.ref || github.ref || 'master' }} - name: Authenticate to Google Cloud uses: google-github-actions/auth@v2 @@ -30,14 +61,6 @@ jobs: - name: Set up Cloud SDK uses: google-github-actions/setup-gcloud@v2 - - name: Install cast - run: | - if ! command -v cast &>/dev/null; then - echo "Installing cast..." - curl -L https://foundry.paradigm.xyz | bash - $HOME/.foundry/bin/foundryup - fi - - name: Get mnemonic id: get-mnemonic run: | @@ -66,7 +89,7 @@ jobs: export ETHEREUM_HOST="https://json-rpc.${{ secrets.GCP_SEPOLIA_URL }}?key=${{ secrets.GCP_SEPOLIA_API_KEY }}" echo "Funding accounts..." - $REPO/spartan/scripts/fund_sepolia_accounts.sh ${{ inputs.values_file }} "$MNEMONIC_FILE" + $REPO/spartan/scripts/prepare_sepolia_accounts.sh ${{ inputs.values_file }} 30 "$MNEMONIC_FILE" mnemonic=$(cat "$MNEMONIC_FILE") rm "$MNEMONIC_FILE" echo "::add-mask::$mnemonic" @@ -76,5 +99,11 @@ jobs: if: ${{ steps.get-mnemonic.outputs.new_mnemonic == 'true' }} run: | echo "Saving mnemonic to GCP" - echo "::add-mask::${{ steps.get-mnemonic.outputs.mnemonic }}" - gcloud secrets versions add latest --secret=${{ inputs.sepolia_accounts_mnemonic_secret_name }} --data-file="$MNEMONIC_FILE" + echo "::add-mask::${{ steps.fund-accounts.outputs.mnemonic }}" + echo "Creating new secret ${{ inputs.sepolia_accounts_mnemonic_secret_name }}" + gcloud secrets create ${{ inputs.sepolia_accounts_mnemonic_secret_name }} + TMP_FILE=$(mktemp) + echo "${{ steps.fund-accounts.outputs.mnemonic }}" > "$TMP_FILE" + gcloud secrets versions add ${{ inputs.sepolia_accounts_mnemonic_secret_name }} --data-file="$TMP_FILE" + rm "$TMP_FILE" + echo "Saved mnemonic to GCP secret ${{ inputs.sepolia_accounts_mnemonic_secret_name }}" diff --git a/.github/workflows/network-deploy.yml b/.github/workflows/network-deploy.yml index 50c39de3b45a..cd72b314115b 100644 --- a/.github/workflows/network-deploy.yml +++ b/.github/workflows/network-deploy.yml @@ -91,13 +91,26 @@ on: type: string default: "false" sepolia_accounts_mnemonic_secret_name: - description: The name of the secret which holds the sepolia accounts mnemonic + description: The name of the secret which holds the sepolia accounts mnemonic (if not provided, will use '{namespace}-accounts-mnemonic'). required: false type: string - default: sepolia-accounts-mnemonic jobs: + fund_sepolia_accounts: + if: ${{ inputs.sepolia_deployment == 'true' }} + uses: ./.github/workflows/fund-sepolia-accounts.yml + with: + values_file: ${{ inputs.values_file }} + sepolia_accounts_mnemonic_secret_name: ${{ inputs.sepolia_accounts_mnemonic_secret_name || format('{0}-accounts-mnemonic', inputs.namespace) }} + ref: ${{ inputs.ref || github.ref || 'master' }} + secrets: + GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }} + SEPOLIA_FUNDING_PRIVATE_KEY: ${{ secrets.SEPOLIA_FUNDING_PRIVATE_KEY }} + GCP_SEPOLIA_URL: ${{ secrets.GCP_SEPOLIA_URL }} + GCP_SEPOLIA_API_KEY: ${{ secrets.GCP_SEPOLIA_API_KEY }} + network_deployment: + needs: fund_sepolia_accounts # This job will run on Ubuntu runs-on: ubuntu-latest concurrency: @@ -129,6 +142,13 @@ jobs: with: ref: ${{ inputs.ref || github.ref }} + - name: Check values + run: | + echo "inputs.ref: ${{ inputs.ref }}" + echo "github.ref: ${{ github.ref }}" + ls -la .github/workflows/ + ls -la .github/workflows/fund-sepolia-accounts.yml + - name: Authenticate to Google Cloud uses: google-github-actions/auth@v2 with: @@ -172,28 +192,6 @@ jobs: $REPO/spartan/scripts/generate_devnet_config.sh ${{ env.VALUES_FILE }} - - name: Fund sepolia accounts - uses: ./.github/workflows/fund-sepolia-accounts.yml - if: ${{ inputs.sepolia_deployment == 'true' }} - with: - values_file: ${{ env.VALUES_FILE }} - sepolia_accounts_mnemonic_secret_name: ${{ inputs.sepolia_accounts_mnemonic_secret_name }} - - - name: Generate sepolia accounts - id: generate-sepolia-accounts - if: ${{ inputs.sepolia_deployment == 'true' }} - run: | - REPO=$(git rev-parse --show-toplevel) - export FUNDING_PRIVATE_KEY=${{ secrets.SEPOLIA_FUNDING_PRIVATE_KEY }} - export ETHEREUM_HOST="https://json-rpc.${{ secrets.GCP_SEPOLIA_URL }}?key=${{ secrets.GCP_SEPOLIA_API_KEY }}" - echo "Preparing sepolia accounts..." - MNEMONIC_FILE=$(mktemp) - $REPO/spartan/scripts/prepare_sepolia_accounts.sh ${{ env.VALUES_FILE }} 30 "$MNEMONIC_FILE" - mnemonic=$(cat "$MNEMONIC_FILE") - rm "$MNEMONIC_FILE" - echo "::add-mask::$mnemonic" - echo "mnemonic=$mnemonic" >> "$GITHUB_OUTPUT" - - name: Setup Terraform uses: hashicorp/setup-terraform@v2 with: @@ -213,6 +211,11 @@ jobs: continue-on-error: true run: | if ${{ inputs.sepolia_deployment == 'true' }}; then + if [ -z "${{ inputs.sepolia_accounts_mnemonic_secret_name }}" ]; then + SECRET_NAME="${{ env.NAMESPACE }}-accounts-mnemonic" + else + SECRET_NAME="${{ inputs.sepolia_accounts_mnemonic_secret_name }}" + fi L1_DEPLOYMENT_MNEMONIC=$(gcloud secrets versions access latest --secret=${{ inputs.sepolia_accounts_mnemonic_secret_name }}) terraform destroy -auto-approve \ -var="RELEASE_NAME=${{ env.NAMESPACE }}" \ @@ -244,7 +247,12 @@ jobs: working-directory: ./spartan/terraform/deploy-release run: | if ${{ inputs.sepolia_deployment == 'true' }}; then - L1_DEPLOYMENT_MNEMONIC=$(gcloud secrets versions access latest --secret=${{ inputs.sepolia_accounts_mnemonic_secret_name }}) + if [ -z "${{ inputs.sepolia_accounts_mnemonic_secret_name }}" ]; then + SECRET_NAME="${{ env.NAMESPACE }}-accounts-mnemonic" + else + SECRET_NAME="${{ inputs.sepolia_accounts_mnemonic_secret_name }}" + fi + L1_DEPLOYMENT_MNEMONIC=$(gcloud secrets versions access latest --secret=$SECRET_NAME) terraform plan \ -var="RELEASE_NAME=${{ env.NAMESPACE }}" \ -var="VALUES_FILE=${{ env.VALUES_FILE }}" \ diff --git a/spartan/aztec-network/values/alpha-testnet-provers.yaml b/spartan/aztec-network/values/alpha-testnet-provers.yaml new file mode 100644 index 000000000000..450b4c627df6 --- /dev/null +++ b/spartan/aztec-network/values/alpha-testnet-provers.yaml @@ -0,0 +1,91 @@ +telemetry: + enabled: true + +snapshots: + uploadLocation: "gs://aztec-testnet/snapshots/" + syncUrl: "https://storage.googleapis.com/aztec-testnet/snapshots/" + frequency: "0 0 * * *" # daily uploads at midnight + +aztec: + realProofs: true + numberOfDefaultAccounts: 0 + testAccounts: false + sponsoredFPC: true + 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: "0x4d2cc1d5fb6be65240e0bfc8154243e69c0fb19e" + rollupAddress: "0xee6d4e937f0493fb461f28a75cf591f1dba8704e" + slashFactoryAddress: "0x3c9ccf55a8ac3c2eeedf2ee2aa1722188fd676be" + feeAssetHandlerContractAddress: "0x80d848dc9f52df56789e2d62ce66f19555ff1019" + +network: + public: true + p2pBootstrapNodesAsFullPeers: false + +blobSink: + enabled: false + archiveApiUrl: "https://api.sepolia.blobscan.com" + dataStoreConfig: + dataDir: "/data" + storageSize: "128Gi" + dataStoreMapSize: "134217728" # 128 GB + +bot: + enabled: false + +pxe: + enabled: false + +faucet: + enabled: false + +bootNode: + enabled: false + replicas: 0 + # unused. + externalHost: "http://localhost:8080" + +fullNode: + enabled: false + replicas: 0 + # unused + externalHost: "http://localhost:8080" + +proverNode: + replicas: 1 + l1FixedPriorityFeePerGas: 3 + l1GasLimitBufferPercentage: 15 + l1GasPriceMax: 1000 + failedEpochStore: "gs://aztec-testnet/failed-epochs/" + maxOldSpaceSize: "8192" + storageSize: "512Gi" + resources: + requests: + cpu: "3" + memory: "10Gi" + +validator: + replicas: 0 + +proverBroker: + storageSize: "10Gi" + +proverAgent: + replicas: 15 + 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/scripts/prepare_sepolia_accounts.sh b/spartan/scripts/prepare_sepolia_accounts.sh index 8f5759e6473a..42504fc4cc5b 100755 --- a/spartan/scripts/prepare_sepolia_accounts.sh +++ b/spartan/scripts/prepare_sepolia_accounts.sh @@ -57,6 +57,10 @@ if ! command -v yq &>/dev/null; then fi # Convert ETH to wei +if [[ ! "$eth_amount" =~ ^[0-9]+(\.[0-9]+)?$ ]]; then + echo "Error: Invalid ETH amount: $eth_amount" + exit 1 +fi wei_amount=$(cast to-wei "$eth_amount" ether) value_yamls="../aztec-network/values/$values_file ../aztec-network/values.yaml" @@ -91,7 +95,7 @@ max_index=$((max_index > bot_max_index ? max_index : bot_max_index)) total_accounts=$((num_validators + num_provers + num_bots)) # Check if mnemonic is provided -if [ -z "$MNEMONIC" ]; then +if [ "${MNEMONIC:-}" = "" ]; then # Create a new mnemonic echo "Creating mnemonic..." cast wallet new-mnemonic --json >"$tmp_filename"