Skip to content

Commit 6bba7ec

Browse files
authored
Merge pull request #2287 from input-output-hk/dlachaume/fix-aggregator-stress-test
Fix aggregator stress test
2 parents 38a7584 + fadb6c8 commit 6bba7ec

File tree

6 files changed

+46
-28
lines changed

6 files changed

+46
-28
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mithril-test-lab/mithril-end-to-end/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mithril-end-to-end"
3-
version = "0.4.67"
3+
version = "0.4.68"
44
authors = { workspace = true }
55
edition = { workspace = true }
66
documentation = { workspace = true }

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

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use tokio::sync::oneshot;
55

66
use mithril_common::{
77
digesters::{DummyCardanoDb, DummyCardanoDbBuilder},
8-
entities::{CardanoDbBeacon, Epoch, ProtocolParameters, SignedEntityType, SingleSignatures},
8+
entities::{CardanoDbBeacon, Epoch, ProtocolParameters, SignedEntityType},
99
test_utils::MithrilFixture,
1010
StdResult,
1111
};
@@ -51,13 +51,6 @@ async fn main() -> StdResult<()> {
5151
let signers_fixture =
5252
payload_builder::generate_signer_data(opts.num_signers, protocol_parameters);
5353

54-
let mithril_stake_distribution_signatures =
55-
payload_builder::precompute_mithril_stake_distribution_signatures(
56-
&signers_fixture,
57-
Duration::from_secs(180),
58-
)
59-
.await?;
60-
6154
let aggregator = aggregator_helpers::bootstrap_aggregator(
6255
&aggregator_parameters,
6356
&signers_fixture,
@@ -73,7 +66,6 @@ async fn main() -> StdResult<()> {
7366
signers_fixture,
7467
cardano_db,
7568
reporter,
76-
precomputed_mithril_stake_distribution_signatures: mithril_stake_distribution_signatures,
7769
};
7870

7971
let scenario_counters = ScenarioCounters {
@@ -122,7 +114,6 @@ struct ScenarioParameters {
122114
aggregator_parameters: AggregatorParameters,
123115
signers_fixture: MithrilFixture,
124116
cardano_db: DummyCardanoDb,
125-
precomputed_mithril_stake_distribution_signatures: Vec<SingleSignatures>,
126117
reporter: Reporter,
127118
}
128119

@@ -189,14 +180,24 @@ async fn main_scenario(
189180
)
190181
.await?;
191182

183+
info!(">> Compute the mithril stake distribution signature");
184+
let mithril_stake_distribution_signatures =
185+
payload_builder::compute_mithril_stake_distribution_signatures(
186+
current_epoch,
187+
&parameters.signers_fixture,
188+
Duration::from_secs(180),
189+
)
190+
.await
191+
.unwrap();
192+
192193
info!(
193194
">> Send the Signer Signatures payloads for MithrilStakeDistribution({:?})",
194195
current_epoch
195196
);
196197
parameters.reporter.start("signatures registration");
197198
let errors = fake_signer::register_signatures_to_aggregator(
198199
&parameters.aggregator,
199-
&parameters.precomputed_mithril_stake_distribution_signatures,
200+
&mithril_stake_distribution_signatures,
200201
SignedEntityType::MithrilStakeDistribution(current_epoch),
201202
)
202203
.await?;
@@ -238,7 +239,7 @@ async fn main_scenario(
238239
&parameters.cardano_db,
239240
current_epoch,
240241
&parameters.signers_fixture,
241-
Duration::from_secs(60),
242+
Duration::from_secs(180),
242243
)
243244
.await
244245
.unwrap();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pub struct Args {
7676
mithril_run_interval: u32,
7777

7878
/// Mithril era to run
79-
#[clap(long, default_value = "thales")]
79+
#[clap(long, default_value = "pythagoras")]
8080
mithril_era: String,
8181

8282
/// Mithril next era to run

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub struct MainOpts {
3434
pub num_clients: usize,
3535

3636
/// Mithril technical Era
37-
#[arg(long, default_value = "thales")]
37+
#[arg(long, default_value = "pythagoras")]
3838
pub mithril_era: String,
3939

4040
/// Aggregator HTTP port

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

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ pub fn generate_register_signature_message(
6363
.collect::<Vec<_>>()
6464
}
6565

66-
/// Precompute all signers single signatures for the given fixture
67-
pub async fn precompute_mithril_stake_distribution_signatures(
66+
/// Compute all signers single signatures for mithril stake distribution for the given fixture
67+
pub async fn compute_mithril_stake_distribution_signatures(
68+
epoch: Epoch,
6869
signers_fixture: &MithrilFixture,
6970
timeout: Duration,
7071
) -> StdResult<Vec<SingleSignatures>> {
@@ -75,9 +76,17 @@ pub async fn precompute_mithril_stake_distribution_signatures(
7576
let mithril_stake_distribution_message = {
7677
let mut message = ProtocolMessage::new();
7778
message.set_message_part(
78-
mithril_common::entities::ProtocolMessagePartKey::NextAggregateVerificationKey,
79-
signers_fixture.compute_and_encode_avk(),
80-
);
79+
mithril_common::entities::ProtocolMessagePartKey::NextAggregateVerificationKey,
80+
signers_fixture.compute_and_encode_avk(),
81+
);
82+
message.set_message_part(
83+
mithril_common::entities::ProtocolMessagePartKey::NextProtocolParameters,
84+
signers_fixture.protocol_parameters().compute_hash(),
85+
);
86+
message.set_message_part(
87+
mithril_common::entities::ProtocolMessagePartKey::CurrentEpoch,
88+
epoch.to_string(),
89+
);
8190

8291
message
8392
};
@@ -89,12 +98,12 @@ pub async fn precompute_mithril_stake_distribution_signatures(
8998
Ok(signatures)
9099
},
91100
timeout,
92-
format!("Precompute signatures for MithrilStakeDistribution signed entity"),
93-
format!("Precomputing signatures timeout after {timeout:?}")
101+
format!("Compute signatures for MithrilStakeDistribution signed entity"),
102+
format!("Computing signatures timeout after {timeout:?}")
94103
)
95104
}
96105

97-
/// Compute all signers single signatures for the given fixture
106+
/// Compute all signers single signatures for immutable files full for the given fixture
98107
pub async fn compute_immutable_files_signatures(
99108
cardano_db: &DummyCardanoDb,
100109
epoch: Epoch,
@@ -122,25 +131,33 @@ pub async fn compute_immutable_files_signatures(
122131
let signers_fixture = signers_fixture.clone();
123132

124133
let signatures = tokio::task::spawn_blocking(move || -> Vec<SingleSignatures> {
125-
let mithril_stake_distribution_message = {
134+
let cardano_immutable_files_full_message = {
126135
let mut message = ProtocolMessage::new();
127136
message.set_message_part(ProtocolMessagePartKey::SnapshotDigest, digest);
128137
message.set_message_part(
129138
ProtocolMessagePartKey::NextAggregateVerificationKey,
130139
signers_fixture.compute_and_encode_avk(),
131140
);
141+
message.set_message_part(
142+
mithril_common::entities::ProtocolMessagePartKey::NextProtocolParameters,
143+
signers_fixture.protocol_parameters().compute_hash(),
144+
);
145+
message.set_message_part(
146+
mithril_common::entities::ProtocolMessagePartKey::CurrentEpoch,
147+
epoch.to_string(),
148+
);
132149

133150
message
134151
};
135152

136-
signers_fixture.sign_all(&mithril_stake_distribution_message)
153+
signers_fixture.sign_all(&cardano_immutable_files_full_message)
137154
})
138155
.await?;
139156

140157
Ok((beacon, signatures))
141158
},
142159
timeout,
143-
format!("Precompute signatures for CardanoImmutableFiles signed entity"),
144-
format!("Precomputing signatures timeout after {timeout:?}")
160+
format!("Compute signatures for CardanoImmutableFiles signed entity"),
161+
format!("Computing signatures timeout after {timeout:?}")
145162
)
146163
}

0 commit comments

Comments
 (0)