-
Notifications
You must be signed in to change notification settings - Fork 437
285 lines (256 loc) · 10.3 KB
/
sync-supported-chains.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
name: Sync Supported Chains
on:
workflow_run:
workflows: ["Publish Docker image"]
branches: [master, release/*]
types:
- completed
workflow_dispatch:
inputs:
nethermind_image:
description: "Docker image to be used by action"
default: ""
required: false
network_filter:
description: "Usefull for manual execution on only specified networks - provide partial or full name. Will execute action only on networks which contains phrase."
default: ""
required: false
env:
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: "1"
TERM: xterm
jobs:
setup-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: nethermind
- name: Set Matrix
id: set-matrix
run: |
matrix=$(cat nethermind/scripts/workflow_config/sync_testnets_matrix.json)
if [ -n "${{ github.event.inputs.network_filter }}" ]; then
matrix=$(echo "$matrix" | jq --arg filter "${{ github.event.inputs.network_filter }}" '[.[] | select(.network | contains($filter))]')
fi
echo "matrix=$(echo "$matrix" | jq -c .)" >> $GITHUB_OUTPUT
create_a_runner:
needs: [setup-matrix]
strategy:
fail-fast: false
matrix:
config: ${{fromJson(needs.setup-matrix.outputs.matrix)}}
runs-on: ubuntu-latest
outputs:
runner_label: ${{ steps.run-linode-action.outputs.runner_label }}
machine_id: ${{ steps.run-linode-action.outputs.machine_id }}
steps:
- name: Install sshpass
run: sudo apt-get update && sudo apt-get install -y sshpass
- name: Create a Runner
id: run-linode-action
uses: kamilchodola/linode-github-runner/.github/actions/linode-machine-manager@main
with:
linode_token: ${{ secrets.LINODE_TOKEN }}
github_token: "${{ secrets.REPOSITORY_DISPATCH_TOKEN }}"
action: "create"
runner_label: t-${{ github.run_id }}-${{ matrix.config.network }}
root_password: ${{ secrets.LINODE_ROOT_PASSWORD }}
machine_type: "${{ matrix.config.agent }}"
image: "linode/ubuntu24.04"
tags: "core, self-hosted, dynamic"
organization: "NethermindEth"
repo_name: "nethermind"
blocked_ports: "8545,8546,8551,8552"
sync-chain:
needs: [setup-matrix, create_a_runner]
strategy:
fail-fast: false
matrix:
config: ${{fromJson(needs.setup-matrix.outputs.matrix)}}
name: "Run sync of ${{ matrix.config.network }} chain"
runs-on: t-${{ github.run_id }}-${{ matrix.config.network }}
timeout-minutes: ${{ matrix.config.timeout }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
clean: true
- name: Installing requirements
run: |
sudo apt-get update
sudo apt-get install -y make build-essential jq screen lshw dmidecode fio
- name: Setup Go environment
uses: actions/setup-go@v5
with:
go-version: 'stable'
check-latest: true
cache: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.X"
- name: Install Sedge environment
run: |
echo "Downloading sedge sources..."
git clone https://github.com/NethermindEth/sedge.git sedge --branch core --single-branch
echo "Sources downloaded."
cd sedge
echo "Building sedge..."
make compile
- name: Run Sedge
working-directory: sedge
run: |
docker_image=""
network="${{ matrix.config.network }}"
if [ -z "${{ inputs.nethermind_image }}" ]; then
REF_NAME=${{ github.ref }}
if [[ $REF_NAME == refs/heads/release/* ]]; then
CLEAN_REF=$(echo "${REF_NAME/refs\/heads\//}" | sed 's/[^a-zA-Z0-9._-]/-/g')
docker_image="nethermindeth/nethermind:$CLEAN_REF"
else
docker_image="nethermindeth/nethermind:master"
fi
else
docker_image="${{ inputs.nethermind_image }}"
fi
echo 'Generating sedge docker...'
./build/sedge deps install
if [[ "$network" == base-* || "$network" == op-* ]]; then
if [[ "$network" == *mainnet* ]]; then
CONSENSUS_URL="${{ secrets.MAINNET_CONSENSUS_URL }}"
EXECUTION_URL="${{ secrets.MAINNET_EXECUTION_URL }}"
elif [[ "$network" == *sepolia* ]]; then
CONSENSUS_URL="${{ secrets.SEPOLIA_CONSENSUS_URL }}"
EXECUTION_URL="${{ secrets.SEPOLIA_EXECUTION_URL }}"
else
echo "Unknown network"
exit 1
fi
if [[ "$network" == base-* ]]; then
extra_param="--base"
fi
stripped_network="${network#base-}"
stripped_network="${stripped_network#op-}"
./build/sedge generate \
--logging none \
-p $GITHUB_WORKSPACE/sedge \
op-full-node \
--op-execution opnethermind:$docker_image \
--op-image op-node:us-docker.pkg.dev/oplabs-tools-artifacts/images/op-node:latest \
--map-all \
--network $stripped_network \
--consensus-url $CONSENSUS_URL \
--execution-api-url $EXECUTION_URL \
--el-op-extra-flag Sync.VerifyTrieOnStateSyncFinished=true \
$extra_param
else
./build/sedge generate \
--logging none \
-p $GITHUB_WORKSPACE/sedge \
full-node \
-c ${{ matrix.config.cl }}:${{ matrix.config.cl_image }} \
-e nethermind:$docker_image \
--map-all \
--no-mev-boost \
--no-validator \
--network ${{ matrix.config.network }} \
--el-extra-flag Sync.NonValidatorNode=true \
--el-extra-flag Sync.DownloadBodiesInFastSync=false \
--el-extra-flag Sync.DownloadReceiptsInFastSync=false \
--el-extra-flag JsonRpc.EnabledModules=[Eth,Subscribe,Trace,TxPool,Web3,Personal,Proof,Net,Parity,Health,Rpc,Debug] \
--el-extra-flag Sync.VerifyTrieOnStateSyncFinished=true \
--el-extra-flag Sync.SnapSync=true \
--checkpoint-sync-url=${{ matrix.config.checkpoint-sync-url }}
fi
echo 'Running sedge...'
./build/sedge run -p $GITHUB_WORKSPACE/sedge
- name: Wait for ${{ matrix.config.network }} to sync
id: wait
env:
NETWORK: ${{ matrix.config.network }}
run: |
python scripts/waitForSync.py
- name: Get Consensus Logs
if: always() && matrix.config.network != 'joc-mainnet' && matrix.config.network != 'joc-testnet' && matrix.config.network != 'linea-mainnet' && matrix.config.network != 'linea-sepolia'
run: |
network="${{ matrix.config.network }}"
if [[ "$network" == base-* || "$network" == op-* ]]; then
docker logs sedge-consensus-op-l2-client
else
docker logs sedge-consensus-client
fi
- name: Check size of DB
run: |
du -h $GITHUB_WORKSPACE/sedge
- name: Destroy VM
if: always()
id: run-linode-action
uses: kamilchodola/linode-github-runner/.github/actions/linode-machine-manager@main
with:
linode_token: ${{ secrets.LINODE_TOKEN }}
github_token: "${{ secrets.REPOSITORY_DISPATCH_TOKEN }}"
action: "destroy-machine"
runner_label: t-${{ github.run_id }}-${{ matrix.config.network }}
search_phrase: t-${{ github.run_id }}-${{ matrix.config.network }}
root_password: ${{ secrets.LINODE_ROOT_PASSWORD }}
organization: "NethermindEth"
repo_name: "nethermind"
destroy_runner:
needs: [setup-matrix, create_a_runner, sync-chain]
if: always()
strategy:
fail-fast: false
matrix:
config: ${{fromJson(needs.setup-matrix.outputs.matrix)}}
runs-on: ubuntu-latest
steps:
- name: Destroy VM (make sure is removed)
uses: kamilchodola/linode-github-runner/.github/actions/linode-machine-manager@main
continue-on-error: true
with:
linode_token: ${{ secrets.LINODE_TOKEN }}
github_token: "${{ secrets.REPOSITORY_DISPATCH_TOKEN }}"
action: "destroy-machine"
runner_label: t-${{ github.run_id }}-${{ matrix.config.network }}
search_phrase: t-${{ github.run_id }}-${{ matrix.config.network }}
root_password: ${{ secrets.LINODE_ROOT_PASSWORD }}
organization: "NethermindEth"
repo_name: "nethermind"
- name: Destroy Runner
uses: kamilchodola/linode-github-runner/.github/actions/linode-machine-manager@main
with:
linode_token: ${{ secrets.LINODE_TOKEN }}
github_token: "${{ secrets.REPOSITORY_DISPATCH_TOKEN }}"
action: "destroy-runner"
runner_label: t-${{ github.run_id }}-${{ matrix.config.network }}
search_phrase: t-${{ github.run_id }}-${{ matrix.config.network }}
root_password: ${{ secrets.LINODE_ROOT_PASSWORD }}
organization: "NethermindEth"
repo_name: "nethermind"
trigger_tests:
needs: [setup-matrix, create_a_runner, sync-chain, destroy_runner]
if: success()
runs-on: ubuntu-latest
steps:
- 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 }}
repositories: "nethermind,post-merge-smoke-tests"
- name: Trigger notification action on test repo
if: startsWith(github.event.workflow_run.head_branch, 'release/')
continue-on-error: true
uses: benc-uk/workflow-dispatch@v1
with:
workflow: receive-push-notification.yml
repo: NethermindEth/post-merge-smoke-tests
ref: "main"
token: "${{ steps.gh-app.outputs.token }}"
inputs: '{
"nethermind_branch": "${{ github.ref}}"
}'