Skip to content

Commit 6e8d24a

Browse files
committed
fix snapshot digest and tests
1 parent d68f312 commit 6e8d24a

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

mithril-aggregator/src/runtime/runner.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use crate::snapshot_uploaders::SnapshotLocation;
44
use crate::{DependencyManager, SnapshotError, Snapshotter};
55
use async_trait::async_trait;
66
use chrono::Utc;
7+
use hex::FromHex;
78
use mithril_common::digesters::{Digester, DigesterResult, ImmutableDigester, ImmutableFile};
89
use mithril_common::entities::{Beacon, Certificate, CertificatePending, Snapshot};
910

@@ -378,8 +379,9 @@ impl AggregatorRunnerTrait for AggregatorRunner {
378379
file_path: &Path,
379380
remote_locations: Vec<String>,
380381
) -> Result<Snapshot, RuntimeError> {
382+
let digest_hex = Vec::from_hex(certificate.digest).unwrap();
381383
let snapshot = Snapshot::new(
382-
certificate.digest,
384+
String::from_utf8(digest_hex).map_err(|e| RuntimeError::General(e.to_string()))?,
383385
certificate.hash,
384386
std::fs::metadata(file_path)
385387
.map_err(|e| RuntimeError::General(e.to_string()))?

mithril-aggregator/src/runtime/state_machine.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,14 @@ impl AggregatorRuntime {
154154
) -> Result<IdleState, RuntimeError> {
155155
let certificate_pending = self.runner.drop_pending_certificate().await?;
156156
let path = self.runner.create_snapshot_archive().await?;
157-
let _ = self.runner.upload_snapshot_archive(&path).await?;
157+
let locations = self.runner.upload_snapshot_archive(&path).await?;
158158
let certificate = self
159159
.runner
160160
.create_and_save_certificate(&state.current_beacon, &certificate_pending)
161161
.await?;
162162
let _ = self
163163
.runner
164-
.create_and_save_snapshot(certificate, &path, Vec::new())
164+
.create_and_save_snapshot(certificate, &path, locations)
165165
.await?;
166166

167167
Ok(IdleState {

mithril-test-lab/mithril-end-to-end/src/end_to_end_spec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl Spec {
5656
async fn wait_for_pending_certificate(aggregator_endpoint: &str) -> Result<(), String> {
5757
let url = format!("{}/certificate-pending", aggregator_endpoint);
5858

59-
match attempt!(10, Duration::from_millis(100), {
59+
match attempt!(10, Duration::from_millis(1000), {
6060
match reqwest::get(url.clone()).await {
6161
Ok(response) => match response.status() {
6262
StatusCode::OK => {

mithril-test-lab/mithril-end-to-end/src/mithril/aggregator.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,14 @@ impl Aggregator {
2525
("SNAPSHOT_UPLOADER_TYPE", "local"),
2626
(
2727
"PENDING_CERTIFICATE_STORE_DIRECTORY",
28-
"./store/pending-certs",
28+
"./store/aggregator/pending-certs",
2929
),
30-
("CERTIFICATE_STORE_DIRECTORY", "./store/certs"),
31-
("VERIFICATION_KEY_STORE_DIRECTORY", "./store/certs"),
32-
("STAKE_STORE_DIRECTORY", "./store/stakes"),
30+
("CERTIFICATE_STORE_DIRECTORY", "./store/aggregator/certs"),
31+
(
32+
"VERIFICATION_KEY_STORE_DIRECTORY",
33+
"./store/aggregator/certs",
34+
),
35+
("STAKE_STORE_DIRECTORY", "./store/aggregator/stakes"),
3336
]);
3437
let args = vec![
3538
"--db-directory",

mithril-test-lab/mithril-end-to-end/src/mithril/signer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl Signer {
2222
("RUN_INTERVAL", "2000"),
2323
("AGGREGATOR_ENDPOINT", &aggregator_endpoint),
2424
("DB_DIRECTORY", db_directory.to_str().unwrap()),
25-
("STAKE_STORE_DIRECTORY", "./store/stakes")
25+
("STAKE_STORE_DIRECTORY", "./store/signer/stakes"),
2626
]);
2727
let args = vec!["-vvv"];
2828

0 commit comments

Comments
 (0)