diff --git a/.github/CHECKPOINT_ISSUE_TEMPLATE.md b/.github/CHECKPOINT_ISSUE_TEMPLATE.md deleted file mode 100644 index d1e6732c7973..000000000000 --- a/.github/CHECKPOINT_ISSUE_TEMPLATE.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -title: "cron: update known_blocks.yaml" -labels: ["Type: Task"] ---- - -Forest uses checkpoints to improve performance when loading a snapshot. Without checkpoints, the blockchain has to be fully traversed to verify we have the right genesis block. Checkpoints short-circuit this search and shave off tens of minutes in boot time. - -Checkpoints have to be regularly updated, though, and [this issue](/.github/CHECKPOINT_ISSUE_TEMPLATE.md) is [automatically created once per month](/.github/workflows/checkpoints.yml). Follow the procedure below to update [`build/known_blocks.yaml`](/build/known_blocks.yaml), and close this issue. - -# Procedure - -```bash -#!/bin/bash - -# Perform this for `calibnet` AND `mainnet` -chains=("mainnet" "calibnet") - -for chain in "${chains[@]}" -do - # download the latest snapshot. - # ============================= - # - calibnet ~6G, ~5min on a droplet - # - mainnet ~74G, ~60mins on a droplet - aria2c -x5 https://forest-archive.chainsafe.dev/latest/"$chain"/ -o "$chain" - - # print out the checkpoints. - # ========================== - # The whole operation takes a long time, BUT you only need the first line or so. - timeout 15s forest-tool archive checkpoints "$chain" -done - -# Update `build/known_blocks.yaml` as appropriate, manually. -``` diff --git a/.github/workflows/checkpoints.yml b/.github/workflows/checkpoints.yml index a4c106d378de..8a489121cef7 100644 --- a/.github/workflows/checkpoints.yml +++ b/.github/workflows/checkpoints.yml @@ -1,17 +1,34 @@ -name: Checkpoints +name: Checkpoints Auto Update on: workflow_dispatch: schedule: - - cron: "0 0 1 * *" # The 1st of every month + # Everyday at midnight UTC + - cron: "0 0 * * *" jobs: - checkpoint_issue: + update-checkpoints: runs-on: ubuntu-slim steps: - uses: actions/checkout@v6 - - uses: JasonEtco/create-an-issue@v2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Update checkpoints + run: | + docker run --rm -v $PWD:/app -w /app --entrypoint forest-dev ghcr.io/chainsafe/forest:edge update-checkpoints + # This is needed in order to have the commits signed. + - uses: actions/create-github-app-token@v2 + id: generate-token with: - filename: .github/CHECKPOINT_ISSUE_TEMPLATE.md + app-id: ${{ secrets.LESHY_APP_ID }} + private-key: ${{ secrets.LESHY_APP_PRIVATE_KEY }} + - name: Create Pull Request + uses: peter-evans/create-pull-request@v8 + with: + base: main + branch: leshy/update-forest-checkpoints + token: ${{ steps.generate-token.outputs.token }} + commit-message: Update Forest checkpoints + sign-commits: true + title: "[automated] Update Forest checkpoints" + body: | + ### Changes + - Updates Forest checkpoints