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

Redesign mithril client api #1332

Merged
merged 52 commits into from
Nov 13, 2023
Merged

Conversation

Alenar
Copy link
Collaborator

@Alenar Alenar commented Nov 8, 2023

Content

This PR add the mithril-client library crate, see #1311 for details.

Still todo:

  • Polish/refine/complete the developer doc on website

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
    • 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)

Relates to #1311

Copy link

github-actions bot commented Nov 8, 2023

Test Results

    3 files  ±  0    29 suites  +12   6m 31s ⏱️ -43s
732 tests +17  732 ✔️ +17  0 💤 ±0  0 ±0 
840 runs  +51  840 ✔️ +51  0 💤 ±0  0 ±0 

Results for commit 76347c5. ± Comparison against base commit b0177e5.

♻️ This comment has been updated with latest results.

@Alenar Alenar force-pushed the ensemble/1311/redesign_mithril_client_api branch from 4fd9587 to a1f5ca9 Compare November 8, 2023 17:15
/// If not set a default implementation will be used.
pub fn with_immutable_digester(
mut self,
immutable_digester: Arc<dyn ImmutableDigester>,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should we re-export ImmutableDigester and it's error chain ?

mithril-client/src/type_alias.rs Outdated Show resolved Hide resolved
mithril-client/src/snapshot_downloader.rs Outdated Show resolved Hide resolved
mithril-client/src/snapshot_downloader.rs Outdated Show resolved Hide resolved
mithril-client/src/snapshot_downloader.rs Outdated Show resolved Hide resolved
mithril-client/src/snapshot_client.rs Outdated Show resolved Hide resolved
@Alenar Alenar force-pushed the ensemble/1311/redesign_mithril_client_api branch from a1f5ca9 to 96628b3 Compare November 8, 2023 17:33
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 👍

Nice work guys 💪

The majority of the comments are related to fixing typos.

.github/workflows/ci.yml Outdated Show resolved Hide resolved
mithril-client-cli/Cargo.toml Outdated Show resolved Hide resolved
mithril-client/src/feedback.rs Outdated Show resolved Hide resolved
mithril-client/src/feedback.rs Outdated Show resolved Hide resolved
mithril-client/src/feedback.rs Outdated Show resolved Hide resolved
mithril-client/src/feedback.rs Outdated Show resolved Hide resolved
.github/workflows/ci.yml Show resolved Hide resolved
@dlachaume dlachaume force-pushed the ensemble/1311/redesign_mithril_client_api branch 2 times, most recently from 342795d to 27fc71f Compare November 9, 2023 16:36
@jpraynaud
Copy link
Member

@scarmuega, @falcucci this is the PR for the new mithril-client library. It should be merged very shortly.

We also intend to publish it on crates.io in the comping weeks 👍

@scarmuega
Copy link

amazing!

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.

Few more comments 👼

@Alenar Alenar force-pushed the ensemble/1311/redesign_mithril_client_api branch from c3c9d98 to 862eca1 Compare November 10, 2023 14:47
@Alenar Alenar force-pushed the ensemble/1311/redesign_mithril_client_api branch from 862eca1 to 863b4c1 Compare November 13, 2023 10:37
Alenar and others added 24 commits November 13, 2023 12:47
…ient

This allow to reduce the number of re-export of `mithril-common` needed
since we can now use a `CerticateMessage` as our main certicate type
instead of using the `mithril_common::entities::Certificate` full type.
Meaning that we don't have to re-export crypto helpers or types anymore !

To do so we define a new `CertificateVerifier` trait that only have a
method that validate a chain and implement it with a new
`MithrilCertificateVerifier` struct that use internally the verifier
from `mithril-common`.
As with the `InternalCertificateRetriever` this add some complexity to
this specific part but the trade-off for it are worth it (as said
before: no crypto type re-export leading to far less mithril-common
dependency on the api level).
Using `pub use` instead of `pub type` lead to a better rust-doc since
the re-exported type are displayed as 'internal' type instead of alias.

+ Move all alias to a dedicated mod to cleanup the `lib.rs`.
This simplify the import of those types that are likely the one that will
be the most used by third parties.

Co-authored-by: Damien Lachaume <dlachaumepalo@users.noreply.github.com>
Fix typos and move `certificate().verify_chain` before
`snapshot().download_unpack` in integration test, doc and example.
 - Fix outdated `utils` module documentation.
 - Add more details on a hack comment.
 - rename `aggregator_url` to `aggregator_endpoint`.
 - rename `SnapshotDownloadComplete` mithril event to
  `SnapshotDownloadCompleted`.
 - Add a Todo on the verify chain to specify that we want
  to merge most of its code in the `mithril-common` codebase.
Since the cli won't be used anymore to define the client library.
Typos in dev documentation and lib.rs
Only use the features that we needs
By running 'nix flake update' command.
@Alenar Alenar force-pushed the ensemble/1311/redesign_mithril_client_api branch from f6f73d3 to 76347c5 Compare November 13, 2023 11:55
@Alenar Alenar merged commit 78981d2 into main Nov 13, 2023
26 checks passed
@Alenar Alenar deleted the ensemble/1311/redesign_mithril_client_api branch November 13, 2023 12:07
falcucci pushed a commit to falcucci/mithril that referenced this pull request Nov 28, 2023
…/1311/redesign_mithril_client_api

Redesign mithril client api
falcucci pushed a commit to falcucci/mithril that referenced this pull request Nov 28, 2023
…/1311/redesign_mithril_client_api

Redesign mithril client api
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.

5 participants