Skip to content

Commit de2a341

Browse files
authored
Merge pull request #2685 from input-output-hk/ctl/2678-add-verification-step-of-tampered-cardano-database-in-CI
add cardano db verify step in the CI that fails on expected tampered/missing files
2 parents 6a7107e + 45f0d8b commit de2a341

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

.github/workflows/test-client.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,26 @@ jobs:
273273
shell: bash
274274
run: .github/workflows/scripts/verify-cardano-db-restoration.sh ./bin/cdb-v2-download-output.txt "${{ matrix.extra_args }}"
275275

276+
- name: Cardano Database V2 Snapshot / verify tampered and missing immutables from a specific range
277+
if: steps.aggregator_capability_unix.outputs.cardano_database_v2_enabled == 'true' || steps.aggregator_capability_windows.outputs.cardano_database_v2_enabled == 'true'
278+
shell: bash
279+
working-directory: ./bin
280+
run: |
281+
rm -f v2/db/immutable/00007.chunk
282+
rm -f v2/db/immutable/00007.primary
283+
rm -f v2/db/immutable/00007.secondary
284+
rm -f v2/db/immutable/00011.chunk
285+
echo "tampered chunk 5" > v2/db/immutable/00005.chunk
286+
echo "tampered primary 9" > v2/db/immutable/00009.primary
287+
echo "tampered outside verification range" > v2/db/immutable/00012.chunk
288+
./mithril-client ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db verify --end 10 --backend v2 --db-dir v2/db $CARDANO_DATABASE_V2_SNAPSHOT_HASH
289+
# Check missing files in immutables_verification_error-*.json
290+
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; }
291+
# Check tampered files in immutables_verification_error-*.json
292+
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; }
293+
# check that non-verifiable-files list is empty
294+
jq -e '.["non-verifiable-files"] | length == 0' immutables_verification_error-*.json || { echo "ERROR: non-verifiable-files is not empty!"; exit 1; }
295+
276296
test-docker:
277297
strategy:
278298
fail-fast: false

0 commit comments

Comments
 (0)