Skip to content

Commit 730ee75

Browse files
committed
wip(e2e): support for fake DMQ node
1 parent a59d304 commit 730ee75

File tree

5 files changed

+49
-5
lines changed

5 files changed

+49
-5
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ impl Aggregator {
7575
let public_server_url = format!("http://localhost:{server_port_parameter}/aggregator");
7676
let mut env = HashMap::from([
7777
("NETWORK", "devnet"),
78+
("NETWORK_MAGIC", &magic_id),
7879
("RUN_INTERVAL", &mithril_run_interval),
7980
("SERVER_IP", "0.0.0.0"),
8081
("SERVER_PORT", &server_port_parameter),
@@ -85,7 +86,6 @@ impl Aggregator {
8586
"SNAPSHOT_DIRECTORY",
8687
aggregator_config.artifacts_dir.to_str().unwrap(),
8788
),
88-
("NETWORK_MAGIC", &magic_id),
8989
(
9090
"DATA_STORES_DIRECTORY",
9191
aggregator_config.store_dir.to_str().unwrap(),
@@ -129,6 +129,16 @@ impl Aggregator {
129129
if let Some(leader_aggregator_endpoint) = aggregator_config.leader_aggregator_endpoint {
130130
env.insert("LEADER_AGGREGATOR_ENDPOINT", leader_aggregator_endpoint);
131131
}
132+
// TODO: make this configurable
133+
let dmq_node_socket_path = aggregator_config
134+
.work_dir
135+
.join(format!("dmq-aggregator-{}.socket", aggregator_config.index));
136+
if true {
137+
env.insert(
138+
"DMQ_NODE_SOCKET_PATH",
139+
dmq_node_socket_path.to_str().unwrap(),
140+
);
141+
}
132142
let args = vec![
133143
"--db-directory",
134144
aggregator_config.full_node.db_path.to_str().unwrap(),

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ impl MithrilInfrastructure {
266266
let mut bootstrap_peer_addr = None;
267267
for (index, aggregator_endpoint) in aggregator_endpoints.iter().enumerate() {
268268
let mut relay_aggregator = RelayAggregator::new(
269-
Aggregator::name_suffix(index),
269+
index,
270270
config.server_port + index as u64 + 100,
271271
bootstrap_peer_addr.clone(),
272272
aggregator_endpoint,
@@ -282,6 +282,7 @@ impl MithrilInfrastructure {
282282

283283
for (index, party_id) in signers_party_ids.iter().enumerate() {
284284
let mut relay_signer = RelaySigner::new(&RelaySignerConfiguration {
285+
signer_number: index + 1,
285286
listen_port: config.server_port + index as u64 + 200,
286287
server_port: config.server_port + index as u64 + 300,
287288
dial_to: bootstrap_peer_addr.clone(),

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::utils::MithrilCommand;
2+
use crate::{Aggregator, DEVNET_MAGIC_ID};
23
use mithril_common::StdResult;
34
use std::collections::HashMap;
45
use std::path::Path;
@@ -14,16 +15,25 @@ pub struct RelayAggregator {
1415

1516
impl RelayAggregator {
1617
pub fn new(
17-
name: String,
18+
index: usize,
1819
listen_port: u64,
1920
dial_to: Option<String>,
2021
aggregator_endpoint: &str,
2122
work_dir: &Path,
2223
bin_dir: &Path,
2324
) -> StdResult<Self> {
25+
let name = Aggregator::name_suffix(index);
2426
let listen_port_str = format!("{listen_port}");
27+
let dmq_node_socket_path = work_dir.join(format!("dmq-aggregator-{index}.socket"));
28+
let magic_id = DEVNET_MAGIC_ID.to_string();
2529
let mut env = HashMap::from([
2630
("LISTEN_PORT", listen_port_str.as_str()),
31+
(
32+
"DMQ_NODE_SOCKET_PATH",
33+
dmq_node_socket_path.to_str().unwrap(),
34+
),
35+
("NETWORK", "devnet"),
36+
("NETWORK_MAGIC", &magic_id),
2737
("AGGREGATOR_ENDPOINT", aggregator_endpoint),
2838
]);
2939
if let Some(dial_to) = &dial_to {

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use crate::DEVNET_MAGIC_ID;
12
use crate::utils::MithrilCommand;
23
use mithril_common::StdResult;
34
use mithril_common::entities::PartyId;
@@ -6,6 +7,7 @@ use std::path::Path;
67
use tokio::process::Child;
78

89
pub struct RelaySignerConfiguration<'a> {
10+
pub signer_number: usize,
911
pub listen_port: u64,
1012
pub server_port: u64,
1113
pub dial_to: Option<String>,
@@ -28,15 +30,26 @@ pub struct RelaySigner {
2830

2931
impl RelaySigner {
3032
pub fn new(configuration: &RelaySignerConfiguration) -> StdResult<Self> {
33+
let party_id = configuration.party_id.to_owned();
3134
let listen_port_str = format!("{}", configuration.listen_port);
3235
let server_port_str = format!("{}", configuration.server_port);
36+
let dmq_node_socket_path = configuration
37+
.work_dir
38+
.join(format!("dmq-signer-{}.socket", configuration.signer_number));
39+
let magic_id = DEVNET_MAGIC_ID.to_string();
3340
let relay_signer_registration_mode =
3441
configuration.relay_signer_registration_mode.to_string();
3542
let relay_signature_registration_mode =
3643
configuration.relay_signature_registration_mode.to_string();
3744
let mut env = HashMap::from([
3845
("LISTEN_PORT", listen_port_str.as_str()),
3946
("SERVER_PORT", server_port_str.as_str()),
47+
(
48+
"DMQ_NODE_SOCKET_PATH",
49+
dmq_node_socket_path.to_str().unwrap(),
50+
),
51+
("NETWORK", "devnet"),
52+
("NETWORK_MAGIC", &magic_id),
4053
("AGGREGATOR_ENDPOINT", configuration.aggregator_endpoint),
4154
("SIGNER_REPEATER_DELAY", "100"),
4255
(
@@ -65,7 +78,7 @@ impl RelaySigner {
6578
Ok(Self {
6679
listen_port: configuration.listen_port,
6780
server_port: configuration.server_port,
68-
party_id: configuration.party_id.to_owned(),
81+
party_id,
6982
command,
7083
process: None,
7184
})

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ impl Signer {
5454
let mithril_run_interval = format!("{}", signer_config.mithril_run_interval);
5555
let mut env = HashMap::from([
5656
("NETWORK", "devnet"),
57+
("NETWORK_MAGIC", &magic_id),
5758
("RUN_INTERVAL", &mithril_run_interval),
5859
("AGGREGATOR_ENDPOINT", &signer_config.aggregator_endpoint),
5960
(
@@ -65,7 +66,6 @@ impl Signer {
6566
signer_config.store_dir.to_str().unwrap(),
6667
),
6768
("STORE_RETENTION_LIMIT", "10"),
68-
("NETWORK_MAGIC", &magic_id),
6969
(
7070
"CARDANO_NODE_SOCKET_PATH",
7171
signer_config.pool_node.socket_path.to_str().unwrap(),
@@ -96,6 +96,16 @@ impl Signer {
9696
} else {
9797
env.insert("PARTY_ID", &party_id);
9898
}
99+
// TODO: make this configurable
100+
let dmq_node_socket_path = signer_config
101+
.work_dir
102+
.join(format!("dmq-signer-{}.socket", signer_config.signer_number));
103+
if true {
104+
env.insert(
105+
"DMQ_NODE_SOCKET_PATH",
106+
dmq_node_socket_path.to_str().unwrap(),
107+
);
108+
}
99109
let args = vec!["-vvv"];
100110

101111
let mut command = MithrilCommand::new(

0 commit comments

Comments
 (0)