Skip to content

Commit 0df5853

Browse files
authored
Merge pull request #2706 from input-output-hk/ctl/2701-make-cardano-db-backend-v2-default
Make cardano-db backend v2 as default
2 parents 67b18cd + 45ff226 commit 0df5853

File tree

14 files changed

+70
-60
lines changed

14 files changed

+70
-60
lines changed

.github/workflows/test-client.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ jobs:
155155
working-directory: ./bin
156156
run: |
157157
./mithril-client ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db snapshot list --backend v1
158-
echo "CDB_SNAPSHOT_DIGEST=$(./mithril-client --origin-tag CI cardano-db snapshot list --json | jq -r '.[0].digest')" >> $GITHUB_ENV
158+
echo "CDB_SNAPSHOT_DIGEST=$(./mithril-client --origin-tag CI cardano-db snapshot list --backend v1 --json | jq -r '.[0].digest')" >> $GITHUB_ENV
159159
160160
- name: Cardano Database Snapshot / download & restore latest
161161
shell: bash
@@ -247,26 +247,26 @@ jobs:
247247
shell: bash
248248
working-directory: ./bin
249249
run: |
250-
./mithril-client ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db snapshot list --backend v2
251-
echo "CARDANO_DATABASE_V2_SNAPSHOT_HASH=$(./mithril-client --origin-tag CI cardano-db snapshot list --backend v2 --json | jq -r '.[0].hash')" >> $GITHUB_ENV
250+
./mithril-client ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db snapshot list
251+
echo "CARDANO_DATABASE_V2_SNAPSHOT_HASH=$(./mithril-client --origin-tag CI cardano-db snapshot list --json | jq -r '.[0].hash')" >> $GITHUB_ENV
252252
253253
- name: Cardano Database V2 Snapshot / show snapshot
254254
if: steps.aggregator_capability_unix.outputs.cardano_database_v2_enabled == 'true' || steps.aggregator_capability_windows.outputs.cardano_database_v2_enabled == 'true'
255255
shell: bash
256256
working-directory: ./bin
257-
run: ./mithril-client --origin-tag CI cardano-db snapshot show --backend v2 $CARDANO_DATABASE_V2_SNAPSHOT_HASH
257+
run: ./mithril-client --origin-tag CI cardano-db snapshot show $CARDANO_DATABASE_V2_SNAPSHOT_HASH
258258

259259
- name: Cardano Database V2 Snapshot / download & restore latest (Full restoration)
260260
if: steps.aggregator_capability_unix.outputs.cardano_database_v2_enabled == 'true' || steps.aggregator_capability_windows.outputs.cardano_database_v2_enabled == 'true'
261261
shell: bash
262262
working-directory: ./bin
263-
run: ./mithril-client ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db download --backend v2 --download-dir v2 $CARDANO_DATABASE_V2_SNAPSHOT_HASH ${{ matrix.extra_args }} 2>&1 | tee cdb-v2-download-output.txt
263+
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
264264

265265
- name: Cardano Database V2 Snapshot / verify immutables
266266
if: steps.aggregator_capability_unix.outputs.cardano_database_v2_enabled == 'true' || steps.aggregator_capability_windows.outputs.cardano_database_v2_enabled == 'true'
267267
shell: bash
268268
working-directory: ./bin
269-
run: ./mithril-client ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db verify --backend v2 --db-dir v2/db $CARDANO_DATABASE_V2_SNAPSHOT_HASH | tee cdb-v2-verify-output.txt
269+
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
270270

