Skip to content

Feat: add mithril-client CLI command for UTxO-HD ledger state snapshot conversion #2518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

dlachaume
Copy link
Collaborator

@dlachaume dlachaume commented May 23, 2025

Content

This PR includes a new mithril-client CLI command to convert a restored InMemory ledger state snapshot using the snapshot-converter tool from the Cardano node distribution.

The command mithril-client tools utxo-hd snapshot-converter is marked as unstable and must be used with the --unstable flag.

It supports selecting a target UTxO-HD flavor (LMDB or Legacy) and optionally replacing the current ledger state with the converted snapshot using the --commit flag.

Example:

mithril-client --unstable tools utxo-hd snapshot-converter --db-directory ./db --cardano-node-version 10.4.1 --utxo-hd-flavor LMDB --cardano-network preview --commit
Downloading Cardano node distribution for tag: '10.4.1'...
Distribution downloaded successfully. Archive location: ./db/tmp/cardano-node-distribution/cardano-node-10.4.1-macos.tar.gz
Unpacking distribution from archive: ./db/tmp/cardano-node-distribution/cardano-node-10.4.1-macos.tar.gz
Distribution unpacked successfully to: ./db/tmp/cardano-node-distribution
Converting ledger state snapshot to 'LMDB' flavor
Loading snapshot...
Loaded snapshot
Writing snapshot...
Written snapshot
Upgrading and replacing ledger state in ./db/ledger with converted snapshot: ./db/tmp/snapshots/82383798_lmdb

Pre-submit checklist

  • Branch
    • Tests are provided (if possible)
    • Crates versions are updated (if relevant)
    • CHANGELOG file is updated (if relevant)
    • Commit sequence broadly makes sense
    • Key commits have useful messages
  • PR
    • All check jobs of the CI have succeeded
    • Self-reviewed the diff
    • Useful pull request description
    • Reviewer requested
  • Documentation
    • Update README file (if relevant)
    • Update documentation website (if relevant)
    • Add dev blog post (if relevant)
    • Add ADR blog post or Dev ADR entry (if relevant)
    • No new TODOs introduced

Issue(s)

Closes #2492

@dlachaume dlachaume self-assigned this May 23, 2025
Copy link

github-actions bot commented May 23, 2025

Test Results

    3 files  ±  0     77 suites  ±0   13m 50s ⏱️ - 2m 27s
1 985 tests + 45  1 985 ✅ + 45  0 💤 ±0  0 ❌ ±0 
3 427 runs  +135  3 427 ✅ +135  0 💤 ±0  0 ❌ ±0 

Results for commit 5b39c59. ± Comparison against base commit 29be6f6.

♻️ This comment has been updated with latest results.

