From 07f2f9c39e432da203288d490b2a2abd642c13bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Wed, 23 Jun 2021 12:46:38 +0100 Subject: [PATCH] Fixed mixnet contract test fixtures --- common/mixnet-contract/src/gateway.rs | 7 ------- contracts/mixnet/src/support/tests.rs | 12 ++++++++---- contracts/mixnet/src/transactions.rs | 8 ++++---- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/common/mixnet-contract/src/gateway.rs b/common/mixnet-contract/src/gateway.rs index 8285c4a641..c474d20a41 100644 --- a/common/mixnet-contract/src/gateway.rs +++ b/common/mixnet-contract/src/gateway.rs @@ -39,13 +39,6 @@ impl Gateway { version, } } - - // pub fn try_resolve_hostname(&self) -> Result { - // self.mix_host - // .to_socket_addrs()? - // .next() - // .ok_or_else(|| io::Error::new(io::ErrorKind::Other, "no valid socket address")) - // } } #[derive(Clone, Debug, Deserialize, PartialEq, Serialize, JsonSchema)] diff --git a/contracts/mixnet/src/support/tests.rs b/contracts/mixnet/src/support/tests.rs index 79bb07c816..8b3ee0dc37 100644 --- a/contracts/mixnet/src/support/tests.rs +++ b/contracts/mixnet/src/support/tests.rs @@ -107,6 +107,7 @@ pub mod helpers { pub fn mix_node_fixture() -> MixNode { MixNode::new( "mix.node.org".to_string(), + 1789, 1, "Sweden".to_string(), "sphinx".to_string(), @@ -118,6 +119,7 @@ pub mod helpers { pub fn mixnode_bond_fixture() -> MixNodeBond { let mix_node = MixNode::new( "1.1.1.1".to_string(), + 1789, 1, "London".to_string(), "1234".to_string(), @@ -129,8 +131,9 @@ pub mod helpers { pub fn gateway_fixture() -> Gateway { Gateway::new( - "1.1.1.1:1234".to_string(), - "ws://1.1.1.1:1235".to_string(), + "1.1.1.1".to_string(), + 1789, + 9000, "Sweden".to_string(), "sphinx".to_string(), "identity".to_string(), @@ -140,8 +143,9 @@ pub mod helpers { pub fn gateway_bond_fixture() -> GatewayBond { let gateway = Gateway::new( - "1.1.1.1:1234".to_string(), - "ws://1.1.1.1:1235".to_string(), + "1.1.1.1".to_string(), + 1789, + 9000, "London".to_string(), "sphinx".to_string(), "identity".to_string(), diff --git a/contracts/mixnet/src/transactions.rs b/contracts/mixnet/src/transactions.rs index 3f70ae364d..7640f4ea5a 100644 --- a/contracts/mixnet/src/transactions.rs +++ b/contracts/mixnet/src/transactions.rs @@ -1210,7 +1210,7 @@ pub mod tests { let msg = ExecuteMsg::BondGateway { gateway: Gateway { identity_key: "myAwesomeGateway".to_string(), - mix_host: "1.1.1.1:1789".into(), + host: "1.1.1.1".into(), ..helpers::gateway_fixture() }, }; @@ -1221,7 +1221,7 @@ pub mod tests { let msg = ExecuteMsg::BondGateway { gateway: Gateway { identity_key: "myAwesomeGateway".to_string(), - mix_host: "2.2.2.2:1789".into(), + host: "2.2.2.2".into(), ..helpers::gateway_fixture() }, }; @@ -1230,12 +1230,12 @@ pub mod tests { // make sure the host information was updated assert_eq!( - "2.2.2.2:1789".to_string(), + "2.2.2.2".to_string(), gateways_read(deps.as_ref().storage) .load("myAwesomeGateway".as_bytes()) .unwrap() .gateway - .mix_host + .host ); }