Skip to content

Conversation

@turmelclem
Copy link
Collaborator

@turmelclem turmelclem commented Jul 15, 2025

Content

improve client library and CLI for verify command to list missing, tampered and/or non verifiable files

  • verify command can now be use with a range
  • a flag can be use (--allow-missing) to not throw error if immutable file is missing

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

Comments

Issue(s)

Closes #2618

@github-actions
Copy link

github-actions bot commented Jul 15, 2025

Test Results

    4 files  ± 0    164 suites  ±0   22m 31s ⏱️ -54s
2 181 tests +16  2 181 ✅ +16  0 💤 ±0  0 ❌ ±0 
6 706 runs  +64  6 706 ✅ +64  0 💤 ±0  0 ❌ ±0 

Results for commit 9370314. ± Comparison against base commit 0461172.

This pull request removes 1 and adds 17 tests. Note that renamed tests count towards both.
mithril-client ‑ cardano_database_client::proving::tests::compute_merkle_proof::compute_merkle_proof_succeeds
mithril-client ‑ cardano_database_client::proving::tests::download_and_verify_digests::download_and_verify_digest_should_return_digest_map_acording_to_beacon
mithril-client ‑ cardano_database_client::proving::tests::list_immutable_files_not_verified::should_return_empty_list_when_no_tampered_files
mithril-client ‑ cardano_database_client::proving::tests::list_immutable_files_not_verified::should_return_list_with_non_verifiable
mithril-client ‑ cardano_database_client::proving::tests::list_immutable_files_not_verified::should_return_list_with_tampered_files
mithril-client ‑ message::tests::cardano_database_message::compute_cardano_database_message_should_fail_if_immutable_is_missing_and_allow_missing_not_set
mithril-client ‑ message::tests::cardano_database_message::compute_cardano_database_message_should_fail_if_immutable_is_tampered
mithril-client ‑ message::tests::cardano_database_message::compute_cardano_database_message_should_fail_if_immutables_are_missing_and_tampered
mithril-client ‑ message::tests::cardano_database_message::compute_cardano_database_message_should_fail_if_there_is_more_local_immutable_than_verified_digest
mithril-client ‑ message::tests::cardano_database_message::compute_cardano_database_message_should_success_if_immutable_is_missing_and_allow_missing_is_set
mithril-client ‑ message::tests::cardano_database_message::compute_cardano_database_message_succeeds
…

♻️ This comment has been updated with latest results.

@turmelclem turmelclem force-pushed the ctl/2618-list-invalid-or-missing-immutable-files-in-verify-command branch from 48bf6a1 to 68915c2 Compare July 15, 2025 08:47
@turmelclem turmelclem force-pushed the ctl/2618-list-invalid-or-missing-immutable-files-in-verify-command branch from 68915c2 to 169a685 Compare July 15, 2025 08:54
@turmelclem turmelclem force-pushed the ctl/2618-list-invalid-or-missing-immutable-files-in-verify-command branch 5 times, most recently from 6a98b96 to 2af282f Compare July 16, 2025 14:05
@turmelclem turmelclem force-pushed the ctl/2618-list-invalid-or-missing-immutable-files-in-verify-command branch 3 times, most recently from 54a2b7c to cc140f0 Compare July 16, 2025 16:22
@turmelclem turmelclem self-assigned this Jul 17, 2025
@turmelclem turmelclem force-pushed the ctl/2618-list-invalid-or-missing-immutable-files-in-verify-command branch 6 times, most recently from 2eae876 to 65218e9 Compare July 17, 2025 15:55
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the Cardano database snapshot verification by listing missing or tampered immutable files instead of failing silently. It refactors the digest download and Merkle-proof verification into a unified flow, introduces detailed error types with file listings, and updates the CLI to surface these details in both JSON and human-readable formats.

  • Refactored compute_merkle_proof into download_and_verify_digests, returning VerifiedDigests (digest map + Merkle tree).
  • Extended MessageBuilder::compute_cardano_database_message to accept VerifiedDigests, handle an allow_missing flag, and return rich error information (ImmutableFilesLists).
  • Updated CLI commands to write JSON error files and print counts of missing/tampered files.

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
mithril-client/tests/cardano_db_snapshot_list_get_download_verify.rs Updated tests to use download_and_verify_digests and VerifiedDigests.
mithril-client/src/message.rs Added ImmutableFilesLists, ComputeCardanoDatabaseMessageError, and enhanced compute_cardano_database_message.
mithril-client/src/cardano_database_client/proving.rs Replaced compute_merkle_proof with download_and_verify_digests returning VerifiedDigests.
mithril-client/src/cardano_database_client/api.rs Updated public API to expose download_and_verify_digests.
mithril-client-cli/src/commands/cardano_db/verify.rs Integrated new error handling in the verify command and JSON output.

@turmelclem turmelclem temporarily deployed to testing-preview July 17, 2025 16:05 — with GitHub Actions Inactive
@turmelclem turmelclem force-pushed the ctl/2618-list-invalid-or-missing-immutable-files-in-verify-command branch from 65218e9 to b33c6f7 Compare July 18, 2025 08:32
@turmelclem turmelclem temporarily deployed to testing-preview July 18, 2025 08:42 — with GitHub Actions Inactive
Clément Turmel added 16 commits September 1, 2025 16:43
…ano database message with a structured error
…red immutables files in case of ImmutableFilesVerification error
@turmelclem turmelclem force-pushed the ctl/2618-list-invalid-or-missing-immutable-files-in-verify-command branch from 9eaf920 to 8c183f5 Compare September 1, 2025 14:52
@turmelclem turmelclem requested a review from jpraynaud September 2, 2025 07:29
Copy link
Member

@jpraynaud jpraynaud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Clément Turmel added 2 commits September 2, 2025 09:54
 name = "client-cardano-database-v2" -version = "0.0.12" +version = "0.0.13" * mithril-client-cli from `0.12.26` to `0.12.27`
* mithril-client from `0.12.27` to `0.12.28`
@turmelclem turmelclem force-pushed the ctl/2618-list-invalid-or-missing-immutable-files-in-verify-command branch from a06362d to 9370314 Compare September 2, 2025 07:55
@turmelclem turmelclem merged commit 9d9e963 into main Sep 2, 2025
41 checks passed
@turmelclem turmelclem deleted the ctl/2618-list-invalid-or-missing-immutable-files-in-verify-command branch September 2, 2025 08:06
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.

List the invalid/missing immutable files in the verify command in client CLI

5 participants