Skip to content
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

feat: incremental cardano database restoration with client CLI #2318

Conversation

dlachaume
Copy link
Collaborator

@dlachaume dlachaume commented Feb 17, 2025

Content

This PR introduces a new unstable subcommand for cardano-db-v2 command in the client CLI.

It allows users to restore an Incremental Cardano DB snapshots using the following options:

  • --start: set the first immutable file number to download
  • --end: set the last immutable file number to download.
  • --include-ancillary: specify if the ancillary file must be downloaded
  • --allow-override: allow existing files in the download directory to be overridden.

The command must be run with a specific snapshot artifact_hash or using latest (fetch the latest produced artifact).

A rework of the IndicatifFeedbackReceiver has been done to handle and display the Cardano database events sent by the client library:
image

Additionally, the E2E test and the Mithril Client multi-platform test manual workflow have been updated to verify the command.


Examples:

Restore a full Cardano database:

mithril-client --unstable cardano-db-v2 download latest

Restore a Cardano database with ancillary files:

mithril-client --unstable cardano-db-v2 download latest --include-ancillary

Restore from a starting point:

mithril-client --unstable cardano-db-v2 snapshot list --start 17000

Restore using a range:

mithril-client --unstable cardano-db-v2 snapshot list --start 17000 --end 18000

Restore until a end point:

mithril-client --unstable cardano-db-v2 snapshot list --end 18000

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
    • No clippy warnings in the CI
    • 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)

Issue(s)

Closes #2246

@dlachaume dlachaume self-assigned this Feb 17, 2025
Copy link

github-actions bot commented Feb 17, 2025

Test Results

    3 files  ±  0     52 suites  ±0   10m 40s ⏱️ -6s
1 698 tests + 41  1 698 ✅ + 41  0 💤 ±0  0 ❌ ±0 
2 086 runs  +123  2 086 ✅ +123  0 💤 ±0  0 ❌ ±0 

Results for commit a9c87ee. ± Comparison against base commit d7080eb.

This pull request removes 10 and adds 51 tests. Note that renamed tests count towards both.
mithril-client ‑ cardano_database_client::download_unpack::tests::download_unpack_ancillary_file::download_unpack_ancillary_files_sends_feedbacks
mithril-client ‑ cardano_database_client::download_unpack::tests::download_unpack_immutable_files::download_unpack_immutable_files_sends_feedbacks_when_fails
mithril-client ‑ cardano_database_client::download_unpack::tests::download_unpack_immutable_files::download_unpack_immutable_files_sends_feedbacks_when_succeeds
mithril-client ‑ cardano_database_client::proving::tests::download_unpack_digest_file::sends_feedbacks
mithril-client ‑ file_downloader::interface::tests::download_event_type_builds_correct_event
mithril-client ‑ snapshot_client::tests_download::download_unpack_send_feedbacks
mithril-client-cli ‑ utils::cardano_db::test::check_disk_space_error_should_return_warning_message_if_error_is_not_enough_space
mithril-client-cli ‑ utils::cardano_db_download_checker::test::return_error_if_not_enough_available_space
mithril-client-cli ‑ utils::cardano_db_download_checker::test::return_error_if_unpack_directory_exists_and_not_empty
mithril-client-cli ‑ utils::cardano_db_download_checker::test::return_ok_if_unpack_directory_exist_and_empty
mithril-client ‑ cardano_database_client::statistics::tests::add_statistics_do_not_increments_immutable_files_restored_when_no_immutable_files_restored
mithril-client ‑ cardano_database_client::statistics::tests::add_statistics_increments_immutable_files_restored
mithril-client ‑ cardano_database_client::statistics::tests::add_statistics_with_ancillary
mithril-client ‑ cardano_database_client::statistics::tests::add_statistics_with_full_restoration
mithril-client ‑ cardano_database_client::statistics::tests::add_statistics_with_partial_restoration
mithril-client ‑ cardano_database_client::statistics::tests::add_statistics_without_ancillary
mithril-client ‑ file_downloader::http::tests::test_download_http_file_send_feedback
mithril-client ‑ file_downloader::http::tests::test_download_local_file_send_feedback
mithril-client ‑ file_downloader::interface::tests::download_event_type_builds_completed_event
mithril-client ‑ file_downloader::interface::tests::download_event_type_builds_progress_event
…

♻️ This comment has been updated with latest results.

