-
Notifications
You must be signed in to change notification settings - Fork 2.2k
430 lines (397 loc) · 16.1 KB
/
test-suite-e2e-tests.yml
File metadata and controls
430 lines (397 loc) · 16.1 KB
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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
name: test-suite-e2e-tests
on:
workflow_dispatch:
inputs: &workflow_inputs
image_mode:
description: "Use registry images or build workspace overrides on the runner"
default: "registry"
type: string
override:
description: "Comma-separated override values for workspace mode (for example: all, coprocessor, or coprocessor:host-listener)"
default: ""
type: string
stack-era:
description: "Stack era hint for workflow_call consumers (leave empty for manual dispatch)"
default: ""
type: string
coprocessor-db-migration-version:
description: "Coprocessor DB Migration Image Version"
default: ""
type: string
coprocessor-host-listener-version:
description: "Coprocessor Host Listener Image Version"
default: ""
type: string
coprocessor-gw-listener-version:
description: "Coprocessor Gateway Listener Image Version"
default: ""
type: string
coprocessor-tx-sender-version:
description: "Coprocessor Transaction Sender Image Version"
default: ""
type: string
coprocessor-tfhe-worker-version:
description: "Coprocessor TFHE Worker Image Version"
default: ""
type: string
coprocessor-sns-worker-version:
description: "Coprocessor SNS Worker Image Version"
default: ""
type: string
coprocessor-zkproof-worker-version:
description: "Coprocessor ZKProof Worker Image Version"
default: ""
type: string
gateway-version:
description: "Gateway version"
default: ""
type: string
host-version:
description: "Host version"
default: ""
type: string
connector-db-migration-version:
description: "KMS Connector DB Migration Image Version"
default: ""
type: string
connector-gw-listener-version:
description: "KMS Connector Gateway Listener Image Version"
default: ""
type: string
connector-kms-worker-version:
description: "KMS Connector KMS Worker Image Version"
default: ""
type: string
connector-tx-sender-version:
description: "KMS Connector Transaction Sender Image Version"
default: ""
type: string
test-suite-version:
description: "Test suite version"
default: ""
type: string
relayer-version:
description: "Relayer version"
default: ""
type: string
relayer-migrate-version:
description: "Relayer migrate version"
default: ""
type: string
kms-core-version:
description: "KMS Core version"
default: ""
type: string
workflow_call:
secrets:
GHCR_READ_TOKEN:
required: true
CGR_USERNAME:
required: true
CGR_PASSWORD:
required: true
inputs: *workflow_inputs
permissions: {}
# Allow to run multiple instances of the same workflow in parallel when triggered manually
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name == 'workflow_dispatch' && github.run_id || 'auto' }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
fhevm-e2e-test:
permissions:
contents: 'read' # Required to checkout repository code
id-token: 'write' # Required for OIDC authentication
packages: 'read' # Required to read GitHub packages/container registry
env:
GH_TOKEN: ${{ secrets.GHCR_READ_TOKEN || github.token }}
IMAGE_MODE: ${{ inputs.image_mode || 'registry' }}
WORKSPACE_OVERRIDE: ${{ inputs.override || '' }}
COPROCESSOR_DB_MIGRATION_VERSION: ${{ inputs.coprocessor-db-migration-version }}
COPROCESSOR_HOST_LISTENER_VERSION: ${{ inputs.coprocessor-host-listener-version }}
COPROCESSOR_GW_LISTENER_VERSION: ${{ inputs.coprocessor-gw-listener-version }}
COPROCESSOR_TX_SENDER_VERSION: ${{ inputs.coprocessor-tx-sender-version }}
COPROCESSOR_TFHE_WORKER_VERSION: ${{ inputs.coprocessor-tfhe-worker-version }}
COPROCESSOR_SNS_WORKER_VERSION: ${{ inputs.coprocessor-sns-worker-version }}
COPROCESSOR_ZKPROOF_WORKER_VERSION: ${{ inputs.coprocessor-zkproof-worker-version }}
GATEWAY_VERSION: ${{ inputs.gateway-version }}
HOST_VERSION: ${{ inputs.host-version }}
CONNECTOR_DB_MIGRATION_VERSION: ${{ inputs.connector-db-migration-version }}
CONNECTOR_GW_LISTENER_VERSION: ${{ inputs.connector-gw-listener-version }}
CONNECTOR_KMS_WORKER_VERSION: ${{ inputs.connector-kms-worker-version }}
CONNECTOR_TX_SENDER_VERSION: ${{ inputs.connector-tx-sender-version }}
TEST_SUITE_VERSION: ${{ inputs.test-suite-version }}
RELAYER_VERSION: ${{ inputs.relayer-version }}
RELAYER_MIGRATE_VERSION: ${{ inputs.relayer-migrate-version }}
CORE_VERSION: ${{ inputs.kms-core-version }}
STACK_ERA: ${{ inputs.stack-era }}
runs-on: large_ubuntu_32
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: 'false'
fetch-depth: 0
- name: Setup Docker
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
- name: Setup Bun
uses: oven-sh/setup-bun@ecf28ddc73e819eb6fa29df6b34ef8921c743461 # v2.1.3
- name: Install foundry
uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de # v1.4.0
- name: Login to GitHub Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_READ_TOKEN }}
- name: Login to Chainguard Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: cgr.dev
username: ${{ secrets.CGR_USERNAME }}
password: ${{ secrets.CGR_PASSWORD }}
- name: Install CLI deps
working-directory: test-suite/fhevm
run: bun install --frozen-lockfile
- name: Resolve CLI up args
working-directory: test-suite/fhevm
run: |
set -euo pipefail
args_file="$RUNNER_TEMP/fhevm-up-args"
scenario_file="$RUNNER_TEMP/fhevm-scenario.yaml"
workspace_all=false
coprocessor_local=false
coprocessor_local_services=()
scenario_path="./scenarios/two-of-two.yaml"
case "$IMAGE_MODE" in
registry)
if [ -n "$WORKSPACE_OVERRIDE" ]; then
echo "::error::override requires image_mode=workspace"
exit 1
fi
;;
workspace)
if [ -z "$WORKSPACE_OVERRIDE" ]; then
echo "::error::image_mode=workspace requires override"
exit 1
fi
IFS=',' read -r -a overrides <<< "$WORKSPACE_OVERRIDE"
for raw in "${overrides[@]}"; do
override="${raw#"${raw%%[![:space:]]*}"}"
override="${override%"${override##*[![:space:]]}"}"
[ -n "$override" ] || continue
if [ "$override" = "all" ]; then
workspace_all=true
coprocessor_local=true
continue
fi
if [ "$override" = "coprocessor" ]; then
coprocessor_local=true
continue
fi
if [[ "$override" == coprocessor:* ]]; then
coprocessor_local=true
suffixes="${override#coprocessor:}"
IFS=',' read -r -a services <<< "$suffixes"
for service in "${services[@]}"; do
service="${service#"${service%%[![:space:]]*}"}"
service="${service%"${service##*[![:space:]]}"}"
[ -n "$service" ] || continue
coprocessor_local_services+=("$service")
done
continue
fi
done
if [ "$coprocessor_local" = false ] && [ "${#overrides[@]}" -eq 0 ]; then
echo "::error::override did not contain any usable values"
exit 1
fi
if [ "$coprocessor_local" = true ]; then
{
echo "version: 1"
echo "kind: coprocessor-consensus"
echo "topology:"
echo " count: 2"
echo " threshold: 2"
echo "instances:"
echo " - index: 1"
echo " source:"
echo " mode: local"
if [ "${#coprocessor_local_services[@]}" -gt 0 ]; then
echo " localServices:"
for service in "${coprocessor_local_services[@]}"; do
echo " - ${service}"
done
fi
} > "$scenario_file"
scenario_path="$scenario_file"
fi
if [ -z "$WORKSPACE_OVERRIDE" ]; then
echo "::error::override did not contain any usable values"
exit 1
fi
;;
*)
echo "::error::image_mode must be registry or workspace"
exit 1
;;
esac
printf '%s\n%s\n%s\n%s\n' --target latest-release --scenario "$scenario_path" > "$args_file"
if [ "$IMAGE_MODE" = "workspace" ]; then
IFS=',' read -r -a overrides <<< "$WORKSPACE_OVERRIDE"
for raw in "${overrides[@]}"; do
override="${raw#"${raw%%[![:space:]]*}"}"
override="${override%"${override##*[![:space:]]}"}"
[ -n "$override" ] || continue
case "$override" in
all)
printf '%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n' \
--override gateway-contracts \
--override host-contracts \
--override kms-connector \
--override test-suite >> "$args_file"
;;
coprocessor|coprocessor:*)
;;
*)
printf '%s\n%s\n' --override "$override" >> "$args_file"
;;
esac
done
fi
FORCE_MODERN_RELAYER=$workspace_all ./scripts/resolve-workflow-compat-env.sh \
"${COPROCESSOR_DB_MIGRATION_VERSION:-}" \
"${COPROCESSOR_HOST_LISTENER_VERSION:-}" \
"${COPROCESSOR_GW_LISTENER_VERSION:-}" \
"${COPROCESSOR_TX_SENDER_VERSION:-}" \
"${COPROCESSOR_TFHE_WORKER_VERSION:-}" \
"${COPROCESSOR_SNS_WORKER_VERSION:-}" \
"${COPROCESSOR_ZKPROOF_WORKER_VERSION:-}" \
"${CONNECTOR_DB_MIGRATION_VERSION:-}" \
"${CONNECTOR_GW_LISTENER_VERSION:-}" \
"${CONNECTOR_KMS_WORKER_VERSION:-}" \
"${CONNECTOR_TX_SENDER_VERSION:-}" \
"${GATEWAY_VERSION:-}" \
"${HOST_VERSION:-}" \
"${TEST_SUITE_VERSION:-}"
echo "UP_ARGS_FILE=$args_file" >> "$GITHUB_ENV"
- name: Dry run
working-directory: test-suite/fhevm
run: |
mapfile -t up_args < "$UP_ARGS_FILE"
./fhevm-cli up "${up_args[@]}" --dry-run
- name: Boot fhevm Stack
working-directory: test-suite/fhevm
run: |
mapfile -t up_args < "$UP_ARGS_FILE"
./fhevm-cli up "${up_args[@]}"
# E2E tests on pausing the Host contracts
- name: Pause Host Contracts
working-directory: test-suite/fhevm
run: |
./fhevm-cli pause host
- name: Paused Host contracts test
working-directory: test-suite/fhevm
run: |
./fhevm-cli test paused-host-contracts
- name: Unpause Host Contracts
working-directory: test-suite/fhevm
run: |
./fhevm-cli unpause host
# E2E tests on pausing the Gateway contracts
- name: Pause Gateway Contracts
working-directory: test-suite/fhevm
run: |
./fhevm-cli pause gateway
- name: Paused Gateway contracts test
working-directory: test-suite/fhevm
run: |
./fhevm-cli test paused-gateway-contracts
- name: Unpause Gateway Contracts
working-directory: test-suite/fhevm
run: |
./fhevm-cli unpause gateway
# E2E tests after unpausing the Host and Gateway contracts
- name: Input proof test (uint64)
working-directory: test-suite/fhevm
run: |
./fhevm-cli test input-proof
- name: Input proof test with compute and decrypt (uint64)
working-directory: test-suite/fhevm
run: |
./fhevm-cli test input-proof-compute-decrypt
- name: User Decryption test
working-directory: test-suite/fhevm
run: |
./fhevm-cli test user-decryption
- name: Delegated User Decryption test
working-directory: test-suite/fhevm
run: |
./fhevm-cli test delegated-user-decryption
- name: ERC20 test
working-directory: test-suite/fhevm
run: |
./fhevm-cli test erc20
- name: Public Decryption HTTP endpoint test (ebool)
working-directory: test-suite/fhevm
run: |
./fhevm-cli test public-decrypt-http-ebool
- name: Public Decryption HTTP endpoint test (mixed)
working-directory: test-suite/fhevm
run: |
./fhevm-cli test public-decrypt-http-mixed
- name: Negative ACL tests
working-directory: test-suite/fhevm
run: |
./fhevm-cli test negative-acl
- name: Random operators test (subset)
working-directory: test-suite/fhevm
run: |
./fhevm-cli test random-subset
- name: HCU block cap test
working-directory: test-suite/fhevm
run: |
./fhevm-cli test hcu-block-cap
- name: Ciphertext drift test
working-directory: test-suite/fhevm
run: |
./fhevm-cli test ciphertext-drift
- name: Host listener poller test
working-directory: test-suite/fhevm
run: |
docker stop coprocessor-host-listener
./fhevm-cli test erc20
docker start coprocessor-host-listener
- name: Show logs on test failure
working-directory: test-suite/fhevm
if: failure()
run: |
snapshot_logs() {
local group="$1"
local container="$2"
local filter="${3:-}"
echo "::group::${group}"
if [ -n "$filter" ]; then
docker logs --tail 200 "${container}" 2>&1 | grep -v "$filter" || true
else
docker logs --tail 200 "${container}" 2>&1 || true
fi
echo "::endgroup::"
}
snapshot_logs "Relayer Logs" fhevm-relayer
snapshot_logs "SNS Worker Logs" coprocessor-sns-worker "Selected 0 rows to process"
snapshot_logs "Transaction Sender Logs (filtered)" coprocessor-transaction-sender "Selected 0 rows to process"
snapshot_logs "Host Listener" coprocessor-host-listener
snapshot_logs "Gateway Listener" coprocessor-gw-listener
snapshot_logs "ZKProof Worker" coprocessor-zkproof-worker
snapshot_logs "TFHE Worker" coprocessor-tfhe-worker
snapshot_logs "Coprocessor 2 - Host Listener" coprocessor1-host-listener
snapshot_logs "Coprocessor 2 - Gateway Listener" coprocessor1-gw-listener
snapshot_logs "Coprocessor 2 - SNS Worker" coprocessor1-sns-worker "Selected 0 rows to process"
snapshot_logs "Coprocessor 2 - Transaction Sender (filtered)" coprocessor1-transaction-sender "Selected 0 rows to process"
snapshot_logs "Coprocessor 2 - ZKProof Worker" coprocessor1-zkproof-worker
snapshot_logs "Coprocessor 2 - TFHE Worker" coprocessor1-tfhe-worker
- name: Cleanup
working-directory: test-suite/fhevm
if: always()
run: |
./fhevm-cli clean --images