Skip to content

Commit cbba9d7

Browse files
fix(ci): restore checkpoint update PRs (#10975)
1 parent b7ae2ba commit cbba9d7

1 file changed

Lines changed: 26 additions & 47 deletions

File tree

.github/workflows/checkpoint-update.yml

Lines changed: 26 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
# Automated checkpoint and end-of-support height updates.
1+
# Automated checkpoint updates.
22
#
33
# Triggered when the weekly integration tests complete successfully.
44
# Downloads checkpoint artifacts produced by generate-checkpoints-* jobs,
5-
# appends new entries to the checkpoint files, updates the end-of-support
6-
# height, validates everything, and opens a PR.
5+
# appends new entries to the checkpoint files, validates them, and opens a PR.
76
#
87
# The PR requires human review before merge; checkpoints are consensus-critical.
98
name: Checkpoint Update
@@ -30,17 +29,25 @@ jobs:
3029
github.event.workflow_run.conclusion == 'success'
3130
permissions:
3231
actions: read
33-
contents: write
34-
pull-requests: write
32+
contents: read
3533
env:
3634
MAINNET_CHECKPOINTS: zebra-chain/src/parameters/checkpoint/main-checkpoints.txt
3735
TESTNET_CHECKPOINTS: zebra-chain/src/parameters/checkpoint/test-checkpoints.txt
38-
EOS_FILE: zebrad/src/components/sync/end_of_support.rs
3936
steps:
37+
- name: Generate release app token
38+
id: app-token
39+
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 #v3.2.0
40+
with:
41+
app-id: ${{ vars.RELEASE_APP_ID }}
42+
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
43+
permission-contents: write
44+
permission-pull-requests: write
45+
4046
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
4147
with:
42-
persist-credentials: true
48+
persist-credentials: false
4349
ref: main
50+
token: ${{ steps.app-token.outputs.token }}
4451

4552
# Resolve the integration test run ID.
4653
# For workflow_run: use the triggering run directly.
@@ -124,9 +131,11 @@ jobs:
124131
exit 0
125132
fi
126133
127-
echo "has_mainnet=${HAS_MAINNET}" >> "$GITHUB_OUTPUT"
128-
echo "has_testnet=${HAS_TESTNET}" >> "$GITHUB_OUTPUT"
129-
echo "has_updates=true" >> "$GITHUB_OUTPUT"
134+
{
135+
echo "has_mainnet=${HAS_MAINNET}"
136+
echo "has_testnet=${HAS_TESTNET}"
137+
echo "has_updates=true"
138+
} >> "$GITHUB_OUTPUT"
130139
131140
# Append new mainnet checkpoints (entries with heights higher than current last)
132141
- name: Append new mainnet checkpoints
@@ -161,22 +170,6 @@ jobs:
161170
echo "Updated last testnet checkpoint: ${NEW_LAST}"
162171
fi
163172
164-
# Update the end-of-support estimated release height using the latest
165-
# mainnet checkpoint height. This is a lower bound (~3-7 days behind
166-
# the real tip), but the EOS window is 105 days, making it negligible.
167-
- name: Update end-of-support height
168-
if: steps.check-artifacts.outputs.has_mainnet == 'true'
169-
run: |
170-
LAST_HEIGHT=$(tail -1 "${MAINNET_CHECKPOINTS}" | awk '{print $1}')
171-
# Format with underscores for Rust readability (e.g., 3_282_406)
172-
FORMATTED=$(echo "$LAST_HEIGHT" | awk '{n=$0; r=""; for(i=length(n);i>0;i--) { r=substr(n,i,1) r; if((length(n)-i)%3==2 && i>1) r="_" r }; print r}')
173-
echo "Setting ESTIMATED_RELEASE_HEIGHT to ${FORMATTED} (height ${LAST_HEIGHT})"
174-
175-
sed -i "s/ESTIMATED_RELEASE_HEIGHT: u32 = [0-9_]*/ESTIMATED_RELEASE_HEIGHT: u32 = ${FORMATTED}/" \
176-
"${EOS_FILE}"
177-
178-
grep "ESTIMATED_RELEASE_HEIGHT" "${EOS_FILE}" | head -1
179-
180173
# Validate the updated checkpoint files
181174
- name: Validate checkpoint files
182175
if: steps.check-artifacts.outputs.has_updates == 'true'
@@ -203,32 +196,18 @@ jobs:
203196
if: steps.changes.outputs.has_changes == 'true'
204197
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 #v8.1.1
205198
with:
206-
token: ${{ secrets.GITHUB_TOKEN }}
199+
token: ${{ steps.app-token.outputs.token }}
207200
branch: chore/update-checkpoints
208-
title: "chore(chain): update checkpoints and end-of-support height"
201+
add-paths: |
202+
zebra-chain/src/parameters/checkpoint/main-checkpoints.txt
203+
zebra-chain/src/parameters/checkpoint/test-checkpoints.txt
204+
title: "chore(chain): update checkpoints"
209205
body: |
210206
Automated checkpoint update from the weekly integration test run.
211207
212208
**Source:** [Integration test run #${{ steps.resolve-run.outputs.run_id }}](${{ steps.resolve-run.outputs.run_url }})
213209
214-
### Changes
215-
216-
- Updated mainnet and/or testnet checkpoint files with new entries
217-
- Updated `ESTIMATED_RELEASE_HEIGHT` in `end_of_support.rs` to match the latest mainnet checkpoint
218-
219-
### Validation
220-
221-
The checkpoint validation script verified:
222-
- All entries match `HEIGHT HASH` format
223-
- Heights are monotonically increasing
224-
- No gaps exceed 400 blocks
225-
- No duplicate heights or hashes
226-
227-
### Review
228-
229-
Checkpoints are consensus-critical; incorrect hashes could cause nodes
230-
to follow a wrong fork. Verify the source integration test run linked
231-
above completed successfully against the real Zcash network.
210+
Checkpoints are consensus-critical. Verify the new hashes against the source run before merging.
232211
labels: A-release,C-enhancement
233-
commit-message: "chore(chain): update checkpoints and end-of-support height"
212+
commit-message: "chore(chain): update checkpoints"
234213
delete-branch: true

0 commit comments

Comments
 (0)