@dlachaume dlachaume temporarily deployed to testing-preview May 23, 2025 16:27 — with GitHub Actions Inactive
@dlachaume dlachaume force-pushed the dlachaume/2492/add-client-cli-command-for-utxo-hd-ledger-state-snapshot-conversion branch from cc19034 to 1cb0c25 Compare June 2, 2025 13:03
@dlachaume dlachaume temporarily deployed to testing-preview June 2, 2025 13:13 — with GitHub Actions Inactive
@dlachaume dlachaume force-pushed the dlachaume/2492/add-client-cli-command-for-utxo-hd-ledger-state-snapshot-conversion branch 2 times, most recently from a9a2e1e to 4f877a0 Compare June 2, 2025 14:31
@dlachaume dlachaume temporarily deployed to testing-preview June 2, 2025 14:44 — with GitHub Actions Inactive
@dlachaume dlachaume force-pushed the dlachaume/2492/add-client-cli-command-for-utxo-hd-ledger-state-snapshot-conversion branch from 4f877a0 to 4576675 Compare June 2, 2025 14:59
@dlachaume dlachaume temporarily deployed to testing-preview June 2, 2025 15:09 — with GitHub Actions Inactive
@dlachaume dlachaume force-pushed the dlachaume/2492/add-client-cli-command-for-utxo-hd-ledger-state-snapshot-conversion branch from 4576675 to cdbff79 Compare June 2, 2025 16:12
@dlachaume dlachaume temporarily deployed to testing-preview June 2, 2025 16:21 — with GitHub Actions Inactive
@dlachaume dlachaume force-pushed the dlachaume/2492/add-client-cli-command-for-utxo-hd-ledger-state-snapshot-conversion branch 2 times, most recently from 680a476 to ff07c4f Compare June 2, 2025 17:27
@dlachaume dlachaume temporarily deployed to testing-preview June 2, 2025 17:38 — with GitHub Actions Inactive
@dlachaume dlachaume force-pushed the dlachaume/2492/add-client-cli-command-for-utxo-hd-ledger-state-snapshot-conversion branch 3 times, most recently from 286c8d2 to 02b9448 Compare June 3, 2025 07:11
@dlachaume dlachaume temporarily deployed to testing-preview June 3, 2025 07:21 — with GitHub Actions Inactive
@dlachaume dlachaume force-pushed the dlachaume/2492/add-client-cli-command-for-utxo-hd-ledger-state-snapshot-conversion branch from 02b9448 to 0b71f51 Compare June 3, 2025 17:14
@dlachaume dlachaume temporarily deployed to testing-preview June 3, 2025 17:25 — with GitHub Actions Inactive
@dlachaume dlachaume force-pushed the dlachaume/2492/add-client-cli-command-for-utxo-hd-ledger-state-snapshot-conversion branch 2 times, most recently from a023a54 to 3fa570c Compare June 4, 2025 09:28
@dlachaume dlachaume temporarily deployed to testing-preview June 4, 2025 09:38 — with GitHub Actions Inactive
@dlachaume dlachaume force-pushed the dlachaume/2492/add-client-cli-command-for-utxo-hd-ledger-state-snapshot-conversion branch from 3fa570c to 89a712d Compare June 4, 2025 09:40
@dlachaume dlachaume temporarily deployed to testing-preview June 4, 2025 09:50 — with GitHub Actions Inactive
@dlachaume dlachaume force-pushed the dlachaume/2492/add-client-cli-command-for-utxo-hd-ledger-state-snapshot-conversion branch from 89a712d to 5126d95 Compare June 4, 2025 13:21
@dlachaume dlachaume temporarily deployed to testing-preview June 4, 2025 13:36 — with GitHub Actions Inactive
@dlachaume dlachaume force-pushed the dlachaume/2492/add-client-cli-command-for-utxo-hd-ledger-state-snapshot-conversion branch from 163d6d6 to 2c55cf5 Compare June 5, 2025 10:25
@dlachaume dlachaume temporarily deployed to testing-preview June 5, 2025 10:35 — with GitHub Actions Inactive
@dlachaume dlachaume force-pushed the dlachaume/2492/add-client-cli-command-for-utxo-hd-ledger-state-snapshot-conversion branch from 2c55cf5 to 074f5ee Compare June 5, 2025 13:00
@dlachaume dlachaume temporarily deployed to testing-preview June 5, 2025 13:11 — with GitHub Actions Inactive
dlachaume added 2 commits June 5, 2025 16:10
Extracts and sorts valid ledger snapshots by slot number, then returns the oldest one.
@dlachaume dlachaume force-pushed the dlachaume/2492/add-client-cli-command-for-utxo-hd-ledger-state-snapshot-conversion branch from 074f5ee to e3ce6cd Compare June 5, 2025 14:10
@dlachaume dlachaume temporarily deployed to testing-preview June 5, 2025 14:20 — with GitHub Actions Inactive
@dlachaume dlachaume force-pushed the dlachaume/2492/add-client-cli-command-for-utxo-hd-ledger-state-snapshot-conversion branch 2 times, most recently from e0ea5cc to f2e3feb Compare June 5, 2025 15:02
@dlachaume dlachaume temporarily deployed to testing-preview June 5, 2025 15:12 — with GitHub Actions Inactive
@dlachaume dlachaume force-pushed the dlachaume/2492/add-client-cli-command-for-utxo-hd-ledger-state-snapshot-conversion branch from f2e3feb to 5b39c59 Compare June 5, 2025 16:09
@dlachaume dlachaume temporarily deployed to testing-preview June 5, 2025 16:19 — with GitHub Actions Inactive
@dlachaume dlachaume merged commit f03f887 into main Jun 6, 2025
42 of 45 checks passed
@dlachaume dlachaume deleted the dlachaume/2492/add-client-cli-command-for-utxo-hd-ledger-state-snapshot-conversion branch June 6, 2025 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a Mithril client CLI command for UTxO-HD ledger state snapshot conversion
4 participants