-
Notifications
You must be signed in to change notification settings - Fork 91
216 lines (177 loc) · 8.06 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
---
name: Deploy
on:
pull_request:
push:
branches: [main]
concurrency:
group: deploy-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CHECK_VERIFIED_BATCHES_TIMEOUT_MINUTES: 10
GO_VERSION: "1.21"
jobs:
# Deploy the CDK environment in one step, with the gas token feature enabled.
monolithic_cdk:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: scripts/zkevm-config-diff/go.sum
# Install tools.
- name: Install kurtosis
run: |
echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list
sudo apt update
sudo apt install kurtosis-cli
kurtosis analytics disable
- name: Install yq
run: pip3 install yq
- name: Install foundry
uses: foundry-rs/foundry-toolchain@v1
# Deploy components.
- name: Enable gas token feature
run: yq -Y --in-place '.args.zkevm_use_gas_token_contract = true' params.yml
- name: Deploy Kurtosis CDK package
run: kurtosis run --enclave cdk-v1 --args-file params.yml --image-download always .
- name: Check that batches are being verified
run: |
timeout_minutes="${CHECK_VERIFIED_BATCHES_TIMEOUT_MINUTES}"
start_time=$(date +%s)
end_time=$((start_time + timeout_minutes*60))
export ETH_RPC_URL="$(kurtosis port print cdk-v1 zkevm-node-rpc-001 http-rpc)"
while true; do
current_time=$(date +%s)
if (( current_time > end_time )); then
echo "[$(date '+%Y-%m-%d %H:%M:%S')] ❌ Exiting... Timeout reached. No batches were verified."
exit 1
fi
verified_batches=$(cast to-dec $(cast rpc zkevm_verifiedBatchNumber | sed 's/"//g'))
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Verified Batches: $verified_batches"
if (( verified_batches > 5 )); then
echo "[$(date '+%Y-%m-%d %H:%M:%S')] ✅ Exiting... At least five batches were verified."
exit 0
fi
sleep 10
done
# Compare configs.
- name: Dump configs
working-directory: ./scripts/zkevm-config-diff
run: |
mkdir -p default-configs kurtosis-cdk-configs
sh zkevm_config.sh dump default ./default-configs
echo
sh zkevm_config.sh dump kurtosis-cdk ./kurtosis-cdk-configs
- name: Compare configs
working-directory: ./scripts/zkevm-config-diff
run: sh zkevm_config.sh compare configs ./default-configs ./kurtosis-cdk-configs
- name: Diff configs
working-directory: ./scripts/zkevm-config-diff
run: diff -r ./default-configs ./kurtosis-cdk-configs || true
# Deploy the CDK environment incrementally, stage by stage.
incremental_cdk:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: scripts/zkevm-config-diff/go.sum
# Install tools.
- name: Install kurtosis
run: |
echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list
sudo apt update
sudo apt install kurtosis-cli
kurtosis analytics disable
- name: Install yq
run: pip3 install yq
- name: Install foundry
uses: foundry-rs/foundry-toolchain@v1
# Deploy components.
- name: Disable All Deployment Steps
run: |
yq -Y --in-place '.deploy_l1 = false' params.yml
yq -Y --in-place '.deploy_zkevm_contracts_on_l1 = false' params.yml
yq -Y --in-place '.deploy_databases = false' params.yml
yq -Y --in-place '.deploy_cdk_central_environment = false' params.yml
yq -Y --in-place '.deploy_cdk_bridge_infra = false' params.yml
yq -Y --in-place '.deploy_zkevm_permissionless_node = false' params.yml
yq -Y --in-place '.deploy_observability = false' params.yml
yq -Y --in-place '.deploy_blutgang = false' params.yml
- name: Deploy L1
run: |
yq -Y --in-place '.deploy_l1 = true' params.yml
kurtosis run --enclave cdk-v1 --args-file params.yml .
yq -Y --in-place '.deploy_l1 = false' params.yml # reset
- name: Deploy ZkEVM Contracts on L1
run: |
yq -Y --in-place '.deploy_zkevm_contracts_on_l1 = true' params.yml
kurtosis run --enclave cdk-v1 --args-file params.yml --image-download always .
yq -Y --in-place '.deploy_zkevm_contracts_on_l1 = false' params.yml # reset
- name: Deploy ZkEVM Node and CDK Peripheral Databases
run: |
yq -Y --in-place '.deploy_databases = true' params.yml
kurtosis run --enclave cdk-v1 --args-file params.yml .
yq -Y --in-place '.deploy_databases = false' params.yml # reset
- name: Deploy CDK Central Environment
run: |
yq -Y --in-place '.deploy_cdk_central_environment = true' params.yml
kurtosis run --enclave cdk-v1 --args-file params.yml .
yq -Y --in-place '.deploy_cdk_central_environment = false' params.yml # reset
- name: Deploy CDK Bridge Infrastructure
run: |
yq -Y --in-place '.deploy_cdk_bridge_infra = true' params.yml
kurtosis run --enclave cdk-v1 --args-file params.yml .
yq -Y --in-place '.deploy_cdk_bridge_infra = false' params.yml # reset
- name: Deploy ZkEVM Permissionless Node
run: |
yq -Y --in-place '.deploy_zkevm_permissionless_node = true' params.yml
kurtosis run --enclave cdk-v1 --args-file params.yml .
yq -Y --in-place '.deploy_zkevm_permissionless_node = false' params.yml # reset
- name: Deploy Observability Stack
run: |
yq -Y --in-place '.deploy_observability = true' params.yml
kurtosis run --enclave cdk-v1 --args-file params.yml .
yq -Y --in-place '.deploy_observability = false' params.yml # reset
- name: Deploy Loadbalancer (blutgang)
run: |
yq -Y --in-place '.deploy_blutgang = true' params.yml
kurtosis run --enclave cdk-v1 --args-file params.yml .
yq -Y --in-place '.deploy_blutgang = false' params.yml # reset
- name: Check that batches are being verified
run: |
timeout_minutes="${CHECK_VERIFIED_BATCHES_TIMEOUT_MINUTES}"
start_time=$(date +%s)
end_time=$((start_time + timeout_minutes*60))
export ETH_RPC_URL="$(kurtosis port print cdk-v1 zkevm-node-rpc-001 http-rpc)"
while true; do
current_time=$(date +%s)
if (( current_time > end_time )); then
echo "[$(date '+%Y-%m-%d %H:%M:%S')] ❌ Exiting... Timeout reached. No batches were verified."
exit 1
fi
verified_batches=$(cast to-dec $(cast rpc zkevm_verifiedBatchNumber | sed 's/"//g'))
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Verified Batches: $verified_batches"
if (( verified_batches > 5 )); then
echo "[$(date '+%Y-%m-%d %H:%M:%S')] ✅ Exiting... At least five batches were verified."
exit 0
fi
sleep 10
done
# Compare configs.
- name: Dump configs
working-directory: scripts/zkevm-config-diff
run: |
mkdir default-configs kurtosis-cdk-configs
sh zkevm_config.sh dump default ./default-configs
echo
sh zkevm_config.sh dump kurtosis-cdk ./kurtosis-cdk-configs
- name: Compare configs
working-directory: scripts/zkevm-config-diff
run: sh zkevm_config.sh compare configs ./default-configs ./kurtosis-cdk-configs
- name: Diff configs
working-directory: scripts/zkevm-config-diff
run: diff -r ./default-configs ./kurtosis-cdk-configs || true