Skip to content

Commit 4e22d9f

Browse files
committed
refactor(test-lab): switch to v2 endpoint with CardanoDatabase signed_entity_type for aggregator stress test
1 parent 4c357ff commit 4e22d9f

File tree

5 files changed

+30
-21
lines changed

5 files changed

+30
-21
lines changed

mithril-test-lab/mithril-end-to-end/src/bin/load-aggregator/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ async fn main() -> StdResult<()> {
3636
reporter.start("stress tests bootstrap");
3737
// configure a dummy immutable db
3838
let cardano_db = DummyCardanoDbBuilder::new("load-tester")
39-
.with_immutables(&[1, 2, 3])
39+
.with_immutables(&[0, 1, 2])
4040
.with_legacy_ledger_snapshots(&[533])
4141
.append_immutable_trio()
4242
.build();
@@ -226,7 +226,7 @@ async fn main_scenario(
226226
.unwrap();
227227

228228
info!(
229-
">> Send the Signer Signatures payloads for CardanoImmutableFiles({:?})",
229+
">> Send the Signer Signatures payloads for CardanoDatabase({:?})",
230230
current_beacon
231231
);
232232
parameters.reporter.start("signatures registration");

mithril-test-lab/mithril-end-to-end/src/stress_test/aggregator_helpers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub async fn bootstrap_aggregator(
1515
current_epoch: &mut Epoch,
1616
) -> StdResult<Aggregator> {
1717
info!(">> Launch Aggregator");
18-
let signed_entity_types = vec!["CardanoImmutableFilesFull".to_string()];
18+
let signed_entity_types = vec!["CardanoDatabase".to_string()];
1919
let chain_observer_type = "cardano-cli";
2020

2121
let mut aggregator = Aggregator::new(&AggregatorConfig {

mithril-test-lab/mithril-end-to-end/src/stress_test/fake_client.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ use async_recursion::async_recursion;
55
use indicatif::{ProgressBar, ProgressDrawTarget};
66
use mithril_common::{
77
StdResult,
8-
messages::{CertificateMessage, SnapshotListItemMessage, SnapshotListMessage},
8+
messages::{
9+
CardanoDatabaseSnapshotListItemMessage, CardanoDatabaseSnapshotListMessage,
10+
CertificateMessage,
11+
},
912
};
1013
use reqwest::StatusCode;
1114
use slog_scope::warn;
@@ -47,12 +50,12 @@ pub enum LoadError {
4750
pub async fn download_latest_snasphot(
4851
http_client: Arc<reqwest::Client>,
4952
endpoint: &str,
50-
) -> StdResult<SnapshotListItemMessage> {
51-
let http_request = http_client.get(format!("{endpoint}/artifact/snapshots"));
53+
) -> StdResult<CardanoDatabaseSnapshotListItemMessage> {
54+
let http_request = http_client.get(format!("{endpoint}/artifact/cardano-database"));
5255
let response = http_request.send().await;
53-
let snapshots: SnapshotListMessage = match response {
56+
let snapshots: CardanoDatabaseSnapshotListMessage = match response {
5457
Ok(response) => match response.status() {
55-
StatusCode::OK => Ok(serde_json::from_str::<SnapshotListMessage>(
58+
StatusCode::OK => Ok(serde_json::from_str::<CardanoDatabaseSnapshotListMessage>(
5659
&response.text().await.unwrap(),
5760
)
5861
.expect("this error should never happen")),
@@ -67,8 +70,8 @@ pub async fn download_latest_snasphot(
6770

6871
let last_snapshot = snapshots.first().ok_or(LoadError::EmptySnapshotList)?;
6972
let http_request = http_client.get(format!(
70-
"{}/artifact/snapshot/{}",
71-
endpoint, last_snapshot.digest
73+
"{}/artifact/cardano-database/{}",
74+
endpoint, last_snapshot.hash
7275
));
7376
let response = http_request.send().await;
7477
match response {

mithril-test-lab/mithril-end-to-end/src/stress_test/payload_builder.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,21 +114,25 @@ pub async fn compute_immutable_files_signatures(
114114
let beacon = CardanoDbBeacon::new(*epoch, immutable_file_number);
115115
let digester =
116116
CardanoImmutableDigester::new("devnet".to_string(), None, slog_scope::logger());
117-
let digest = digester
118-
.compute_digest(cardano_db.get_immutable_dir(), &beacon)
117+
let merkle_tree = digester
118+
.compute_merkle_tree(cardano_db.get_immutable_dir(), &beacon)
119119
.await
120120
.with_context(|| {
121121
format!(
122122
"Payload Builder can not compute digest of '{}'",
123123
cardano_db.get_immutable_dir().display()
124124
)
125125
})?;
126+
let merkle_root = merkle_tree.compute_root()?.to_hex();
126127
let signers_fixture = signers_fixture.clone();
127128

128129
let signatures = tokio::task::spawn_blocking(move || -> Vec<_> {
129130
let cardano_immutable_files_full_message = {
130131
let mut message = ProtocolMessage::new();
131-
message.set_message_part(ProtocolMessagePartKey::SnapshotDigest, digest);
132+
message.set_message_part(
133+
ProtocolMessagePartKey::CardanoDatabaseMerkleRoot,
134+
merkle_root,
135+
);
132136
message.set_message_part(
133137
ProtocolMessagePartKey::NextAggregateVerificationKey,
134138
signers_fixture.compute_and_encode_avk(),
@@ -148,7 +152,7 @@ pub async fn compute_immutable_files_signatures(
148152
.sign_all(&cardano_immutable_files_full_message)
149153
.into_iter()
150154
.map(|s| RegisterSignatureMessageHttp {
151-
signed_entity_type: SignedEntityType::CardanoImmutableFilesFull(
155+
signed_entity_type: SignedEntityType::CardanoDatabase(
152156
CardanoDbBeacon::new(*epoch, immutable_file_number),
153157
),
154158
party_id: s.party_id.clone(),

mithril-test-lab/mithril-end-to-end/src/stress_test/wait.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use mithril_common::{
1010
StdResult,
1111
entities::Epoch,
1212
messages::{
13-
CertificateListItemMessage, EpochSettingsMessage, MithrilStakeDistributionListItemMessage,
14-
SnapshotListItemMessage,
13+
CardanoDatabaseSnapshotListItemMessage, CertificateListItemMessage, EpochSettingsMessage,
14+
MithrilStakeDistributionListItemMessage,
1515
},
1616
};
1717

@@ -163,13 +163,15 @@ pub async fn for_immutable_files_artifacts(
163163
aggregator: &Aggregator,
164164
total: usize,
165165
timeout: Duration,
166-
) -> StdResult<SnapshotListItemMessage> {
167-
let url = &format!("{}/artifact/snapshots", aggregator.endpoint());
166+
) -> StdResult<CardanoDatabaseSnapshotListItemMessage> {
167+
let url = &format!("{}/artifact/cardano-database", aggregator.endpoint());
168168
spin_while_waiting!(
169169
{
170-
request_first_list_item_with_expected_size::<SnapshotListItemMessage>(url, total)
171-
.await
172-
.map_err(|e| anyhow!(e).context("Request first snapshot failure"))
170+
request_first_list_item_with_expected_size::<CardanoDatabaseSnapshotListItemMessage>(
171+
url, total,
172+
)
173+
.await
174+
.map_err(|e| anyhow!(e).context("Request first snapshot failure"))
173175
},
174176
timeout,
175177
format!("Waiting for immutable files artifacts"),

0 commit comments

Comments
 (0)