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
Ensemble/895/mithril client snapshot commands #951
Ensemble/895/mithril client snapshot commands #951
Conversation
Test Results 3 files ± 0 30 suites ±0 5m 28s ⏱️ -19s Results for commit fbece38. ± Comparison against base commit b2124a3. This pull request removes 33 and adds 11 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
I left few comments below
Arc::new(CertificateClient::new(http_client)), | ||
Arc::new(MithrilCertificateVerifier::new(slog_scope::logger())), | ||
Arc::new(CardanoImmutableDigester::new( | ||
Path::new(""), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a comment or to do here to explain with the path is empty?
Arc::new(CertificateClient::new(http_client)), | ||
Arc::new(MithrilCertificateVerifier::new(slog_scope::logger())), | ||
Arc::new(CardanoImmutableDigester::new( | ||
Path::new(""), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above
|
||
/// Convert Snapshot to SnapshotFieldItems routine | ||
fn convert_to_field_items(snapshot: &Snapshot) -> Vec<SnapshotFieldItem> { | ||
let mut field_items = vec![ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could add a SnapshotFieldItem
with the Cardano network and use the snapshot.beacon.network
to retrieve the value
@@ -21,10 +21,6 @@ pub struct Config { | |||
/// for the purpose of tabular display | |||
#[derive(Table, Debug, Clone, PartialEq, Eq, PartialOrd, Serialize)] | |||
pub struct SnapshotListItem { | |||
/// Cardano network |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could have kept this information of the Cardano network and use the snapshot.beacon.network
to retrieve the value
mithril-client/src/main.rs
Outdated
/// CLI command list | ||
#[derive(Subcommand, Debug, Clone)] | ||
enum Commands { | ||
enum SnapshotCommands { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be declared in the snapshot command sub-module? WDYT?
mithril-client/src/main.rs
Outdated
/// List available snapshots | ||
#[clap(arg_required_else_help = false)] | ||
List(ListCommand), | ||
List(SnapshotListCommand), | ||
|
||
/// Show detailed informations about a snapshot | ||
#[clap(arg_required_else_help = false)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this instead?
#[clap(arg_required_else_help = false)] | |
#[clap(arg_required_else_help = true)] |
mithril-client/src/runtime.rs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this runtime
module?
let from_vec = Vec::from_hex(from).map_err(|e| format!("can't parse from hex: {e}"))?; | ||
serde_json::from_slice(from_vec.as_slice()).map_err(|e| format!("can't deserialize: {e}")) | ||
let from_vec = Vec::from_hex(from).map_err(|e| { | ||
format!("Key decode hex: can not turn hexadecimal '{from}' into bytes, error: {e}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The from
could be very lengthy and hard to read error message. Maybe using the std::any::type_name::<T>()
as below could give a good hint of where the problem occurs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We miss an update of this doc as well: https://mithril.network/doc/manual/getting-started/run-mithril-devnet
2428f22
to
671c082
Compare
14060f8
to
1cb7bdb
Compare
1cb7bdb
to
fbece38
Compare
Content
This PR includes snapshot commands to the Mithril client.
Pre-submit checklist
Comments
This PR also includes some refactoring in the common crate.
Issue(s)
Closes #895