forked from input-output-hk/mithril
-
Notifications
You must be signed in to change notification settings - Fork 0
518 lines (452 loc) · 27.5 KB
/
test-client.yml
File metadata and controls
518 lines (452 loc) · 27.5 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
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
name: Mithril Client multi-platform test
on:
workflow_dispatch:
inputs:
commit_sha:
description: |
SHA of the commit on which the mithril-client binary should be obtained, a "ci.yml" workflow must have run
on it else no binary would be available leading to the failure of this.
If not provided the last commit on the main branch will be used instead.
required: false
type: string
docker_image_id:
description: The selected Docker image id.
required: true
type: string
default: latest
network:
description: The name of the selected Cardano network.
required: true
type: string
default: preview
aggregator_endpoint:
description: The endpoint of the selected aggregator of the Mithril network.
required: true
type: string
default: https://aggregator.pre-release-preview.api.mithril.network/aggregator
genesis_verification_key:
description: The genesis verification key location for the Mithril network.
required: false
type: string
default: https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/pre-release-preview/genesis.vkey
transactions_hashes_to_certify:
description: Comma separated list of transactions hashes to test certification on.
required: false
type: string
ancillary_verification_key:
description: The ancillary verification key location to verify the ancillary files.
required: false
type: string
default: https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/pre-release-preview/ancillary.vkey
enable_debug:
description: Enable debug output ("-vvv") for the mithril-client calls
required: true
type: boolean
default: false
workflow_call:
inputs:
commit_sha:
type: string
docker_image_id:
type: string
default: unstable
network:
type: string
default: preview
aggregator_endpoint:
type: string
default: https://aggregator.testing-preview.api.mithril.network/aggregator
genesis_verification_key:
type: string
default: https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/testing-preview/genesis.vkey
transactions_hashes_to_certify:
type: string
default: 1f7dbc899a898ceb4274bbc33b31ca5f0de497753c6c6795fa34838fc252de9b,c43e809de628f7c1ba41a44f188ed3872bb1f97aa101271e35424a8e1d95bea9,c61e22ac4a79a02b28ed36217369ff6959465790a4fe9e66738b7a820e174fcd
ancillary_verification_key:
type: string
default: https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/testing-preview/ancillary.vkey
enable_debug:
type: boolean
default: false
jobs:
test-binaries:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm, macos-14, windows-latest]
extra_args: ["", "--include-ancillary"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Prepare environment variables
id: prepare
shell: bash
run: |
if [[ -n "${{ inputs.commit_sha }}" ]]; then
echo "sha=${{ inputs.commit_sha }}" >> $GITHUB_OUTPUT
else
echo "branch=main" >> $GITHUB_OUTPUT
fi
if [[ "${{ inputs.enable_debug }}" == "true" ]]; then
echo "debug_level=-vvv" >> $GITHUB_OUTPUT
fi
echo "NETWORK=${{ inputs.network }}" >> $GITHUB_ENV
echo "AGGREGATOR_ENDPOINT=${{ inputs.aggregator_endpoint }}" >> $GITHUB_ENV
echo "GENESIS_VERIFICATION_KEY=$(curl -s ${{ inputs.genesis_verification_key }})" >> $GITHUB_ENV
echo "TRANSACTIONS_HASHES_TO_CERTIFY=${{ inputs.transactions_hashes_to_certify }}" >> $GITHUB_ENV
echo "ANCILLARY_VERIFICATION_KEY=$(curl -s ${{ inputs.ancillary_verification_key }})" >> $GITHUB_ENV
- name: Assessing aggregator capabilities (Unix)
id: aggregator_capability_unix
if: runner.os != 'Windows'
shell: bash
run: |
CARDANO_TRANSACTIONS_CAPABILITY=$(wget -q -O - $AGGREGATOR_ENDPOINT | jq '.capabilities.signed_entity_types | contains(["CardanoTransactions"])')
CARDANO_STAKE_DISTRIBUTION_CAPABILITY=$(wget -q -O - $AGGREGATOR_ENDPOINT | jq '.capabilities.signed_entity_types | contains(["CardanoStakeDistribution"])')
CARDANO_DATABASE_V2_CAPABILITY=$(wget -q -O - $AGGREGATOR_ENDPOINT | jq '.capabilities.signed_entity_types | contains(["CardanoDatabase"])')
echo "cardano_transactions_enabled=$CARDANO_TRANSACTIONS_CAPABILITY" >> $GITHUB_OUTPUT
echo "cardano_stake_distribution_enabled=$CARDANO_STAKE_DISTRIBUTION_CAPABILITY" >> $GITHUB_OUTPUT
echo "cardano_database_v2_enabled=$CARDANO_DATABASE_V2_CAPABILITY" >> $GITHUB_OUTPUT
- name: Assessing aggregator capabilities (Windows)
id: aggregator_capability_windows
if: runner.os == 'Windows'
shell: bash
run: |
aria2c -o aggregator_capabilities.json $AGGREGATOR_ENDPOINT
CARDANO_TRANSACTIONS_CAPABILITY=$(jq '.capabilities.signed_entity_types | contains(["CardanoTransactions"])' aggregator_capabilities.json)
CARDANO_STAKE_DISTRIBUTION_CAPABILITY=$(jq '.capabilities.signed_entity_types | contains(["CardanoStakeDistribution"])' aggregator_capabilities.json)
CARDANO_DATABASE_V2_CAPABILITY=$(jq '.capabilities.signed_entity_types | contains(["CardanoDatabase"])' aggregator_capabilities.json)
echo "cardano_transactions_enabled=$CARDANO_TRANSACTIONS_CAPABILITY" >> $GITHUB_OUTPUT
echo "cardano_stake_distribution_enabled=$CARDANO_STAKE_DISTRIBUTION_CAPABILITY" >> $GITHUB_OUTPUT
echo "cardano_database_v2_enabled=$CARDANO_DATABASE_V2_CAPABILITY" >> $GITHUB_OUTPUT
- name: Checkout binary
uses: dawidd6/action-download-artifact@v6
with:
name: mithril-distribution-${{ runner.os }}-${{ runner.arch }}
path: ./bin
commit: ${{ steps.prepare.outputs.sha }}
branch: ${{ steps.prepare.outputs.branch }}
workflow: ci.yml
workflow_conclusion: success
- name: Set permissions
shell: bash
working-directory: ./bin
run: chmod +x ./mithril-client
- name: Show client version
shell: bash
working-directory: ./bin
run: ./mithril-client ${{ steps.prepare.outputs.debug_level }} --version
- name: Cardano Database Snapshot / list and get last digest
shell: bash
working-directory: ./bin
run: |
./mithril-client ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db snapshot list --backend v1
echo "CDB_SNAPSHOT_DIGEST=$(./mithril-client --origin-tag CI cardano-db snapshot list --backend v1 --json | jq -r '.[0].digest')" >> $GITHUB_ENV
- name: Cardano Database Snapshot / download & restore latest
shell: bash
working-directory: ./bin
run: ./mithril-client ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db download $CDB_SNAPSHOT_DIGEST --backend v1 --download-dir v1 ${{ matrix.extra_args }} 2>&1 | tee cdb-download-output.txt
- name: Cardano Database Snapshot / verify Cardano node starts successfully
if: matrix.os == 'ubuntu-24.04'
shell: bash
run: .github/workflows/scripts/verify-cardano-db-restoration.sh ./bin/cdb-download-output.txt "${{ matrix.extra_args }}"
# The 'snapshot-converter' binary is not currently supported on Linux ARM64 platforms.
- name: Ledger state snapshot conversion from InMemory to LMDB
if: matrix.os != 'ubuntu-24.04-arm' && matrix.extra_args == '--include-ancillary'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
working-directory: ./bin
run: ./mithril-client ${{ steps.prepare.outputs.debug_level }} tools utxo-hd snapshot-converter --db-directory v1/db --cardano-node-version latest --utxo-hd-flavor LMDB --commit
- name: Remove downloaded artifacts to free up disk space (Linux, Windows)
if: runner.os != 'macOS'
shell: bash
working-directory: ./bin
run: rm --force v1/db/immutable/*.{chunk,primary,secondary}
- name: Remove downloaded artifacts to free up disk space (macOs)
if: runner.os == 'macOS'
shell: bash
working-directory: ./bin
run: sudo rm -rf v1/db/
- name: Mithril Stake Distribution / list and get last hash
shell: bash
working-directory: ./bin
run: |
./mithril-client ${{ steps.prepare.outputs.debug_level }} --origin-tag CI mithril-stake-distribution list
echo "MITHRIL_STAKE_DISTRIBUTION_HASH=$(./mithril-client --origin-tag CI mithril-stake-distribution list --json | jq -r '.[0].hash')" >> $GITHUB_ENV
- name: Mithril Stake Distribution / download & restore latest
shell: bash
working-directory: ./bin
run: ./mithril-client ${{ steps.prepare.outputs.debug_level }} --origin-tag CI mithril-stake-distribution download $MITHRIL_STAKE_DISTRIBUTION_HASH
- name: Cardano transaction / list and get last snapshot
if: steps.aggregator_capability_unix.outputs.cardano_transactions_enabled == 'true' || steps.aggregator_capability_windows.outputs.cardano_transactions_enabled == 'true'
shell: bash
working-directory: ./bin
run: |
./mithril-client ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-transaction snapshot list
echo "CTX_SNAPSHOT_HASH=$(./mithril-client --origin-tag CI cardano-transaction snapshot list --json | jq -r '.[0].hash')" >> $GITHUB_ENV
- name: Cardano transaction / show snapshot
if: steps.aggregator_capability_unix.outputs.cardano_transactions_enabled == 'true' || steps.aggregator_capability_windows.outputs.cardano_transactions_enabled == 'true'
shell: bash
working-directory: ./bin
run: ./mithril-client --origin-tag CI cardano-transaction snapshot show $CTX_SNAPSHOT_HASH
- name: Cardano transaction certify
if: steps.aggregator_capability_unix.outputs.cardano_transactions_enabled == 'true' || steps.aggregator_capability_windows.outputs.cardano_transactions_enabled == 'true'
shell: bash
working-directory: ./bin
run: ./mithril-client ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-transaction certify $TRANSACTIONS_HASHES_TO_CERTIFY
- name: Cardano Stake Distribution / list and get last epoch and hash
if: steps.aggregator_capability_unix.outputs.cardano_stake_distribution_enabled == 'true' || steps.aggregator_capability_windows.outputs.cardano_stake_distribution_enabled == 'true'
shell: bash
working-directory: ./bin
run: |
./mithril-client ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-stake-distribution list
CMD_OUTPUT=$(./mithril-client --origin-tag CI cardano-stake-distribution list --json)
echo "CARDANO_STAKE_DISTRIBUTION_EPOCH=$(echo "$CMD_OUTPUT" | jq -r '.[0].epoch')" >> $GITHUB_ENV
echo "CARDANO_STAKE_DISTRIBUTION_HASH=$(echo "$CMD_OUTPUT" | jq -r '.[0].hash')" >> $GITHUB_ENV
- name: Cardano Stake Distribution / download & restore latest by epoch
if: steps.aggregator_capability_unix.outputs.cardano_stake_distribution_enabled == 'true' || steps.aggregator_capability_windows.outputs.cardano_stake_distribution_enabled == 'true'
shell: bash
working-directory: ./bin
run: ./mithril-client ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-stake-distribution download $CARDANO_STAKE_DISTRIBUTION_EPOCH
- name: Cardano Stake Distribution / download & restore latest by hash
if: steps.aggregator_capability_unix.outputs.cardano_stake_distribution_enabled == 'true' || steps.aggregator_capability_windows.outputs.cardano_stake_distribution_enabled == 'true'
shell: bash
working-directory: ./bin
run: ./mithril-client ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-stake-distribution download $CARDANO_STAKE_DISTRIBUTION_HASH
- name: Cardano Database V2 Snapshot / list and get last hash
if: steps.aggregator_capability_unix.outputs.cardano_database_v2_enabled == 'true' || steps.aggregator_capability_windows.outputs.cardano_database_v2_enabled == 'true'
shell: bash
working-directory: ./bin
run: |
./mithril-client ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db snapshot list
echo "CARDANO_DATABASE_V2_SNAPSHOT_HASH=$(./mithril-client --origin-tag CI cardano-db snapshot list --json | jq -r '.[0].hash')" >> $GITHUB_ENV
- name: Cardano Database V2 Snapshot / show snapshot
if: steps.aggregator_capability_unix.outputs.cardano_database_v2_enabled == 'true' || steps.aggregator_capability_windows.outputs.cardano_database_v2_enabled == 'true'
shell: bash
working-directory: ./bin
run: ./mithril-client --origin-tag CI cardano-db snapshot show $CARDANO_DATABASE_V2_SNAPSHOT_HASH
- name: Cardano Database V2 Snapshot / download & restore latest (Full restoration)
if: steps.aggregator_capability_unix.outputs.cardano_database_v2_enabled == 'true' || steps.aggregator_capability_windows.outputs.cardano_database_v2_enabled == 'true'
shell: bash
working-directory: ./bin
run: ./mithril-client ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db download --download-dir v2 $CARDANO_DATABASE_V2_SNAPSHOT_HASH ${{ matrix.extra_args }} 2>&1 | tee cdb-v2-download-output.txt
- name: Cardano Database V2 Snapshot / verify immutables
if: steps.aggregator_capability_unix.outputs.cardano_database_v2_enabled == 'true' || steps.aggregator_capability_windows.outputs.cardano_database_v2_enabled == 'true'
shell: bash
working-directory: ./bin
run: ./mithril-client ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db verify --db-dir v2/db $CARDANO_DATABASE_V2_SNAPSHOT_HASH | tee cdb-v2-verify-output.txt
- name: Cardano Database V2 Snapshot / verify Cardano node starts successfully
if: matrix.os == 'ubuntu-24.04' && steps.aggregator_capability_unix.outputs.cardano_database_v2_enabled == 'true'
shell: bash
run: .github/workflows/scripts/verify-cardano-db-restoration.sh ./bin/cdb-v2-download-output.txt "${{ matrix.extra_args }}"
- name: Cardano Database V2 Snapshot / verify tampered and missing immutables from a specific range
if: steps.aggregator_capability_unix.outputs.cardano_database_v2_enabled == 'true' || steps.aggregator_capability_windows.outputs.cardano_database_v2_enabled == 'true'
shell: bash
working-directory: ./bin
run: |
rm -f v2/db/immutable/00007.chunk
rm -f v2/db/immutable/00007.primary
rm -f v2/db/immutable/00007.secondary
rm -f v2/db/immutable/00011.chunk
echo "tampered chunk 5" > v2/db/immutable/00005.chunk
echo "tampered primary 9" > v2/db/immutable/00009.primary
echo "tampered outside verification range" > v2/db/immutable/00012.chunk
./mithril-client ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db verify --end 10 --db-dir v2/db $CARDANO_DATABASE_V2_SNAPSHOT_HASH
# Check missing files in immutables_verification_error-*.json
jq -r '.["missing-files"] | sort | @csv' immutables_verification_error-*.json | grep -qx '"00007.chunk","00007.primary","00007.secondary"' || { echo "Error: missing-files array does not match expected values!"; exit 1; }
# Check tampered files in immutables_verification_error-*.json
jq -r '.["tampered-files"] | sort | @csv' immutables_verification_error-*.json | grep -qx '"00005.chunk","00009.primary"' || { echo "Error: tampered-files array does not match expected values!"; exit 1; }
# check that non-verifiable-files list is empty
jq -e '.["non-verifiable-files"] | length == 0' immutables_verification_error-*.json || { echo "ERROR: non-verifiable-files is not empty!"; exit 1; }
test-docker:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04]
extra_args: ["", "--include-ancillary"]
runs-on: ${{ matrix.os }}
steps:
- name: Prepare environment variables
id: prepare
shell: bash
run: |
if [[ "${{ inputs.enable_debug }}" == "true" ]]; then
echo "debug_level=-vvv" >> $GITHUB_OUTPUT
fi
echo "MITHRIL_IMAGE_ID=${{ inputs.docker_image_id }}" >> $GITHUB_ENV
echo "NETWORK=${{ inputs.network }}" >> $GITHUB_ENV
echo "AGGREGATOR_ENDPOINT=${{ inputs.aggregator_endpoint }}" >> $GITHUB_ENV
echo "GENESIS_VERIFICATION_KEY=$(curl -s ${{ inputs.genesis_verification_key }})" >> $GITHUB_ENV
echo "TRANSACTIONS_HASHES_TO_CERTIFY=${{ inputs.transactions_hashes_to_certify }}" >> $GITHUB_ENV
echo "ANCILLARY_VERIFICATION_KEY=$(curl -s ${{ inputs.ancillary_verification_key }})" >> $GITHUB_ENV
- name: Assessing aggregator capabilities
id: aggregator_capability
shell: bash
run: |
CARDANO_TRANSACTIONS_CAPABILITY=$(wget -q -O - $AGGREGATOR_ENDPOINT | jq '.capabilities.signed_entity_types | contains(["CardanoTransactions"])')
CARDANO_STAKE_DISTRIBUTION_CAPABILITY=$(wget -q -O - $AGGREGATOR_ENDPOINT | jq '.capabilities.signed_entity_types | contains(["CardanoStakeDistribution"])')
CARDANO_DATABASE_V2_CAPABILITY=$(wget -q -O - $AGGREGATOR_ENDPOINT | jq '.capabilities.signed_entity_types | contains(["CardanoDatabase"])')
echo "cardano_transactions_enabled=$CARDANO_TRANSACTIONS_CAPABILITY" >> $GITHUB_OUTPUT
echo "cardano_stake_distribution_enabled=$CARDANO_STAKE_DISTRIBUTION_CAPABILITY" >> $GITHUB_OUTPUT
echo "cardano_database_v2_enabled=$CARDANO_DATABASE_V2_CAPABILITY" >> $GITHUB_OUTPUT
- name: Prepare Mithril client command
id: command
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
mkdir -p $PWD/data
chmod -R a+w $PWD/data
echo "mithril_client=docker run --rm -e NETWORK=$NETWORK -e GENESIS_VERIFICATION_KEY=$GENESIS_VERIFICATION_KEY -e ANCILLARY_VERIFICATION_KEY=$ANCILLARY_VERIFICATION_KEY -e AGGREGATOR_ENDPOINT=$AGGREGATOR_ENDPOINT -e GITHUB_TOKEN=$GITHUB_TOKEN --name='mithril-client' -v $PWD/data:/app/data ghcr.io/input-output-hk/mithril-client:$MITHRIL_IMAGE_ID" >> $GITHUB_OUTPUT
- name: Show client version
shell: bash
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} --version
- name: Cardano Database Snapshot / list and get last digest
shell: bash
run: |
${{ steps.command.outputs.mithril_client }} --origin-tag CI cardano-db snapshot list --backend v1
echo "CDB_SNAPSHOT_DIGEST=$(${{ steps.command.outputs.mithril_client }} --origin-tag CI cardano-db snapshot list --backend v1 --json | jq -r '.[0].digest')" >> $GITHUB_ENV
- name: Cardano Database Snapshot / download & restore latest
shell: bash
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db download $CDB_SNAPSHOT_DIGEST --backend v1 --download-dir /app/data/v1 ${{ matrix.extra_args }}
- name: Ledger state snapshot conversion from InMemory to LMDB
if: matrix.extra_args == '--include-ancillary'
shell: bash
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} tools utxo-hd snapshot-converter --db-directory /app/data/v1/db --cardano-node-version latest --utxo-hd-flavor LMDB --commit
- name: Remove downloaded artifacts to free up disk space
shell: bash
run: sudo rm -rf $PWD/data/v1/db/
- name: Mithril Stake Distribution / list and get last hash
shell: bash
run: |
${{ steps.command.outputs.mithril_client }} --origin-tag CI mithril-stake-distribution list
echo "MITHRIL_STAKE_DISTRIBUTION_HASH=$(${{ steps.command.outputs.mithril_client }} --origin-tag CI mithril-stake-distribution list --json | jq -r '.[0].hash')" >> $GITHUB_ENV
- name: Mithril Stake Distribution / download & restore latest
shell: bash
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} --origin-tag CI mithril-stake-distribution download $MITHRIL_STAKE_DISTRIBUTION_HASH --download-dir /app/data
- name: Cardano transaction / list and get last snapshot
if: steps.aggregator_capability.outputs.cardano_transactions_enabled == 'true'
shell: bash
run: |
${{ steps.command.outputs.mithril_client }} --origin-tag CI cardano-transaction snapshot list
echo "CTX_SNAPSHOT_HASH=$(${{ steps.command.outputs.mithril_client }} --origin-tag CI cardano-transaction snapshot list --json | jq -r '.[0].hash')" >> $GITHUB_ENV
- name: Cardano transaction / show snapshot
if: steps.aggregator_capability.outputs.cardano_transactions_enabled == 'true'
shell: bash
run: ${{ steps.command.outputs.mithril_client }} --origin-tag CI cardano-transaction snapshot show $CTX_SNAPSHOT_HASH
- name: Cardano transaction certify
if: steps.aggregator_capability.outputs.cardano_transactions_enabled == 'true'
shell: bash
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-transaction certify $TRANSACTIONS_HASHES_TO_CERTIFY
- name: Cardano Stake Distribution / list and get last epoch and hash
if: steps.aggregator_capability.outputs.cardano_stake_distribution_enabled == 'true'
shell: bash
run: |
${{ steps.command.outputs.mithril_client }} --origin-tag CI cardano-stake-distribution list
CMD_OUTPUT=$(${{ steps.command.outputs.mithril_client }} --origin-tag CI cardano-stake-distribution list --json)
echo "CARDANO_STAKE_DISTRIBUTION_EPOCH=$(echo "$CMD_OUTPUT" | jq -r '.[0].epoch')" >> $GITHUB_ENV
echo "CARDANO_STAKE_DISTRIBUTION_HASH=$(echo "$CMD_OUTPUT" | jq -r '.[0].hash')" >> $GITHUB_ENV
- name: Cardano Stake Distribution / download & restore latest by epoch
if: steps.aggregator_capability.outputs.cardano_stake_distribution_enabled == 'true'
shell: bash
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-stake-distribution download $CARDANO_STAKE_DISTRIBUTION_EPOCH --download-dir /app/data
- name: Cardano Stake Distribution / download & restore latest by hash
if: steps.aggregator_capability.outputs.cardano_stake_distribution_enabled == 'true'
shell: bash
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-stake-distribution download $CARDANO_STAKE_DISTRIBUTION_HASH --download-dir /app/data
- name: Cardano Database V2 Snapshot / list and get last digest
if: steps.aggregator_capability.outputs.cardano_database_v2_enabled == 'true'
shell: bash
run: |
${{ steps.command.outputs.mithril_client }} --origin-tag CI cardano-db snapshot list
echo "CARDANO_DATABASE_V2_SNAPSHOT_HASH=$(${{ steps.command.outputs.mithril_client }} --origin-tag CI cardano-db snapshot list --json | jq -r '.[0].hash')" >> $GITHUB_ENV
- name: Cardano Database V2 Snapshot / show snapshot
if: steps.aggregator_capability.outputs.cardano_database_v2_enabled == 'true'
shell: bash
run: ${{ steps.command.outputs.mithril_client }} --origin-tag CI cardano-db snapshot show $CARDANO_DATABASE_V2_SNAPSHOT_HASH
- name: Cardano Database V2 Snapshot / download & restore latest (Full restoration)
if: steps.aggregator_capability.outputs.cardano_database_v2_enabled == 'true'
shell: bash
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db download $CARDANO_DATABASE_V2_SNAPSHOT_HASH --download-dir /app/data/v2 ${{ matrix.extra_args }}
- name: Cardano Database V2 Snapshot / verify immutables
if: steps.aggregator_capability.outputs.cardano_database_v2_enabled == 'true'
shell: bash
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db verify $CARDANO_DATABASE_V2_SNAPSHOT_HASH --db-dir /app/data/v2/db
test-mithril-client-wasm:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Download built artifacts
uses: dawidd6/action-download-artifact@v6
with:
name: mithril-distribution-wasm
path: ./mithril-client-wasm
commit: ${{ steps.prepare.outputs.sha }}
branch: ${{ steps.prepare.outputs.branch }}
workflow: ci.yml
workflow_conclusion: success
- name: Unpack 'mithril-client-wasm' package
working-directory: mithril-client-wasm
run: tar -xvzf *.tgz && mv package/dist .
- name: Install dependencies
working-directory: mithril-client-wasm
run: make ci-test-install
- name: Create .env file
working-directory: mithril-client-wasm
run: |
echo "AGGREGATOR_ENDPOINT=${{ inputs.aggregator_endpoint }}" > ./ci-test/.env
echo "GENESIS_VERIFICATION_KEY=$(curl -s ${{ inputs.genesis_verification_key }})" >> ./ci-test/.env
echo "TRANSACTIONS_HASHES_TO_CERTIFY=${{ inputs.transactions_hashes_to_certify }}" >> ./ci-test/.env
- name: Start the server
working-directory: mithril-client-wasm
shell: bash
run: make ci-test-serve &
- name: Wait for the server to be ready
shell: bash
run: |
MAX_ATTEMPTS=30
CURRENT_ATTEMPT=0
while true
do
sleep 1
CURRENT_ATTEMPT=$(( ${CURRENT_ATTEMPT} + 1 ))
if nc -z localhost 8080; then
echo "Server is ready."
break
fi
if [ "$CURRENT_ATTEMPT" -ge "$MAX_ATTEMPTS" ]; then
echo "Error: Server not ready after $MAX_ATTEMPTS attempts."
exit 1
fi
done
- name: Install selenium
shell: bash
run: pip install selenium
- name: Run Chrome headless
shell: bash
run: |
python3 ./.github/workflows/scripts/run-wasm-tests-browser-headless.py chrome
./.github/workflows/scripts/parse-wasm-headless-tests-results.sh chrome-results.html
- name: Run Firefox headless
shell: bash
run: |
python3 ./.github/workflows/scripts/run-wasm-tests-browser-headless.py firefox
./.github/workflows/scripts/parse-wasm-headless-tests-results.sh firefox-results.html
- name: Upload Results Artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: mithril-client-wasm-tests-artifacts-run_${{ github.run_number }}-attempt_${{ github.run_attempt }}-os_${{ matrix.os }}
path: |
chrome-results.html
chrome-driver.log
chrome-console.log
firefox-results.html
firefox-driver.log
if-no-files-found: error