forked from 0xPolygon/kurtosis-cdk
-
Notifications
You must be signed in to change notification settings - Fork 3
239 lines (188 loc) · 11.7 KB
/
deploy.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
---
# Basic deployment workflow.
# Note that more advanced use cases are tested in the nightly workflow.
name: Deploy
on:
pull_request:
push:
branches: [main]
concurrency:
group: deploy-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
ENCLAVE_NAME: cdk
jobs:
cdk-fork9:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Install Kurtosis CDK tools
uses: ./.github/actions/setup-kurtosis-cdk
# Deploy the CDK environment with cdk-erigon, serving as the sequencer.
# Set up the cdk-node for the remaining components.
# Additionally, deploy cdk-erigon and zkevm-node as permissionless nodes or RPCs.
- name: Deploy L1 chain and a first CDK L2 chain (erigon)
run: |
yq -Y --in-place '.args.additional_services = ["pless_zkevm_node", "tx_spammer"]' params.yml
kurtosis run --enclave=${{ env.ENCLAVE_NAME }} --show-enclave-inspect=false --args-file=params.yml .
- name: Inspect enclave
run: kurtosis enclave inspect ${{ env.ENCLAVE_NAME }}
- name: List first CDK L2 chain databases (erigon)
run: |
postgres1_port=$(kurtosis port print ${{ env.ENCLAVE_NAME }} postgres-001 postgres | cut -d':' -f3)
PGPASSWORD=master_password psql --host 127.0.0.1 --port "$postgres1_port" --username master_user --dbname master --list
- name: Attach a second CDK L2 chain (erigon)
run: |
yq -Y --in-place '.args.additional_services = ["pless_zkevm_node", "tx_spammer"]' agglayer-attach-cdk-params.yml
kurtosis run --enclave=${{ env.ENCLAVE_NAME }} --show-enclave-inspect=false --args-file=agglayer-attach-cdk-params.yml .
- name: Inspect enclave
run: kurtosis enclave inspect ${{ env.ENCLAVE_NAME }}
- name: List second CDK L2 chain databases (erigon)
run: |
postgres2_port=$(kurtosis port print ${{ env.ENCLAVE_NAME }} postgres-002 postgres | cut -d':' -f3)
PGPASSWORD=master_password psql --host 127.0.0.1 --port "$postgres2_port" --username master_user --dbname master --list
- name: Update the agglayer config
run: |
# Download the agglayer config file.
kurtosis files download ${{ env.ENCLAVE_NAME }} agglayer-config-artifact
cd agglayer-config-artifact
# Update the config by adding the rpc and proof signer of the second chain.
tomlq -Y --toml-output --in-place '.FullNodeRPCs += {"2": "http://cdk-erigon-node-002:8123"}' agglayer-config.toml
proof_signer_2="$(yq --raw-output .args.zkevm_l2_sequencer_address ../agglayer-attach-cdk-params.yml)"
tomlq -Y --toml-output --arg proofSigner2 "$proof_signer_2" --in-place '.ProofSigners += {"2": $proofSigner2}' agglayer-config.toml
# Replace the agglayer config.
agglayer_container_id="$(docker ps --filter "name=zkevm-agglayer" --format "{{.ID}}")"
docker cp agglayer-config.toml "$agglayer_container_id:/etc/zkevm/agglayer-config.toml"
# Restart the agglayer service.
kurtosis service stop ${{ env.ENCLAVE_NAME }} zkevm-agglayer-001
kurtosis service start ${{ env.ENCLAVE_NAME }} zkevm-agglayer-001
- name: Monitor verified batches of the first L2 chain (CDK Erigon Permissionless RPC)
working-directory: .github/scripts
run: ./monitor-verified-batches.sh --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} cdk-erigon-node-001 http-rpc)"
- name: Monitor verified batches of the first L2 chain (zkEVM Node Permissionless RPC)
working-directory: .github/scripts
run: ./monitor-verified-batches.sh --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} zkevm-node-rpc-pless-001 http-rpc)"
- name: Monitor verified batches of the second L2 chain (CDK Erigon Permissionless RPC)
working-directory: .github/scripts
run: ./monitor-verified-batches.sh --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} cdk-erigon-node-002 http-rpc)"
- name: Monitor verified batches of the second L2 chain (zkEVM Node Permissionless RPC)
working-directory: .github/scripts
run: ./monitor-verified-batches.sh --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} zkevm-node-rpc-pless-002 http-rpc)"
cdk-fork12:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Install Kurtosis CDK tools
uses: ./.github/actions/setup-kurtosis-cdk
- name: Deploy L1 chain and CDK L2 chain (erigon)
run: |
yq -Y --in-place '.args.zkevm_rollup_fork_id = "12"' params.yml
yq -Y --in-place '.args.zkevm_prover_image = "hermeznetwork/zkevm-prover:v8.0.0-RC5-fork.12"' params.yml
# TODO: Use a tagged version for cdk-erigon node image.
yq -Y --in-place '.args.cdk_erigon_node_image = "hermeznetwork/cdk-erigon:fe54243ce2cd0563396b509ff19e178178e9d712"' params.yml
# Fork12 is only supported by cdk-erigon, not by cdk-validium-node or zkevm-node.
# That's why we don't deploy the permissionless zkevm-node in this job.
yq -Y --in-place '.args.additional_services = ["tx_spammer"]' params.yml
kurtosis run --enclave=${{ env.ENCLAVE_NAME }} --show-enclave-inspect=false --args-file=params.yml .
- name: Inspect enclave
run: kurtosis enclave inspect ${{ env.ENCLAVE_NAME }}
- name: Monitor verified batches (CDK Erigon Permissionless RPC)
working-directory: .github/scripts
run: ./monitor-verified-batches.sh --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} cdk-erigon-node-001 http-rpc)"
zkevm-fork9:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Install Kurtosis CDK tools
uses: ./.github/actions/setup-kurtosis-cdk
# Deploy the CDK environment with zkevm-node, serving as the sequencer.
# Also set up the zkevm-node for the remaining components.
# Additionally, deploy zkevm-node as permissionless node or RPC.
- name: Deploy L1 chain and a first CDK L2 chain (zkevm)
run: |
yq -Y --in-place '.deploy_cdk_erigon_node = false' params.yml
yq -Y --in-place '.args.sequencer_type = "zkevm"' params.yml
yq -Y --in-place '.args.additional_services = ["pless_zkevm_node", "tx_spammer"]' params.yml
kurtosis run --enclave=${{ env.ENCLAVE_NAME }} --show-enclave-inspect=false --args-file=params.yml .
- name: Inspect enclave
run: kurtosis enclave inspect ${{ env.ENCLAVE_NAME }}
- name: List first CDK L2 chain databases (zkevm)
run: |
postgres1_port=$(kurtosis port print ${{ env.ENCLAVE_NAME }} postgres-001 postgres | cut -d':' -f3)
PGPASSWORD=master_password psql --host 127.0.0.1 --port "$postgres1_port" --username master_user --dbname master --list
- name: Attach a second CDK L2 chain (erigon)
run: |
yq -Y --in-place '.args.additional_services = ["pless_zkevm_node", "tx_spammer"]' agglayer-attach-cdk-params.yml
kurtosis run --enclave=${{ env.ENCLAVE_NAME }} --show-enclave-inspect=false --args-file=agglayer-attach-cdk-params.yml .
- name: Inspect enclave
run: kurtosis enclave inspect ${{ env.ENCLAVE_NAME }}
- name: List second CDK L2 chain databases (erigon)
run: |
postgres2_port=$(kurtosis port print ${{ env.ENCLAVE_NAME }} postgres-002 postgres | cut -d':' -f3)
PGPASSWORD=master_password psql --host 127.0.0.1 --port "$postgres2_port" --username master_user --dbname master --list
- name: Update the agglayer config
run: |
# Download the agglayer config file.
kurtosis files download ${{ env.ENCLAVE_NAME }} agglayer-config-artifact
cd agglayer-config-artifact
# Update the config by adding the rpc and proof signer of the second chain.
tomlq -Y --toml-output --in-place '.FullNodeRPCs += {"2": "http://cdk-erigon-node-002:8123"}' agglayer-config.toml
proof_signer_2="$(yq --raw-output .args.zkevm_l2_sequencer_address ../agglayer-attach-cdk-params.yml)"
tomlq -Y --toml-output --arg proofSigner2 "$proof_signer_2" --in-place '.ProofSigners += {"2": $proofSigner2}' agglayer-config.toml
# Replace the agglayer config.
agglayer_container_id="$(docker ps --filter "name=zkevm-agglayer" --format "{{.ID}}")"
docker cp agglayer-config.toml "$agglayer_container_id:/etc/zkevm/agglayer-config.toml"
# Restart the agglayer service.
kurtosis service stop ${{ env.ENCLAVE_NAME }} zkevm-agglayer-001
kurtosis service start ${{ env.ENCLAVE_NAME }} zkevm-agglayer-001
- name: Monitor verified batches of the first L2 chain (zkEVM Node Trusted RPC)
working-directory: .github/scripts
run: ./monitor-verified-batches.sh --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} zkevm-node-rpc-001 http-rpc)"
- name: Monitor verified batches of the first L2 chain (zkEVM Node Permissionless RPC)
working-directory: .github/scripts
run: ./monitor-verified-batches.sh --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} zkevm-node-rpc-pless-001 http-rpc)"
# TODO(nit): Deploy a CDK Erigon Permissionless RPC and check that it can sync.
- name: Monitor verified batches of the second L2 chain (CDK Erigon Permissionless RPC)
working-directory: .github/scripts
run: ./monitor-verified-batches.sh --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} cdk-erigon-node-002 http-rpc)"
- name: Monitor verified batches of the second L2 chain (zkEVM Node Permissionless RPC)
working-directory: .github/scripts
run: ./monitor-verified-batches.sh --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} zkevm-node-rpc-pless-002 http-rpc)"
# TODO(nit): Deploy a CDK Erigon Permissionless RPC and check that it can sync.
additional_services:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Install Kurtosis CDK tools
uses: ./.github/actions/setup-kurtosis-cdk
- name: Deploy Kurtosis CDK package with additional services
run: |
yq -Y --in-place '.args.additional_services = ["arpeggio", "blockscout", "blutgang", "pless_zkevm_node", "prometheus_grafana", "tx_spammer"]' params.yml
kurtosis run --enclave=${{ env.ENCLAVE_NAME }} --show-enclave-inspect=false --args-file=params.yml .
- name: Inspect enclave
run: kurtosis enclave inspect ${{ env.ENCLAVE_NAME }}
- name: Verify Blutgang rpc
run: cast bn --rpc-url $(kurtosis port print ${{ env.ENCLAVE_NAME }} blutgang-001 http)
- name: Verify Arpeggio rpc
run: cast bn --rpc-url $(kurtosis port print ${{ env.ENCLAVE_NAME }} arpeggio-001 rpc)
- name: Verify permissionless zkevm-node rpc
run: cast bn --rpc-url $(kurtosis port print ${{ env.ENCLAVE_NAME }} zkevm-node-rpc-pless-001 http-rpc)
- name: Verify Prometheus collects Panoptichain metrics
run: |
echo "Wait for one minute while Prometheus gathers metrics..."
sleep 60
echo "Retrieve Panoptichain metrics from Prometheus..."
panoptichain_metric="panoptichain_system_uptime"
prometheus_url=$(kurtosis port print ${{ env.ENCLAVE_NAME }} prometheus-001 http)
prometheus_query=$(curl "$prometheus_url/api/v1/query?query=$panoptichain_metric")
echo $prometheus_query | jq
if [ "$(jq -r '.data.result[0].metric.__name__' <<<$prometheus_query)" == "$panoptichain_metric" ]; then
echo "✅ Prometheus collects panoptichain metrics!"
else
echo "❌ Prometheus does not collect panoptichain metrics..."
exit 1
fi