271271
- name: Cardano Database V2 Snapshot / verify Cardano node starts successfully
272272
if: matrix.os == 'ubuntu-24.04' && steps.aggregator_capability_unix.outputs.cardano_database_v2_enabled == 'true'
@@ -285,7 +285,7 @@ jobs:
285285
echo "tampered chunk 5" > v2/db/immutable/00005.chunk
286286
echo "tampered primary 9" > v2/db/immutable/00009.primary
287287
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
288+
./mithril-client ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db verify --end 10 --db-dir v2/db $CARDANO_DATABASE_V2_SNAPSHOT_HASH
289289
# Check missing files in immutables_verification_error-*.json
290290
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; }
291291
# Check tampered files in immutables_verification_error-*.json
@@ -411,23 +411,23 @@ jobs:
411411
if: steps.aggregator_capability.outputs.cardano_database_v2_enabled == 'true'
412412
shell: bash
413413
run: |
414-
${{ steps.command.outputs.mithril_client }} --origin-tag CI cardano-db snapshot list --backend v2
415-
echo "CARDANO_DATABASE_V2_SNAPSHOT_HASH=$(${{ steps.command.outputs.mithril_client }} --origin-tag CI cardano-db snapshot list --backend v2 --json | jq -r '.[0].hash')" >> $GITHUB_ENV
414+
${{ steps.command.outputs.mithril_client }} --origin-tag CI cardano-db snapshot list
415+
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
416416
417417
- name: Cardano Database V2 Snapshot / show snapshot
418418
if: steps.aggregator_capability.outputs.cardano_database_v2_enabled == 'true'
419419
shell: bash
420-
run: ${{ steps.command.outputs.mithril_client }} --origin-tag CI cardano-db snapshot show --backend v2 $CARDANO_DATABASE_V2_SNAPSHOT_HASH
420+
run: ${{ steps.command.outputs.mithril_client }} --origin-tag CI cardano-db snapshot show $CARDANO_DATABASE_V2_SNAPSHOT_HASH
421421

422422
- name: Cardano Database V2 Snapshot / download & restore latest (Full restoration)
423423
if: steps.aggregator_capability.outputs.cardano_database_v2_enabled == 'true'
424424
shell: bash
425-
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db download --backend v2 $CARDANO_DATABASE_V2_SNAPSHOT_HASH --download-dir /app/data/v2 ${{ matrix.extra_args }}
425+
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 }}
426426

427427
- name: Cardano Database V2 Snapshot / verify immutables
428428
if: steps.aggregator_capability.outputs.cardano_database_v2_enabled == 'true'
429429
shell: bash
430-
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db verify --backend v2 $CARDANO_DATABASE_V2_SNAPSHOT_HASH --db-dir /app/data/v2/db
430+
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
431431

432432
test-mithril-client-wasm:
433433
strategy:

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/website/blog/2025-06-17-client-cli-cardano-database-backends.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,14 @@ To support this transition, both certification versions will remain available du
4646

4747
- [ ] **Distribution +2**:
4848
- The `v2` backend will become the default
49-
- The `v1` backend will be deprecated.
5049

5150
- [ ] **Distribution +3**:
52-
- The `v1` backend will be decommissioned and removed from the client CLI and library.
51+
- The `v1` backend will be deprecated.
5352

5453
- [ ] **Distribution +4**:
54+
- The `v1` backend will be decommissioned and removed from the client CLI and library.
55+
56+
- [ ] **Distribution +5**:
5557
- The `v1` backend will be fully removed from the signer and aggregator.
5658

