From 8ab45a7c61bfc8a90af427721e346250e45bfe46 Mon Sep 17 00:00:00 2001 From: spypsy Date: Fri, 23 May 2025 13:56:41 +0000 Subject: [PATCH 01/13] try fix fund action --- .github/workflows/fund-sepolia-accounts.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/fund-sepolia-accounts.yml b/.github/workflows/fund-sepolia-accounts.yml index 27bbd3cd19a2..49c345773096 100644 --- a/.github/workflows/fund-sepolia-accounts.yml +++ b/.github/workflows/fund-sepolia-accounts.yml @@ -12,6 +12,11 @@ on: 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 +25,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 From a95169dd763e8d96e81ce94d325a57ec1d046f69 Mon Sep 17 00:00:00 2001 From: spypsy Date: Fri, 23 May 2025 13:59:54 +0000 Subject: [PATCH 02/13] fix script name --- .github/workflows/fund-sepolia-accounts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/fund-sepolia-accounts.yml b/.github/workflows/fund-sepolia-accounts.yml index 49c345773096..282961899456 100644 --- a/.github/workflows/fund-sepolia-accounts.yml +++ b/.github/workflows/fund-sepolia-accounts.yml @@ -71,7 +71,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 }} "$MNEMONIC_FILE" mnemonic=$(cat "$MNEMONIC_FILE") rm "$MNEMONIC_FILE" echo "::add-mask::$mnemonic" From 7d146f5ee36a8853919c59ad38b95d45b9aadb91 Mon Sep 17 00:00:00 2001 From: spypsy Date: Fri, 23 May 2025 14:05:38 +0000 Subject: [PATCH 03/13] try project path --- .github/workflows/network-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/network-deploy.yml b/.github/workflows/network-deploy.yml index 50c39de3b45a..98092c1719b8 100644 --- a/.github/workflows/network-deploy.yml +++ b/.github/workflows/network-deploy.yml @@ -173,7 +173,7 @@ jobs: $REPO/spartan/scripts/generate_devnet_config.sh ${{ env.VALUES_FILE }} - name: Fund sepolia accounts - uses: ./.github/workflows/fund-sepolia-accounts.yml + uses: AztecProtocol/aztec-packages/.github/workflows/fund-sepolia-accounts.yml if: ${{ inputs.sepolia_deployment == 'true' }} with: values_file: ${{ env.VALUES_FILE }} From 5810dc2aa6c25951aa6735bb6f4550ae032ee017 Mon Sep 17 00:00:00 2001 From: spypsy Date: Fri, 23 May 2025 14:14:41 +0000 Subject: [PATCH 04/13] debug --- .github/workflows/fund-sepolia-accounts.yml | 16 ++++++++++++++++ .github/workflows/network-deploy.yml | 10 +++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/fund-sepolia-accounts.yml b/.github/workflows/fund-sepolia-accounts.yml index 282961899456..f77b6900f2ba 100644 --- a/.github/workflows/fund-sepolia-accounts.yml +++ b/.github/workflows/fund-sepolia-accounts.yml @@ -17,6 +17,22 @@ on: required: false type: string default: master + 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: diff --git a/.github/workflows/network-deploy.yml b/.github/workflows/network-deploy.yml index 98092c1719b8..c90d7b1d7d11 100644 --- a/.github/workflows/network-deploy.yml +++ b/.github/workflows/network-deploy.yml @@ -128,6 +128,14 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ inputs.ref || github.ref }} + fetch-depth: 0 + + - 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 @@ -173,7 +181,7 @@ jobs: $REPO/spartan/scripts/generate_devnet_config.sh ${{ env.VALUES_FILE }} - name: Fund sepolia accounts - uses: AztecProtocol/aztec-packages/.github/workflows/fund-sepolia-accounts.yml + uses: ./.github/workflows/fund-sepolia-accounts.yml if: ${{ inputs.sepolia_deployment == 'true' }} with: values_file: ${{ env.VALUES_FILE }} From 6c152ff43a6e8c2141ccd41fae80a58926ba290b Mon Sep 17 00:00:00 2001 From: spypsy Date: Fri, 23 May 2025 14:26:22 +0000 Subject: [PATCH 05/13] separate funding job --- .github/workflows/network-deploy.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/network-deploy.yml b/.github/workflows/network-deploy.yml index c90d7b1d7d11..8455d7a6484b 100644 --- a/.github/workflows/network-deploy.yml +++ b/.github/workflows/network-deploy.yml @@ -91,13 +91,21 @@ 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 (required for sepolia deployment) 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 }} + network_deployment: + needs: fund_sepolia_accounts # This job will run on Ubuntu runs-on: ubuntu-latest concurrency: @@ -180,13 +188,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' }} From 9ea9cd9b66395fd5fba3283a428f57e03b8aa1d6 Mon Sep 17 00:00:00 2001 From: spypsy Date: Fri, 23 May 2025 14:26:43 +0000 Subject: [PATCH 06/13] undo depth 0 --- .github/workflows/network-deploy.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/network-deploy.yml b/.github/workflows/network-deploy.yml index 8455d7a6484b..c24f132fcee2 100644 --- a/.github/workflows/network-deploy.yml +++ b/.github/workflows/network-deploy.yml @@ -136,7 +136,6 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ inputs.ref || github.ref }} - fetch-depth: 0 - name: Check values run: | From 320fd4e6ce1a2f1056b71a1afdb02a575b13397a Mon Sep 17 00:00:00 2001 From: spypsy Date: Fri, 23 May 2025 14:30:40 +0000 Subject: [PATCH 07/13] add secrets --- .github/workflows/network-deploy.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/network-deploy.yml b/.github/workflows/network-deploy.yml index c24f132fcee2..38f3d243cb43 100644 --- a/.github/workflows/network-deploy.yml +++ b/.github/workflows/network-deploy.yml @@ -103,6 +103,13 @@ jobs: with: values_file: ${{ inputs.values_file }} sepolia_accounts_mnemonic_secret_name: ${{ inputs.sepolia_accounts_mnemonic_secret_name }} + 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 }} + QUICKNODE_SEPOLIA_URL: ${{ secretsQUICKNODE_SEPOLIA_URL }} network_deployment: needs: fund_sepolia_accounts From 3d85a58a2ddfd38b5bab8603bba5b444e01d9e5a Mon Sep 17 00:00:00 2001 From: spypsy Date: Fri, 23 May 2025 14:32:04 +0000 Subject: [PATCH 08/13] fix typo --- .github/workflows/network-deploy.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/network-deploy.yml b/.github/workflows/network-deploy.yml index 38f3d243cb43..b316a573c15e 100644 --- a/.github/workflows/network-deploy.yml +++ b/.github/workflows/network-deploy.yml @@ -109,7 +109,6 @@ jobs: 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 }} - QUICKNODE_SEPOLIA_URL: ${{ secretsQUICKNODE_SEPOLIA_URL }} network_deployment: needs: fund_sepolia_accounts From 3cd11137c5db3e528892fe50b20ffca871896cc6 Mon Sep 17 00:00:00 2001 From: spypsy Date: Fri, 23 May 2025 14:35:29 +0000 Subject: [PATCH 09/13] add secrets to workflow_call --- .github/workflows/fund-sepolia-accounts.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/fund-sepolia-accounts.yml b/.github/workflows/fund-sepolia-accounts.yml index f77b6900f2ba..1c3aee6c7ed7 100644 --- a/.github/workflows/fund-sepolia-accounts.yml +++ b/.github/workflows/fund-sepolia-accounts.yml @@ -17,6 +17,16 @@ on: 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: From 8f94583651d27b714982b4b228e925c7bf63e17f Mon Sep 17 00:00:00 2001 From: spypsy Date: Fri, 23 May 2025 14:39:30 +0000 Subject: [PATCH 10/13] rm install cast step --- .github/workflows/fund-sepolia-accounts.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/fund-sepolia-accounts.yml b/.github/workflows/fund-sepolia-accounts.yml index 1c3aee6c7ed7..d597235ef504 100644 --- a/.github/workflows/fund-sepolia-accounts.yml +++ b/.github/workflows/fund-sepolia-accounts.yml @@ -61,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: | From fdb7eecfafb100910c46bfd48f5780513798fb06 Mon Sep 17 00:00:00 2001 From: spypsy Date: Fri, 23 May 2025 14:44:56 +0000 Subject: [PATCH 11/13] fix script usage --- .github/workflows/fund-sepolia-accounts.yml | 2 +- .github/workflows/network-deploy.yml | 15 --------------- spartan/scripts/prepare_sepolia_accounts.sh | 4 ++++ 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/.github/workflows/fund-sepolia-accounts.yml b/.github/workflows/fund-sepolia-accounts.yml index d597235ef504..5045274e62c2 100644 --- a/.github/workflows/fund-sepolia-accounts.yml +++ b/.github/workflows/fund-sepolia-accounts.yml @@ -89,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/prepare_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" diff --git a/.github/workflows/network-deploy.yml b/.github/workflows/network-deploy.yml index b316a573c15e..fc9be41bc444 100644 --- a/.github/workflows/network-deploy.yml +++ b/.github/workflows/network-deploy.yml @@ -193,21 +193,6 @@ jobs: $REPO/spartan/scripts/generate_devnet_config.sh ${{ env.VALUES_FILE }} - - 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: diff --git a/spartan/scripts/prepare_sepolia_accounts.sh b/spartan/scripts/prepare_sepolia_accounts.sh index 8f5759e6473a..649a42015168 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" From df2f02a2eb4d54330dce7e93a6bc0e958a01f145 Mon Sep 17 00:00:00 2001 From: spypsy Date: Fri, 23 May 2025 14:48:05 +0000 Subject: [PATCH 12/13] fix mnemonic check --- spartan/scripts/prepare_sepolia_accounts.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spartan/scripts/prepare_sepolia_accounts.sh b/spartan/scripts/prepare_sepolia_accounts.sh index 649a42015168..42504fc4cc5b 100755 --- a/spartan/scripts/prepare_sepolia_accounts.sh +++ b/spartan/scripts/prepare_sepolia_accounts.sh @@ -95,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" From 507eacb7051ef679c6c8893beb18537b6f71482c Mon Sep 17 00:00:00 2001 From: spypsy Date: Fri, 23 May 2025 14:52:50 +0000 Subject: [PATCH 13/13] fix step output --- .github/workflows/fund-sepolia-accounts.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/fund-sepolia-accounts.yml b/.github/workflows/fund-sepolia-accounts.yml index 5045274e62c2..26dee1b278ba 100644 --- a/.github/workflows/fund-sepolia-accounts.yml +++ b/.github/workflows/fund-sepolia-accounts.yml @@ -96,8 +96,8 @@ jobs: echo "mnemonic=$mnemonic" >> "$GITHUB_OUTPUT" - name: Save mnemonic to GCP - if: ${{ steps.get-mnemonic.outputs.new_mnemonic == 'true' }} + if: ${{ steps.fund-accounts.outputs.new_mnemonic == 'true' }} run: | echo "Saving mnemonic to GCP" - echo "::add-mask::${{ steps.get-mnemonic.outputs.mnemonic }}" + echo "::add-mask::${{ steps.fund-accounts.outputs.mnemonic }}" gcloud secrets versions add latest --secret=${{ inputs.sepolia_accounts_mnemonic_secret_name }} --data-file="$MNEMONIC_FILE"