-
Notifications
You must be signed in to change notification settings - Fork 58
Adding individual epoch auditing in kt auditor example #460
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
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #460 +/- ##
==========================================
+ Coverage 88.61% 89.03% +0.42%
==========================================
Files 39 38 -1
Lines 9109 7600 -1509
==========================================
- Hits 8072 6767 -1305
+ Misses 1037 833 -204 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
9fdd42c to
6a2c0f7
Compare
| } | ||
|
|
||
| pub(crate) async fn get_proof_from_epoch(url: &str, epoch: u64) -> Result<EpochSummary> { | ||
| let params: Vec<(String, String)> = 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.
I don't think that we need to explicitly denote the type here.
| ("prefix".to_string(), format!("{}/", epoch)), | ||
| ]; | ||
|
|
||
| let (keys, truncated_result) = get_xml(url, ¶ms).await.unwrap(); |
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 may want to propagate the error instead of unwrapping here, otherwise we can lose useful context.
| if keys.is_empty() { | ||
| bail!("Could not find epoch {}", epoch); | ||
| } | ||
| Ok(keys[0].clone()) |
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.
I think we can just call Vec::remove here.
| if let Some(epoch_summary) = maybe_proof { | ||
| do_epoch_audit(epoch_summary).await?; | ||
| } else { | ||
| Err("Epoch is out of available range") | ||
| bail!("Could not find epoch {}", epoch); |
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 can use let-else here to clean this up a bit:
let Some(epoch_summary) = maybe_proof else {
bail!("Could not find epoch {epoch}");
};
do_epoch_audit(epoch_summary).await?6a2c0f7 to
43bf51e
Compare
This adds the ability for the whatsapp-kt-auditor example to audit a specific epoch, rather than loading all proofs first and then picking the epoch (which can be much slower)