Skip to content

Commit

Permalink
Configure Optimism and Base fast sync settings update (#7448)
Browse files Browse the repository at this point in the history
  • Loading branch information
rubo authored Sep 17, 2024
1 parent c6a768d commit ffaf875
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 47 deletions.
69 changes: 22 additions & 47 deletions .github/workflows/update-config-files.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: "[UPDATE] Config files (fast sync settings)"
name: Update fast sync settings

on:
schedule:
- cron: "0 0 * * 0"
- cron: '0 0 * * 0'
workflow_dispatch:

permissions:
Expand All @@ -11,58 +11,33 @@ permissions:

jobs:
update-configs:
if: github.repository_owner == 'NethermindEth'
name: Update fast sync settings in config files
name: Update fast sync settings
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: Authenticate App
id: gh-app
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
uses: actions/checkout@v4
- name: Install dependencies
run: |
pip3 install setuptools
pip3 install emoji
- name: Update config files
run: |
python3 scripts/syncSettings.py ${{ secrets.ETHERSCAN_API_KEY }}
- name: Create pull request
uses: peter-evans/create-[email protected]
run: python3 scripts/syncSettings.py ${{ secrets.ETHERSCAN_API_KEY }}
- name: Create GitHub app token
id: gh-app
uses: actions/create-github-app-token@v1
with:
token: ${{ steps.gh-app.outputs.token }}
commit-message: Updating Fast Sync config files
body: |
Config files included:
- mainnet.cfg
- gnosis.cfg
- chiado.cfg
- sepolia.cfg
- energyweb.cfg
- volta.cfg
- exosama.cfg
- joc-mainnet.cfg
- joc-testnet.cfg
Properties refreshed:
- PivotNumber
- PivotHash
- PivotTotalDifficulty
- Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
title: "Update Fast Sync configuration in Nethermind repository"
labels: configs
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
committer: GitHub <[email protected]>
branch: configs-update
branch-suffix: short-commit-hash
base: master
- name: Check outputs
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Create a pull request
env:
GH_TOKEN: ${{ steps.gh-app.outputs.token }}
run: |
echo "Pull Request Number - ${{ env.PULL_REQUEST_NUMBER }}"
head_branch=feature/fast-sync-config-${{ github.run_number }}-${{ github.run_attempt }}
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git checkout -b $head_branch
git add -A
git commit -am "Auto-update fast sync settings"
git push origin $head_branch
gh pr create -B master -H $head_branch -t "Auto-update fast sync settings" \
-b "Updated fast sync settings in the configuration files" -l configuration -l sync
43 changes: 43 additions & 0 deletions .github/workflows/update-fast-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Update fast sync settings

on:
schedule:
- cron: '0 0 * * 0'
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
update-configs:
name: Update fast sync settings
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
pip3 install setuptools
pip3 install emoji
- name: Update config files
run: python3 scripts/syncSettings.py ${{ secrets.ETHERSCAN_API_KEY }}
- name: Create GitHub app token
id: gh-app
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Create a pull request
env:
GH_TOKEN: ${{ steps.gh-app.outputs.token }}
run: |
head_branch=feature/fast-sync-config-${{ github.run_number }}-${{ github.run_attempt }}
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git checkout -b $head_branch
git add -A
git commit -am "Auto-update fast sync settings"
git push origin $head_branch
gh pr create -B master -H $head_branch -t "Auto-update fast sync settings" \
-b "Updated fast sync settings in config files" -l configuration -l sync
20 changes: 20 additions & 0 deletions scripts/syncSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,26 @@
"url": "https://rpc-1.testnet.japanopenchain.org:8545",
"blockReduced": 8192,
"multiplierRequirement": 10000
},
"base-mainnet": {
"url": "https://mainnet.base.org",
"blockReduced": 8192,
"multiplierRequirement": 10000
},
"base-sepolia": {
"url": "https://sepolia.base.org",
"blockReduced": 8192,
"multiplierRequirement": 10000
},
"op-mainnet": {
"url": "https://mainnet.optimism.io",
"blockReduced": 8192,
"multiplierRequirement": 10000
},
"op-sepolia": {
"url": "https://sepolia.optimism.io",
"blockReduced": 8192,
"multiplierRequirement": 10000
}
}

Expand Down

0 comments on commit ffaf875

Please sign in to comment.