Skip to content

Commit 87e278d

Browse files
committed
ci(test-client): allow verification of node startup with lmdb ledger
1 parent 95a9b7f commit 87e278d

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

.github/workflows/scripts/verify-cardano-db-restoration.sh

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,17 @@ if [[ ! -f "$1" ]]; then
1414
exit 1
1515
fi
1616

17-
CLIENT_CMD_OUTPUT=$(cat "$1")
18-
INCLUDE_ANCILLARY="$2"
17+
CLIENT_CMD_OUTPUT=$(cat "$1"); shift
18+
INCLUDE_ANCILLARY="false"
19+
LEDGER_BACKEND="in-memory"
20+
21+
while [[ "$#" -gt 0 ]]; do
22+
case $1 in
23+
--include-ancillary) INCLUDE_ANCILLARY="true" ;;
24+
--ledger-backend) LEDGER_BACKEND="$2"; shift ;;
25+
esac
26+
shift
27+
done
1928

2029
DOCKER_CMD=$(echo "$CLIENT_CMD_OUTPUT" | grep -E '^\s*docker run')
2130
if [[ -z "$DOCKER_CMD" ]]; then
@@ -26,6 +35,11 @@ fi
2635
echo "Extracted Docker command:"
2736
echo "$DOCKER_CMD"
2837

38+
# Note: ledger conversion to lmdb can only be executed if ancillary files are included
39+
if [[ ${LEDGER_BACKEND,,} == "lmdb" && "$INCLUDE_ANCILLARY" == "true" ]]; then
40+
DOCKER_CMD="${DOCKER_CMD/ ghcr/" -e CARDANO_CONFIG_JSON_MERGE='{\"LedgerDB\":{\"Backend\":\"V1LMDB\"}}' ghcr"}"
41+
fi
42+
2943
DOCKER_CMD_DETACHED="${DOCKER_CMD/docker run/docker run -d}"
3044
echo "Running Docker command in detached mode:"
3145
echo "$DOCKER_CMD_DETACHED"
@@ -58,7 +72,7 @@ else
5872
exit 1
5973
fi
6074

61-
if [[ "$INCLUDE_ANCILLARY" == "--include-ancillary" ]]; then
75+
if [[ "$INCLUDE_ANCILLARY" == "true" ]]; then
6276
echo "Parameter '--include-ancillary' is set."
6377
if wait_for_log "$CONTAINER_ID" 30 "Chain extended, new tip"; then
6478
echo "✅ The Cardano node started successfully from the Mithril snapshot with the ancillary files."

.github/workflows/test-client.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ jobs:
8888
cardano_stake_distribution_enabled: ${{ steps.prepare.outputs.cardano_stake_distribution_enabled }}
8989
cardano_database_v2_enabled: ${{ steps.prepare.outputs.cardano_database_v2_enabled }}
9090
available_cardano_database_backends: ${{ steps.prepare.outputs.available_cardano_database_backends }}
91+
bin-cdb-download-matrix-include: ${{ steps.prepare.outputs.bin-cdb-download-matrix-include }}
9192
steps:
9293
- name: Prepare
9394
id: prepare
@@ -115,8 +116,10 @@ jobs:
115116
116117
if [[ $CARDANO_DATABASE_V2_CAPABILITY == "true" ]]; then
117118
echo 'available_cardano_database_backends=["v1","v2"]' >> $GITHUB_OUTPUT
119+
echo 'bin-cdb-download-matrix-include=[{"backend":"v2","os":"ubuntu-24.04","ledger_backend":"lmdb","extra_args":"--include-ancillary"}]' >> $GITHUB_OUTPUT
118120
else
119121
echo 'available_cardano_database_backends=["v1"]' >> $GITHUB_OUTPUT
122+
echo 'bin-cdb-download-matrix-include=[]' >> $GITHUB_OUTPUT
120123
fi
121124
122125
bin:
@@ -247,8 +250,11 @@ jobs:
247250
matrix:
248251
backend: ${{ fromJson(needs.prepare.outputs.available_cardano_database_backends) }}
249252
os: [ubuntu-24.04, ubuntu-24.04-arm, macos-14, windows-latest]
253+
ledger_backend: ["in-memory"]
250254
extra_args: ["", "--include-ancillary"]
251255

256+
include: ${{ fromJson(needs.prepare.outputs.bin-cdb-download-matrix-include) }}
257+
252258
runs-on: ${{ matrix.os }}
253259
env:
254260
GENESIS_VERIFICATION_KEY: ${{ needs.prepare.outputs.genesis_verification_key }}
@@ -291,12 +297,12 @@ jobs:
291297
292298
- name: Ledger state snapshot conversion from InMemory to LMDB
293299
# The 'snapshot-converter' binary is not currently supported on Linux ARM64 platforms.
294-
if: matrix.os != 'ubuntu-24.04-arm' && matrix.extra_args == '--include-ancillary' && matrix.backend == 'v2'
300+
if: matrix.os != 'ubuntu-24.04-arm' && matrix.extra_args == '--include-ancillary' && matrix.ledger_backend == 'lmdb'
295301
env:
296302
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
297303
shell: bash
298304
working-directory: ./bin
299-
run: ./mithril-client ${{ needs.prepare.outputs.debug_level }} tools utxo-hd snapshot-converter --db-directory v2/db --cardano-node-version latest --utxo-hd-flavor LMDB --commit
305+
run: ./mithril-client ${{ needs.prepare.outputs.debug_level }} tools utxo-hd snapshot-converter --db-directory ${{ matrix.backend }}/db --cardano-node-version latest --utxo-hd-flavor LMDB --commit
300306

301307
- name: Cardano Database V2 Snapshot / verify immutables
302308
if: matrix.backend == 'v2'
@@ -307,7 +313,7 @@ jobs:
307313
- name: Cardano Database Snapshot / verify Cardano node starts successfully
308314
if: matrix.os == 'ubuntu-24.04'
309315
shell: bash
310-
run: .github/workflows/scripts/verify-cardano-db-restoration.sh ./bin/cdb-${{ matrix.backend }}-download-output.txt "${{ matrix.extra_args }}"
316+
run: .github/workflows/scripts/verify-cardano-db-restoration.sh ./bin/cdb-${{ matrix.backend }}-download-output.txt --ledger-backend ${{ matrix.ledger_backend }} ${{ matrix.extra_args }}
311317

312318
- name: Cardano Database V2 Snapshot / verify tampered and missing immutables from a specific range
313319
if: matrix.backend == 'v2'

0 commit comments

Comments
 (0)