Skip to content

fix: check of unexpected file too eager on all network except devnet #2517

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Alenar
Copy link
Collaborator

@Alenar Alenar commented May 23, 2025

Content

This PR make the unexpected download verifier to always expect immutable files starting from 0 on all network.

After checking it appears that all network starts at 0, but it was expecting the first immutable to be 1 on network that were not devnet, meaning that the first immutable files trio was removed after download, making impossible for the message verifier to compute the expected message.

Note: as this remove what was expected to be a business case, this change allow to simplify the unexpected download verifier api and code a bit.

Pre-submit checklist

  • Branch
    • Tests are provided (if possible)
    • Crates versions are 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
    • No new TODOs introduced

Issue(s)

Relates to #2429

… downloads

as it start at 0 for all networks, this allow to simplify the api
@Alenar Alenar self-assigned this May 23, 2025
Copy link

@Copilot 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 fixes the unexpected download verifier so that it always expects immutable files starting at 0 for all networks, simplifying the API and code.

  • Removed the redundant network parameter and related logic in UnexpectedDownloadedFileVerifier.
  • Updated tests and usage in SnapshotClient and InternalDownloader accordingly.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
mithril-client/src/utils/unexpected_downloaded_file_verifier.rs Removed network-specific behavior and updated tests/docs.
mithril-client/src/snapshot_client.rs Removed outdated network parameter from verifier invocation.
mithril-client/src/cardano_database_client/download_unpack/internal_downloader.rs Removed redundant network parameter from verifier call.
Comments suppressed due to low confidence (2)

mithril-client/src/utils/unexpected_downloaded_file_verifier.rs:15

  • Update the module-level comment to reflect the new behavior that immutable file numbers now always start at 0 and remove any reference to devnet-specific logic.
//!   * networks: immutables file numbers start at 1 on most network, but 0 on devnet

mithril-client/src/utils/unexpected_downloaded_file_verifier.rs:214

  • [nitpick] Revise the test case comments to state that the expected range always begins at 0, since the network distinction has been removed.
// Specs:

Copy link

Test Results

    3 files  ±0     77 suites  ±0   15m 17s ⏱️ -37s
1 929 tests  - 2  1 929 ✅  - 2  0 💤 ±0  0 ❌ ±0 
3 272 runs   - 6  3 272 ✅  - 6  0 💤 ±0  0 ❌ ±0 

Results for commit 615a138. ± Comparison against base commit 623dbe8.

This pull request removes 4 and adds 2 tests. Note that renamed tests count towards both.
mithril-client ‑ utils::unexpected_downloaded_file_verifier::tests::compute_expected_state_after_download::when_dir_empty_return_empty_if_immutable_files_dir_does_not_exist_and_range_is_empty
mithril-client ‑ utils::unexpected_downloaded_file_verifier::tests::compute_expected_state_after_download::when_dir_empty_return_empty_if_immutable_files_dir_exist_and_range_is_empty
mithril-client ‑ utils::unexpected_downloaded_file_verifier::tests::compute_expected_state_after_download::when_immutable_files_dir_does_not_exist_return_immutables_trios_if_immutable_files_range_is_not_empty
mithril-client ‑ utils::unexpected_downloaded_file_verifier::tests::compute_expected_state_after_download::when_immutable_files_dir_empty_return_immutables_trios_if_immutable_files_range_is_not_empty
mithril-client ‑ utils::unexpected_downloaded_file_verifier::tests::compute_expected_state_after_download::when_db_dir_contains_empty_immutable_dir_return_minimal_set
mithril-client ‑ utils::unexpected_downloaded_file_verifier::tests::compute_expected_state_after_download::when_db_dir_empty_return_minimal_set

@Alenar Alenar temporarily deployed to testing-preview May 23, 2025 15:29 — with GitHub Actions Inactive
Copy link
Collaborator

@dlachaume dlachaume left a comment

Choose a reason for hiding this comment

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

LGTM 👍

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 👍

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.

3 participants