5759
If you have any questions or need assistance, contact the team on the [Discord channel](https://discord.gg/5kaErDKDRq).

docs/website/root/manual/develop/nodes/mithril-client.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ Here is a list of the available parameters:
554554

555555
| Parameter | Command line (long) | Command line (short) | Environment variable | Description | Default value | Example | Mandatory |
556556
| --------------------- | ----------------------- | :------------------: | --------------------- | --------------------------------------------------------------------------------------------------------------------- | ------------- | ------- | :----------------: |
557-
| `backend` | `--backend` | `-b` | - | Backend to use, either: `v1` (default, full database restoration only) or `v2` (full or partial database restoration) | `v1` | - | - |
557+
| `backend` | `--backend` | `-b` | - | Backend to use, either: `v1` (full database restoration only) or `v2` (default, full or partial database restoration) | `v2` | - | - |
558558
| `digest` | - | - | - | Digest of the Cardano db snapshot to show or `latest` for the latest artifact | - | - | :heavy_check_mark: |
559559
| `run_mode` | `--run-mode` | - | `RUN_MODE` | Run Mode | `dev` | - | - |
560560
| `verbose` | `--verbose` | `-v` | - | Verbosity level (-v=warning, -vv=info, -vvv=debug, -vvvv=trace) | `0` | - | - |
@@ -572,7 +572,7 @@ Here is a list of the available parameters:
572572

573573
| Parameter | Command line (long) | Command line (short) | Environment variable | Description | Default value | Example | Mandatory |
574574
| --------------------- | ----------------------- | :------------------: | --------------------- | --------------------------------------------------------------------------------------------------------------------- | ------------- | ------- | :-------: |
575-
| `backend` | `--backend` | `-b` | - | Backend to use, either: `v1` (default, full database restoration only) or `v2` (full or partial database restoration) | `v1` | - | - |
575+
| `backend` | `--backend` | `-b` | - | Backend to use, either: `v1` (full database restoration only) or `v2` (default, full or partial database restoration) | `v2` | - | - |
576576
| `run_mode` | `--run-mode` | - | `RUN_MODE` | Run Mode | `dev` | - | - |
577577
| `verbose` | `--verbose` | `-v` | - | Verbosity level (-v=warning, -vv=info, -vvv=debug, -vvvv=trace) | `0` | - | - |
578578
| `config_directory` | `--config-directory` | - | - | Directory where configuration file is located | `./config` | - | - |
@@ -589,7 +589,7 @@ Here is a list of the available parameters:
589589

590590
| Parameter | Command line (long) | Command line (short) | Environment variable | Description | Default value | Example | Mandatory |
591591
| ---------------------------- | ------------------------------ | :------------------: | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | ------------- | ------- | :----------------: |
592-
| `backend` | `--backend` | `-b` | - | Backend to use, either: `v1` (default, full database restoration only) or `v2` (full or partial database restoration) | `v1` | - | - |
592+
| `backend` | `--backend` | `-b` | - | Backend to use, either: `v1` (full database restoration only) or `v2` (default, full or partial database restoration) | `v2` | - | - |
593593
| `digest` | - | - | - | Digest of the Cardano db snapshot to download or `latest` for the latest artifact | - | - | :heavy_check_mark: |
594594
| `download_dir` | `--download-dir` | - | - | Directory where the immutable and ancillary files will be downloaded | - | - | - |
595595
| `genesis_verification_key` | `--genesis-verification-key` | - | `GENESIS_VERIFICATION_KEY` | Genesis verification key to check the certificate chain | - | - | :heavy_check_mark: |
@@ -614,7 +614,7 @@ Here is a list of the available parameters:
614614

615615
| Parameter | Command line (long) | Command line (short) | Environment variable | Description | Default value | Example | Mandatory |
616616
| -------------------------- | ---------------------------- | :------------------: | -------------------------- | --------------------------------------------------------------------------------------------------------------------- | ------------- | ------- | :----------------: |
617-
| `backend` | `--backend` | `-b` | - | Backend to use, either: `v1` (default, full database restoration only) or `v2` (full or partial database restoration) | `v2` | - | - |
617+
| `backend` | `--backend` | `-b` | - | Backend to use, either: `v1` (full database restoration only) or `v2` (default, full or partial database restoration) | `v2` | - | - |
618618
| `digest` | - | - | - | Digest of the Cardano db snapshot to verify or `latest` for the latest artifact | - | - | :heavy_check_mark: |
619619
| `db_dir` | `--db-dir` | - | - | Directory from where the immutable will be verified | - | - | - |
620620
| `genesis_verification_key` | `--genesis-verification-key` | - | `GENESIS_VERIFICATION_KEY` | Genesis verification key to check the certificate chain | - | - | - |

docs/website/root/manual/develop/run-mithril-devnet.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -585,16 +585,18 @@ AGGREGATOR_ENDPOINT=$AGGREGATOR_ENDPOINT ./mithril-client cardano-db download $S
585585
You will see that the certificate chain is validated to ensure the issued certificate is genuine and then the selected snapshot archive is downloaded, unpacked and verified against the corresponding certificate.
586586
587587
```bash
588-
1/5 - Checking local disk info…
589-
2/5 - Fetching the certificate and verifying the certificate chain…
590-
3/5 - Downloading and unpacking the Cardano db
591-
4/5 - Computing the Cardano db message
592-
5/5 - Verifying the cardano db signature…
593-
Cardano db 'db5f50a060d4b813125c4263b700ecc96e5d8c8710f0430e5c80d2f0fa79b667' has been unpacked and successfully verified with Mithril.
588+
1/7 - Checking local disk info…
589+
2/7 - Fetching the certificate and verifying the certificate chain…
590+
3/7 - Downloading and unpacking the cardano db snapshot
591+
4/7 - Downloading and verifying digests…
592+
5/7 - Verifying the cardano database
593+
6/7 - Computing the cardano db snapshot message
594+
7/7 - Verifying the cardano db signature…
595+
Cardano database snapshot 'bfd6621886fe1d3810e1ffb5e366c1688f9cc2ac1ee6aa40eb99ab28f0cc1fd6' archives have been successfully unpacked. Immutable files have been successfully verified with Mithril.
594596

595-
Files in the directory '/home/mithril/data/testnet/db5f50a060d4b813125c4263b700ecc96e5d8c8710f0430e5c80d2f0fa79b667/db' can be used to run a Cardano node with version >= 10.5.1.
597+
Files in the directory 'db' can be used to run a Cardano node with version >= 10.5.1.
596598

597599
If you are using Cardano Docker image, you can restore a Cardano Node with:
598600

599-
docker run -v cardano-node-ipc:/ipc -v cardano-node-data:/data --mount type=bind,source="/home/mithril/data/testnet/db5f50a060d4b813125c4263b700ecc96e5d8c8710f0430e5c80d2f0fa79b667/db",target=/data/db/ -e NETWORK=preview ghcr.io/intersectmbo/cardano-node:10.5.1
601+
docker run -v cardano-node-ipc:/ipc -v cardano-node-data:/data --mount type=bind,source="/home/mithril/data/testnet/bfd6621886fe1d3810e1ffb5e366c1688f9cc2ac1ee6aa40eb99ab28f0cc1fd6/db",target=/data/db/ -e NETWORK=preview ghcr.io/intersectmbo/cardano-node:10.5.1
600602
```

mithril-client-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mithril-client-cli"
3-
version = "0.12.30"
3+
version = "0.12.31"
44
description = "A Mithril Client"
55
authors = { workspace = true }
66
edition = { workspace = true }

mithril-client-cli/src/commands/cardano_db/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ use mithril_client::MithrilResult;
1818
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Default, ValueEnum)]
1919
pub enum CardanoDbCommandsBackend {
2020
/// Legacy backend
21-
#[default]
22-
#[clap(help = "[default] Legacy backend, full database restoration only")]
21+
#[clap(help = "Legacy backend, full database restoration only")]
2322
V1,
2423
/// V2 backend
25-
#[clap(help = "V2 backend, full or partial database restoration")]
24+
#[default]
25+
#[clap(help = "[default] V2 backend, full or partial database restoration")]
2626
V2,
2727
}
2828

