Skip to content

Commit

Permalink
fix bad network parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Giordyfish committed Mar 7, 2023
1 parent ac24e99 commit d71a3cb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 30 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ hex = "0.4.3"
clap = { version = "4.0.32", features = ["derive"] }
serde = "1.0.152"
serde_json = "1.0.91"
iota-client = { version = "2.0.1-rc.4", default-features = false, features = ["tls", "mqtt"] }
iota-client = { version = "2.0.1-rc.5", default-features = false, features = ["tls", "mqtt"] }
identity_iota = { version = "0.7.0-alpha" }
time = { version = "0.3.5", features = [
"std",
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ services:
dora-storage-1:
container_name: d1
tty: true
image: giordyfish/dora-storage-demo:1.1.0
image: giordyfish/dora-storage-demo:1.2.0
stop_grace_period: 5m
restart: always
volumes:
Expand All @@ -69,7 +69,7 @@ services:
dora-storage-2:
container_name: d2
tty: true
image: giordyfish/dora-storage-demo:1.1.0
image: giordyfish/dora-storage-demo:1.2.0
stop_grace_period: 5m
restart: always
volumes:
Expand All @@ -95,7 +95,7 @@ services:
dora-storage-3:
container_name: d3
tty: true
image: giordyfish/dora-storage-demo:1.1.0
image: giordyfish/dora-storage-demo:1.2.0
stop_grace_period: 5m
restart: always
volumes:
Expand Down
7 changes: 1 addition & 6 deletions src/demo/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,9 @@ impl Node {
get_address(&dist_pub_key.marshal_binary()?),
))?;
for id in alias_ids {
let name_string = match rt.block_on(c.get_network_name())?.as_ref() {
"shimmer" => todo!(),
"testnet" => "rms",
_ => return Err(anyhow::Error::msg("got unsupported network from client")),
};
let did_candidate = IotaDID::from_alias_id(
&id.to_string(),
&NetworkName::try_from(name_string)?,
&NetworkName::try_from("rms")?,
);
let published_doc = resolve_document(did_candidate.to_string(), node_url);
match published_doc {
Expand Down
26 changes: 6 additions & 20 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,26 +213,12 @@ fn new_committee(args: NewCommitteeArgs) -> Result<()> {
let publisher = Publisher::new(&args.node_url)?;

let rt = tokio::runtime::Runtime::new()?;
let network_name = rt.block_on(publisher.0.get_network_name())?;

match network_name.as_str() {
// or mainnet?
"shimmer" => {
nodes = nodes
.split(',')
.map(|d| format!("\"did:iota:smr:{d}\""))
.collect::<Vec<String>>()
.join(",");
}
"testnet" => {
nodes = nodes
.split(',')
.map(|d| format!("\"did:iota:rms:{d}\""))
.collect::<Vec<String>>()
.join(",");
}
_ => panic!("invalid network"),
}

nodes = nodes
.split(',')
.map(|d| format!("\"did:iota:rms:{d}\""))
.collect::<Vec<String>>()
.join(",");

let request = format!("{{\"nodes\": [{nodes}]}}").as_bytes().to_owned();

Expand Down

0 comments on commit d71a3cb

Please sign in to comment.