@dlachaume dlachaume temporarily deployed to testing-sanchonet February 17, 2025 18:19 — with GitHub Actions Inactive
@jpraynaud jpraynaud force-pushed the jpraynaud/2214-client-library-cardano-database-restore branch from 3fcea9b to 1a4d98a Compare February 18, 2025 15:38
@dlachaume dlachaume force-pushed the dlachaume/2246/client-cli-incremental-cardano-database-restoration branch from ccc5bba to 504fc0a Compare February 18, 2025 16:06
@jpraynaud jpraynaud force-pushed the jpraynaud/2214-client-library-cardano-database-restore branch 4 times, most recently from 68c58fb to c318e5b Compare February 19, 2025 10:10
Base automatically changed from jpraynaud/2214-client-library-cardano-database-restore to main February 19, 2025 10:35
@dlachaume dlachaume force-pushed the dlachaume/2246/client-cli-incremental-cardano-database-restoration branch 2 times, most recently from e618d0f to 3ff5aa4 Compare February 19, 2025 11:48
@dlachaume dlachaume force-pushed the dlachaume/2246/client-cli-incremental-cardano-database-restoration branch from 3ff5aa4 to 1d41bc2 Compare February 19, 2025 13:08
@dlachaume dlachaume force-pushed the dlachaume/2246/client-cli-incremental-cardano-database-restoration branch 2 times, most recently from 35d01f7 to 329c02c Compare February 20, 2025 17:46
@dlachaume dlachaume force-pushed the dlachaume/2246/client-cli-incremental-cardano-database-restoration branch 6 times, most recently from d6aa693 to 8efc964 Compare February 21, 2025 17:04
@dlachaume dlachaume force-pushed the dlachaume/2246/client-cli-incremental-cardano-database-restoration branch from 8efc964 to 0eaf982 Compare February 21, 2025 17:34
@dlachaume dlachaume force-pushed the dlachaume/2246/client-cli-incremental-cardano-database-restoration branch from 0eaf982 to 2ff6c05 Compare February 21, 2025 18:11
dlachaume and others added 26 commits February 25, 2025 09:37
Co-authored-by: DJO <Alenar@users.noreply.github.com>
Fetch the `CardanoDatabaseSnapshot` by its hash (or use `latest`) and verify the certificate chain using its certificate hash.
- simplify tests by unit testing each function (`check_path_is_an_empty_dir`, `check_dir_writable`, `check_disk_space`) instead of testing directly `check_prerequisites`.
- renamed `check_prerequisites` to `check_prerequisites_for_archive` and added `check_prerequisites_for_uncompressed_data` for distinct verification flows.
- renamed `check_disk_space` to `check_disk_space_for_archive` and added `check_disk_space_for_uncompressed_data` to separately validate disk space for uncompressed data.
…edback receiver

Co-authored-by: DJO <Alenar@users.noreply.github.com>
Co-authored-by: DJO <Alenar@users.noreply.github.com>
…ent`

Also add `digest` to `Full` variant for `DownloadEvent`.

Co-authored-by: DJO <Alenar@users.noreply.github.com>
… clients to the downloader

Co-authored-by: DJO <Alenar@users.noreply.github.com>
Co-authored-by: DJO <Alenar@users.noreply.github.com>
…ultiple downloads at once

Co-authored-by: DJO <Alenar@users.noreply.github.com>
…DownloadProgressReporter`

Co-authored-by: DJO <Alenar@users.noreply.github.com>
…porter`

Co-authored-by: DJO <Alenar@users.noreply.github.com>
…bytes downloaded

Co-authored-by: DJO <Alenar@users.noreply.github.com>
Also remove use of unnecessary `StdResult`.

Co-authored-by: DJO <Alenar@users.noreply.github.com>
…oadProgressReporter`

Co-authored-by: DJO <Alenar@users.noreply.github.com>
Co-authored-by: DJO <Alenar@users.noreply.github.com>
Co-authored-by: DJO <Alenar@users.noreply.github.com>
- add a comment with an example of Windows canonicalize path for clarity in client `http` module
- rename test in CLI `multi_download_progress_reporter` module
* mithril-client-cli from `0.11.2` to `0.11.3`
* mithril-client from `0.11.4` to `0.11.5`
* mithril-end-to-end from `0.4.70` to `0.4.71`
@dlachaume dlachaume force-pushed the dlachaume/2246/client-cli-incremental-cardano-database-restoration branch from f5b2e88 to a9c87ee Compare February 25, 2025 08:39
@dlachaume dlachaume merged commit 8f9e3b6 into main Feb 25, 2025
37 of 41 checks passed
@dlachaume dlachaume deleted the dlachaume/2246/client-cli-incremental-cardano-database-restoration branch February 25, 2025 09:02
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.

Implement Incremental Cardano DB in client CLI
4 participants