mithril-test-lab/mithril-end-to-end/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mithril-end-to-end"
3-
version = "0.4.102"
3+
version = "0.4.103"
44
authors = { workspace = true }
55
edition = { workspace = true }
66
documentation = { workspace = true }

mithril-test-lab/mithril-end-to-end/src/bin/load-aggregator/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ async fn main() -> StdResult<()> {
3636
reporter.start("stress tests bootstrap");
3737
// configure a dummy immutable db
3838
let cardano_db = DummyCardanoDbBuilder::new("load-tester")
39-
.with_immutables(&[1, 2, 3])
39+
.with_immutables(&[0, 1, 2])
4040
.with_legacy_ledger_snapshots(&[533])
4141
.append_immutable_trio()
4242
.build();
@@ -226,7 +226,7 @@ async fn main_scenario(
226226
.unwrap();
227227

228228
info!(
229-
">> Send the Signer Signatures payloads for CardanoImmutableFiles({:?})",
229+
">> Send the Signer Signatures payloads for CardanoDatabase({:?})",
230230
current_beacon
231231
);
232232
parameters.reporter.start("signatures registration");

mithril-test-lab/mithril-end-to-end/src/mithril/client.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,9 @@ impl ClientCommand {
220220
ClientCommand::CardanoStakeDistribution(cmd) => {
221221
[vec!["cardano-stake-distribution".to_string()], cmd.cli_arg()].concat()
222222
}
223-
ClientCommand::CardanoDbV2(cmd) => [
224-
vec!["cardano-db".to_string()],
225-
cmd.cli_arg(),
226-
vec!["--backend".to_string(), "v2".to_string()],
227-
]
228-
.concat(),
223+
ClientCommand::CardanoDbV2(cmd) => {
224+
[vec!["cardano-db".to_string()], cmd.cli_arg()].concat()
225+
}
229226
};
230227
args.push("--json".to_string());
231228

0 commit comments

Comments
 (0)